Permalink
Browse files

fixed bug in time setting

bootloader is now nicer, blinks backlight to indicate
  • Loading branch information...
1 parent 227aa89 commit 07da2efb62c8d22b85553ce87f32f18d44f165cc @ladyada ladyada committed Feb 20, 2010
@@ -139,10 +139,10 @@
/* other boards like e.g. Crumb8, Crumb168 are using PB2 */
// MONOCHRON MOD
-#define LED_DDR DDRC
-#define LED_PORT PORTC
-#define LED_PIN PINC
-#define LED PINC3
+#define LED_DDR DDRD
+#define LED_PORT PORTD
+#define LED_PIN PIND
+#define LED PIND3
#endif
@@ -278,13 +278,13 @@ int main(void)
uint8_t ch,ch2;
uint16_t w;
+ WDTCSR |= _BV(WDCE) | _BV(WDE);
+ WDTCSR = 0;
+
#ifdef WATCHDOG_MODS
ch = MCUSR;
MCUSR = 0;
- WDTCSR |= _BV(WDCE) | _BV(WDE);
- WDTCSR = 0;
-
// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
if (! (ch & _BV(EXTRF))) // if its a not an external reset...
app_start(); // skip bootloader
@@ -5,17 +5,17 @@
:107840000C94513C0C94513C0C94513C0C94513C84
:107850000C94513C0C94513C0C94513C0C94513C74
:107860000C94513C0C94513C11241FBECFEFD8E036
-:10787000DEBFCDBF11E0A0E0B1E0EAE8FFE702C063
+:10787000DEBFCDBF11E0A0E0B1E0E8E9FFE702C064
:1078800005900D92A230B107D9F712E0A2E0B1E065
:1078900001C01D92AD30B107E1F70E942D3D0C945F
-:1078A000C33F0C94003C982F95959595959595958B
+:1078A000CA3F0C94003C982F959595959595959584
:1078B000905D8F708A307CF0282F295A8091C0000B
:1078C00085FFFCCF9093C6008091C00085FFFCCF60
:1078D0002093C6000895282F205DF0CF982F809127
:1078E000C00085FFFCCF9093C6000895EF92FF92F1
:1078F0000F931F93EE24FF2487018091C00087FD22
-:1079000017C00894E11CF11C011D111D81E2E8164D
-:1079100081EAF80687E0080780E0180770F3E09135
+:1079000017C00894E11CF11C011D111D81E4E8164B
+:1079100082E4F8068FE0080780E0180770F3E09132
:107920000401F091050109958091C00087FFE9CF1E
:107930008091C6001F910F91FF90EF9008950E94D3
:10794000763C982F8091C00085FFFCCF9093C600B5
@@ -33,92 +33,93 @@
:107A0000C00085FFFCCF84E18093C6008091C00058
:107A100085FFFCCF80E18093C6000895E0910401CA
:107A2000F09105010995089548EC50E08823A1F0F4
-:107A3000439A28EE33E0FA013197F1F721503040B4
-:107A4000D1F7439828EE33E0FA013197F1F721504E
+:107A30005B9A28EE33E0FA013197F1F7215030409C
+:107A4000D1F75B9828EE33E0FA013197F1F7215036
:107A50003040D1F7815061F708953F924F925F9285
:107A60006F927F928F929F92AF92BF92CF92DF924E
-:107A7000EF92FF920F931F93CF93DF93000082E06A
-:107A80008093C00080E18093C4001092C50088E11B
-:107A90008093C10086E08093C2005098589A3B9A28
-:107AA00081E00E94143D24E1F22E9EE1E92E85E959
-:107AB000D82E0FE0C02E10E1B12EAA24A394B1E479
-:107AC0009B2EA6E58A2EF2E57F2EE0E26E2E79E46B
-:107AD000572E63E5462E50E5352E0E94763C8033C6
-:107AE000B1F18133B9F1803409F46FC0813409F404
-:107AF00076C0823409F485C0853409F488C08035A5
-:107B000031F1823521F1813511F1853509F485C0D6
-:107B1000863509F48DC0843609F496C0843709F49B
-:107B200003C1853709F472C1863709F466C08091B4
-:107B300003018F5F80930301853079F6E0910401A2
-:107B4000F091050109950E94763C803351F60E9420
-:107B5000F33CC3CF0E94763C803249F78091C0004D
-:107B600085FFFCCFF092C6008091C00085FFFCCF5E
-:107B70009092C6008091C00085FFFCCF8092C60025
-:107B80008091C00085FFFCCF7092C6008091C0003C
-:107B900085FFFCCF6092C6008091C00085FFFCCFBE
-:107BA0005092C6008091C00085FFFCCF4092C60075
-:107BB0008091C00085FFFCCF3092C6008091C0004C
-:107BC00085FFFCCFB092C60088CF0E94763C8638F5
-:107BD00008F4BDCF0E94763C0E94F33C7ECF0E9409
-:107BE000763C803809F49CC0813809F40BC1823896
-:107BF00009F430C1883909F48FC080E00E94C73C85
-:107C00006CCF84E10E94BD3C0E94F33C66CF85E0CE
-:107C10000E94BD3C0E94F33C60CF0E94763C809362
-:107C200006010E94763C809307010E94F33C55CFE9
-:107C30000E94763C803309F411C183E00E94BD3C70
-:107C400080E00E94C73C49CF0E94763C80930902A5
-:107C50000E94763C8093080280910C028E7F809374
-:107C60000C020E94763C853409F409C18091080217
-:107C700090910902892B89F000E010E00E94763C87
-:107C8000F801E85FFE4F80830F5F1F4F809108026D
-:107C9000909109020817190788F30E94763C8032F8
-:107CA00009F045CF80910C0280FFF5C0609106017C
-:107CB00070910701660F771F7093070160930601AB
-:107CC000A0910802B09109021097C9F0E8E0F1E034
-:107CD0009B01AD014E0F5F1FF999FECF32BD21BD53
-:107CE000819180BDFA9AF99A2F5F3F4FE417F5070B
-:107CF00099F76A0F7B1F70930701609306018091CB
-:107D0000C00085FFFCCFF092C6008091C00085FFC7
-:107D1000FCCFB092C600E1CE83E00E94C73CDDCE2E
-:107D200082E00E94C73CD9CE0E94763C8093090233
-:107D30000E94763C80930802809106019091070191
-:107D4000880F991F90930701809306010E94763C4B
-:107D5000853409F49AC080910C028E7F80930C02C6
-:107D60000E94763C803209F0B8CE8091C00085FF39
-:107D7000FCCFF092C600A0910802B09109021097C2
-:107D8000C1F180910C02082F0170182F1695117007
-:107D9000E0910601F0910701AF014F5F5F4FBA011B
-:107DA00020E030E00023B1F4112339F49491809164
-:107DB000C00085FFFCCF9093C6002F5F3F4FCB01E3
-:107DC0000196FA012A173B0780F4BC014F5F5F4F11
-:107DD000002351F3F999FECFF2BDE1BDF89A90B5B9
-:107DE0008091C00085FFFCCFE6CF709307016093C0
-:107DF00006018091C00085FDE5CE8091C00085FF21
-:107E0000F8CFE0CE81E00E94C73C67CE0E94763C6E
-:107E1000803209F08CCE8091C00085FFFCCFF092BB
-:107E2000C6008091C00085FFFCCFE092C600809123
-:107E3000C00085FFFCCFD092C6008091C00085FFB6
-:107E4000FCCFC092C6008091C00085FFFCCFB092ED
-:107E5000C60043CE80E10E94C73C3FCE0E94763CE4
-:107E60000E94763C182F0E94763C112309F483C0AF
-:107E7000113009F484C08FE00E94C73C2ECE80915F
-:107E80000C02816080930C02F1CE80910C02816023
-:107E900080930C0265CF809107018823880F880B9F
-:107EA0008A2180930B028091060190910701880F2F
-:107EB000991F90930701809306018091080280FF2B
-:107EC00009C08091080290910902019690930902DD
-:107ED00080930802F894F999FECF1127E0910601EA
-:107EE000F0910701C8E0D1E0809108029091090269
-:107EF000103091F40091570001700130D9F303E084
-:107F000000935700E8950091570001700130D9F3B4
-:107F100001E100935700E8950990199000915700EE
-:107F200001700130D9F301E000935700E8951395F3
-:107F3000103498F011270091570001700130D9F3E7
-:107F400005E000935700E89500915700017001305B
-:107F5000D9F301E100935700E8953296029709F0B2
-:107F6000C7CF103011F00296E5CF11248091C000E8
-:107F700085FFC5CEC8CE8EE10E94C73CAECD85E957
-:0A7F80000E94C73CAACDF894FFCF81
-:027F8A00800075
+:107A7000EF92FF920F931F93CF93DF93809160005B
+:107A800088618093600010926000000082E0809323
+:107A9000C00080E18093C4001092C50088E180930B
+:107AA000C10086E08093C2005098589A539A81E0B2
+:107AB0000E94143D24E1F22E9EE1E92E85E9D82EA4
+:107AC0000FE0C02E10E1B12EAA24A394B1E49B2EA6
+:107AD000A6E58A2EF2E57F2EE0E26E2E79E4572E9F
+:107AE00063E5462E50E5352E0E94763C8033B1F199
+:107AF0008133B9F1803409F46FC0813409F476C060
+:107B0000823409F485C0853409F488C0803531F1A8
+:107B1000823521F1813511F1853509F485C086352D
+:107B200009F48DC0843609F496C0843709F403C182
+:107B3000853709F472C1863709F466C08091030164
+:107B40008F5F80930301853079F6E0910401F09115
+:107B5000050109950E94763C803351F60E94F33C62
+:107B6000C3CF0E94763C803249F78091C00085FFE8
+:107B7000FCCFF092C6008091C00085FFFCCF9092B0
+:107B8000C6008091C00085FFFCCF8092C600809126
+:107B9000C00085FFFCCF7092C6008091C00085FFB9
+:107BA000FCCF6092C6008091C00085FFFCCF509250
+:107BB000C6008091C00085FFFCCF4092C600809136
+:107BC000C00085FFFCCF3092C6008091C00085FFC9
+:107BD000FCCFB092C60088CF0E94763C863808F46D
+:107BE000BDCF0E94763C0E94F33C7ECF0E94763C43
+:107BF000803809F49CC0813809F40BC1823809F43B
+:107C000030C1883909F48FC080E00E94C73C6CCF36
+:107C100084E10E94BD3C0E94F33C66CF85E00E9457
+:107C2000BD3C0E94F33C60CF0E94763C80930601ED
+:107C30000E94763C809307010E94F33C55CF0E943E
+:107C4000763C803309F411C183E00E94BD3C80E0A2
+:107C50000E94C73C49CF0E94763C809309020E9453
+:107C6000763C8093080280910C028E7F80930C02F8
+:107C70000E94763C853409F409C1809108029091F4
+:107C80000902892B89F000E010E00E94763CF8019F
+:107C9000E85FFE4F80830F5F1F4F80910802909135
+:107CA00009020817190788F30E94763C803209F010
+:107CB00045CF80910C0280FFF5C060910601709164
+:107CC0000701660F771F7093070160930601A0916B
+:107CD0000802B09109021097C9F0E8E0F1E09B01B9
+:107CE000AD014E0F5F1FF999FECF32BD21BD8191CD
+:107CF00080BDFA9AF99A2F5F3F4FE417F50799F77D
+:107D00006A0F7B1F70930701609306018091C0008A
+:107D100085FFFCCFF092C6008091C00085FFFCCFAC
+:107D2000B092C600E1CE83E00E94C73CDDCE82E087
+:107D30000E94C73CD9CE0E94763C809309020E94E3
+:107D4000763C809308028091060190910701880F8C
+:107D5000991F90930701809306010E94763C853419
+:107D600009F49AC080910C028E7F80930C020E94CD
+:107D7000763C803209F0B8CE8091C00085FFFCCF00
+:107D8000F092C600A0910802B09109021097C1F1CB
+:107D900080910C02082F0170182F16951170E09138
+:107DA0000601F0910701AF014F5F5F4FBA0120E07C
+:107DB00030E00023B1F4112339F494918091C00094
+:107DC00085FFFCCF9093C6002F5F3F4FCB010196FC
+:107DD000FA012A173B0780F4BC014F5F5F4F002375
+:107DE00051F3F999FECFF2BDE1BDF89A90B58091BB
+:107DF000C00085FFFCCFE6CF7093070160930601BA
+:107E00008091C00085FDE5CE8091C00085FFF8CF50
+:107E1000E0CE81E00E94C73C67CE0E94763C803273
+:107E200009F08CCE8091C00085FFFCCFF092C60097
+:107E30008091C00085FFFCCFE092C6008091C00019
+:107E400085FFFCCFD092C6008091C00085FFFCCF9B
+:107E5000C092C6008091C00085FFFCCFB092C600E2
+:107E600043CE80E10E94C73C3FCE0E94763C0E94F8
+:107E7000763C182F0E94763C112309F483C0113000
+:107E800009F484C08FE00E94C73C2ECE80910C0282
+:107E9000816080930C02F1CE80910C02816080930E
+:107EA0000C0265CF809107018823880F880B8A21F7
+:107EB00080930B028091060190910701880F991F12
+:107EC00090930701809306018091080280FF09C00A
+:107ED0008091080290910902019690930902809383
+:107EE0000802F894F999FECF1127E0910601F0916C
+:107EF0000701C8E0D1E0809108029091090210309A
+:107F000091F40091570001700130D9F303E0009320
+:107F10005700E8950091570001700130D9F301E155
+:107F200000935700E895099019900091570001704F
+:107F30000130D9F301E000935700E8951395103410
+:107F400098F011270091570001700130D9F305E036
+:107F500000935700E8950091570001700130D9F364
+:107F600001E100935700E8953296029709F0C7CFD8
+:107F7000103011F00296E5CF11248091C00085FFEA
+:107F8000C5CEC8CE8EE10E94C73CAECD85E90E9429
+:087F9000C73CAACDF894FFCF15
+:027F9800800067
:040000030000780081
:00000001FF
@@ -22,7 +22,7 @@ PROGRAM = ATmegaBOOT_168
# enter the parameters for the avrdude isp tool
ISPTOOL = usbtiny
ISPPORT = usb
-ISPSPEED = -B 10
+ISPSPEED = -B 1
MCU_TARGET = atmega168
LDSECTION = --section-start=.text=0x3800
@@ -168,7 +168,7 @@ atmega328_isp: isp
atmega328_pro8: TARGET = atmega328_pro_8MHz
atmega328_pro8: MCU_TARGET = atmega328p
-atmega328_pro8: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600 -DDOUBLE_SPEED
+atmega328_pro8: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>3' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600 -DDOUBLE_SPEED
atmega328_pro8: AVR_FREQ = 8000000L
atmega328_pro8: LDSECTION = --section-start=.text=0x7800
atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.hex
@@ -228,5 +228,4 @@ clean:
$(OBJCOPY) -j .text -j .data -O srec $< $@
%.bin: %.elf
- $(OBJCOPY) -j .text -j .data -O binary $< $@
-
+ $(OBJCOPY) -j .text -j .data -O binary $< $@
View
@@ -641,7 +641,7 @@ void set_time(void) {
glcdSetAddress(MENU_INDENT + 18*6, 2);
if (time_format == TIME_12H) {
glcdWriteChar(' ', NORMAL);
- if (time_h >= 12) {
+ if (hour >= 12) {
glcdWriteChar('P', INVERTED);
} else {
glcdWriteChar('A', INVERTED);
@@ -671,7 +671,7 @@ void set_time(void) {
glcdSetAddress(MENU_INDENT + 18*6, 2);
if (time_format == TIME_12H) {
glcdWriteChar(' ', NORMAL);
- if (time_h >= 12) {
+ if (hour >= 12) {
glcdWriteChar('P', NORMAL);
} else {
glcdWriteChar('A', NORMAL);
View
@@ -142,49 +142,13 @@ int main(void) {
//plugged in, glcd will run forever. For good reason, it would be desirable to know
//that the LCD is plugged in and working correctly as a result. This is why we are
//using a watch dog timer. The lcd should initialized in way less than 500 ms.
- wdt_enable(WDTO_500MS);
+ wdt_enable(WDTO_2S);
glcdInit();
glcdClearScreen();
- /*
- for (uint8_t f=0; f<64; f++) {
- for (uint8_t g=0; g+f < 64; g++) {
- glcdClearScreen();
- glcdFillRectangle(0, f, 8, g, ON);
- _delay_ms(100);
- DEBUG(putstring("\n\rg = "));
- DEBUG(uart_putw_dec(g));
- }
- }
- halt();
- */
-
initanim();
initdisplay(0);
-
- /*
- while (1) {
- uint16_t x, y;
-
- for (x = 60; x < GLCD_XPIXELS; x++) {
- for (y = 0; y < GLCD_YPIXELS; y++) {
- glcdSetDot(x, y);
- _delay_ms(10);
- }
-
- }
- for (x = 0; x < GLCD_XPIXELS-1; x++) {
- for (y = 0; y < GLCD_YPIXELS-1; y++) {
- glcdClearDot(x, y);
- _delay_ms(10);
- }
- }
-
- halt();
- }
- */
-
while (1) {
animticker = ANIMTICK_MS;
@@ -269,7 +233,7 @@ int main(void) {
}
while (animticker);
- //uart_getchar();
+ //uart_getchar(); // you would uncomment this so you can manually 'step'
}
halt();

0 comments on commit 07da2ef

Please sign in to comment.