mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/stm32: cpu/sam0_common: rename internal i2c _start function
This commit is contained in:
parent
2863dc9031
commit
d2433454b5
@ -49,7 +49,7 @@
|
||||
#define SERCOM_I2CM_CTRLA_MODE_I2C_MASTER SERCOM_I2CM_CTRLA_MODE(5)
|
||||
#endif
|
||||
|
||||
static int _start(SercomI2cm *dev, uint16_t addr);
|
||||
static int _i2c_start(SercomI2cm *dev, uint16_t addr);
|
||||
static inline int _write(SercomI2cm *dev, const uint8_t *data, size_t length,
|
||||
uint8_t stop);
|
||||
static inline int _read(SercomI2cm *dev, uint8_t *data, size_t length,
|
||||
@ -248,7 +248,7 @@ int i2c_read_bytes(i2c_t dev, uint16_t addr,
|
||||
|
||||
if (!(flags & I2C_NOSTART)) {
|
||||
/* start transmission and send slave address */
|
||||
ret = _start(bus(dev), (addr << 1) | I2C_READ);
|
||||
ret = _i2c_start(bus(dev), (addr << 1) | I2C_READ);
|
||||
if (ret < 0) {
|
||||
DEBUG("Start command failed\n");
|
||||
return ret;
|
||||
@ -289,7 +289,7 @@ int i2c_write_bytes(i2c_t dev, uint16_t addr, const void *data, size_t len,
|
||||
}
|
||||
|
||||
if (!(flags & I2C_NOSTART)) {
|
||||
ret = _start(bus(dev), (addr<<1));
|
||||
ret = _i2c_start(bus(dev), (addr<<1));
|
||||
if (ret < 0) {
|
||||
DEBUG("Start command failed\n");
|
||||
return ret;
|
||||
@ -326,7 +326,7 @@ void _i2c_poweroff(i2c_t dev)
|
||||
_syncbusy(bus(dev));
|
||||
}
|
||||
|
||||
static int _start(SercomI2cm *dev, uint16_t addr)
|
||||
static int _i2c_start(SercomI2cm *dev, uint16_t addr)
|
||||
{
|
||||
/* Wait for hardware module to sync */
|
||||
DEBUG("Wait for device to be ready\n");
|
||||
|
@ -74,7 +74,7 @@ static uint32_t hsi_state;
|
||||
static inline void _i2c_init(I2C_TypeDef *i2c, uint32_t timing);
|
||||
static int _write(I2C_TypeDef *i2c, uint16_t addr, const void *data,
|
||||
size_t length, uint8_t flags, uint32_t cr2_flags);
|
||||
static int _start(I2C_TypeDef *i2c, uint32_t cr2, uint8_t flags);
|
||||
static int _i2c_start(I2C_TypeDef *i2c, uint32_t cr2, uint8_t flags);
|
||||
static int _stop(I2C_TypeDef *i2c);
|
||||
static int _wait_isr_set(I2C_TypeDef *i2c, uint32_t mask, uint8_t flags);
|
||||
static inline int _wait_for_bus(I2C_TypeDef *i2c);
|
||||
@ -227,7 +227,7 @@ int i2c_read_bytes(i2c_t dev, uint16_t address, void *data,
|
||||
}
|
||||
DEBUG("[i2c] read_bytes: Starting\n");
|
||||
/* RELOAD is needed because we don't know the full frame */
|
||||
int ret = _start(i2c, (address << 1) | (length << I2C_CR2_NBYTES_Pos) |
|
||||
int ret = _i2c_start(i2c, (address << 1) | (length << I2C_CR2_NBYTES_Pos) |
|
||||
I2C_CR2_RELOAD | I2C_FLAG_READ, flags);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
@ -280,7 +280,7 @@ static int _write(I2C_TypeDef *i2c, uint16_t addr, const void *data,
|
||||
if ((i2c->ISR & I2C_ISR_TC) && (flags & I2C_NOSTART)) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
int ret = _start(i2c, (addr << 1) | (length << I2C_CR2_NBYTES_Pos) |
|
||||
int ret = _i2c_start(i2c, (addr << 1) | (length << I2C_CR2_NBYTES_Pos) |
|
||||
cr2_flags, flags);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
@ -320,7 +320,7 @@ static int _write(I2C_TypeDef *i2c, uint16_t addr, const void *data,
|
||||
return _wait_for_bus(i2c);
|
||||
}
|
||||
|
||||
static int _start(I2C_TypeDef *i2c, uint32_t cr2, uint8_t flags)
|
||||
static int _i2c_start(I2C_TypeDef *i2c, uint32_t cr2, uint8_t flags)
|
||||
{
|
||||
assert(i2c != NULL);
|
||||
assert((i2c->ISR & I2C_ISR_BUSY) || !(flags & I2C_NOSTART));
|
||||
|
@ -63,7 +63,7 @@
|
||||
/* static function definitions */
|
||||
static void _init(i2c_t dev);
|
||||
static void _i2c_init(I2C_TypeDef *i2c, uint32_t clk, uint32_t ccr);
|
||||
static int _start(I2C_TypeDef *dev, uint8_t address_byte, uint8_t flags,
|
||||
static int _i2c_start(I2C_TypeDef *dev, uint8_t address_byte, uint8_t flags,
|
||||
size_t length);
|
||||
static int _stop(I2C_TypeDef *dev);
|
||||
static int _is_sr1_mask_set(I2C_TypeDef *i2c, uint32_t mask, uint8_t flags);
|
||||
@ -234,7 +234,7 @@ int i2c_read_bytes(i2c_t dev, uint16_t address, void *data, size_t length,
|
||||
!(flags & I2C_NOSTART)) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
int ret = _start(i2c, (address << 1) | I2C_FLAG_READ, flags, length);
|
||||
int ret = _i2c_start(i2c, (address << 1) | I2C_FLAG_READ, flags, length);
|
||||
if (ret < 0) {
|
||||
if (ret == -ETIMEDOUT) {
|
||||
_init(dev);
|
||||
@ -282,7 +282,7 @@ int i2c_write_bytes(i2c_t dev, uint16_t address, const void *data,
|
||||
assert(i2c != NULL);
|
||||
DEBUG("[i2c] write_bytes: Starting\n");
|
||||
/* Length is 0 in start since we don't need to preset the stop bit */
|
||||
ret = _start(i2c, (address << 1) | I2C_FLAG_WRITE, flags, 0);
|
||||
ret = _i2c_start(i2c, (address << 1) | I2C_FLAG_WRITE, flags, 0);
|
||||
if (ret < 0) {
|
||||
if (ret == -ETIMEDOUT) {
|
||||
_init(dev);
|
||||
@ -321,7 +321,7 @@ int i2c_write_bytes(i2c_t dev, uint16_t address, const void *data,
|
||||
return _wait_for_bus(i2c);
|
||||
}
|
||||
|
||||
static int _start(I2C_TypeDef *i2c, uint8_t address_byte, uint8_t flags,
|
||||
static int _i2c_start(I2C_TypeDef *i2c, uint8_t address_byte, uint8_t flags,
|
||||
size_t length)
|
||||
{
|
||||
assert(i2c != NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user