Name

i2c_tx — writes data to a slave device

Synopsis

#include <i2c.h>   
void i2c_tx (dev,  
 data,  
 count); 
uint8_t dev;
const uint8_t * data;
uint8_t count;
 

Arguments

dev

7-bit slave device address

data

bytes to be written

count

number of bytes to be written

Description

Writes the bytes specified by data to the slave device at address dev. The API generates the START condition, selects the slave device, writes the data bytes and generates the STOP condition.

Errors

ERR_I2C_NODEV, ERR_I2C_NOACK

Example


   // Write two bytes to device 0x51.
   uint8_t bytes[] = { 0xAA, 0x55 };
   i2c_tx(0x51, bytes, 2);