X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fcobboard%2Fmain.c;h=ad496ca471e2b6085dae2f0fbfbf703d95a41257;hp=d21e7b73fde9e83d062aa7337d0182f8b6be6ad9;hb=HEAD;hpb=b022f257a5ee568737e1a684a83d0154397fffcb diff --git a/projects/microb2010/cobboard/main.c b/projects/microb2010/cobboard/main.c index d21e7b7..ad496ca 100755 --- a/projects/microb2010/cobboard/main.c +++ b/projects/microb2010/cobboard/main.c @@ -173,13 +173,17 @@ int main(void) # error not supported #endif - //eeprom_write_byte(EEPROM_MAGIC_ADDRESS, EEPROM_MAGIC_COBBOARD); /* check eeprom to avoid to run the bad program */ if (eeprom_read_byte(EEPROM_MAGIC_ADDRESS) != EEPROM_MAGIC_COBBOARD) { + int c; sei(); - printf_P(PSTR("Bad eeprom value\r\n")); - while(1); + printf_P(PSTR("Bad eeprom value ('f' to force)\r\n")); + c = uart_recv(CMDLINE_UART); + if (c == 'f') + eeprom_write_byte(EEPROM_MAGIC_ADDRESS, EEPROM_MAGIC_COBBOARD); + wait_ms(100); + bootloader(); } /* LOGS */ @@ -207,10 +211,10 @@ int main(void) PWM_NG_TIMER_16BITS_INIT(4, TIMER_16_MODE_PWM_10, TIMER4_PRESCALER_DIV_1); - PWM_NG_INIT16(&gen.pwm1_4A, 4, A, 10, PWM_NG_MODE_SIGNED, - &PORTD, 4); - PWM_NG_INIT16(&gen.pwm2_4B, 4, B, 10, PWM_NG_MODE_SIGNED | - PWM_NG_MODE_SIGN_INVERTED, &PORTD, 5); + PWM_NG_INIT16(&gen.pwm1_4A, 4, A, 10, PWM_NG_MODE_SIGNED | + PWM_NG_MODE_SIGN_INVERTED, &PORTD, 4); + PWM_NG_INIT16(&gen.pwm2_4B, 4, B, 10, PWM_NG_MODE_SIGNED, + &PORTD, 5); PWM_NG_INIT16(&gen.pwm3_1A, 1, A, 10, PWM_NG_MODE_SIGNED, &PORTD, 6); PWM_NG_INIT16(&gen.pwm4_1B, 1, B, 10, PWM_NG_MODE_SIGNED | @@ -254,13 +258,13 @@ int main(void) printf_P(PSTR("cobboard start\r\n")); + /* actuators */ + actuator_init(); + /* spickle, shovel */ spickle_init(); shovel_init(); - /* actuators */ - actuator_init(); - state_init(); printf_P(PSTR("\r\n"));