Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Stm32PWMGroup Class Reference

Set of 4 PWM channels that belong to a single timer resource in the STM32 microcontrollers. More...

#include <Stm32PWM.hxx>

Classes

class  Channel
 

Public Member Functions

 Stm32PWMGroup (TIM_TypeDef *base, uint16_t prescaler, uint32_t period_counts)
 Constructor.
 
PWMget_channel (unsigned id)
 

Static Public Member Functions

static constexpr PWMget_channel (Stm32PWMGroup *parent, unsigned id)
 

Private Member Functions

void set_period (uint32_t counts)
 

Private Attributes

TIM_HandleTypeDef timHandle_
 HAL handle structure. Note this is extremely wasteful of RAM.
 
uninitialized< Channelchannels_ [4]
 

Friends

class Channel
 

Detailed Description

Set of 4 PWM channels that belong to a single timer resource in the STM32 microcontrollers.

Note that the different channels are tied to be using the same period, but the duty cycle can be independently set.

Definition at line 45 of file Stm32PWM.hxx.

Constructor & Destructor Documentation

◆ Stm32PWMGroup()

Stm32PWMGroup::Stm32PWMGroup ( TIM_TypeDef *  base,
uint16_t  prescaler,
uint32_t  period_counts 
)
inline

Constructor.

Parameters
basedefines which timer resource to use.
prescaleris 0 to 65535 (plus 1 will be the prescaling factor)
period_countsis the timer period in clock cycles. Must be less than 65536 * prescaler.

Definition at line 54 of file Stm32PWM.hxx.

Member Function Documentation

◆ get_channel() [1/2]

static constexpr PWM * Stm32PWMGroup::get_channel ( Stm32PWMGroup parent,
unsigned  id 
)
inlinestaticconstexpr
Returns
one PWM channel.
Parameters
parentthe PWMGroup object. Does not need to be initialized yet.
idis the channel number, 1..4

Definition at line 81 of file Stm32PWM.hxx.

◆ get_channel() [2/2]

PWM * Stm32PWMGroup::get_channel ( unsigned  id)
inline
Returns
one PWM channel.
Parameters
idis the channel number, 1..4

Definition at line 72 of file Stm32PWM.hxx.

◆ set_period()

void Stm32PWMGroup::set_period ( uint32_t  counts)
inlineprivate

Definition at line 147 of file Stm32PWM.hxx.

Friends And Related Symbol Documentation

◆ Channel

friend class Channel
friend

Definition at line 145 of file Stm32PWM.hxx.

Member Data Documentation

◆ channels_

uninitialized<Channel> Stm32PWMGroup::channels_[4]
private

Definition at line 157 of file Stm32PWM.hxx.

◆ timHandle_

TIM_HandleTypeDef Stm32PWMGroup::timHandle_
private

HAL handle structure. Note this is extremely wasteful of RAM.

Definition at line 155 of file Stm32PWM.hxx.


The documentation for this class was generated from the following file: