change LED blink timer to TIMER16.
change ultrasonic transmit pin timer to TIMER13 CH0 PB1(AF_0). rename function name.
This commit is contained in:
@@ -98,46 +98,67 @@ void SysTick_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
void TIMER13_IRQHandler(void) {
|
||||
if (timer_interrupt_flag_get(TIMER13, TIMER_INT_FLAG_UP) == SET)
|
||||
void TIMER16_IRQHandler(void) {
|
||||
if (timer_interrupt_flag_get(TIMER16, TIMER_INT_FLAG_UP) == SET)
|
||||
{
|
||||
timer_interrupt_flag_clear(TIMER13, TIMER_INT_FLAG_UP);
|
||||
timer_interrupt_flag_clear(TIMER16, TIMER_INT_FLAG_UP);
|
||||
static uint8_t led_status = 0;
|
||||
if (led_status)
|
||||
{
|
||||
//! turn on led & reconfig timer13 period to 19000(1900ms)
|
||||
gpio_bit_write(GPIOA, GPIO_PIN_9, RESET);
|
||||
timer_autoreload_value_config(TIMER13, 19200);
|
||||
timer_autoreload_value_config(TIMER16, 19200);
|
||||
} else {
|
||||
//! turn off led & reconfig timer13 period to 1000(100ms)
|
||||
gpio_bit_write(GPIOA, GPIO_PIN_9, SET);
|
||||
timer_autoreload_value_config(TIMER13, 800);
|
||||
timer_autoreload_value_config(TIMER16, 800);
|
||||
}
|
||||
led_status = !led_status;
|
||||
}
|
||||
}
|
||||
|
||||
void TIMER14_IRQHandler(void)
|
||||
{
|
||||
if (timer_flag_get(TIMER14, TIMER_FLAG_CH0))
|
||||
{
|
||||
timer_flag_clear(TIMER14, TIMER_FLAG_CH0);
|
||||
|
||||
uint32_t capture_value = timer_channel_capture_value_register_read(TIMER14, TIMER_CH_0);
|
||||
|
||||
timer_disable(TIMER14);
|
||||
}
|
||||
}
|
||||
|
||||
void TIMER15_IRQHandler(void) {
|
||||
if (timer_interrupt_flag_get(TIMER15, TIMER_INT_FLAG_UP) == SET)
|
||||
{
|
||||
timer_interrupt_flag_clear(TIMER15, TIMER_INT_FLAG_UP);
|
||||
|
||||
exti_interrupt_enable(EXTI_0);
|
||||
// timer_enable(TIMER14);
|
||||
timer_enable(TIMER14);
|
||||
|
||||
/*
|
||||
* GPIO Toggle will be delete when the project is ready
|
||||
*/
|
||||
gpio_bit_toggle(GPIOA, GPIO_PIN_7);
|
||||
/*******************************************************/
|
||||
|
||||
timer_disable(TIMER15);
|
||||
}
|
||||
}
|
||||
|
||||
void EXTI0_1_IRQHandler(void) {
|
||||
if (exti_interrupt_flag_get(EXTI_0) == SET) {
|
||||
if (exti_interrupt_flag_get(EXTI_0) == SET)
|
||||
{
|
||||
exti_interrupt_flag_clear(EXTI_0);
|
||||
|
||||
/*
|
||||
* GPIO Toggle will be delete when the project is ready
|
||||
*/
|
||||
gpio_bit_toggle(GPIOA, GPIO_PIN_5);
|
||||
/*******************************************************/
|
||||
|
||||
timer_event_software_generate(TIMER14, TIMER_EVENT_SRC_CH0G);
|
||||
// timer_event_software_generate(TIMER14, TIMER_EVENT_SRC_CH0G);
|
||||
|
||||
exti_interrupt_disable(EXTI_0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user