diff options
Diffstat (limited to 'platforms/chibios/drivers/i2c_master.h')
| -rw-r--r-- | platforms/chibios/drivers/i2c_master.h | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/platforms/chibios/drivers/i2c_master.h b/platforms/chibios/drivers/i2c_master.h index c68109acb..5f082e9d1 100644 --- a/platforms/chibios/drivers/i2c_master.h +++ b/platforms/chibios/drivers/i2c_master.h | |||
| @@ -27,24 +27,11 @@ | |||
| 27 | #include <ch.h> | 27 | #include <ch.h> |
| 28 | #include <hal.h> | 28 | #include <hal.h> |
| 29 | 29 | ||
| 30 | #ifdef I2C1_BANK | 30 | #ifndef I2C1_SCL_PIN |
| 31 | # define I2C1_SCL_BANK I2C1_BANK | 31 | # define I2C1_SCL_PIN B6 |
| 32 | # define I2C1_SDA_BANK I2C1_BANK | ||
| 33 | #endif | 32 | #endif |
| 34 | 33 | #ifndef I2C1_SDA_PIN | |
| 35 | #ifndef I2C1_SCL_BANK | 34 | # define I2C1_SDA_PIN B7 |
| 36 | # define I2C1_SCL_BANK GPIOB | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #ifndef I2C1_SDA_BANK | ||
| 40 | # define I2C1_SDA_BANK GPIOB | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #ifndef I2C1_SCL | ||
| 44 | # define I2C1_SCL 6 | ||
| 45 | #endif | ||
| 46 | #ifndef I2C1_SDA | ||
| 47 | # define I2C1_SDA 7 | ||
| 48 | #endif | 35 | #endif |
| 49 | 36 | ||
| 50 | #ifdef USE_I2CV1 | 37 | #ifdef USE_I2CV1 |
| @@ -83,10 +70,10 @@ | |||
| 83 | 70 | ||
| 84 | #ifdef USE_GPIOV1 | 71 | #ifdef USE_GPIOV1 |
| 85 | # ifndef I2C1_SCL_PAL_MODE | 72 | # ifndef I2C1_SCL_PAL_MODE |
| 86 | # define I2C1_SCL_PAL_MODE PAL_MODE_STM32_ALTERNATE_OPENDRAIN | 73 | # define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATE_OPENDRAIN |
| 87 | # endif | 74 | # endif |
| 88 | # ifndef I2C1_SDA_PAL_MODE | 75 | # ifndef I2C1_SDA_PAL_MODE |
| 89 | # define I2C1_SDA_PAL_MODE PAL_MODE_STM32_ALTERNATE_OPENDRAIN | 76 | # define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATE_OPENDRAIN |
| 90 | # endif | 77 | # endif |
| 91 | #else | 78 | #else |
| 92 | // The default PAL alternate modes are used to signal that the pins are used for I2C | 79 | // The default PAL alternate modes are used to signal that the pins are used for I2C |
| @@ -109,5 +96,7 @@ i2c_status_t i2c_start(uint8_t address); | |||
| 109 | i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout); | 96 | i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout); |
| 110 | i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); | 97 | i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); |
| 111 | i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout); | 98 | i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout); |
| 99 | i2c_status_t i2c_writeReg16(uint8_t devaddr, uint16_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout); | ||
| 112 | i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); | 100 | i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); |
| 101 | i2c_status_t i2c_readReg16(uint8_t devaddr, uint16_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); | ||
| 113 | void i2c_stop(void); | 102 | void i2c_stop(void); |
