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
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
 I2C peripheral structure. More...
 
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)
 

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...
 
bool i2c_idle (struct i2c_periph *p)
 Check if I2C bus is idle. More...
 
bool i2c_submit (struct i2c_periph *p, struct i2c_transaction *t)
 Submit a I2C transaction. More...
 
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...
 

Detailed Description

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

Also see the I2C interface page.

Definition in file i2c.h.