85 TIM_TypeDef*
const counterTimer,
156 void configureTimers();
166 unsigned int pulseFrequency = 50;
167 float dutyCycle = 0.5;
168 unsigned int dutyCycleResolution =
This class generates a PWM signal for a chosen number of pulses.
uint16_t getTargetCount()
Allows to get the target periods count while the timers are generating the signal.
void updateCurrentCount(uint16_t count)
Allows to update the current periods count while the timers are generating the signal.
void stop()
Stops the PWM signal generation if it is ongoing.
void generatePulses(uint16_t pulses)
Triggers the generation of a specific number of PWM periods.
void updateTargetCount(uint16_t pulses)
Allows to update the target periods count while the timers are generating the signal.
void setFrequency(unsigned int pulseFrequency)
void setDutyCycle(float dutyCycle)
Sets the duty cycle for the specified channel.
uint16_t getCurrentCount()
Returns the number of periods counted until now.
CountedPWM(TIM_TypeDef *const pulseTimer, TimerUtils::Channel const pulseChannel, TimerUtils::TriggerSource const pulseTriggerSource, TIM_TypeDef *const counterTimer, TimerUtils::Channel const counterChannel, TimerUtils::TriggerSource const counterTriggerSource)
Constructor that initializes the timers.
void setDutyCycleResolution(unsigned int dutyCycleResolution)
Sets the granularity of the PulseTimer duty cycle. So it sets the Auto Reload Register of the PulseTi...
bool isGenerating()
Returns whether the timers are generating the PWM signal or not.
void setCaptureCompareRegister(TimerUtils::Channel channel, T value)
void setCounter(T counterValue)
T readCaptureCompareRegister(TimerUtils::Channel channel)
TriggerSource
Trigger sources.
This file includes all the types the logdecoder script will decode.