mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
i2c: Make transaction initiator available in txn list
The info field in the pios_i2c_txn list can now be used to provide a const string which describes the context for this transaction. This is very helpful when diagnosing an error that occurs somewhere in the middle of the I2C FSM since the FSM runs primarily in the ISR where the original context for the transactions is no longer available in the traceback. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1622 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
85c60479c1
commit
65ad2caf8a
@ -204,12 +204,14 @@ bool PIOS_BMP085_Read(uint8_t address, uint8_t *buffer, uint8_t len)
|
||||
|
||||
const struct pios_i2c_txn txn_list[] = {
|
||||
{
|
||||
.info = __func__,
|
||||
.addr = BMP085_I2C_ADDR,
|
||||
.rw = PIOS_I2C_TXN_WRITE,
|
||||
.len = sizeof(addr_buffer),
|
||||
.buf = addr_buffer,
|
||||
},
|
||||
{
|
||||
.info = __func__,
|
||||
.addr = BMP085_I2C_ADDR,
|
||||
.rw = PIOS_I2C_TXN_READ,
|
||||
.len = len,
|
||||
@ -238,6 +240,7 @@ bool PIOS_BMP085_Write(uint8_t address, uint8_t buffer)
|
||||
|
||||
const struct pios_i2c_txn txn_list[] = {
|
||||
{
|
||||
.info = __func__,
|
||||
.addr = BMP085_I2C_ADDR,
|
||||
.rw = PIOS_I2C_TXN_WRITE,
|
||||
.len = sizeof(data),
|
||||
|
@ -214,12 +214,14 @@ bool PIOS_HMC5843_Read(uint8_t address, uint8_t *buffer, uint8_t len)
|
||||
|
||||
const struct pios_i2c_txn txn_list[] = {
|
||||
{
|
||||
.info = __func__,
|
||||
.addr = PIOS_HMC5843_I2C_ADDR,
|
||||
.rw = PIOS_I2C_TXN_WRITE,
|
||||
.len = sizeof(addr_buffer),
|
||||
.buf = addr_buffer,
|
||||
},
|
||||
{
|
||||
.info = __func__,
|
||||
.addr = PIOS_HMC5843_I2C_ADDR,
|
||||
.rw = PIOS_I2C_TXN_READ,
|
||||
.len = len,
|
||||
@ -247,6 +249,7 @@ bool PIOS_HMC5843_Write(uint8_t address, uint8_t buffer)
|
||||
|
||||
const struct pios_i2c_txn txn_list[] = {
|
||||
{
|
||||
.info = __func__,
|
||||
.addr = PIOS_HMC5843_I2C_ADDR,
|
||||
.rw = PIOS_I2C_TXN_WRITE,
|
||||
.len = sizeof(data),
|
||||
|
@ -40,6 +40,7 @@ enum pios_i2c_txn_direction {
|
||||
};
|
||||
|
||||
struct pios_i2c_txn {
|
||||
const char * info;
|
||||
uint16_t addr;
|
||||
enum pios_i2c_txn_direction rw;
|
||||
uint32_t len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user