121 #include "periph_conf.h" 122 #include "periph_cpu.h" 139 #define I2C_DEV(x) (x) 148 #define I2C_UNDEF (UINT_MAX) 164 #define I2C_READ (0x0001) 174 #define I2C_10BIT_MAGIC (0xF0u) 180 #ifndef HAVE_I2C_SPEED_T 195 #ifndef HAVE_I2C_FLAGS_T 262 int i2c_read_reg(i2c_t dev, uint16_t addr, uint16_t reg,
263 void *data, uint8_t flags);
291 void *data,
size_t len, uint8_t flags);
315 int i2c_read_byte(i2c_t dev, uint16_t addr,
void *data, uint8_t flags);
341 void *data,
size_t len, uint8_t flags);
361 int i2c_write_byte(i2c_t dev, uint16_t addr, uint8_t data, uint8_t flags);
383 size_t len, uint8_t flags);
410 uint8_t data, uint8_t flags);
437 const void *data,
size_t len, uint8_t flags);
void i2c_init(i2c_t dev)
Initialize the given I2C bus.
high speed mode: ~3400 kbit/s
int i2c_read_reg(i2c_t dev, uint16_t addr, uint16_t reg, void *data, uint8_t flags)
Convenience function for reading one byte from a given register address.
int i2c_acquire(i2c_t dev)
Get mutually exclusive access to the given I2C bus.
int i2c_read_bytes(i2c_t dev, uint16_t addr, void *data, size_t len, uint8_t flags)
Convenience function for reading bytes from a device.
i2c_speed_t
Default mapping of I2C bus speed values.
unsigned int i2c_t
Default i2c_t type definition.
int i2c_write_regs(i2c_t dev, uint16_t addr, uint16_t reg, const void *data, size_t len, uint8_t flags)
Convenience function for writing data to a given register address.
int i2c_read_regs(i2c_t dev, uint16_t addr, uint16_t reg, void *data, size_t len, uint8_t flags)
Convenience function for reading several bytes from a given register address.
int i2c_write_reg(i2c_t dev, uint16_t addr, uint16_t reg, uint8_t data, uint8_t flags)
Convenience function for writing one byte to a given register address.
Device enumerations for backward compatibility with existing peripheral driver implementations.
use 10-bit device addressing
void i2c_release(i2c_t dev)
Release the given I2C device to be used by others.
skip START sequence, ignores address field
use 16-bit register addressing, big-endian
low speed mode: ~10 kbit/s
int i2c_write_bytes(i2c_t dev, uint16_t addr, const void *data, size_t len, uint8_t flags)
Convenience function for writing several bytes onto the bus.
int i2c_write_byte(i2c_t dev, uint16_t addr, uint8_t data, uint8_t flags)
Convenience function for writing a single byte onto the bus.
i2c_flags_t
I2C transfer flags.
int i2c_read_byte(i2c_t dev, uint16_t addr, void *data, uint8_t flags)
Convenience function for reading one byte from a device.
fast plus mode: ~1000 kbit/s
do not issue a STOP condition after transfer