Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
i2c.h File Reference
#include "std.h"
#include "mcu_periph/i2c_arch.h"
#include <string.h>
+ Include dependency graph for i2c.h:

Go to the source code of this file.

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)
 
#define I2CReceive(_p, _t, _s_addr, _len)
 
#define I2CTransmit(_p, _t, _s_addr, _len)
 
#define I2CTransceive(_p, _t, _s_addr, _len_w, _len_r)
 

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)
 

Macro Definition Documentation

#define I2C_BUF_LEN   32

Definition at line 38 of file i2c.h.

#define I2C_TRANSACTION_QUEUE_LEN   8

Definition at line 51 of file i2c.h.

Referenced by end_of_transaction(), i2c_event(), i2c_irq(), and i2c_submit().

#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 88 of file i2c.h.

#define I2CReceive (   _p,
  _t,
  _s_addr,
  _len 
)
#define I2CTransceive (   _p,
  _t,
  _s_addr,
  _len_w,
  _len_r 
)
#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 94 of file i2c.h.

Enumeration Type Documentation

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

Definition at line 22 of file i2c.h.

Enumerator
I2CTransPending 
I2CTransRunning 
I2CTransSuccess 
I2CTransFailed 
I2CTransDone 

Definition at line 14 of file i2c.h.

Enumerator
I2CTransTx 
I2CTransRx 
I2CTransTxRx 

Definition at line 8 of file i2c.h.

Function Documentation

void i2c_event ( void  )

Definition at line 344 of file i2c_arch.c.

References i2c_idle(), I2CIdle, I2CStartRequested, LED1_OFF(), LED1_ON(), LED2_OFF(), LED2_ON(), and PPRZ_I2C_SEND_START().

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)
void i2c_init ( struct i2c_periph p)
void i2c_setbitrate ( struct i2c_periph p,
int  bitrate 
)

Definition at line 346 of file i2c_arch.c.

References I2C_CR1_BIT_PE, i2c_idle(), 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: