Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
i2c.h File Reference

Architecture independent I2C (Inter-Integrated Circuit Bus) API. More...

#include "std.h"
#include "mcu_periph/i2c_arch.h"
+ Include dependency graph for i2c.h:

Go to the source code of this file.

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...
 

Detailed Description

Architecture independent I2C (Inter-Integrated Circuit Bus) API.

Also see the I2C interface page.

Definition in file i2c.h.