Skip to content
Browse files

firmware: published firmware to ajprogramming

  • Loading branch information...
1 parent 2c3f654 commit 0733b5b63c8a672799398403b637f22992f67f6f @todbot committed Aug 19, 2012
View
14 hardware/firmware/Makefile
@@ -26,6 +26,8 @@ FUSE_H=0xdd
FUSE_L=0xe2
endif
+PKGDATE = `date +%Y%m%d`
+
AVRDUDE = avrdude -c avrispmkii -P usb -p $(MCU)
# The two lines above are for "avrdude" and the STK500 programmer connected
# to an USB to serial converter to a Mac running Mac OS X.
@@ -100,7 +102,7 @@ readeep:
clean:
- rm -f $(TARGET).hex $(TARGET).lst $(TARGET).obj $(TARGET).cof $(TARGET).list $(TARGET).map $(TARGET).eep.hex $(TARGET).bin *.o usbdrv/*.o $(TARGET).s usbdrv/oddebug.s usbdrv/usbdrv.s
+ rm -f $(TARGET).hex $(TARGET).lst $(TARGET).obj $(TARGET).cof $(TARGET).list $(TARGET).map $(TARGET).eep.hex $(TARGET).bin *.o usbdrv/*.o $(TARGET).s usbdrv/oddebug.s usbdrv/usbdrv.s
# file targets:
$(TARGET).bin: $(OBJECTS)
@@ -116,3 +118,13 @@ disasm: $(TARGET).bin
cpp:
$(COMPILE) -E $(TARGET).c
+
+
+packaging:
+ echo "making $(TARGET)_$(PKGDATE)"
+ mkdir -p $(TARGET)_$(PKGDATE)
+ cp -f $(TARGET).hex $(TARGET)_$(PKGDATE)/$(TARGET)_$(PKGDATE).hex
+ cp -f $(TARGET).eep $(TARGET)_$(PKGDATE)/$(TARGET)_$(PKGDATE).eep
+ cp -f $(TARGET)_$(MCU)_fuse.txt $(TARGET)_$(PKGDATE)
+ cp -f $(TARGET)_eeprom_layout.txt $(TARGET)_$(PKGDATE)
+ zip -r $(TARGET)_$(PKGDATE).zip $(TARGET)_$(PKGDATE)
View
82 hardware/firmware/blink1.c
@@ -11,13 +11,6 @@
* the PWM is hardware, not software, and the fading and pattern engine work
* differently.
*
- * Firmware TODOs: (x=done)
- * x detect plugged in to power supply vs computer,
- * x play pattern if not on computer
- * - log2lin() function, maybe map in memory (256 RAM bytes, compute at boot)
- * - upload new log2lin table
- * x upload of pattern
- * -
*
*/
@@ -55,6 +48,7 @@ static uint8_t usbHasBeenSetup;
#include "color_funcs.h" // needs "setRGBOut()" defined before inclusion
+// number of entries a color pattern can contain
#define patt_max 12
// possible values for boot_mode
@@ -64,7 +58,7 @@ static uint8_t usbHasBeenSetup;
uint8_t ee_osccal EEMEM = 0; // used by "osccal.h"
uint8_t ee_bootmode EEMEM = BOOT_MODE_SPACER;
-uint8_t ee_serialnum[4] EEMEM = { 0x1A, 0xAA, 0x1B, 0x23 };
+uint8_t ee_serialnum[4] EEMEM = { 0x01, 0xAA, 0x1A, 0x23 };
// serial num is represented as hex ascii on USB, ==> 8 bytes
patternline_t ee_pattern[patt_max] EEMEM = {
{ { 0xff, 0x00, 0x00 }, 50 }, // 0
@@ -514,76 +508,4 @@ int main(void)
- /* this is unneeded currently, use USB activity to determine play/not-play
- // load startup mode
- uint8_t bootmode = eeprom_read_byte( &ee_bootmode );
- if( bootmode == BOOT_NIGHTLIGHT ) {
- eeprom_read_block( &pattern,&ee_pattern,sizeof(patternline_t)*patt_max);
- playing = 1;
- } */
- /*
- // old style, where each serial num byte is a char
- for( uint8_t i=0; i< 8; i++ ) {
- uint8_t v = eeprom_read_byte( ee_serialnum + i );
- usbDescriptorStringSerialNumber[1+i] = v;
- }
- */
- // new style, where serial num bytes are turned into chars
-
-/*
-// a simple logarithmic -> linear mapping as a sort of gamma correction
-// maps from 0-255 to 0-255
-static int log2lin( int n )
-{
- //return (int)(1.0* (n * 0.707 )); // 1/sqrt(2)
- return (((1<<(n/32))-1) + ((1<<(n/32))*((n%32)+1)+15)/32);
-}
-*/
-
-/*
-static void updateLEDs(void)
-{
- uint32_t now = millis();
- if( (now - ledLastMillis) >= ledUpdateMillis ) {
- ledLastMillis = now;
- rgb_updateCurrent();
- }
-}
-*/
-
-/*
-
-// scrapped idea for using pinchange to detect bus activity
-// (and thus use it for plug/unplug state)
-//
-
-//volatile uint8_t pintick;
-
-//
-ISR(SIG_PIN_CHANGE,ISR_NOBLOCK) // NOBLOCK allows USB ISR to run
-{
- pintick++;
-}
-
-//
-void pinChangeInit(void)
-{
- PCMSK |= _BV(PCINT3);
- GIMSK |= _BV(PCIE);
-}
-
-//
-void connectedTest(void)
-{
- if( ((long)millis() - connectedTestTimeNext) > 0 ) {
- connectedTestTimeNext += 1000;
- if( pintick < 20 ) { // disconnected
- rgb_t cDisconn = {0xff,0xdd,0x33};
- rgb_setCurr( &cDisconn );
- }
- pintick = 0;
- }
-}
-*/
-
// -eof-
View
BIN hardware/firmware/blink1_20120815.zip
Binary file not shown.
View
8 hardware/firmware/blink1_attiny85_fuse.txt
@@ -0,0 +1,8 @@
+blink(1) Fuse Settings
+======================
+15 Aug 2012, Tod E. Kurt, ThingM
+
+Part: Atmel AVR ATTINY85
+
+FUSE_LOW = 0xE1
+FUSE_HIGH = 0xDD
View
45 hardware/firmware/blink1_eeprom_layout.txt
@@ -0,0 +1,45 @@
+
+blink(1) EEPROM layout
+======================
+15 Aug 2012, Tod E. Kurt, ThingM
+
+address - default value - description
+----------------------------------
+0x00 - 0x00 - osc cal byte
+0x01 - 0x55 - (boot mode, reserved)
+0x02 - 0x01 - serial num byte 3 (MSB)
+0x03 - 0xAA - serial num byte 2
+0x04 - 0x1B - serial num byte 1
+0x05 - 0x23 - serial num byte 0 (LSB)
+0x06 - 0xFF - start of light pattern data
+...
+
+EEPROM Serial Numbers
+---------------------
+The default serial number is 0x01AA1B23 as seen above.
+It is invalid for production use.
+
+Production serial numbers range, inclusive:
+- start serial number: 0x1A001000
+- end serial number: 0x1A002FFF
+
+In EEPROM address form:
+
+Start serial number:
+EEPROM[ 0x02 ] = 0x1A
+EEPROM[ 0x03 ] = 0x00
+EEPROM[ 0x04 ] = 0x01
+EEPROM[ 0x05 ] = 0x00
+
+End serial number:
+EEPROM[ 0x02 ] = 0x1A
+EEPROM[ 0x03 ] = 0x00
+EEPROM[ 0x04 ] = 0x2F
+EEPROM[ 0x05 ] = 0xFF
+
+
+
+-eof-
+
+
+

0 comments on commit 0733b5b

Please sign in to comment.
Something went wrong with that request. Please try again.