#include "buses.h"
Defines | |
#define | I2C1_RXBUF_OVERRUN 0x10 |
#define | I2C1_TXBUF_OVERRUN 0x01 |
#define | i2c1BusIsGetReady() busRxBufHasData(BUSID_I2C1) |
#define | i2c1BusRxBufEmpty() busIsRxBufEmpty(BUSID_I2C1) |
#define | I2C_RXING 0x80 |
#define | I2C_TXING 0x08 |
Functions | |
BYTE | i2c1BusGetByte (void) |
void | i2c1BusPutByte (BYTE c) |
void | i2c1BusPutByteHex (BYTE c) |
void | i2c1BusPutRomString (ROM char *str) |
void | i2c1BusPutString (BYTE *s) |
void | i2c1BusReset (void) |
void | i2cBusInit (void) |
void | i2cBusService (void) |
Variables | |
BYTE | i2c1Stat |
All data written to the transmit buffer is decoded by this module, and will generally instruct data to be written, or read from a I2C slave node. An ASCII text based message protocol is used. The protocol format is:
//********************************************************************* //-------------- BusI2C1 Configuration -------------------- //*********************************************************************
#define I2C1_RXBUF_OVERRUN 0x10 |
#define I2C1_TXBUF_OVERRUN 0x01 |
#define i2c1BusIsGetReady | ( | ) | busRxBufHasData(BUSID_I2C1) |
Are there any bytes in the I2C1 Bus receive buffer.
#define i2c1BusRxBufEmpty | ( | ) | busIsRxBufEmpty(BUSID_I2C1) |
Are there any bytes in the receive buffer.
#define I2C_RXING 0x80 |
#define I2C_TXING 0x08 |
BYTE i2c1BusGetByte | ( | void | ) |
Get the next byte in the RX buffer. Before calling this function, the i2c1IsGetReady() function should be called to check if there is any data available.
void i2c1BusPutByte | ( | BYTE | c | ) |
Add a byte to the TX buffer.
c | Byte to write out on the serial port |
void i2c1BusPutByteHex | ( | BYTE | c | ) |
Send the ASCII hex value of the given byte to the BUS. It is added to the transmit buffer, and asynchronously transmitted. For example, if c=11, then "0B" will be sent to the Bus
c | Byte to write out on the bus |
void i2c1BusPutRomString | ( | ROM char * | str | ) |
Transmit a NULL terminated string. It is added to the transmit buffer, and asynchronously transmitted. The NULL is NOT sent!
str | Null terminated string to write out on the bus. |
void i2c1BusPutString | ( | BYTE * | s | ) |
Transmit a NULL terminated string. It is added to the transmit buffer, and asynchronously transmitted. The NULL is NOT sent!
s | Null terminated string to write out on the bus. |
void i2c1BusReset | ( | void | ) |
Resets this module, and empties all buffers.
void i2cBusInit | ( | void | ) |
Initialize all I2C modules
void i2cBusService | ( | void | ) |
Service all I2C modules