i2c interface class
More...
#include <i2c.h>
|
enum | { type = type_i2c_bus
} |
| identify this type as an i2c bus
|
|
|
static void | init () |
| initialize the i2c bus
|
|
static void | put_start () |
| output an I2C start condition
|
|
static void | put_stop () |
| output an I2C stop condition
|
|
static bool | get_ack () |
| get an acknowledge
|
|
static void | put_ack () |
| output an ack
|
|
static void | put_nack () |
| output a nack
|
|
static void | put_byte (unsigned char x) |
| output a byte, 8 bits, MSB first
|
|
static unsigned char | get_byte () |
| get (receive) a byte, 8 bits, MSB first
|
|
static void | write (unsigned char address, unsigned const char *data, int n) |
| multi-byte write transaction
|
|
static void | read (unsigned char address, unsigned char *data, int n) |
| multi-byte read transaction
|
|
i2c interface class
Definition at line 37 of file i2c.h.
static bool bmptk::hardware::i2c_interface::get_ack |
( |
| ) |
|
|
static |
get an acknowledge
This method gets (receives) an acknowledge from the slave. The method returns true when an ack was received, false when no ack (equivalent to a nack) was received. Note that this is opposite to the polarity on the bus, where a low level represents an ack.
static void bmptk::hardware::i2c_interface::read |
( |
unsigned char |
address, |
|
|
unsigned char * |
data, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
multi-byte read transaction
This method reads n bytes over the i2c bus from the 7-bit i2c address 'address' to *data.
Definition at line 92 of file i2c.h.
static void bmptk::hardware::i2c_interface::write |
( |
unsigned char |
address, |
|
|
unsigned const char * |
data, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
multi-byte write transaction
This method writes n bytes from *data over the i2c bus to the the 7-bit i2c address 'address'.
Definition at line 77 of file i2c.h.
The documentation for this class was generated from the following file: