picoAPI  1.0.0
I2C

Typedefs

typedef enum picoI2CPort picoI2CPort
 

Enumerations

enum  picoI2CPort { I2C0, I2C1, I2C2 }
 

Functions

void picoI2CInit (picoI2CPort p)
 
int32_t picoI2CTransfer (picoI2CPort p, uint8_t slave_addr, uint8_t *txbuf, uint16_t txlen, uint8_t *rxbuf, uint16_t rxlen)
 

Detailed Description

Inter-Integrated Circuit communication API

Available signals and pins:

picoCIAA Signal
P8_5 I2C1_SCL
P8_8 I2C1_SDA
P8_3 I2C0_SCL
P8_6 I2C0_SDA
P8_7 I2C2_SCL
P2_13 I2C2_SDA
Note
use I2C1 as default because it has external pull-ups available

Typedef Documentation

typedef enum picoI2CPort picoI2CPort

Available I2C ports

Enumeration Type Documentation

Available I2C ports

Enumerator
I2C0 

I2C0 on pins P8_3 (SCL) and P8_6 (SDA)

I2C1 

I2C1 on pins P8_5 (SCL) and P8_8 (SDA) with external pull-ups

I2C2 

I2C2 on pins P8_7 (SCL) and P2_13 (SDA)

Function Documentation

void picoI2CInit ( picoI2CPort  p)

initialize I2C port

Parameters
pport number, can be I2C0, I2C1 or I2C2.

Here is the call graph for this function:

int32_t picoI2CTransfer ( picoI2CPort  p,
uint8_t  slave_addr,
uint8_t *  txbuf,
uint16_t  txlen,
uint8_t *  rxbuf,
uint16_t  rxlen 
)

transmit and receive data to/from I2C port

Parameters
pport number, can be I2C0, I2C1 or I2C2.
slave_addrslave ID
txbuftransmit data buffer
txlentransmit data buffer length in bytes
rxbufreceive data buffer
rxlenreceive data buffer length in bytes
Returns
0 on success, other value in case of I2C error