Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
infrared_i2c.c File Reference
#include "sensors/infrared_i2c.h"
+ Include dependency graph for infrared_i2c.c:

Go to the source code of this file.

Macros

#define IR_HOR_I2C_ADDR   (0x6C << 1)
 
#define IR_VER_I2C_ADDR   (0x68 << 1)
 
#define IR_SAMPLE_RATE_SELECT   (0 << 2)
 
#define IR_HOR_OC_BIT   (0 << 4)
 
#define IR_VER_OC_BIT   (1 << 4)
 
#define IR_HOR_I2C_SELECT_IR1   (0 << 5)
 
#define IR_HOR_I2C_SELECT_IR2   (1 << 5)
 
#define IR_START_CONV   (1 << 7)
 
#define IR_I2C_IR1_NEUTRAL   0
 
#define IR_I2C_IR2_NEUTRAL   0
 
#define IR_I2C_TOP_NEUTRAL   0
 
#define IR_I2C_IDLE   0
 
#define IR_I2C_READ_IR1   1
 
#define IR_I2C_IR2_SELECTED   2
 
#define IR_I2C_READ_IR2   3
 
#define IR_I2C_IR1_SELECTED   4
 
#define IR_I2C_CONFIGURE_HOR   5
 
#define NO_CONF_WORD   0xff
 
#define ValidConfWord(_x)   (_x < 0x4)
 
#define FilterIR(_ir_prev, _ir_next)   (((1<<ir_i2c_conf_word)*_ir_prev + _ir_next) / ((1<<ir_i2c_conf_word) + 1))
 

Functions

void infrared_init (void)
 
void infrared_update (void)
 
void infrared_event (void)
 
void infrared_i2c_init (void)
 Initialisation. More...
 
void infrared_i2c_update (void)
 
void infrared_i2c_hor_event (void)
 
void infrared_i2c_ver_event (void)
 

Variables

struct Infrared_raw ir_i2c
 
bool ir_i2c_data_hor_available
 
bool ir_i2c_data_ver_available
 
uint8_t ir_i2c_conf_word
 
bool ir_i2c_conf_hor_done
 
bool ir_i2c_conf_ver_done
 
static uint8_t ir_i2c_hor_status
 
struct i2c_transaction irh_trans irv_trans
 

Macro Definition Documentation

#define FilterIR (   _ir_prev,
  _ir_next 
)    (((1<<ir_i2c_conf_word)*_ir_prev + _ir_next) / ((1<<ir_i2c_conf_word) + 1))

Definition at line 131 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), and infrared_i2c_ver_event().

#define IR_HOR_I2C_ADDR   (0x6C << 1)

Definition at line 26 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), and infrared_i2c_update().

#define IR_HOR_I2C_SELECT_IR1   (0 << 5)

Definition at line 31 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event().

#define IR_HOR_I2C_SELECT_IR2   (1 << 5)

Definition at line 32 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event().

#define IR_HOR_OC_BIT   (0 << 4)

Definition at line 29 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), and infrared_i2c_update().

#define IR_I2C_CONFIGURE_HOR   5

Definition at line 59 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), and infrared_i2c_update().

#define IR_I2C_IDLE   0

Definition at line 54 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), infrared_i2c_init(), and infrared_i2c_update().

#define IR_I2C_IR1_NEUTRAL   0

Definition at line 37 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event().

#define IR_I2C_IR1_SELECTED   4

Definition at line 58 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event().

#define IR_I2C_IR2_NEUTRAL   0

Definition at line 41 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event().

#define IR_I2C_IR2_SELECTED   2

Definition at line 56 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event().

#define IR_I2C_READ_IR1   1

Definition at line 55 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), and infrared_i2c_update().

#define IR_I2C_READ_IR2   3

Definition at line 57 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event().

#define IR_I2C_TOP_NEUTRAL   0

Definition at line 45 of file infrared_i2c.c.

Referenced by infrared_i2c_ver_event().

#define IR_SAMPLE_RATE_SELECT   (0 << 2)

Definition at line 28 of file infrared_i2c.c.

#define IR_START_CONV   (1 << 7)

Definition at line 33 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), and infrared_i2c_update().

#define IR_VER_I2C_ADDR   (0x68 << 1)

Definition at line 27 of file infrared_i2c.c.

Referenced by infrared_i2c_update().

#define IR_VER_OC_BIT   (1 << 4)

Definition at line 30 of file infrared_i2c.c.

Referenced by infrared_i2c_update().

#define NO_CONF_WORD   0xff

Definition at line 63 of file infrared_i2c.c.

#define ValidConfWord (   _x)    (_x < 0x4)

Definition at line 64 of file infrared_i2c.c.

Referenced by infrared_i2c_update().

Function Documentation

void infrared_event ( void  )

Definition at line 80 of file infrared_i2c.c.

References infrared_i2cEvent.

void infrared_i2c_init ( void  )

Initialisation.

Definition at line 87 of file infrared_i2c.c.

References I2CTransDone, infrared_struct_init(), ir_i2c_conf_hor_done, ir_i2c_conf_ver_done, ir_i2c_conf_word, ir_i2c_data_hor_available, ir_i2c_data_ver_available, ir_i2c_hor_status, IR_I2C_IDLE, irv_trans, and i2c_transaction::status.

Referenced by infrared_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void infrared_init ( void  )

Definition at line 70 of file infrared_i2c.c.

References infrared_i2c_init().

+ Here is the call graph for this function:

void infrared_update ( void  )

Definition at line 75 of file infrared_i2c.c.

References infrared_i2c_update().

+ Here is the call graph for this function:

Variable Documentation

struct Infrared_raw ir_i2c

Definition at line 48 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), and infrared_i2c_ver_event().

bool ir_i2c_conf_hor_done

Definition at line 51 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), infrared_i2c_init(), and infrared_i2c_update().

bool ir_i2c_conf_ver_done

Definition at line 51 of file infrared_i2c.c.

Referenced by infrared_i2c_init(), infrared_i2c_update(), and infrared_i2c_ver_event().

uint8_t ir_i2c_conf_word
bool ir_i2c_data_hor_available
bool ir_i2c_data_ver_available
uint8_t ir_i2c_hor_status
static

Definition at line 61 of file infrared_i2c.c.

Referenced by infrared_i2c_hor_event(), infrared_i2c_init(), and infrared_i2c_update().

struct i2c_transaction irh_trans irv_trans

Definition at line 67 of file infrared_i2c.c.

Referenced by infrared_i2c_init(), infrared_i2c_update(), and infrared_i2c_ver_event().