Pico-Arduino
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pico_arduino::PicoPWMNano Class Reference

Basic PWM API based on the input and output in nano seconds The Raspberry Pico has 8 controllable PWM slices with each 2 channels, so we can control up to 16 pwm devices at the same time! This is Simple Basic PWM API where we specifiy the periods and duty cyle in Nanoseconds. More...

#include <PicoPWM.h>

Public Member Functions

 PicoPWMNano (uint64_t periodNanoSeconds)
 Constructor: Defines the length of a full cycle in nanoseconds (mio of seconds)
 
void begin (pin_size_t gpio, uint64_t initialDutyCyleNanoSeconds=0, PinMode pinMode=OUTPUT)
 setup the pin mode only if necessary
 
void end (pin_size_t gpio)
 sets the output pins to low
 
float frequency ()
 converts the PWM period to hz for the PWM output
 
uint64_t measureDutyCycle (uint gpio)
 measures the duty cycle in nanoseconds - only the PWM B pins can be used as inputs!
 
float measureDutyCyclePercent (uint gpio)
 provides the duty cycle in percent
 
uint64_t period ()
 provides the full cycle period in nanoseconds
 
void setDutyCycle (pin_size_t gpio, uint64_t dutyCyleNanoSeconds)
 Defines the active period is nanoseconds.
 

Protected Member Functions

bool isInput (pin_size_t gpio)
 
bool isOutput (pin_size_t gpio)
 

Protected Attributes

PicoPinFunction pin_function = PicoPinFunction::instance()
 
PinMode pin_mode
 
PicoPWMReaderreader
 
PicoPWMWriterwriter
 

Detailed Description

Basic PWM API based on the input and output in nano seconds The Raspberry Pico has 8 controllable PWM slices with each 2 channels, so we can control up to 16 pwm devices at the same time! This is Simple Basic PWM API where we specifiy the periods and duty cyle in Nanoseconds.

Author
Phil Schatzmann

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