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

#include <pwm.h>

Classes

struct  Config
 Configuration struct for an individual channel. More...
 

Public Member Functions

 Channel (PWMHandle *owner, uint32_t channel)
 Private constructor for channel. Do not use.
 
const ConfigGetConfig () const
 Returns a const reference to the Config struct.
 
PWMHandle::Result Init (const Channel::Config &config)
 Initialize the channel. Must be called manually, after PWMHandle::Init

 
PWMHandle::Result Init ()
 Initialize the channel using all defaults. Must be called manually, after PWMHandle::Init

 
PWMHandle::Result DeInit ()
 Deinitialize the channel. Called automatically by PWMHandle::DeInit.
 
void SetRaw (uint32_t raw)
 Set the duty cycle for the PWM channel.
 
void Set (float val)
 Set the duty cycle for the PWM channel. Automatically normalized to the timer's period.
 

Constructor & Destructor Documentation

◆ Channel()

daisy::PWMHandle::Channel::Channel ( PWMHandle * owner,
uint32_t channel )
inline

Private constructor for channel. Do not use.

Member Function Documentation

◆ DeInit()

PWMHandle::Result daisy::PWMHandle::Channel::DeInit ( )

Deinitialize the channel. Called automatically by PWMHandle::DeInit.

◆ GetConfig()

const Config & daisy::PWMHandle::Channel::GetConfig ( ) const
inline

Returns a const reference to the Config struct.

◆ Init() [1/2]

PWMHandle::Result daisy::PWMHandle::Channel::Init ( )

Initialize the channel using all defaults. Must be called manually, after PWMHandle::Init

◆ Init() [2/2]

PWMHandle::Result daisy::PWMHandle::Channel::Init ( const Channel::Config & config)

Initialize the channel. Must be called manually, after PWMHandle::Init

◆ Set()

void daisy::PWMHandle::Channel::Set ( float val)
inline

Set the duty cycle for the PWM channel. Automatically normalized to the timer's period.

Parameters
valRelative value, [0.0, 1.0]
Note
May experience rounding errors when period is > 2^24; use SetRaw.

◆ SetRaw()

void daisy::PWMHandle::Channel::SetRaw ( uint32_t raw)
inline

Set the duty cycle for the PWM channel.

Parameters
rawMust be less than or equal to the timer's period

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