Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/pca9685/pca9685_i2c.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/i2c.h"
#include "mcu_periph/sys_time.h"
#include "math/pprz_isa.h"
#include "subsystems/abi.h"
#include "mcu_periph/uart.h"
#include "subsystems/datalink/telemetry.h"
Go to the source code of this file.
Functions | |
bool | pca9865_set_servo (uint8_t srv_nb, uint16_t srv_val) |
void | pca9685_i2c_init (void) |
void | pca9685_i2c_periodic (void) |
void | pca9685_i2c_event (void) |
Variables | |
struct i2c_transaction | pca9685_i2c_trans |
uint8_t | pca9685_i2c_status = 0 |
uint8_t | srv_cnt = 0 |
uint16_t | pca9865_write_servo_vals [PCA9865_SRV_NUMBER] |
uint8_t | pca9865_reg_nb [16] |
#define BUF2INT | ( | _buf, | |
_idx | |||
) | ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx])) |
Definition at line 58 of file pca9685_i2c.c.
#define INT2BUF | ( | _int, | |
_buf, | |||
_idx | |||
) | { _buf[_idx] = _int; _buf[_idx+1] = (_int>>8); } |
Definition at line 59 of file pca9685_i2c.c.
#define PCA9685_ALL_LED_OFF_H_REG_ADDR 0XFD |
Definition at line 183 of file pca9685_i2c.c.
#define PCA9685_ALL_LED_OFF_L_REG_ADDR 0XFC |
Definition at line 182 of file pca9685_i2c.c.
#define PCA9685_ALL_LED_ON_H_REG_ADDR 0XFB |
Definition at line 181 of file pca9685_i2c.c.
#define PCA9685_ALL_LED_ON_L_REG_ADDR 0XFA |
Definition at line 180 of file pca9685_i2c.c.
#define PCA9685_ALLCALL_ADDR 0x05 |
Definition at line 97 of file pca9685_i2c.c.
#define PCA9685_I2C_ALLCALL_ADDR 0xE0 |
Definition at line 85 of file pca9685_i2c.c.
#define PCA9685_I2C_DEV i2c2 |
Definition at line 62 of file pca9685_i2c.c.
#define PCA9685_I2C_GEN_CALL_ADDR 0x00 |
Definition at line 91 of file pca9685_i2c.c.
#define PCA9685_I2C_RESET_ADDR 0x06 |
Definition at line 88 of file pca9685_i2c.c.
#define PCA9685_I2C_SLAVE_ADDR 0xE0 |
Definition at line 80 of file pca9685_i2c.c.
#define PCA9685_LED0_OFF_H_REG_ADDR 0X09 |
Definition at line 102 of file pca9685_i2c.c.
#define PCA9685_LED0_OFF_L_REG_ADDR 0X08 |
Definition at line 101 of file pca9685_i2c.c.
#define PCA9685_LED0_ON_H_REG_ADDR 0X07 |
Definition at line 100 of file pca9685_i2c.c.
#define PCA9685_LED0_ON_L_REG_ADDR 0X06 |
Definition at line 99 of file pca9685_i2c.c.
#define PCA9685_LED10_OFF_H_REG_ADDR 0X31 |
Definition at line 153 of file pca9685_i2c.c.
#define PCA9685_LED10_OFF_L_REG_ADDR 0X30 |
Definition at line 152 of file pca9685_i2c.c.
#define PCA9685_LED10_ON_H_REG_ADDR 0X2F |
Definition at line 151 of file pca9685_i2c.c.
#define PCA9685_LED10_ON_L_REG_ADDR 0X2E |
Definition at line 150 of file pca9685_i2c.c.
#define PCA9685_LED11_OFF_H_REG_ADDR 0X35 |
Definition at line 158 of file pca9685_i2c.c.
#define PCA9685_LED11_OFF_L_REG_ADDR 0X34 |
Definition at line 157 of file pca9685_i2c.c.
#define PCA9685_LED11_ON_H_REG_ADDR 0X33 |
Definition at line 156 of file pca9685_i2c.c.
#define PCA9685_LED11_ON_L_REG_ADDR 0X32 |
Definition at line 155 of file pca9685_i2c.c.
#define PCA9685_LED12_OFF_H_REG_ADDR 0X39 |
Definition at line 163 of file pca9685_i2c.c.
#define PCA9685_LED12_OFF_L_REG_ADDR 0X38 |
Definition at line 162 of file pca9685_i2c.c.
#define PCA9685_LED12_ON_H_REG_ADDR 0X37 |
Definition at line 161 of file pca9685_i2c.c.
#define PCA9685_LED12_ON_L_REG_ADDR 0X36 |
Definition at line 160 of file pca9685_i2c.c.
#define PCA9685_LED13_OFF_H_REG_ADDR 0X3D |
Definition at line 168 of file pca9685_i2c.c.
#define PCA9685_LED13_OFF_L_REG_ADDR 0X3C |
Definition at line 167 of file pca9685_i2c.c.
#define PCA9685_LED13_ON_H_REG_ADDR 0X3B |
Definition at line 166 of file pca9685_i2c.c.
#define PCA9685_LED13_ON_L_REG_ADDR 0X3A |
Definition at line 165 of file pca9685_i2c.c.
#define PCA9685_LED14_OFF_H_REG_ADDR 0X41 |
Definition at line 173 of file pca9685_i2c.c.
#define PCA9685_LED14_OFF_L_REG_ADDR 0X40 |
Definition at line 172 of file pca9685_i2c.c.
#define PCA9685_LED14_ON_H_REG_ADDR 0X3F |
Definition at line 171 of file pca9685_i2c.c.
#define PCA9685_LED14_ON_L_REG_ADDR 0X3E |
Definition at line 170 of file pca9685_i2c.c.
#define PCA9685_LED15_OFF_H_REG_ADDR 0X45 |
Definition at line 178 of file pca9685_i2c.c.
#define PCA9685_LED15_OFF_L_REG_ADDR 0X44 |
Definition at line 177 of file pca9685_i2c.c.
#define PCA9685_LED15_ON_H_REG_ADDR 0X43 |
Definition at line 176 of file pca9685_i2c.c.
#define PCA9685_LED15_ON_L_REG_ADDR 0X42 |
Definition at line 175 of file pca9685_i2c.c.
#define PCA9685_LED1_OFF_H_REG_ADDR 0X0D |
Definition at line 107 of file pca9685_i2c.c.
#define PCA9685_LED1_OFF_L_REG_ADDR 0X0C |
Definition at line 106 of file pca9685_i2c.c.
#define PCA9685_LED1_ON_H_REG_ADDR 0X0B |
Definition at line 105 of file pca9685_i2c.c.
#define PCA9685_LED1_ON_L_REG_ADDR 0X0A |
Definition at line 104 of file pca9685_i2c.c.
#define PCA9685_LED2_OFF_H_REG_ADDR 0X11 |
Definition at line 112 of file pca9685_i2c.c.
#define PCA9685_LED2_OFF_L_REG_ADDR 0X10 |
Definition at line 111 of file pca9685_i2c.c.
#define PCA9685_LED2_ON_H_REG_ADDR 0X0F |
Definition at line 110 of file pca9685_i2c.c.
#define PCA9685_LED2_ON_L_REG_ADDR 0X0E |
Definition at line 109 of file pca9685_i2c.c.
#define PCA9685_LED3_OFF_H_REG_ADDR 0X15 |
Definition at line 117 of file pca9685_i2c.c.
#define PCA9685_LED3_OFF_L_REG_ADDR 0X14 |
Definition at line 116 of file pca9685_i2c.c.
#define PCA9685_LED3_ON_H_REG_ADDR 0X13 |
Definition at line 115 of file pca9685_i2c.c.
#define PCA9685_LED3_ON_L_REG_ADDR 0X12 |
Definition at line 114 of file pca9685_i2c.c.
#define PCA9685_LED4_OFF_H_REG_ADDR 0X19 |
Definition at line 122 of file pca9685_i2c.c.
#define PCA9685_LED4_OFF_L_REG_ADDR 0X18 |
Definition at line 121 of file pca9685_i2c.c.
#define PCA9685_LED4_ON_H_REG_ADDR 0X17 |
Definition at line 120 of file pca9685_i2c.c.
#define PCA9685_LED4_ON_L_REG_ADDR 0X16 |
Definition at line 119 of file pca9685_i2c.c.
#define PCA9685_LED5_OFF_H_REG_ADDR 0X1D |
Definition at line 127 of file pca9685_i2c.c.
#define PCA9685_LED5_OFF_L_REG_ADDR 0X1C |
Definition at line 126 of file pca9685_i2c.c.
#define PCA9685_LED5_ON_H_REG_ADDR 0X1B |
Definition at line 125 of file pca9685_i2c.c.
#define PCA9685_LED5_ON_L_REG_ADDR 0X1A |
Definition at line 124 of file pca9685_i2c.c.
#define PCA9685_LED6_OFF_H_REG_ADDR 0X21 |
Definition at line 132 of file pca9685_i2c.c.
#define PCA9685_LED6_OFF_L_REG_ADDR 0X20 |
Definition at line 131 of file pca9685_i2c.c.
#define PCA9685_LED6_ON_H_REG_ADDR 0X1F |
Definition at line 130 of file pca9685_i2c.c.
#define PCA9685_LED6_ON_L_REG_ADDR 0X1E |
Definition at line 129 of file pca9685_i2c.c.
#define PCA9685_LED7_OFF_H_REG_ADDR 0X25 |
Definition at line 137 of file pca9685_i2c.c.
#define PCA9685_LED7_OFF_L_REG_ADDR 0X24 |
Definition at line 136 of file pca9685_i2c.c.
#define PCA9685_LED7_ON_H_REG_ADDR 0X23 |
Definition at line 135 of file pca9685_i2c.c.
#define PCA9685_LED7_ON_L_REG_ADDR 0X22 |
Definition at line 134 of file pca9685_i2c.c.
#define PCA9685_LED8_OFF_H_REG_ADDR 0X29 |
Definition at line 143 of file pca9685_i2c.c.
#define PCA9685_LED8_OFF_L_REG_ADDR 0X28 |
Definition at line 142 of file pca9685_i2c.c.
#define PCA9685_LED8_ON_H_REG_ADDR 0X27 |
Definition at line 141 of file pca9685_i2c.c.
#define PCA9685_LED8_ON_L_REG_ADDR 0X26 |
Definition at line 140 of file pca9685_i2c.c.
#define PCA9685_LED9_OFF_H_REG_ADDR 0X2D |
Definition at line 148 of file pca9685_i2c.c.
#define PCA9685_LED9_OFF_L_REG_ADDR 0X2C |
Definition at line 147 of file pca9685_i2c.c.
#define PCA9685_LED9_ON_H_REG_ADDR 0X2B |
Definition at line 146 of file pca9685_i2c.c.
#define PCA9685_LED9_ON_L_REG_ADDR 0X2A |
Definition at line 145 of file pca9685_i2c.c.
#define PCA9685_MODE1_REG_ADDR 0x00 |
Definition at line 95 of file pca9685_i2c.c.
#define PCA9685_MODE2_REG_ADDR 0x01 |
Definition at line 96 of file pca9685_i2c.c.
#define PCA9685_PRESCALER_REG_ADDR 0XFE |
Definition at line 185 of file pca9685_i2c.c.
#define PCA9865_ALLCALL_BIT 0 |
Definition at line 192 of file pca9685_i2c.c.
#define PCA9865_AUTO_INCREMENT_BIT 5 |
Definition at line 190 of file pca9685_i2c.c.
#define PCA9865_OUTDRV_BIT 2 |
Definition at line 194 of file pca9685_i2c.c.
#define PCA9865_RESTART_BIT 7 |
Definition at line 189 of file pca9685_i2c.c.
#define PCA9865_SLEEP_BIT 4 |
Definition at line 191 of file pca9685_i2c.c.
#define PCA9865_SRV_DEFAULT_VAL_US 1000. |
Definition at line 71 of file pca9685_i2c.c.
#define PCA9865_SRV_NUMBER 16 |
Definition at line 75 of file pca9685_i2c.c.
#define PCA9865_SRV_RESOLUTION 1. |
Definition at line 67 of file pca9685_i2c.c.
anonymous enum |
Definition at line 214 of file pca9685_i2c.c.
void pca9685_i2c_event | ( | void | ) |
Definition at line 421 of file pca9685_i2c.c.
References i2c_transaction::buf, BUF2INT, i2c_transceive(), I2CTransSuccess, PCA9685_I2C_DEV, PCA9685_I2C_SLAVE_ADDR, pca9685_i2c_status, pca9685_i2c_trans, PCA9865_I2C_STATUS_CHANGE_LED_REG_FINISHED, PCA9865_I2C_STATUS_READ_LED_REG_BUSY, PCA9865_I2C_STATUS_WRITE_LED_REG_BUSY, pca9865_reg_nb, pca9865_write_servo_vals, srv_cnt, and i2c_transaction::status.
void pca9685_i2c_init | ( | void | ) |
Definition at line 279 of file pca9685_i2c.c.
References i2c_transaction::buf, DefaultPeriodic, i2c_transceive(), i2c_transmit(), I2CTransDone, I2CTransPending, sys_time::nb_tick, PCA9685_ALL_LED_ON_L_REG_ADDR, PCA9685_I2C_ALLCALL_ADDR, PCA9685_I2C_DEV, PCA9685_I2C_GEN_CALL_ADDR, PCA9685_I2C_RESET_ADDR, PCA9685_I2C_SLAVE_ADDR, pca9685_i2c_status, PCA9685_I2C_STATUS_INITIALIZED, PCA9685_I2C_STATUS_UNINIT, pca9685_i2c_trans, PCA9685_MODE1_REG_ADDR, PCA9685_PRESCALER_REG_ADDR, PCA9865_ALLCALL_BIT, PCA9865_AUTO_INCREMENT_BIT, pca9865_reg_nb, PCA9865_RESTART_BIT, pca9865_set_servo(), PCA9865_SLEEP_BIT, PCA9865_SRV_DEFAULT_VAL_US, PCA9865_SRV_NUMBER, PCA9865_SRV_RESOLUTION, pca9865_write_servo_vals, register_periodic_telemetry(), srv_cnt, i2c_transaction::status, and SYS_TIME_FREQUENCY.
void pca9685_i2c_periodic | ( | void | ) |
Definition at line 380 of file pca9685_i2c.c.
References i2c_transaction::buf, i2c_transmit(), PCA9685_I2C_DEV, PCA9685_I2C_SLAVE_ADDR, pca9685_i2c_status, PCA9685_I2C_STATUS_INITIALIZED, pca9685_i2c_trans, PCA9865_I2C_STATUS_CHANGE_LED_REG_FINISHED, PCA9865_I2C_STATUS_WRITE_LED_REG_BUSY, pca9865_reg_nb, pca9865_write_servo_vals, and srv_cnt.
Definition at line 262 of file pca9685_i2c.c.
References FALSE, pca9865_reg_nb, PCA9865_SRV_RESOLUTION, and pca9865_write_servo_vals.
Referenced by pca9685_i2c_init().
uint8_t pca9685_i2c_status = 0 |
Definition at line 224 of file pca9685_i2c.c.
Referenced by pca9685_i2c_event(), pca9685_i2c_init(), and pca9685_i2c_periodic().
struct i2c_transaction pca9685_i2c_trans |
Definition at line 223 of file pca9685_i2c.c.
Referenced by pca9685_i2c_event(), pca9685_i2c_init(), and pca9685_i2c_periodic().
uint8_t pca9865_reg_nb[16] |
Definition at line 231 of file pca9685_i2c.c.
Referenced by pca9685_i2c_event(), pca9685_i2c_init(), pca9685_i2c_periodic(), and pca9865_set_servo().
uint16_t pca9865_write_servo_vals[PCA9865_SRV_NUMBER] |
Definition at line 226 of file pca9685_i2c.c.
Referenced by pca9685_i2c_event(), pca9685_i2c_init(), pca9685_i2c_periodic(), and pca9865_set_servo().
uint8_t srv_cnt = 0 |
Definition at line 225 of file pca9685_i2c.c.
Referenced by pca9685_i2c_event(), pca9685_i2c_init(), and pca9685_i2c_periodic().