Skip to content

Commit

Permalink
Remove TOGGLE mode from timer driver
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelcoeffic committed Aug 10, 2023
1 parent 480146c commit 19c430c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
5 changes: 0 additions & 5 deletions radio/src/hal/timer_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@

#include <stdint.h>

enum PulseGenerationType {
ETX_PWM=0,
ETX_TOGGLE
};

typedef struct {
uint8_t type;
uint8_t polarity;
uint16_t cmp_val;
} etx_timer_config_t;
Expand Down
2 changes: 0 additions & 2 deletions radio/src/pulses/ppm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions radio/src/targets/common/arm/stm32/module_timer_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down

0 comments on commit 19c430c

Please sign in to comment.