9 #include "eFlexPwmPin.h"
37 bool beginSubModules (uint8_t subModulesToBegin,
bool doStart =
true,
bool doSync =
true);
52 inline bool begin (
bool doStart =
true,
bool doSync =
true) {
102 inline void start (uint8_t subModulesToStart,
bool startit =
true) {
104 PWM_StartTimer (ptr(), subModulesToStart);
107 PWM_StopTimer (ptr(), subModulesToStart);
117 inline void start (
bool startit =
true) {
118 start (SmMask[m_tmidx], startit);
130 inline void stop (uint8_t subModulesToStop) {
131 start (subModulesToStop,
false);
257 inline void setPwmLdok (uint8_t subModulesToUpdate,
bool value) {
258 PWM_SetPwmLdok (ptr(), subModulesToUpdate, value);
267 PWM_SetupFaultInputFilter (ptr(), faultInputFilterParams);
279 PWM_SetupFaults (ptr(), faultNum, faultParams);
289 return (
busClockHz() / (
static_cast<uint32_t
> (prescaler & 0x7F) * 65535UL) + 1);
305 Timer (uint8_t
index);
306 inline PWM_Type *ptr() {
309 inline const PWM_Type *ptr()
const {
318 extern Timer *TM[NofTimers];
enum _pwm_clock_prescale pwm_clock_prescale_t
PWM prescaler factor selection for clock source.
enum _pwm_fault_state pwm_fault_state_t
PWM output fault status.
enum _pwm_fault_input pwm_fault_input_t
List of PWM fault selections.
enum _pwm_level_select pwm_level_select_t
PWM output pulse mode, high-true or low-true.
void disable()
Disable all instantiated submodules of the timer.
uint8_t index() const
Returns the timer module index (0 for PWM1...)
static uint32_t busClockHz()
Bus clock in Hz.
void start(bool startit=true)
Starts or stops the PWM counter for all instantiated submodules for this timer.
void printRegs(Stream &out=Serial) const
Print PWM module registers to the output stream.
void setupFaults(pwm_fault_input_t faultNum, const pwm_fault_param_t *faultParams)
Sets up the PWM fault protection.
bool updateSetting(bool doSync=true)
Update PWM signals for all submodules.
void stop()
Stops the PWM counter for all instantiated submodules for this timer.
static uint32_t prescalerToMinPwmFrequency(unsigned prescaler)
Calculates the minimum PWM frequency corresponding to a prescaler.
void stop(uint8_t subModulesToStop)
Stops the PWM counter for a single or multiple submodules.
void setupFaultInputFilter(const pwm_fault_input_filter_param_t *faultInputFilterParams)
Sets up the PWM fault input filter.
void enable(bool value=true)
Enable or disable all instantiated submodules of the timer.
uint32_t srcClockHz() const
PWM main counter clock in Hz.
void setupDutyCyclePercent(uint8_t dutyCyclePercent)
Setting the duty cycle for all submodules before calling begin.
bool begin(bool doStart=true, bool doSync=true)
Sets up the PWM signals for all instantiated submodules of the timer.
void start(uint8_t subModulesToStart, bool startit=true)
Starts or stops the PWM counter for a single or multiple submodules.
bool beginSubModules(uint8_t subModulesToBegin, bool doStart=true, bool doSync=true)
Sets up the PWM signals for the sub-modules passed as parameters.
void setPwmLdok(uint8_t subModulesToUpdate, bool value)
Sets or clears the PWM LDOK bit on a single or multiple submodules.
void setupDeadtime(uint16_t deadtimeValue, uint32_t unit=1)
Setting the deadtime for all submodules before calling begin.
void printAllRegs(Stream &out=Serial) const
Print registers of PWM module and its submodules to the output stream.
bool isEnabled() const
Returns true if the timer is enabled.
void setPwmLdok(bool value=true)
Sets or clears the PWM LDOK bit on all instantiated submodules for this timer.
void setupFaultState(pwm_fault_state_t faultState)
Setting the output fault status for all submodules before calling begin.
void setupOutputEnable(bool activate=true)
Setting output enable for all submodules before calling begin.
void setupLevel(pwm_level_select_t level)
Setting the output pulse mode for all submodules before calling begin.
Structure for the user to configure the fault input filter.
Structure is used to hold the parameters to configure a PWM fault.