Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Data Structures | |
struct | i2c_transaction |
I2C transaction structure. More... | |
struct | i2c_periph |
struct | i2c_errors |
I2C errors counter. More... | |
Macros | |
#define | I2C_BUF_LEN 32 |
I2C buffer length. More... | |
#define | I2C_TRANSACTION_QUEUE_LEN 8 |
I2C transaction queue length. More... | |
#define | ZEROS_ERR_COUNTER(_i2c_err) |
Typedefs | |
typedef bool | i2c_idle_fn_t(struct i2c_periph *p) |
typedef bool | i2c_submit_fn_t(struct i2c_periph *p, struct i2c_transaction *t) |
typedef void | i2c_setbitrate_fn_t(struct i2c_periph *p, int bitrate) |
typedef void | i2c_spin_fn_t(struct i2c_periph *p) |
Enumerations | |
enum | I2CTransactionType { I2CTransTx, I2CTransRx, I2CTransTxRx } |
I2C transaction type. More... | |
enum | I2CTransactionStatus { I2CTransPending, I2CTransRunning, I2CTransSuccess, I2CTransFailed, I2CTransDone } |
I2C transaction status. More... | |
enum | I2CStatus { I2CIdle, I2CStartRequested, I2CAddrWrSent, I2CAddrRdSent, I2CSendingByte, I2CReadingByte, I2CReadingLastByte, I2CStopRequested, I2CRestartRequested, I2CComplete, I2CFailed } |
I2C peripheral status. More... | |
Functions | |
void | i2c_init (struct i2c_periph *p) |
Initialize I2C peripheral. More... | |
static bool | i2c_idle (struct i2c_periph *p) |
Check if I2C bus is idle. More... | |
static bool | i2c_submit (struct i2c_periph *p, struct i2c_transaction *t) |
Submit a I2C transaction. More... | |
static void | i2c_setbitrate (struct i2c_periph *p, int bitrate) |
Set I2C bitrate. More... | |
void | i2c_event (void) |
i2c_event() function More... | |
bool | i2c_transmit (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len) |
Submit a write only transaction. More... | |
bool | i2c_receive (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len) |
Submit a read only transaction. More... | |
bool | i2c_transceive (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r) |
Submit a write/read transaction. More... | |
bool | i2c_blocking_transmit (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len) |
Submit a write only transaction and wait for it to complete. More... | |
bool | i2c_blocking_receive (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len) |
Submit a read only transaction and wait for it to complete. More... | |
bool | i2c_blocking_transceive (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r) |
Submit a write/read transaction and wait for it to complete. More... | |
struct i2c_transaction |
I2C transaction structure.
Use this structure to store a request of I2C transaction and submit it using one of the convenience functions (i2c_receive, i2c_transmit or i2c_transceive) or the i2c_submit function.
Data Fields | ||
---|---|---|
volatile uint8_t | buf[I2C_BUF_LEN] |
Transaction buffer With I2C_BUF_LEN number of bytes. Must be able to hold tranmitted + received bytes. |
uint16_t | len_r |
Number of bytes to read/receive. Always set by i2c_receive, i2c_transmit and i2c_transceive, needs to be manually set if using i2c_submit. |
uint8_t | len_w |
Number of bytes to write/transmit. Always set by i2c_receive, i2c_transmit and i2c_transceive, needs to be manually set if using i2c_submit. |
uint8_t | slave_addr |
Slave address. Always set by i2c_receive, i2c_transmit and i2c_transceive, needs to be manually set if using i2c_submit. |
enum I2CTransactionStatus | status | Transaction status. |
enum I2CTransactionType | type |
Transaction type. Always set by i2c_receive, i2c_transmit and i2c_transceive, needs to be manually set every time if using i2c_submit. |
struct i2c_periph |
Data Fields | ||
---|---|---|
struct i2c_errors * | errors | |
i2c_idle_fn_t * | idle | |
volatile uint8_t | idx_buf | |
void * | init_struct | |
void * | reg_addr | |
i2c_setbitrate_fn_t * | setbitrate | |
i2c_spin_fn_t * | spin | |
enum I2CStatus | status | |
i2c_submit_fn_t * | submit | |
struct i2c_transaction * | trans[I2C_TRANSACTION_QUEUE_LEN] | |
uint8_t | trans_extract_idx | |
uint8_t | trans_insert_idx | |
volatile int16_t | watchdog |
struct i2c_errors |
Data Fields | ||
---|---|---|
volatile uint16_t | ack_fail_cnt | |
volatile uint16_t | arb_lost_cnt | |
volatile uint32_t | er_irq_cnt | |
volatile uint32_t | last_unexpected_event | |
volatile uint16_t | miss_start_stop_cnt | |
volatile uint16_t | over_under_cnt | |
volatile uint16_t | pec_recep_cnt | |
volatile uint16_t | queue_full_cnt | |
volatile uint16_t | smbus_alert_cnt | |
volatile uint16_t | timeout_tlow_cnt | |
volatile uint16_t | unexpected_event_cnt | |
volatile uint16_t | wd_reset_cnt |
#define I2C_BUF_LEN 32 |
#define I2C_TRANSACTION_QUEUE_LEN 8 |
#define ZEROS_ERR_COUNTER | ( | _i2c_err | ) |
typedef bool i2c_idle_fn_t(struct i2c_periph *p) |
typedef void i2c_setbitrate_fn_t(struct i2c_periph *p, int bitrate) |
typedef void i2c_spin_fn_t(struct i2c_periph *p) |
typedef bool i2c_submit_fn_t(struct i2c_periph *p, struct i2c_transaction *t) |
enum I2CStatus |
enum I2CTransactionStatus |
enum I2CTransactionType |
bool i2c_blocking_receive | ( | struct i2c_periph * | p, |
struct i2c_transaction * | t, | ||
uint8_t | s_addr, | ||
uint16_t | len | ||
) |
Submit a read only transaction and wait for it to complete.
Convenience function which is usually preferred over i2c_submit, as it explicitly sets the transaction type again.
p | i2c peripheral to be used |
t | i2c transaction |
s_addr | slave address |
len | number of bytes to receive |
Definition at line 381 of file i2c.c.
References get_sys_time_float(), I2C_BLOCKING_TIMEOUT, i2c_submit(), I2CTransPending, I2CTransRunning, I2CTransRx, i2c_transaction::len_r, i2c_transaction::len_w, p, i2c_transaction::slave_addr, i2c_transaction::status, and i2c_transaction::type.
bool i2c_blocking_transceive | ( | struct i2c_periph * | p, |
struct i2c_transaction * | t, | ||
uint8_t | s_addr, | ||
uint8_t | len_w, | ||
uint16_t | len_r | ||
) |
Submit a write/read transaction and wait for it to complete.
Convenience function which is usually preferred over i2c_submit, as it explicitly sets the transaction type again.
p | i2c peripheral to be used |
t | i2c transaction |
s_addr | slave address |
len_w | number of bytes to transmit |
len_r | number of bytes to receive |
Definition at line 403 of file i2c.c.
References get_sys_time_float(), I2C_BLOCKING_TIMEOUT, i2c_submit(), I2CTransPending, I2CTransRunning, I2CTransTxRx, i2c_transaction::len_r, i2c_transaction::len_w, p, i2c_transaction::slave_addr, i2c_transaction::status, and i2c_transaction::type.
Referenced by actuators_bebop_commit(), actuators_disco_commit(), pca95xx_get_input(), read_reg(), tfmini_i2c_periodic(), and VL53L1_ReadMulti().
bool i2c_blocking_transmit | ( | struct i2c_periph * | p, |
struct i2c_transaction * | t, | ||
uint8_t | s_addr, | ||
uint8_t | len | ||
) |
Submit a write only transaction and wait for it to complete.
Convenience function which is usually preferred over i2c_submit, as it explicitly sets the transaction type again.
p | i2c peripheral to be used |
t | i2c transaction |
s_addr | slave address |
len | number of bytes to transmit |
Definition at line 359 of file i2c.c.
References get_sys_time_float(), I2C_BLOCKING_TIMEOUT, i2c_submit(), I2CTransPending, I2CTransRunning, I2CTransTx, i2c_transaction::len_r, i2c_transaction::len_w, p, i2c_transaction::slave_addr, i2c_transaction::status, and i2c_transaction::type.
Referenced by actuators_bebop_commit(), actuators_disco_commit(), mt9v117_write_patch(), pca95xx_configure(), pca95xx_set_output(), VL53L1_WriteMulti(), and write_reg().
void i2c_event | ( | void | ) |
i2c_event() function
Empty, for paparazzi compatibility only
Definition at line 428 of file i2c_arch.c.
References SysTimeTimer, and SysTimeTimerStart.
Referenced by mcu_event().
|
inlinestatic |
Check if I2C bus is idle.
p | i2c peripheral to be used |
Definition at line 256 of file i2c.h.
References p.
Referenced by baro_periodic(), event_i2c_abuse_test(), hmc5843_idle_task(), hmc5843_periodic(), and i2c_stm32_setbitrate().
void i2c_init | ( | struct i2c_periph * | p | ) |
Initialize I2C peripheral.
Definition at line 310 of file i2c.c.
References DefaultPeriodic, I2CIdle, p, register_periodic_telemetry(), and send_i2c_err().
Referenced by i2c_chibios_submit().
bool i2c_receive | ( | struct i2c_periph * | p, |
struct i2c_transaction * | t, | ||
uint8_t | s_addr, | ||
uint16_t | len | ||
) |
Submit a read only transaction.
Convenience function which is usually preferred over i2c_submit, as it explicitly sets the transaction type again.
p | i2c peripheral to be used |
t | i2c transaction |
s_addr | slave address |
len | number of bytes to receive |
Definition at line 334 of file i2c.c.
References i2c_submit(), I2CTransRx, i2c_transaction::len_r, i2c_transaction::len_w, p, i2c_transaction::slave_addr, and i2c_transaction::type.
Referenced by actuators_asctec_v2_set(), airspeed_amsys_read_periodic(), airspeed_ets_read_periodic(), ArduIMU_periodic(), baro_amsys_read_periodic(), baro_ets_read_periodic(), baro_hca_read_periodic(), charge_sens_periodic(), dpicco_periodic(), dust_gp2y_periodic(), ezcurrent_read_periodic(), geiger_counter_periodic(), humid_htm_read(), humid_sht_p_humid(), humid_sht_p_temp(), infrared_i2c_hor_event(), infrared_i2c_update(), lidar_lite_periodic(), MPPT_periodic(), ms45xx_i2c_periodic(), sdp3x_periodic(), srf08_read(), temod_periodic(), teraranger_periodic(), and wind_gfi_event().
|
inlinestatic |
Set I2C bitrate.
p | i2c peripheral to be used |
bitrate | bitrate |
Definition at line 274 of file i2c.h.
References p.
Referenced by event_i2c_abuse_test().
|
inlinestatic |
Submit a I2C transaction.
Must be implemented by the underlying architecture
p | i2c peripheral to be used |
t | i2c transaction |
Definition at line 266 of file i2c.h.
References p.
Referenced by actuators_asctec_v2_set(), actuators_mkk_v2_set(), actuators_skiron_set(), adxl345_i2c_read(), adxl345_i2c_tx_reg(), ami601_read(), baro_board_read_from_current_register(), baro_board_read_from_register(), baro_board_send_reset(), baro_board_set_current_register(), baro_board_write_to_register(), config_mkk_v2_read_eeprom(), config_mkk_v2_send_eeprom(), event_i2c_abuse_test(), hmc5843_idle_task(), hmc5843_periodic(), hmc58xx_i2c_tx_reg(), hmc58xx_read(), i2c_abuse_send_transaction(), i2c_blocking_receive(), i2c_blocking_transceive(), i2c_blocking_transmit(), i2c_receive(), i2c_transceive(), i2c_transmit(), itg3200_i2c_tx_reg(), itg3200_read(), lps25h_i2c_read(), lps25h_i2c_tx_reg(), lsm303dlhc_i2c_read(), lsm303dlhc_i2c_tx_reg(), lsm6_i2c_read(), lsm6_i2c_tx_reg(), and send_config().
bool i2c_transceive | ( | struct i2c_periph * | p, |
struct i2c_transaction * | t, | ||
uint8_t | s_addr, | ||
uint8_t | len_w, | ||
uint16_t | len_r | ||
) |
Submit a write/read transaction.
Convenience function which is usually preferred over i2c_submit, as it explicitly sets the transaction type again.
p | i2c peripheral to be used |
t | i2c transaction |
s_addr | slave address |
len_w | number of bytes to transmit |
len_r | number of bytes to receive |
Definition at line 344 of file i2c.c.
References i2c_submit(), I2CTransTxRx, i2c_transaction::len_r, i2c_transaction::len_w, p, i2c_transaction::slave_addr, and i2c_transaction::type.
Referenced by actuators_md25_periodic(), ads1114_read(), ak8963_event(), ak8963_read(), ak8975_configure(), ak8975_event(), atmega_i2c_cam_ctrl_send(), baro_scp_event(), baro_scp_periodic(), battery_monitor_read_balance_ports(), battery_monitor_read_bus(), bmi088_i2c_read(), bmp085_periodic(), bmp085_read_eeprom_calib(), bmp280_i2c_periodic(), bmp3_i2c_periodic(), gps_ubx_i2c_periodic(), gps_ubx_i2c_read_event(), humid_sht_event_i2c(), humid_sht_periodic_i2c(), ir_mlx_event(), ir_mlx_periodic(), ist8310_event(), ist8310_read(), l3g4200_read(), lidar_sf11_periodic(), lis3mdl_read(), lm75_periodic(), mpl3115_read(), mpu60x0_i2c_read(), mpu9250_i2c_read(), ms5611_i2c_event(), ms5611_i2c_periodic_check(), pca9685_i2c_event(), pca9685_i2c_init(), pcap01readRegister(), px4flow_i2c_periodic(), readPCAP01_SRAM(), srf08_read_register(), tmp102_periodic(), and VL53L1_NonBlocking_ReadMulti().
bool i2c_transmit | ( | struct i2c_periph * | p, |
struct i2c_transaction * | t, | ||
uint8_t | s_addr, | ||
uint8_t | len | ||
) |
Submit a write only transaction.
Convenience function which is usually preferred over i2c_submit, as it explicitly sets the transaction type again.
p | i2c peripheral to be used |
t | i2c transaction |
s_addr | slave address |
len | number of bytes to transmit |
Definition at line 324 of file i2c.c.
References i2c_submit(), I2CTransTx, i2c_transaction::len_r, i2c_transaction::len_w, p, i2c_transaction::slave_addr, and i2c_transaction::type.
Referenced by actuators_asctec_set(), actuators_asctec_v2_set(), actuators_md25_periodic(), actuators_md25_set(), actuators_mkk_set(), ads1114_init(), ak8963_configure(), ak8975_configure(), ak8975_read(), ArduIMU_periodicGPS(), baro_scp_start_high_res_measurement(), bmi088_i2c_write_to_reg(), bmp085_event(), bmp085_periodic(), bmp280_i2c_periodic(), bmp3_i2c_periodic(), generic_com_periodic(), gps_ubx_i2c_periodic(), humid_htm_start(), humid_sht_event_i2c(), humid_sht_periodic_i2c(), infrared_i2c_hor_event(), infrared_i2c_update(), ir_mlx_periodic(), ist8310_configure(), l3g4200_i2c_tx_reg(), lidar_lite_periodic(), lis3mdl_configure(), mpl3115_read(), mpl3115_send_config(), MPPT_ask(), MPPT_periodic(), mpu60x0_i2c_write_to_reg(), mpu9250_i2c_write_to_reg(), ms5611_i2c_event(), ms5611_i2c_start_configure(), ms5611_i2c_start_conversion(), pca95xx_configure(), pca95xx_set_output(), pca9685_i2c_init(), pca9685_i2c_periodic(), PCAP01_Control(), pcap01writeRegister(), px4flow_i2c_periodic(), sdp3x_periodic(), srf08_init(), srf08_initiate_ranging(), srf08_receive(), stop_com(), tmp102_init(), VL53L1_NonBlocking_WriteMulti(), wind_gfi_event(), wind_gfi_periodic(), and writePCAP01_SRAM().