|
Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
Class that implements twi/i2c. More...
#include <cs_Twi.h>


Public Member Functions | |
| void | init (const boards_config_t &board) |
| Init twi with board configuration (nothing is happening to the pins yet). More... | |
| void | initBus (cs_twi_init_t &twi) |
| Init twi as master on the i2c bus. More... | |
| void | write (uint8_t address, uint8_t *data, size_t length, bool stop) |
| Write data to given address. More... | |
| void | read (uint8_t address, uint8_t *data, size_t &length) |
| Read data from given address. More... | |
| void | handleEvent (event_t &event) |
| Incoming events. More... | |
| void | isrEvent (TwiIsrEvent event) |
| Events from the hardware. More... | |
Public Member Functions inherited from EventListener | |
| EventListener () | |
| virtual | ~EventListener () |
| unregisters the listener. More... | |
| virtual void | handleEvent (event_t &event)=0 |
| Handle events. More... | |
| void | listen () |
| Registers this with the EventDispatcher. More... | |
Static Public Member Functions | |
| static Twi & | getInstance () |
| Construct twi/i2c instance. More... | |
Static Protected Attributes | |
| static const nrfx_twi_t | _twi |
Private Member Functions | |
| Twi () | |
| Twi (Twi const &) | |
| void | operator= (Twi const &) |
Private Attributes | |
| nrfx_twi_config_t | _config |
| bool | _initialized |
| bool | _initializedBus |
| bool | _eventRead |
| bool | _eventError |
Class that implements twi/i2c.
This on the moment only implements twi as master.
|
private |
|
static |
Construct twi/i2c instance.
|
virtual |
| void Twi::init | ( | const boards_config_t & | board | ) |
Init twi with board configuration (nothing is happening to the pins yet).
| [in] | board | Hardware board. |
| void Twi::initBus | ( | cs_twi_init_t & | twi | ) |
Init twi as master on the i2c bus.
| [in] | twi | Configuration (frequency, etc.) |
| void Twi::isrEvent | ( | TwiIsrEvent | event | ) |
Events from the hardware.
|
private |
| void Twi::read | ( | uint8_t | address, |
| uint8_t * | data, | ||
| size_t & | length | ||
| ) |
Read data from given address.
| [in] | address | The address of the device to read from. |
| [out] | data | Pointer to data array where result will be received. |
| [in,out] | length | Number of items to read, and returns number of items actually read. |
| void Twi::write | ( | uint8_t | address, |
| uint8_t * | data, | ||
| size_t | length, | ||
| bool | stop | ||
| ) |
Write data to given address.
| [in] | address | The address of the device to write to. |
| [in] | data | Pointer to data to be written. |
| [in] | length | The number of items to be written. |
| [in] | stop | Release the bus after a write (for e.g. another i2c master). |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprotected |