64#error "You cannot use both I2cMaster and I2cSlave in the same application"
70#ifdef DEBUG_I2cSlaveDiary
76#ifndef I2C_SLAVE_BUFFER_SIZE
77#define I2C_SLAVE_BUFFER_SIZE 32
80#if I2C_SLAVE_BUFFER_SIZE > 255
81#error "I2C_SLAVE_BUFFER_SIZE exceeds size of a uint8_t"
204 void start( uint8_t ownAddress, uint8_t speed =
kI2cBusFast,
bool answerGeneralCall =
false );
235#ifdef DEBUG_I2cSlaveDiary
237 void setDebugSout(
Serial0* s );
239 void clearDebugI2cDiary();
240 void dumpDebugI2cDiary();
This file provides functions that offer high-level interfaces to USART0 hardware, which is available ...
Provides a high-end interface to serial communications using USART0.
Definition USART0.h:296
This namespace bundles the I2C-protocol-based interface to the TWI hardware. It provides logical cohe...
Definition I2cSlave.h:108
bool busy()
Reports whether the TWI hardware is busy communicating (either transmitting or receiving).
Definition I2cSlave.cpp:186
I2cPullups
This enum lists the options for controlling the built-in pullups in the TWI hardware.
Definition I2cSlave.h:183
@ kPullupsOff
Disable the built-in TWI hardware pullups.
Definition I2cSlave.h:184
@ kPullupsOn
Enable the built-in TWI hardware pullups.
Definition I2cSlave.h:185
void start(uint8_t ownAddress, uint8_t speed=kI2cBusFast, bool answerGeneralCall=false)
Configures the TWI hardware for I2C communications in Slave mode. You must call this function before ...
Definition I2cSlave.cpp:112
void stop()
Terminates the I2C communications using the TWI hardware, and disables the TWI interrupts.
Definition I2cSlave.cpp:163
void pullups(uint8_t set=kPullupsOn)
Sets the state of the internal pullups that are part of the TWI hardware.
Definition I2cSlave.cpp:170
uint8_t processI2cMessage(uint8_t *buffer, uint8_t len)
This function must be defined by the user. It is called by the TWI interrupt function installed as pa...
I2cBusSpeed
This enum lists I2C bus speed configurations.
Definition I2cSlave.h:149
@ kI2cBusSlow
I2C slow (standard) mode: 100 KHz.
Definition I2cSlave.h:150
@ kI2cBusFast
I2C fast mode: 400 KHz.
Definition I2cSlave.h:151
I2cStatusCodes
This enum lists I2C status codes reported by the various transmit functions.
Definition I2cSlave.h:160
@ kI2cError
I2C communications encountered an error.
Definition I2cSlave.h:169
@ kI2cCompletedOk
I2C communications completed with no error.
Definition I2cSlave.h:168
@ kI2cInProgress
I2C communications on this message still in progress.
Definition I2cSlave.h:172
@ kI2cRxOverflow
Recieved a message larger than can be held in the receive buffer.
Definition I2cSlave.h:171
@ kI2cTxPartial
I2C Master terminated transmission before all data were sent.
Definition I2cSlave.h:170