Pico-Arduino
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PicoPWMWriter Class Reference

Support for the generation of PWM signals. For the standard Arduino functionality we use on fixed frequency (defined in the constructor). If you use this API you can define separate frequencies per slice by creating separate instances. More...

#include <PicoPWM.h>

Inheritance diagram for PicoPWMWriter:
PinSetup

Public Member Functions

 PicoPWMWriter (uint64_t periodNanoSeconds)
 Constructor: Defines the length of a full cycle in nanoseconds (mio of seconds)
 
void begin (pin_size_t pin, uint64_t initialDutyCyleNanoSeconds=0)
 setup a pin for pwm write
 
virtual void setupPin (PinInfo *info, pin_size_t pinNumber)
 setup of pin for PWM Output
 
void end (pin_size_t pin)
 sets the pin to low
 
void setDutyCycle (pin_size_t pin, uint64_t dutyCyleNanoSeconds)
 Defines the active period is nanoseconds.
 
float frequency ()
 converts the PWM period to hz
 
float frequencyTick ()
 
float periodTick ()
 
uint64_t period ()
 provides the full cycle period in nanoseconds
 
- Public Member Functions inherited from PinSetup
virtual bool usePin (PinInfo *info, pin_size_t pin)
 

Protected Member Functions

bool setupConfig ()
 provides the configuration - returns true if we have a new configuration
 
void logConfig (uint32_t sys_clock_freq, float dividerTick, uint16_t wrap)
 

Protected Attributes

PicoPinFunction pinFunction = PicoPinFunction::instance()
 
PinMode pin_mode
 
pwm_config config
 
uint64_t period_nano_sec
 
uint64_t initial_duty_cycle
 
float tick_period_nano_sec
 
bool is_config_done = false
 

Detailed Description

Support for the generation of PWM signals. For the standard Arduino functionality we use on fixed frequency (defined in the constructor). If you use this API you can define separate frequencies per slice by creating separate instances.

Author
Phil Schatzmann

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