libDaisy
Hardware Library for Daisy
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
daisy::PWMHandle::Config Struct Reference

Configuration struct for the timer peripheral. More...

Detailed Description

Configuration struct for the timer peripheral.

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

#include <pwm.h>

Public Types

enum class  Peripheral { TIM_3 = 0 , TIM_4 = 1 , TIM_5 = 2 }
 Hardware Timer to use for PWM. More...
 

Public Member Functions

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

Public Attributes

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

Member Enumeration Documentation

◆ Peripheral

Hardware Timer to use for PWM.

Enumerator
TIM_3 

16-bit counter (max period 0xffff)

TIM_4 

16-bit counter (max period 0xffff)

TIM_5 

32-bit counter (max period 0xffffffff)

Constructor & Destructor Documentation

◆ Config() [1/2]

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

◆ Config() [2/2]

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

Member Data Documentation

◆ period

uint32_t daisy::PWMHandle::Config::period

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

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).

◆ periph

Peripheral daisy::PWMHandle::Config::periph

Hardware Peripheral

◆ prescaler

uint32_t daisy::PWMHandle::Config::prescaler

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


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