Skip to content

Struct daisy::PWMHandle::Config

ClassList > daisy > PWMHandle > Config

Configuration struct for the timer peripheral. More...

  • #include <pwm.h>

Public Types

Type Name
enum Peripheral
Hardware Timer to use for PWM.

Public Attributes

Type Name
uint32_t period
period in ticks at TIM frequency before the counter resets. Affects both the frequency and resolution of PWM.
Peripheral periph
uint32_t prescaler
Prescaler that divides the PWM timer frequency. The final frequency will be sysclk / (2 * (period + 1) * (prescaler + 1)).

Public Functions

Type Name
Config ()
Config (Peripheral periph_, uint32_t prescaler_=0, uint32_t period_=0xffff)

Detailed Description

Note:

These settings are used during initialization and changing them afterwards may not have the desired effect.

Public Types Documentation

enum Peripheral

Hardware Timer to use for PWM.

enum daisy::PWMHandle::Config::Peripheral {
    TIM_3 = 0,
    TIM_4 = 1,
    TIM_5 = 2
};


Public Attributes Documentation

variable period

period in ticks at TIM frequency before the counter resets. Affects both the frequency and resolution of PWM.

uint32_t daisy::PWMHandle::Config::period;

Note:

TIM3 and TIM4 are both 16-bit timers so the max period is 0xffff. TIM5 is a 32-bit timer so the max period is 0xffffffff (about 20 seconds per reset).


variable periph

Peripheral daisy::PWMHandle::Config::periph;

Hardware Peripheral


variable prescaler

Prescaler that divides the PWM timer frequency. The final frequency will be sysclk / (2 * (period + 1) * (prescaler + 1)).

uint32_t daisy::PWMHandle::Config::prescaler;


Public Functions Documentation

function Config [½]

inline daisy::PWMHandle::Config::Config () 

function Config [2/2]

inline daisy::PWMHandle::Config::Config (
    Peripheral periph_,
    uint32_t prescaler_=0,
    uint32_t period_=0xffff
) 


The documentation for this class was generated from the following file external-docs/libDaisy/src/per/pwm.h