mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
LP-537 Remove requirement for left shifting I2C addresses on the F0 devices. This makes the I2C driver on F0 compatible with the other devices.
This commit is contained in:
parent
ea41e40a4a
commit
481d9abfd8
@ -27,7 +27,7 @@
|
||||
#include <stdint.h>
|
||||
#include <pios_i2c.h>
|
||||
#include <pios_helpers.h>
|
||||
#define GPS_I2C_ADDRESS (0x42 << 1)
|
||||
#define GPS_I2C_ADDRESS 0x42
|
||||
#define GPS_I2C_STREAM_REG 0xFF
|
||||
#define GPS_I2C_STREAM_SIZE_HIGH_REG 0xFD
|
||||
#define GPS_I2C_STREAM_SIZE_LOW_REG 0xFE
|
||||
|
@ -274,12 +274,12 @@ void go_txn_setup(struct pios_i2c_adapter *i2c_adapter)
|
||||
|
||||
I2C_ITConfig(i2c_adapter->cfg->regs, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR, ENABLE);
|
||||
if (i2c_adapter->active_txn->rw == PIOS_I2C_TXN_READ) {
|
||||
I2C_TransferHandling(i2c_adapter->cfg->regs, i2c_adapter->active_txn->addr, i2c_adapter->active_txn->len,
|
||||
I2C_TransferHandling(i2c_adapter->cfg->regs, (i2c_adapter->active_txn->addr << 1), i2c_adapter->active_txn->len,
|
||||
/* Only last transaction generates Auto End */
|
||||
i2c_adapter->active_txn == i2c_adapter->last_txn ? I2C_AutoEnd_Mode : I2C_SoftEnd_Mode,
|
||||
I2C_Generate_Start_Read);
|
||||
} else {
|
||||
I2C_TransferHandling(i2c_adapter->cfg->regs, i2c_adapter->active_txn->addr, i2c_adapter->active_txn->len,
|
||||
I2C_TransferHandling(i2c_adapter->cfg->regs, (i2c_adapter->active_txn->addr << 1), i2c_adapter->active_txn->len,
|
||||
/* Only last transaction generates Auto End */
|
||||
i2c_adapter->active_txn == i2c_adapter->last_txn ? I2C_AutoEnd_Mode : I2C_SoftEnd_Mode,
|
||||
I2C_Generate_Start_Write);
|
||||
|
Loading…
Reference in New Issue
Block a user