 |
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
52 __attribute__((always_inline))
static inline void I2cSendAck(
void *reg)
60 p->trans_extract_idx++;
62 p->trans_extract_idx = 0;
65 if (
p->trans_extract_idx ==
p->trans_insert_idx) {
94 __attribute__((always_inline))
static inline void I2cReceive(
void *reg,
bool ack)
105 __attribute__((always_inline))
static inline void I2cClearIT(
void *reg)
117 switch (trans->
type) {
133 if (
p->idx_buf < trans->
len_r) {
143 if (
p->idx_buf < trans->
len_r) {
159 if (
p->idx_buf < trans->
len_w) {
186 #define I2C0_SCLL 200
190 #define I2C0_SCLH 200
195 #if (PCLK == 15000000)
196 #define I2C0_SCLL_D I2C0_SCLL
197 #define I2C0_SCLH_D I2C0_SCLH
200 #if (PCLK == 30000000)
201 #define I2C0_SCLL_D (2*I2C0_SCLL)
202 #define I2C0_SCLH_D (2*I2C0_SCLH)
205 #if (PCLK == 60000000)
206 #define I2C0_SCLL_D (4*I2C0_SCLL)
207 #define I2C0_SCLH_D (4*I2C0_SCLH)
210 #error unknown PCLK frequency
215 #ifndef I2C0_VIC_SLOT
216 #define I2C0_VIC_SLOT 8
220 void i2c0_ISR(
void) __attribute__((naked));
238 void i2c0_hw_init(
void)
244 i2c0.reg_addr =
I2C0;
246 i2c0.init_struct = (
void *)(&i2c0_vic_channel);
274 #define I2C1_SCLL 200
278 #define I2C1_SCLH 200
283 #if (PCLK == 15000000)
284 #define I2C1_SCLL_D I2C1_SCLL
285 #define I2C1_SCLH_D I2C1_SCLH
288 #if (PCLK == 30000000)
289 #define I2C1_SCLL_D (2*I2C1_SCLL)
290 #define I2C1_SCLH_D (2*I2C1_SCLH)
293 #if (PCLK == 60000000)
294 #define I2C1_SCLL_D (4*I2C1_SCLL)
295 #define I2C1_SCLH_D (4*I2C1_SCLH)
298 #error unknown PCLK frequency
303 #ifndef I2C1_VIC_SLOT
304 #define I2C1_VIC_SLOT 9
308 void i2c1_ISR(
void) __attribute__((naked));
326 void i2c1_hw_init(
void)
332 i2c1.reg_addr =
I2C1;
334 i2c1.init_struct = (
void *)(&i2c1_vic_channel);
365 idx =
p->trans_insert_idx + 1;
367 if (
idx ==
p->trans_extract_idx) {
369 p->errors->queue_full_cnt++;
380 p->trans[
p->trans_insert_idx] = t;
381 p->trans_insert_idx =
idx;
400 int period = 15000000 / 2 / bitrate;
410 #if (PCLK == 30000000)
414 #if (PCLK == 60000000)
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
static void I2cSendStart(struct i2c_periph *p)
uint16_t len_r
Number of bytes to read/receive.
unsigned disableIRQ(void)
static void I2cClearStart(void *reg)
@ I2CTransTx
transmit only transaction
void i2c_event(void)
i2c_event() function
static void i2c_lpc21_setbitrate(struct i2c_periph *p, int bitrate)
@ I2CTransFailed
transaction failed
static void I2cFail(struct i2c_periph *p, struct i2c_transaction *t)
uint8_t len_w
Number of bytes to write/transmit.
@ I2CTransSuccess
transaction successfully finished by I2C driver
static bool i2c_lpc21_idle(struct i2c_periph *p)
@ I2CTransRx
receive only transaction
enum I2CTransactionStatus status
Transaction status.
@ I2CTransTxRx
transmit and receive transaction
I2C transaction structure.
uint8_t slave_addr
Slave address.
static void I2cAutomaton(int32_t state, struct i2c_periph *p)
#define I2C_TRANSACTION_QUEUE_LEN
I2C transaction queue length.
static void I2cEndOfTransaction(struct i2c_periph *p)
static void I2cSendStop(struct i2c_periph *p, struct i2c_transaction *t)
@ I2CTransPending
transaction is pending in queue
static void I2cSendByte(void *reg, uint8_t b)
static void I2cClearIT(void *reg)
static bool i2c_lpc21_submit(struct i2c_periph *p, struct i2c_transaction *t)
static void I2cSendAck(void *reg)
static void I2cReceive(void *reg, bool ack)
enum I2CTransactionType type
Transaction type.