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