73 #error "You cannot use both I2cMaster and I2cSlave in the same application" 80 #include <util/atomic.h> 83 #if defined( DEBUG_I2cMasterBuffer ) || defined( DEBUG_I2cMasterDiary ) 91 #ifndef I2C_MASTER_MAX_TX_MSG_LEN 92 #define I2C_MASTER_MAX_TX_MSG_LEN 24 95 #ifndef I2C_MASTER_MAX_TX_MSG_NBR 96 #define I2C_MASTER_MAX_TX_MSG_NBR 3 99 #if I2C_MASTER_MAX_TX_MSG_LEN > 255 100 #error "I2C_MASTER_MAX_TX_MSG_LEN exceeds size of a uint8_t" 103 #if I2C_MASTER_MAX_TX_MSG_NBR > 255 104 #error "I2C_MASTER_MAX_TX_MSG_NBR exceeds size of a uint8_t" 259 uint8_t
writeAsync( uint8_t address, uint8_t registerAddress,
volatile uint8_t* status );
279 uint8_t
writeAsync( uint8_t address, uint8_t registerAddress, uint8_t data,
volatile uint8_t* status );
300 uint8_t
writeAsync( uint8_t address, uint8_t registerAddress,
const char* data,
volatile uint8_t* status );
322 uint8_t
writeAsync( uint8_t address, uint8_t registerAddress, uint8_t* data, uint8_t numberBytes,
323 volatile uint8_t* status );
347 uint8_t
readAsync( uint8_t address, uint8_t numberBytes,
volatile uint8_t* destination,
348 volatile uint8_t* bytesRead,
volatile uint8_t* status );
374 uint8_t
readAsync( uint8_t address, uint8_t registerAddress, uint8_t numberBytes,
375 volatile uint8_t* destination,
volatile uint8_t* bytesRead,
376 volatile uint8_t* status );
394 int writeSync( uint8_t address, uint8_t registerAddress );
409 int writeSync( uint8_t address, uint8_t registerAddress, uint8_t data );
426 int writeSync( uint8_t address, uint8_t registerAddress,
const char* data );
445 int writeSync( uint8_t address, uint8_t registerAddress, uint8_t* data, uint8_t numberBytes );
462 int readSync( uint8_t address, uint8_t numberBytes, uint8_t* destination );
481 int readSync( uint8_t address, uint8_t registerAddress, uint8_t numberBytes, uint8_t* destination );
484 #if defined( DEBUG_I2cMasterBuffer ) || defined( DEBUG_I2cMasterDiary ) 485 void setDebugSout(
Serial0* s );
488 #ifdef DEBUG_I2cMasterBuffer 489 void dumpBufferContents();
492 #ifdef DEBUG_I2cMasterDiary 493 void clearDebugI2cDiary();
494 void dumpDebugI2cDiary();
The message is too long for the transmit buffer.
Definition: I2cMaster.h:176
Disable the built-in TWI hardware pullups.
Definition: I2cMaster.h:190
This file provides functions that offer high-level interfaces to USART0 hardware, which is available ...
void pullups(uint8_t set=kPullupsOn)
Sets the state of the internal pullups that are part of the TWI hardware.
Definition: I2cMaster.cpp:555
int readSync(uint8_t address, uint8_t numberBytes, uint8_t *destination)
Request to read data from a device and receive that data synchronously. This function blocks until th...
Definition: I2cMaster.cpp:812
I2cBusSpeed
This enum lists I2C bus speed configurations.
Definition: I2cMaster.h:150
I2C communications on this message still in progress.
Definition: I2cMaster.h:165
I2C communications not started on this message.
Definition: I2cMaster.h:164
The transmit buffer is full (try again later)
Definition: I2cMaster.h:175
The pointer to the status variable is null (need to provide a valid pointer)
Definition: I2cMaster.h:177
Performing a write+read, but no buffer provided to store the "read" data.
Definition: I2cMaster.h:179
void stop()
Terminates the I2C communications using the TWI hardware, and disables the TWI interrupts.
Definition: I2cMaster.cpp:548
I2C slow (standard) mode: 100 KHz.
Definition: I2cMaster.h:152
Enable the built-in TWI hardware pullups.
Definition: I2cMaster.h:191
I2cSendErrorCodes
This enum lists I2C errors codes that may occur when you try to write a message.
Definition: I2cMaster.h:172
I2C communications had an error on this message.
Definition: I2cMaster.h:163
uint8_t readAsync(uint8_t address, uint8_t numberBytes, volatile uint8_t *destination, volatile uint8_t *bytesRead, volatile uint8_t *status)
Request to read data from a device and receive that data asynchronously. This function queues the mes...
Definition: I2cMaster.cpp:700
No data provided to send.
Definition: I2cMaster.h:178
Provides a high-end interface to serial communications using USART0.
Definition: USART0.h:295
I2cPullups
This enum lists the options for controlling the built-in pullups in the TWI hardware.
Definition: I2cMaster.h:188
I2C communications completed on this message with no error.
Definition: I2cMaster.h:162
void start(uint8_t speed=kI2cBusFast)
Configures the TWI hardware for I2C communications in Master mode. You must call this function before...
Definition: I2cMaster.cpp:508
bool busy()
Reports whether the TWI hardware is busy communicating (either transmitting or receiving).
Definition: I2cMaster.cpp:571
I2C fast mode: 400 KHz.
Definition: I2cMaster.h:153
uint8_t writeAsync(uint8_t address, uint8_t registerAddress, volatile uint8_t *status)
Transmit a single register address (a one-byte message) asynchronously. This function queues the mess...
Definition: I2cMaster.cpp:582
I2cStatusCodes
This enum lists I2C status codes reported by the various transmit functions.
Definition: I2cMaster.h:160
This namespace bundles the I2C-protocol-based interface to the TWI hardware. It provides logical cohe...
Definition: I2cMaster.h:142
No error.
Definition: I2cMaster.h:174
int writeSync(uint8_t address, uint8_t registerAddress)
Transmit a single register address (a one-byte message) synchronously. This function blocks until the...
Definition: I2cMaster.cpp:759