
XBEE receiver v2
PCA9685.h@0:dbef204fd840, 2018-06-20 (annotated)
- Committer:
- MoussOudj
- Date:
- Wed Jun 20 20:09:53 2018 +0000
- Revision:
- 0:dbef204fd840
XBEE_RECEIVER_V2_OK_20/06/2018
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MoussOudj | 0:dbef204fd840 | 1 | #ifndef PCA9685_LIBRARY_H |
MoussOudj | 0:dbef204fd840 | 2 | #define PCA9685_LIBRARY_H |
MoussOudj | 0:dbef204fd840 | 3 | |
MoussOudj | 0:dbef204fd840 | 4 | #include "mbed.h" |
MoussOudj | 0:dbef204fd840 | 5 | #include "definitions.h" |
MoussOudj | 0:dbef204fd840 | 6 | |
MoussOudj | 0:dbef204fd840 | 7 | |
MoussOudj | 0:dbef204fd840 | 8 | class PCA9685 { |
MoussOudj | 0:dbef204fd840 | 9 | |
MoussOudj | 0:dbef204fd840 | 10 | public: |
MoussOudj | 0:dbef204fd840 | 11 | PCA9685(uint8_t i2c_addr, I2C i2c_object, float frequency); |
MoussOudj | 0:dbef204fd840 | 12 | void init(void); |
MoussOudj | 0:dbef204fd840 | 13 | void set_pwm_output(int pwm_output, uint16_t count_on, uint16_t count_off); |
MoussOudj | 0:dbef204fd840 | 14 | void set_pwm_output_on_0(int pwm_output, uint16_t count_off); |
MoussOudj | 0:dbef204fd840 | 15 | void set_pwm_duty(int pwm_output, float duty_cycle); |
MoussOudj | 0:dbef204fd840 | 16 | void set_pwm_pw(int pwm_output, float pulse_width_us); |
MoussOudj | 0:dbef204fd840 | 17 | void update(void); |
MoussOudj | 0:dbef204fd840 | 18 | |
MoussOudj | 0:dbef204fd840 | 19 | private: |
MoussOudj | 0:dbef204fd840 | 20 | void reset(void); |
MoussOudj | 0:dbef204fd840 | 21 | void write_8(uint8_t reg, uint8_t msg); |
MoussOudj | 0:dbef204fd840 | 22 | uint8_t read_8(uint8_t reg); |
MoussOudj | 0:dbef204fd840 | 23 | void set_prescale(uint8_t prescale); |
MoussOudj | 0:dbef204fd840 | 24 | int convert_pwm_value(float pulse_width_us, float period_us); |
MoussOudj | 0:dbef204fd840 | 25 | |
MoussOudj | 0:dbef204fd840 | 26 | private: |
MoussOudj | 0:dbef204fd840 | 27 | int i2c_addr; |
MoussOudj | 0:dbef204fd840 | 28 | float freq; |
MoussOudj | 0:dbef204fd840 | 29 | I2C i2c; |
MoussOudj | 0:dbef204fd840 | 30 | }; |
MoussOudj | 0:dbef204fd840 | 31 | |
MoussOudj | 0:dbef204fd840 | 32 | #endif |