Paparazzi UAS
v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
|
Interface from Paparazzi I2C to ChibiOS I2C driver. More...
#include "mcu_periph/i2c_arch.h"
#include "mcu_periph/i2c.h"
#include <BOARD_CONFIG>
#include <ch.h>
#include <hal.h>
#include "mcu_periph/ram_arch.h"
#include "string.h"
Go to the source code of this file.
Macros | |
#define | I2C_THREAD_STACK_SIZE 512 |
Functions | |
static bool | i2c_chibios_idle (struct i2c_periph *p) |
i2c_idle() function More... | |
static bool | i2c_chibios_submit (struct i2c_periph *p, struct i2c_transaction *t) |
i2c_submit() function More... | |
static void | i2c_chibios_setbitrate (struct i2c_periph *p, int bitrate) |
i2c_setbitrate() function More... | |
void | i2c_event (void) |
i2c_event() function More... | |
Interface from Paparazzi I2C to ChibiOS I2C driver.
I2C configuration files are defined in the board file, so the maximal architecture independence is ensured.
Definition in file i2c_arch.c.
#define I2C_THREAD_STACK_SIZE 512 |
Definition at line 46 of file i2c_arch.c.
|
static |
i2c_idle() function
Empty, for paparazzi compatibility only
Definition at line 494 of file i2c_arch.c.
References FALSE.
|
static |
i2c_setbitrate() function
Empty, for paparazzi compatibility only. Bitrate is already set in i2cX_hw_init()
Definition at line 436 of file i2c_arch.c.
|
static |
i2c_submit() function
Provides interface between high-level paparazzi i2c functions (such as i2c_transmit(), i2c_transcieve()) and ChibiOS i2c transmit function i2cMasterTransmitTimeout()
Note that we are using the same buffer for transmit and recevive. It is OK because in i2c transaction is Tx always before Rx.
I2C calls are synchronous, timeout is set to 1/PERIODIC_FREQUENCY seconds TODO: Note that on STM32F1xx such as Lia board I2C bus can easily hang in an interrupt (see issue #531). Use I2C bus with care and caution.
[in] | p | pointer to a i2c_periph struct |
[in] | t | pointer to a i2c_transaction struct |
Definition at line 455 of file i2c_arch.c.
References i2c_periph::errors, FALSE, i2c_init(), I2C_TRANSACTION_QUEUE_LEN, I2CTransFailed, I2CTransPending, i2c_periph::init_struct, i2c_errors::queue_full_cnt, i2c_transaction::status, i2c_periph::trans, i2c_periph::trans_extract_idx, i2c_periph::trans_insert_idx, and TRUE.