#include <otPWM.h>
Inheritance diagram for otPWM:
Public Types | |
enum | Constants { SERVOMIN = 150, SERVOMAX = 600, USMIN = 600, USMAX = 2400, SERVO_FREQ = 50 } |
Public Member Functions | |
otPWM () | |
bool | init (U8 addr=0x40, U8 prescale=0) |
bool | reset () |
void | sleep () |
void | wakeup () |
void | setExtClk (U8 prescale) |
void | setPWMFreq (float freq) |
void | setOutputMode (bool totempole) |
U8 | getPWM (U8 num) |
void | setPWM (U8 num, U16 on, U16 off) |
void | setPin (U8 num, U16 val, bool invert=false) |
U8 | readPrescale (void) |
void | writeMicroseconds (U8 num, U16 Microseconds) |
void | setTimebase (U32 freq) |
U32 | getTimebase () |
|
|
Create the class |
|
Gets the PWM output of one of the PCA9685 pins
|
|
Getter for the internally tracked oscillator used for freq calculations.
|
|
Init PWM. Call this method as first!
Reimplemented in otScorpio. |
|
Reads set Prescale from PCA9685
|
|
Sends a reset command to the PCA9685 chip over I2C |
|
Sets EXTCLK pin to use the external clock
|
|
Sets the output mode of the PCA9685 to either open drain or push pull / totempole. Warning: LEDs with integrated zener diodes should only be driven in open drain mode.
|
|
Helper to set pin PWM output. Sets pin without having to deal with on/off tick placement and properly handles a zero value as completely off and 4095 as completely on. Optional invert parameter supports inverting the pulse for sinking to ground.
|
|
Sets the PWM output of one of the PCA9685 pins
|
|
Sets the PWM frequency for the entire chip, up to ~1.6 KHz
|
|
Setter for the internally tracked oscillator used for freq calculations
|
|
Puts PWM into sleep mode |
|
Wakes PWM from sleep |
|
Sets the PWM output of one of the PCA9685 pins based on the input microseconds, output is not precise
|