X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fmain.c;h=14a2aad68ef5b18d140a0fb932e27dc6070c952a;hp=88d4f97bacc796eb0ae9219259a50c5db4a2d9ca;hb=4e7801883ed4076cb14b63a0571467747894c0f8;hpb=fa8546ea39c7442ad3bf5a822a72a2b50a41045d diff --git a/projects/microb2010/mainboard/main.c b/projects/microb2010/mainboard/main.c index 88d4f97..14a2aad 100755 --- a/projects/microb2010/mainboard/main.c +++ b/projects/microb2010/mainboard/main.c @@ -67,6 +67,7 @@ #include "actuator.h" #include "cs.h" #include "strat_base.h" +#include "strat_db.h" #include "i2c_protocol.h" /* 0 means "programmed" @@ -83,8 +84,8 @@ struct genboard gen; struct mainboard mainboard; -struct cobboard cobboard; -struct ballboard ballboard; +volatile struct cobboard cobboard; +volatile struct ballboard ballboard; #ifndef HOST_VERSION /***********************/ @@ -133,9 +134,21 @@ void do_time_monitor(void *dummy) void do_led_blink(void *dummy) { -#if 1 /* simple blink */ - LED1_TOGGLE(); -#endif + static uint8_t a = 0; + + if (mainboard.flags & DO_ERRBLOCKING) { + if (a & 1) + LED1_ON(); + else + LED1_OFF(); + } + else { + if (a & 4) + LED1_ON(); + else + LED1_OFF(); + } + a++; } static void main_timer_interrupt(void) @@ -171,7 +184,7 @@ int main(void) memset(&gen, 0, sizeof(gen)); memset(&mainboard, 0, sizeof(mainboard)); mainboard.flags = DO_ENCODERS | DO_CS | DO_RS | - DO_POS | DO_POWER | DO_BD; + DO_POS | DO_POWER | DO_BD | DO_ERRBLOCKING; /* UART */ uart_init(); @@ -262,13 +275,13 @@ int main(void) /* all cs management */ microb_cs_init(); + /* TIME */ + time_init(TIME_PRIO); + #ifndef HOST_VERSION /* sensors, will also init hardware adc */ sensor_init(); - /* TIME */ - time_init(TIME_PRIO); - /* start i2c slave polling */ scheduler_add_periodical_event_priority(i2c_poll_slaves, NULL, 8000L / SCHEDULER_UNIT, I2C_POLL_PRIO); @@ -277,11 +290,11 @@ int main(void) /* strat */ gen.logs[0] = E_USER_STRAT; gen.log_level = 5; - strat_reset_infos(); + strat_db_init(); /* strat-related event */ scheduler_add_periodical_event_priority(strat_event, NULL, - 25000L / SCHEDULER_UNIT, + 10000L / SCHEDULER_UNIT, STRAT_PRIO); #ifndef HOST_VERSION