void main(void) { ao_clock_init(); ao_task_init(); ao_timer_init(); ao_usb_init(); ao_serial_init(); ao_led_init(LEDS_AVAILABLE); ao_relay_init(); // initialize to default output relay_output = 0; ao_relay_control(relay_output); ao_cmd_init(); ao_cmd_register(ao_relay_cmds); ao_start_scheduler(); }
void ao_adc_init(void) { PRR0 &= ~(1 << PRADC); DIDR0 = 0xf3; DIDR2 = 0x3f; ADCSRB = ADCSRB_INIT; ADCSRA = ADCSRA_INIT; ao_cmd_register(&ao_adc_cmds[0]); }
void ao_launch_init(void) { AO_IGNITER_DROGUE = 0; AO_IGNITER_MAIN = 0; AO_IGNITER_DIR |= AO_IGNITER_DROGUE_BIT | AO_IGNITER_MAIN_BIT; ao_cmd_register(&ao_launch_cmds[0]); ao_add_task(&ao_launch_task, ao_launch, "launch listener"); ao_add_task(&ao_launch_ignite_task, ao_launch_run, "launch igniter"); ao_add_task(&ao_launch_status_task, ao_launch_status, "launch status"); }
void ao_log_init(void) { ao_log_running = 0; /* For now, just log the flight starting at the begining of eeprom */ ao_log_state = ao_flight_invalid; ao_cmd_register(&ao_log_cmds[0]); /* Create a task to log events to eeprom */ ao_add_task(&ao_log_task, ao_log, "log"); }
void main(void) { ao_clock_init(); ao_task_init(); ao_timer_init(); ao_spi_init(); ao_usb_init(); ao_serial_init(); ao_led_init(LEDS_AVAILABLE); ao_led_on(AO_LED_GREEN); ao_cmd_init(); ao_cmd_register(ao_trng_cmds); ao_start_scheduler(); }
void ao_fake_flight_init(void) { ao_cmd_register(&ao_fake_flight_cmds[0]); }
void ao_profile_init(void) { /* Turn on timer 2 and 4 */ stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_TIM2EN) | (1 << STM_RCC_APB1ENR_TIM4EN); /* disable timers */ stm_tim4.cr1 = 0; stm_tim2.cr1 = 0; /* tim4 is master */ stm_tim4.cr2 = ((0 << STM_TIM234_CR2_TI1S) | (STM_TIM234_CR2_MMS_UPDATE << STM_TIM234_CR2_MMS) | (0 << STM_TIM234_CR2_CCDS)); stm_tim4.smcr = ((0 << STM_TIM234_SMCR_ETP) | (0 << STM_TIM234_SMCR_ECE) | (STM_TIM234_SMCR_ETPS_OFF << STM_TIM234_SMCR_ETPS) | (STM_TIM234_SMCR_ETF_NONE << STM_TIM234_SMCR_ETF) | (0 << STM_TIM234_SMCR_MSM) | (STM_TIM234_SMCR_TS_ITR3 << STM_TIM234_SMCR_TS) | (0 << STM_TIM234_SMCR_OCCS) | (STM_TIM234_SMCR_SMS_DISABLE << STM_TIM234_SMCR_SMS)); stm_tim4.dier = 0; stm_tim4.sr = 0; stm_tim4.psc = 31; stm_tim4.cnt = 0; stm_tim4.arr = 0xffff; /* tim2 is slaved to tim4 */ stm_tim2.cr2 = ((0 << STM_TIM234_CR2_TI1S) | (STM_TIM234_CR2_MMS_ENABLE << STM_TIM234_CR2_MMS) | (0 << STM_TIM234_CR2_CCDS)); stm_tim2.smcr = ((0 << STM_TIM234_SMCR_ETP) | (0 << STM_TIM234_SMCR_ECE) | (STM_TIM234_SMCR_ETPS_OFF << STM_TIM234_SMCR_ETPS) | (STM_TIM234_SMCR_ETF_NONE << STM_TIM234_SMCR_ETF) | (0 << STM_TIM234_SMCR_MSM) | (STM_TIM234_SMCR_TS_ITR3 << STM_TIM234_SMCR_TS) | (0 << STM_TIM234_SMCR_OCCS) | (STM_TIM234_SMCR_SMS_EXTERNAL_CLOCK << STM_TIM234_SMCR_SMS)); stm_tim2.dier = 0; stm_tim2.sr = 0; stm_tim2.psc = 0; stm_tim2.cnt = 0; stm_tim2.arr = 0xffff; /* Start your timers */ stm_tim2.cr1 = ((STM_TIM234_CR1_CKD_1 << STM_TIM234_CR1_CKD) | (0 << STM_TIM234_CR1_ARPE) | (STM_TIM234_CR1_CMS_EDGE | STM_TIM234_CR1_CMS) | (STM_TIM234_CR1_DIR_UP << STM_TIM234_CR1_DIR) | (0 << STM_TIM234_CR1_OPM) | (0 << STM_TIM234_CR1_URS) | (0 << STM_TIM234_CR1_UDIS) | (1 << STM_TIM234_CR1_CEN)); stm_tim4.cr1 = ((STM_TIM234_CR1_CKD_1 << STM_TIM234_CR1_CKD) | (0 << STM_TIM234_CR1_ARPE) | (STM_TIM234_CR1_CMS_EDGE | STM_TIM234_CR1_CMS) | (STM_TIM234_CR1_DIR_UP << STM_TIM234_CR1_DIR) | (0 << STM_TIM234_CR1_OPM) | (1 << STM_TIM234_CR1_URS) | (0 << STM_TIM234_CR1_UDIS) | (1 << STM_TIM234_CR1_CEN)); ao_cmd_register(&ao_profile_cmds[0]); }
void ao_radio_cmac_cmd_init(void) { ao_cmd_register(&ao_radio_cmac_cmds[0]); }