PebbleOS
Loading...
Searching...
No Matches
Functions
i2c.h File Reference
#include <board/board.h>
#include <stdbool.h>
#include <stdint.h>

Functions

void i2c_use (I2CSlavePort *slave)
 Start using the bus a device is connected to.
 
void i2c_release (I2CSlavePort *slave)
 Stop using the bus a device is connected to.
 
void i2c_reset (I2CSlavePort *slave)
 Reset the bus a device is connected to.
 
bool i2c_bitbang_recovery (I2CSlavePort *slave)
 Recover a stuck bus by clocking SCL until SDA is released.
 
bool i2c_read_register (I2CSlavePort *slave, uint8_t register_address, uint8_t *result)
 Read a register.
 
bool i2c_read_register_block (I2CSlavePort *slave, uint8_t register_address_start, uint32_t read_size, uint8_t *result_buffer)
 Read consecutive registers.
 
bool i2c_read_register_block_dma (I2CSlavePort *slave, uint8_t register_address_start, uint32_t read_size, uint8_t *result_buffer)
 Read a block of registers into a buffer the controller may fill through DMA.
 
bool i2c_read_block (I2CSlavePort *slave, uint32_t read_size, uint8_t *result_buffer)
 Read data without sending a register address.
 
bool i2c_write_register (I2CSlavePort *slave, uint8_t register_address, uint8_t value)
 Write a register.
 
bool i2c_write_register_block (I2CSlavePort *slave, uint8_t register_address_start, uint32_t write_size, const uint8_t *buffer)
 Write consecutive registers.
 
bool i2c_write_block (I2CSlavePort *slave, uint32_t write_size, const uint8_t *buffer)
 Write data without sending a register address.
 
bool i2c_write_read_block (I2CSlavePort *slave, uint32_t write_size, const uint8_t *write_buffer, uint32_t read_size, uint8_t *read_buffer)
 Write data, then read data, with no other transfer on the bus in between.