Pico-Arduino
|
This is an even more powerfull PWM API where we can specify a user defined input range and the cycle frequency in hz. More...
#include <PicoPWM.h>
Public Member Functions | |
PicoPWM (uint64_t frequency, uint64_t maxValue) | |
Default constructor. | |
~PicoPWM () | |
Destructor. | |
void | begin (pin_size_t pin, uint64_t initalValue) |
setup a pin for pwm write | |
void | begin (pin_size_t pin, PinMode pinMode=OUTPUT) |
setup a pin for pwm read or write | |
void | end (pin_size_t pin) |
sets the pin to low | |
void | write (pin_size_t pin, uint64_t value) |
Defines the active period in the value range from 0 to maxValue. | |
uint64_t | read (pin_size_t pin) |
Reads the active period in the value range from 0 to maxValue. | |
float | readPercent (pin_size_t pin) |
Provides the duty cyle in percent. | |
uint64_t | period () |
Provides the full cycle period in nanoseconds. | |
uint64_t | frequency () |
Provides the frequncy in hz which was specified in the constructor. | |
Protected Member Functions | |
uint64_t | valueToDutyCycle (uint64_t value) |
converts an input value to the duty cycle in nanosec | |
uint64_t | dutyCycleToValue (uint64_t dutyCycle) |
Protected Attributes | |
PicoPWMNano * | nano |
int64_t | max_value |
uint64_t | period_nano_sec |
This is an even more powerfull PWM API where we can specify a user defined input range and the cycle frequency in hz.