1
0
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:
Brian Webb 2017-06-24 14:48:58 -07:00
parent ea41e40a4a
commit 481d9abfd8
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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);