|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
23 #include "sensors/infrared_i2c.h"
26 #define IR_HOR_I2C_ADDR (0x6C << 1)
27 #define IR_VER_I2C_ADDR (0x68 << 1)
28 #define IR_SAMPLE_RATE_SELECT (0 << 2)
29 #define IR_HOR_OC_BIT (0 << 4)
30 #define IR_VER_OC_BIT (1 << 4)
31 #define IR_HOR_I2C_SELECT_IR1 (0 << 5)
32 #define IR_HOR_I2C_SELECT_IR2 (1 << 5)
33 #define IR_START_CONV (1 << 7)
36 #ifndef IR_I2C_IR1_NEUTRAL
37 #define IR_I2C_IR1_NEUTRAL 0
40 #ifndef IR_I2C_IR2_NEUTRAL
41 #define IR_I2C_IR2_NEUTRAL 0
44 #ifndef IR_I2C_TOP_NEUTRAL
45 #define IR_I2C_TOP_NEUTRAL 0
55 #define IR_I2C_READ_IR1 1
56 #define IR_I2C_IR2_SELECTED 2
57 #define IR_I2C_READ_IR2 3
58 #define IR_I2C_IR1_SELECTED 4
59 #define IR_I2C_CONFIGURE_HOR 5
63 #define NO_CONF_WORD 0xff
64 #define ValidConfWord(_x) (_x < 0x4)
103 #if ! (defined SITL || defined HITL)
131 #define FilterIR(_ir_prev, _ir_next) (((1<<ir_i2c_conf_word)*_ir_prev + _ir_next) / ((1<<ir_i2c_conf_word) + 1))
135 #if ! (defined SITL || defined HITL)
141 if (bit_is_set(irh_trans.buf[2], 7)) {
146 int16_t ir1 = (irh_trans.buf[0] << 8) | irh_trans.buf[1];
161 if (bit_is_set(irh_trans.buf[2], 7)) {
165 int16_t ir2 = (irh_trans.buf[0] << 8) | irh_trans.buf[1];
170 #ifndef IR_I2C_READ_ONLY
197 #if ! (defined SITL || defined HITL)
205 #ifndef IR_I2C_READ_ONLY
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
#define UpdateIRValue(_v)
@ I2CTransTx
transmit only transaction
void infrared_event(void)
struct Infrared_raw ir_i2c
struct i2c_transaction irh_trans irv_trans
#define IR_HOR_I2C_SELECT_IR1
#define IR_I2C_IR1_SELECTED
#define IR_HOR_I2C_SELECT_IR2
void infrared_update(void)
static uint8_t ir_i2c_hor_status
#define FilterIR(_ir_prev, _ir_next)
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
@ I2CTransRx
receive only transaction
void infrared_i2c_update(void)
#define IR_I2C_IR1_NEUTRAL
void infrared_struct_init(void)
Initialisation of ir structure.
enum I2CTransactionStatus status
Transaction status.
void infrared_i2c_ver_event(void)
#define infrared_i2cEvent()
#define IR_I2C_CONFIGURE_HOR
bool ir_i2c_conf_hor_done
I2C transaction structure.
#define IR_I2C_TOP_NEUTRAL
#define IR_I2C_IR2_SELECTED
@ I2CTransDone
transaction set to done by user level
void infrared_i2c_hor_event(void)
bool ir_i2c_conf_ver_done
bool ir_i2c_data_ver_available
bool ir_i2c_data_hor_available
void infrared_i2c_init(void)
Initialisation.
#define IR_I2C_IR2_NEUTRAL
enum I2CTransactionType type
Transaction type.
bool i2c_receive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len)
Submit a read only transaction.
#define ValidConfWord(_x)