This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/interrupt.h> | |
const int pin_rx = 3; // Pin hooked to the output of the CAN transceiver | |
enum message_state { vacant, loading, ready }; | |
const int ticksPerTs = 132; // 16Mhz clock / 125Kbps / 8 = 128 ticks/bit | |
const int timerLoadValue = 257 - ticksPerTs; | |
const int oneHalfTimerLoadValue = 257 - (ticksPerTs * 1.25); // Add an extra 1/4TS when we know we're at start of a bit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Big block of macros to access EEPROM data | |
#include <avr/eeprom.h> | |
#define eeprom_read_to(dst_p, eeprom_field, dst_size) eeprom_read_block(dst_p, (void *)offsetof(__eeprom_data, eeprom_field), MIN(dst_size, sizeof((__eeprom_data*)0)->eeprom_field)) | |
#define eeprom_read(dst, eeprom_field) eeprom_read_to(&dst, eeprom_field, sizeof(dst)) | |
#define eeprom_write_from(src_p, eeprom_field, src_size) eeprom_write_block(src_p, (void *)offsetof(__eeprom_data, eeprom_field), MIN(src_size, sizeof((__eeprom_data*)0)->eeprom_field)) | |
#define eeprom_write(src, eeprom_field) { typeof(src) x = src; eeprom_write_from(&x, eeprom_field, sizeof(x)); } | |
#define MIN(x,y) ( x > y ? y : x ) | |
#define KEYPAD_SIZE 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scripted as; | |
sleep 15 | |
ifconfig wlan0 up & | |
sleep 10 | |
dmesg > after.log | |
/sbin/poweroff | |
ie 'ifconfig wlan0 up' is run @ 82 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse, serial, socket, select | |
parser = argparse.ArgumentParser(description='Connect to a serial port and allow multiple TCP clients to talk to it (simultaneous output shared between all TCP clients, any client can write to port.)') | |
parser.add_argument('--baud', help="Baud rate", default=115200, type=int) | |
parser.add_argument('port', help="Port to listen on.", type=int) | |
parser.add_argument('serial', help="Serial port to share.") | |
def main(): | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import epics,gc | |
name1 = "c1v0:UPTIME" | |
name2 = "c2v0:UPTIME" | |
name3 = "c3v0:UPTIME" | |
def report_usage(): | |
epics.ca.show_cache() | |
# use the gc's debugging features to look for leaked PV objects | |
gc.collect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import epics, time | |
pvname = "c1v0:UPTIME" | |
def my_callback(value, **kw): | |
print value | |
def setup_callback(): | |
pv = epics.PV(pvname) | |
pv.add_callback(my_callback) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Web Server | |
A simple web server that sends the contents of "hello.txt" on the SD card | |
to any web client that connects. | |
Modified from the "Ethernet -> WebServer" & "SD -> DumpFile" Arduino examples | |
by Angus Gratton <[email protected]> | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Digikey order splitter script for group buys. For Python 3.x. Public Domain. | |
Supports cases where people are paying in a different currency to the Digikey currency, | |
and also pro rata splitting of shipping costs. | |
If you use this then please sanity check the results before sending them | |
Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* SD card CRC32 calculator by Angus Gratton for Freetronics | |
* | |
* CRC32 implementation based on the implementation in the C SNIPPETS archive | |
* http://web.archive.org/web/20080303102524/http://c.snippets.org/snip_lister.php?fname=crc_32.c | |
* | |
* Original Copyright (C) 1986 Gary S. Brown. You may use this program, or | |
* code or tables extracted from it, as desired without restriction. | |
* | |
* This version is released with the same lack of restrictions, use however you please. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// |
OlderNewer