Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
I2C Interface
+ Collaboration diagram for I2C Interface:

Data Structures

struct  i2c_transaction
 
struct  i2c_periph
 
struct  i2c_errors
 

Macros

#define I2C_BUF_LEN   32
 
#define I2C_TRANSACTION_QUEUE_LEN   8
 
#define I2C_ZERO_EVENTS(_err)
 
#define ZEROS_ERR_COUNTER(_i2c_err)
 

Enumerations

enum  I2CTransactionType { I2CTransTx, I2CTransRx, I2CTransTxRx }
 
enum  I2CTransactionStatus {
  I2CTransPending, I2CTransRunning, I2CTransSuccess, I2CTransFailed,
  I2CTransDone
}
 
enum  I2CStatus {
  I2CIdle, I2CStartRequested, I2CAddrWrSent, I2CAddrRdSent,
  I2CSendingByte, I2CReadingByte, I2CReadingLastByte, I2CStopRequested,
  I2CRestartRequested, I2CComplete, I2CFailed
}
 

Functions

void i2c_init (struct i2c_periph *p)
 
bool_t i2c_idle (struct i2c_periph *p)
 
bool_t i2c_submit (struct i2c_periph *p, struct i2c_transaction *t)
 
void i2c_setbitrate (struct i2c_periph *p, int bitrate)
 
void i2c_event (void)
 
bool_t i2c_transmit (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
 
bool_t i2c_receive (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len)
 
bool_t i2c_transceive (struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
 

Detailed Description

Macro Definition Documentation

#define I2C_BUF_LEN   32

Definition at line 74 of file i2c.h.

#define I2C_TRANSACTION_QUEUE_LEN   8

Definition at line 87 of file i2c.h.

Referenced by i2c_irq(), i2c_submit(), and I2cEndOfTransaction().

#define I2C_ZERO_EVENTS (   _err)
Value:
{ \
_err.irq_cnt = 0; \
memset((void*)_err.event_chain, 0, sizeof(_err.event_chain)); \
memset((void*)_err.status_chain, 0, sizeof(_err.status_chain)); \
}

Definition at line 122 of file i2c.h.

#define ZEROS_ERR_COUNTER (   _i2c_err)
Value:
{ \
_i2c_err.ack_fail_cnt = 0; \
_i2c_err.miss_start_stop_cnt = 0; \
_i2c_err.arb_lost_cnt = 0; \
_i2c_err.over_under_cnt = 0; \
_i2c_err.pec_recep_cnt = 0; \
_i2c_err.timeout_tlow_cnt = 0; \
_i2c_err.smbus_alert_cnt = 0; \
_i2c_err.unexpected_event_cnt = 0; \
_i2c_err.last_unexpected_event = 0; \
_i2c_err.er_irq_cnt = 0; \
}

Definition at line 128 of file i2c.h.

Enumeration Type Documentation

enum I2CStatus
Enumerator
I2CIdle 
I2CStartRequested 
I2CAddrWrSent 
I2CAddrRdSent 
I2CSendingByte 
I2CReadingByte 
I2CReadingLastByte 
I2CStopRequested 
I2CRestartRequested 
I2CComplete 
I2CFailed 

Definition at line 58 of file i2c.h.

Enumerator
I2CTransPending 
I2CTransRunning 
I2CTransSuccess 
I2CTransFailed 
I2CTransDone 

Definition at line 50 of file i2c.h.

Enumerator
I2CTransTx 
I2CTransRx 
I2CTransTxRx 

Definition at line 44 of file i2c.h.

Function Documentation

void i2c_event ( void  )
Todo:
Watchdog timer

Definition at line 364 of file i2c_arch.c.

References __disable_irq(), __enable_irq(), I2CIdle, I2CStartRequested, LED1_OFF(), LED1_ON(), LED2_OFF(), and LED2_ON().

Referenced by event_task_ap(), event_task_fbw(), and main_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool_t i2c_idle ( struct i2c_periph p)

Definition at line 329 of file i2c_arch.c.

References BIT_X_IS_SET_IN_REG, FALSE, I2CIdle, if(), i2c_periph::reg_addr, i2c_periph::status, and TRUE.

Referenced by baro_periodic(), event_i2c_abuse_test(), hmc5843_idle_task(), hmc5843_periodic(), and i2c_setbitrate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void i2c_init ( struct i2c_periph p)
void i2c_setbitrate ( struct i2c_periph p,
int  bitrate 
)

Definition at line 366 of file i2c_arch.c.

References __disable_irq(), __enable_irq(), i2c_idle(), if(), LED1_OFF(), LED1_ON(), LED2_OFF(), LED2_ON(), and i2c_periph::reg_addr.

Referenced by event_i2c_abuse_test().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: