| Updated: October 28, 2024 | 
#include <hw/i2c.h> #define DCMD_I2C_SEND __DIOT (_DCMD_I2C, 5, i2c_send_t)
The arguments to devctl() are:
| Argument | Value | 
|---|---|
| filedes | A file descriptor that you obtained by opening the device. | 
| dcmd | DCMD_I2C_SEND | 
| dev_data_ptr | A pointer to a i2c_send_t that's followed by additional data | 
| n_bytes | sizeof(i2c_send_t) plus the size of the additional data | 
| dev_info_ptr | NULL | 
The DCMD_I2C_SEND command executes a master send transaction. It returns when the transaction is complete.
typedef struct {
    i2c_addr_t slave;  /* slave address */
    uint32_t   len;    /* length of send data in bytes */
    uint32_t   stop;   /* send stop when complete? (0=no, 1=yes) */
} i2c_send_t;
    
  If an error occurs, the command returns: