int main(void) { void *rw_hash; hardware_init(); debug_printf("%s started\n", is_ro_mode() ? "RO" : "RW"); /* the RO partition protection is not enabled : do it */ if (!flash_physical_is_permanently_protected()) flash_physical_permanent_protect(); /* * calculate the hash of the RW partition * * Also pre-cache it so we can answer Discover Identity VDM * fast enough (in less than 30ms). */ rw_hash = flash_hash_rw(); /* Verify RW firmware and use it if valid */ if (is_ro_mode() && check_rw_valid(rw_hash)) jump_to_rw(); /* background loop for PD events */ pd_task(); debug_printf("EXIT!\n"); /* we should never reach that point */ system_reset(0); return 0; }
int main(void) { hardware_init(); debug_printf("Power supply started ... %s\n", is_ro_mode() ? "RO" : "RW"); /* Verify RW firmware and use it if valid */ if (is_ro_mode() && check_rw_valid()) jump_to_rw(); /* background loop for PD events */ pd_task(); debug_printf("background loop exited !\n"); /* we should never reach that point */ cpu_reset(); return 0; }
int main(void) { init_menu(); clear(); init_motor(); init_timers(); encoders_init(IO_D2, IO_D3, IO_C4, IO_C5); sei(); while (1) { if(g_pd_release) { pd_task(); g_pd_release = 0; } if(g_velocity_release) { velocity_task(); g_velocity_release = 0; } if(g_encoder_release) { encoder_task(); g_encoder_release = 0; } if(g_log_release) { log_task(); g_log_release = 0; } if(g_interpolate_release) { interoplate_task(); g_interpolate_release = 0; } serial_check(); check_for_new_bytes_received(); } }