// ************************************************************************************************* // @fn start_buzzer // @brief Start buzzer output for a number of cylces // @param uint8_t cycles Keep buzzer output for number of cycles // uint16_t on_time Output buzzer for "on_time" msec // uint16_t off_time Do not output buzzer for "off_time" msec // @return none // ************************************************************************************************* void start_buzzer(uint8_t cycles, uint16_t on_time, uint16_t off_time) { // Store new buzzer duration while buzzer is off if (sBuzzer.time == 0) { sBuzzer.time = cycles; sBuzzer.on_time = on_time; sBuzzer.off_time = off_time; // Need to init every time, because SimpliciTI claims same timer // Reset TA1R, set up mode, TA1 runs from 32768Hz ACLK TA1CTL = TACLR | MC_1 | TASSEL__ACLK; // Set PWM frequency TA1CCR0 = sBuzzer.steps; // Enable IRQ, set output mode "toggle" TA1CCTL0 = OUTMOD_4; // Allow buzzer PWM output on P2.7 P2SEL |= BIT7; // Activate Timer0_A3 periodic interrupts //fptr_Timer0_A3_function = toggle_buzzer; //Timer0_A3_Start(sBuzzer.on_time); buzzer_event.f = &toggle_buzzer; buzzer_event.next_event = sBuzzer.on_time; // Preload timer advance variable //sTimer.timer0_A3_ticks = sBuzzer.off_time; // Start with buzzer output on sBuzzer.state = BUZZER_ON_OUTPUT_ENABLED; timer_add_event(&buzzer_event); } }
static void scan_timeout() { if (dll_state == DllStateNone) return; #ifdef LOG_DLL_ENABLED log_print_stack_string(LOG_DLL, "DLL scan time-out"); #endif phy_idle(); if (current_css == NULL) { return; } //Channel scan series timer_event event; event.next_event = current_css->values[current_scan_id].time_next_scan; event.f = &scan_next; current_scan_id = current_scan_id < current_css->length - 1 ? current_scan_id + 1 : 0; timer_add_event(&event); }
void blink_led() { led_on(1); timer_add_event(&dim_led_event); }