Wyatt  1.0.1
AdafruitPWMServoHat.h
1 #pragma once
2 
3 #include "wiringPiInclude.h"
4 
5 // Registers
6 #define PCA9685_ADDRESS 0x40
7 #define MODE1 0x00
8 #define MODE2 0x01
9 #define SUBADR1 0x02
10 #define SUBADR2 0x03
11 #define SUBADR3 0x04
12 #define PRESCALE 0xFE
13 #define LED0_ON_L 0x06
14 #define LED0_ON_H 0x07
15 #define LED0_OFF_L 0x08
16 #define LED0_OFF_H 0x09
17 #define ALL_LED_ON_L 0xFA
18 #define ALL_LED_ON_H 0xFB
19 #define ALL_LED_OFF_L 0xFC
20 #define ALL_LED_OFF_H 0xFD
21 
22 // Bits
23 #define RESTART 0x80
24 #define SLEEP 0x10
25 #define ALLCALL 0x01
26 #define INVRT 0x10
27 #define OUTDRV 0x04
28 
37 public:
45  AdafruitPWMServoHat(int pwmFrequency = 60);
58  bool setMotor(int motorID, int speed);
66  bool stopMotor(int motorID);
72  bool stopAllMotors();
80  void setPwm(int channel, int on, int off);
87  void setAllPwm(int on, int off);
88 private:
90  int m_i2c;
92  int m_hz;
96  void softwareReset();
102  void setPwmFrequency(double freqHz);
103 };
104 
void setAllPwm(int on, int off)
bool setMotor(int motorID, int speed)
bool stopMotor(int motorID)
AdafruitPWMServoHat(int pwmFrequency=60)
void setPwm(int channel, int on, int off)