From 19c430c8d25599fc082d2153b6584f104433e487 Mon Sep 17 00:00:00 2001 From: raphaelcoeffic Date: Thu, 10 Aug 2023 13:58:08 +0200 Subject: [PATCH] Remove TOGGLE mode from timer driver --- radio/src/hal/timer_driver.h | 5 ----- radio/src/pulses/ppm.cpp | 2 -- radio/src/targets/common/arm/stm32/module_timer_driver.cpp | 4 ++-- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/radio/src/hal/timer_driver.h b/radio/src/hal/timer_driver.h index 2f516eeeb80..98d85f7fa1e 100644 --- a/radio/src/hal/timer_driver.h +++ b/radio/src/hal/timer_driver.h @@ -23,13 +23,8 @@ #include -enum PulseGenerationType { - ETX_PWM=0, - ETX_TOGGLE -}; typedef struct { - uint8_t type; uint8_t polarity; uint16_t cmp_val; } etx_timer_config_t; diff --git a/radio/src/pulses/ppm.cpp b/radio/src/pulses/ppm.cpp index 8792e934622..ad42a6228ab 100644 --- a/radio/src/pulses/ppm.cpp +++ b/radio/src/pulses/ppm.cpp @@ -107,7 +107,6 @@ static void* ppmInit(uint8_t module) auto delay = GET_MODULE_PPM_DELAY(module) * 2; etx_timer_config_t cfg = { - .type = ETX_PWM, .polarity = !GET_MODULE_PPM_POLARITY(module), .cmp_val = (uint16_t)delay, }; @@ -142,7 +141,6 @@ static void ppmSendPulses(void* ctx, uint8_t* buffer, int16_t* channels, uint8_t auto delay = GET_MODULE_PPM_DELAY(module) * 2; etx_timer_config_t cfg = { - .type = ETX_PWM, .polarity = !GET_MODULE_PPM_POLARITY(module), .cmp_val = (uint16_t)delay, }; diff --git a/radio/src/targets/common/arm/stm32/module_timer_driver.cpp b/radio/src/targets/common/arm/stm32/module_timer_driver.cpp index 0b620ea7830..4dce6bc4de7 100644 --- a/radio/src/targets/common/arm/stm32/module_timer_driver.cpp +++ b/radio/src/targets/common/arm/stm32/module_timer_driver.cpp @@ -28,7 +28,7 @@ static void* module_timer_init(void* hw_def, const etx_timer_config_t* cfg) bool polarity = cfg->polarity; uint32_t ocval = cfg->cmp_val; - uint32_t ocmode = (cfg->type == ETX_PWM) ? LL_TIM_OCMODE_FORCED_INACTIVE : LL_TIM_OCMODE_TOGGLE; + uint32_t ocmode = LL_TIM_OCMODE_FORCED_INACTIVE; stm32_pulse_init(timer, 0); stm32_pulse_config_output(timer, polarity, ocmode, ocval); @@ -53,7 +53,7 @@ static void module_timer_send(void* ctx, const etx_timer_config_t* cfg, stm32_pulse_set_polarity(timer, cfg->polarity); // Start DMA request and re-enable timer - uint32_t ocmode = (cfg->type == ETX_PWM) ? LL_TIM_OCMODE_PWM1 : LL_TIM_OCMODE_TOGGLE; + uint32_t ocmode = LL_TIM_OCMODE_PWM1; uint32_t ocval = cfg->cmp_val; stm32_pulse_start_dma_req(timer, pulses, length, ocmode, ocval); }