![]()  | 
  
    Midnight Sun Firmware
    
   | 
 
I2C library. More...
Classes | |
| struct | I2CSettings | 
| I2C settings struct.  More... | |
Macros | |
| #define | I2C_TIMEOUT_MS 100U | 
| Maximum time permitted for an I2C transaction.  | |
| #define | I2C_MAX_NUM_DATA 32U | 
| None of our I2C transactions should need to be longer than 32 bytes.  | |
Typedefs | |
| typedef uint8_t | I2CAddress | 
| I2C address type.  | |
Enumerations | |
| enum | I2CPort { I2C_PORT_1 = 0 , I2C_PORT_2 , NUM_I2C_PORTS } | 
| I2C Port selection.  More... | |
| enum | I2CSpeed { I2C_SPEED_STANDARD = 0 , I2C_SPEED_FAST , NUM_I2C_SPEEDS } | 
| I2C speed type.  More... | |
Functions | |
| StatusCode | i2c_init (I2CPort i2c, const I2CSettings *settings) | 
| Initialize I2C instance.  More... | |
| StatusCode | i2c_read (I2CPort i2c, I2CAddress addr, uint8_t *rx_data, size_t rx_len) | 
| Reads data using the I2C port from the specified address.  More... | |
| StatusCode | i2c_write (I2CPort i2c, I2CAddress addr, uint8_t *tx_data, size_t tx_len) | 
| Writes data using the I2C port to the specified address.  More... | |
| StatusCode | i2c_read_reg (I2CPort i2c, I2CAddress addr, uint8_t reg, uint8_t *rx_data, size_t rx_len) | 
| Reads data using the I2C port from the specified address and register.  More... | |
| StatusCode | i2c_write_reg (I2CPort i2c, I2CAddress addr, uint8_t reg, uint8_t *tx_data, size_t tx_len) | 
| Writes data using the I2C port to the specified address and register.  More... | |
I2C library.
| enum I2CPort | 
| enum I2CSpeed | 
| StatusCode i2c_init | ( | I2CPort | i2c, | 
| const I2CSettings * | settings | ||
| ) | 
Initialize I2C instance.
| i2c | Specifies which I2C port to initialize | 
| settings | Pointer to I2C initialization settings | 
| StatusCode i2c_read | ( | I2CPort | i2c, | 
| I2CAddress | addr, | ||
| uint8_t * | rx_data, | ||
| size_t | rx_len | ||
| ) | 
Reads data using the I2C port from the specified address.
| i2c | Specifies which I2C port to read with | 
| addr | The I2C address to read from | 
| rx_data | Pointer to a buffer to receive data | 
| rx_len | Length of data to receive | 
| StatusCode i2c_read_reg | ( | I2CPort | i2c, | 
| I2CAddress | addr, | ||
| uint8_t | reg, | ||
| uint8_t * | rx_data, | ||
| size_t | rx_len | ||
| ) | 
Reads data using the I2C port from the specified address and register.
| i2c | Specifies which I2C port to read with | 
| addr | Specifies the I2C address to read from | 
| reg | Specifies the register to read from | 
| rx_data | Pointer to a buffer to receive data | 
| rx_len | Length of the data to receive | 
| StatusCode i2c_write | ( | I2CPort | i2c, | 
| I2CAddress | addr, | ||
| uint8_t * | tx_data, | ||
| size_t | tx_len | ||
| ) | 
Writes data using the I2C port to the specified address.
| i2c | Specifies which I2C port to write with | 
| addr | Specifies the I2C address to write to | 
| tx_data | Pointer to a buffer to transmit data | 
| tx_len | Length of the data to transmit | 
| StatusCode i2c_write_reg | ( | I2CPort | i2c, | 
| I2CAddress | addr, | ||
| uint8_t | reg, | ||
| uint8_t * | tx_data, | ||
| size_t | tx_len | ||
| ) | 
Writes data using the I2C port to the specified address and register.
| i2c | Specifies which I2C port to write with | 
| addr | Specifies the I2C address to write to | 
| reg | Specifies the register to write to | 
| tx_data | Pointer to a buffer to transmit data | 
| tx_len | Length of the data to transmit |