MiraOS I2C driver.
More...
#include <stdint.h>
Go to the source code of this file.
|
void | mira_i2c_init (MiraI2CSpeed speed, MiraI2CPullupMode pullups) |
| Initialize the I2C driver. More...
|
|
MiraI2CErrorCodeFlags | mira_i2c_single_send (uint8_t address, uint8_t data) |
| Send a single byte. More...
|
|
MiraI2CErrorCodeFlags | mira_i2c_single_receive (uint8_t address, uint8_t *data_pointer) |
| Receive a single byte. More...
|
|
MiraI2CErrorCodeFlags | mira_i2c_burst_send (uint8_t address, uint8_t *data_pointer, uint8_t length) |
| Send multiple bytes. More...
|
|
MiraI2CErrorCodeFlags | mira_i2c_burst_receive (uint8_t address, uint8_t *data_pointer, uint8_t length) |
| Receive multiple bytes. More...
|
|
MiraI2CErrorCodeFlags | mira_i2c_generic_single_send (uint8_t address, uint8_t data, uint8_t send_start_and_address, uint8_t send_stop) |
| Send a byte with optional start and stop conditions. Send a byte with optional start and stop conditions. A transmission can only occur if a start condition is sent or if a transmission previously has been initiated by sending a start condition. More...
|
|
MiraI2CErrorCodeFlags | mira_i2c_generic_single_receive (uint8_t address, uint8_t *data_pointer, uint8_t send_start_and_address, uint8_t send_stop) |
| Read a byte with optional start and stop conditions. Read a byte with optional start and stop conditions. A transmission can only occur if a start condition is sent or if a transmission previously has been initiated by sending a start condition. More...
|
|
MiraOS I2C driver.
- Author
- LumenRadio AB
- Date
- 19 Aug 2016 The MiraOS library provides functions for controlling the Mira radio module, sending/receiving messages, controlling peripherals, etc.
- See also
- http://docs.lumenrad.io/mira
Error codes for I2C master. Note that combination of errors can exist, in that case error codes are OR'd in the result code.
Enumerator |
---|
MIRA_I2C_MASTER_ERR_NONE |
Success
|
MIRA_I2C_MASTER_ERR_ADDR_ACK |
No ack on address
|
MIRA_I2C_MASTER_ERR_DATA_ACK |
No ack on data
|
MIRA_I2C_MASTER_ERR_ARB_LOST |
Arbitration lost
|
Supported pull-up options for the I2C bus.
Enumerator |
---|
MIRA_I2C_NO_PULLUPS |
Do not enable internal pull-ups (external pull-up must be present)
|
MIRA_I2C_USE_PULLUPS |
Enable internal pull-ups
|
Supported I2C bus speeds.
Enumerator |
---|
MIRA_I2C_NORMAL_BUS_SPEED |
100KHz I2C
|
MIRA_I2C_FAST_BUS_SPEED |
400KHz I2C
|
Receive multiple bytes.
- Parameters
-
address | 7 bit I2C chip address (without R/W bit) |
data_pointer | pointer to where to write received byte |
length | number of bytes |
- Returns
- MiraI2CErrorCodeFlags
Send multiple bytes.
- Parameters
-
address | 7 bit I2C chip address (without R/W bit) |
data_pointer | pointer to data to send |
length | number of bytes |
- Returns
- MiraI2CErrorCodeFlags
MiraI2CErrorCodeFlags mira_i2c_generic_single_receive |
( |
uint8_t |
address, |
|
|
uint8_t * |
data_pointer, |
|
|
uint8_t |
send_start_and_address, |
|
|
uint8_t |
send_stop |
|
) |
| |
Read a byte with optional start and stop conditions. Read a byte with optional start and stop conditions. A transmission can only occur if a start condition is sent or if a transmission previously has been initiated by sending a start condition.
- Parameters
-
address | 7 bit I2C chip address (without R/W bit) |
data_pointer | pointer to where to write received byte |
send_start_and_address | send a start condition and address before the data is received |
send_stop | send a stop condition after the data has been received |
- Returns
- MiraI2CErrorCodeFlags
MiraI2CErrorCodeFlags mira_i2c_generic_single_send |
( |
uint8_t |
address, |
|
|
uint8_t |
data, |
|
|
uint8_t |
send_start_and_address, |
|
|
uint8_t |
send_stop |
|
) |
| |
Send a byte with optional start and stop conditions. Send a byte with optional start and stop conditions. A transmission can only occur if a start condition is sent or if a transmission previously has been initiated by sending a start condition.
- Parameters
-
address | 7 bit I2C chip address (without R/W bit) |
data | data byte to send |
send_start_and_address | send a start condition and address before the data is sent |
send_stop | send a stop condition after the data has been sent |
- Returns
- void
Initialize the I2C driver.
- Parameters
-
speed | Bus speed |
pullups | Use internal pull-ups |
- Returns
- void
Receive a single byte.
- Parameters
-
address | 7 bit I2C chip address (without R/W bit) |
data_pointer | pointer to where to write received byte |
- Returns
- MiraI2CErrorCodeFlags
Send a single byte.
- Parameters
-
address | 7 bit I2C chip address (without R/W bit) |
data | data byte to send |
- Returns
- void