PIC24 Support Libraries
|
Files | |
file | esos_pic24_i2c.h |
This file contains routines which configure and use I2C on the Microchip PIC24 MCUs. | |
file | esos_pic24_i2c.c |
Macros | |
#define | ESOS_TASK_WAIT_ON_WRITE1I2C1(u8_addr, u8_d1) |
#define | ESOS_TASK_WAIT_ON_WRITE2I2C1(u8_addr, u8_d1, u8_d2) |
#define | ESOS_TASK_WAIT_ON_WRITENI2C1(u8_addr, pu8_d, u16_cnt) |
#define | ESOS_TASK_WAIT_ON_READ1I2C1(u8_addr, u8_d1) |
#define | ESOS_TASK_WAIT_ON_READ2I2C1(u8_addr, u8_d1, u8_d2) |
#define | ESOS_TASK_WAIT_ON_READNI2C1(u8_addr, pu8_d, u16_cnt) |
Functions | |
void | esos_pic24_configI2C1 (uint16_t u16_FkHZ) |
ESOS_CHILD_TASK (__esos_pic24_writeNI2C1, uint8_t u8_addr, uint8_t *pu8_d, uint16_t u16_cnt) | |
ESOS_CHILD_TASK (__esos_pic24_readNI2C1, uint8_t u8_addr, uint8_t *pu8_d, uint16_t u16_cnt) | |
#define ESOS_TASK_WAIT_ON_READ1I2C1 | ( | u8_addr, | |
u8_d1 | |||
) |
Transaction: Read 1 (ONE) byte from I2C slave at address u8_addr, and save to variable u8_d1 As per the I2C standard, a NAK is returned for the last byte read from the slave, ACKs are returned for the other bytes.
u8_addr | Slave I2C address |
u8_d1 | variable to hold the read byte |
Definition at line 163 of file esos_pic24_i2c.h.
#define ESOS_TASK_WAIT_ON_READ2I2C1 | ( | u8_addr, | |
u8_d1, | |||
u8_d2 | |||
) |
Transaction: Read 2 (TWO) bytes from I2C slave at address u8_addr, save to variables u8_d1 and u8_d2 As per the I2C standard, a NAK is returned for the last byte read from the slave, ACKs are returned for the other bytes.
u8_addr | Slave I2C address |
u8_d1 | variable to hold first read byte |
u8_d2 | variable to hold second read byte |
Definition at line 181 of file esos_pic24_i2c.h.
#define ESOS_TASK_WAIT_ON_READNI2C1 | ( | u8_addr, | |
pu8_d, | |||
u16_cnt | |||
) |
Transaction: Read u16_cnt bytes from I2C slave at address u8_addr, save to buffer *pu8_d. As per the I2C standard, a NAK is returned for the last byte read from the slave, ACKs are returned for the other bytes.
u8_addr | Slave I2C address |
pu8_d | Pointer to buffer for storing bytes read from slave |
u16_cnt | Number of bytes read from slave. |
Definition at line 199 of file esos_pic24_i2c.h.
#define ESOS_TASK_WAIT_ON_WRITE1I2C1 | ( | u8_addr, | |
u8_d1 | |||
) |
Transaction: Write 1 (ONE) byte stored in variable u8_d1 to I2C slave at address u8_addr.
u8_addr | Slave I2C address |
u8_d1 | Variable containing first byte to write |
Definition at line 115 of file esos_pic24_i2c.h.
#define ESOS_TASK_WAIT_ON_WRITE2I2C1 | ( | u8_addr, | |
u8_d1, | |||
u8_d2 | |||
) |
Transaction: Write 2 (TWO) bytes stored in variables u8_d1 and u8_d2 to I2C slave at address u8_addr.
u8_addr | Slave I2C address |
u8_d1 | Variable containing first byte to write |
u8_d2 | Variable containing second byte to write |
Definition at line 134 of file esos_pic24_i2c.h.
#define ESOS_TASK_WAIT_ON_WRITENI2C1 | ( | u8_addr, | |
pu8_d, | |||
u16_cnt | |||
) |
Transaction: Write u16_cnt bytes stored in buffer *pu8_d to I2C slave at address u8_addr.
u8_addr | Slave I2C address |
pu8_d | Pointer to buffer containing bytes to send |
u16_cnt | Number of bytes to send |
Definition at line 150 of file esos_pic24_i2c.h.
Transaction: Write u16_cnt bytes stored in buffer *pu8_d to I2C slave at address u8_addr.
u8_addr | Slave I2C address |
pu8_d | Pointer to buffer containing bytes to send |
u16_cnt | Number of bytes to send |
Definition at line 98 of file esos_pic24_i2c.c.
Transaction: Read u16_cnt bytes from I2C slave at address u8_addr, save to buffer *pu8_d. As per the I2C standard, a NAK is returned for the last byte read from the slave, ACKs are returned for the other bytes.
u8_addr | Slave I2C address |
pu8_d | Pointer to buffer for storing bytes read from slave |
u16_cnt | Number of bytes read from slave. |
Definition at line 124 of file esos_pic24_i2c.c.
void esos_pic24_configI2C1 | ( | uint16_t | u16_fKHz | ) |
Configure and enable the I2C1 module for operation at u16_fKHz KHz clock speed.
u16_fKHz | specifies clock speed in KHz |
Definition at line 65 of file esos_pic24_i2c.c.