PIC24 Support Libraries
|
Go to the source code of this file.
Functions | |
void | configI2C1 (uint16_t u16_FkHZ) |
void | startI2C1 (void) |
void | rstartI2C1 (void) |
void | stopI2C1 (void) |
void | putI2C1 (uint8_t u8_val) |
uint8_t | putNoAckCheckI2C1 (uint8_t u8_val) |
uint8_t | getI2C1 (uint8_t u8_ack2Send) |
void | write1I2C1 (uint8_t u8_addr, uint8_t u8_d1) |
void | write2I2C1 (uint8_t u8_addr, uint8_t u8_d1, uint8_t u8_d2) |
void | writeNI2C1 (uint8_t u8_addr, uint8_t *pu8_data, uint16_t u16_cnt) |
void | read1I2C1 (uint8_t u8_addr, uint8_t *pu8_d1) |
void | read2I2C1 (uint8_t u8_addr, uint8_t *pu8_d1, uint8_t *pu8_d2) |
void | readNI2C1 (uint8_t u8_addr, uint8_t *pu8_data, uint16_t u16_cnt) |
I2C support functions - these are split into two classes: primitive operations (start, stop, rstart, put, get) and transactions, which use the primitive operations to read/write multiple bytes.
Definition in file pic24_i2c.h.
void 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 51 of file pic24_i2c.c.
Operation: Wait for a byte byte on the I2C bus, send u8_ack2Send as the acknowledgement bit to send back to the slave.
u8_ack2Send | ack bit to send back to slave after byte is read |
Definition at line 159 of file pic24_i2c.c.
void putI2C1 | ( | uint8_t | u8_val | ) |
Operation: Send one byte (u8_val), if NAK is returned use reportError() function to save error and do software reset.
u8_val | byte to send |
Definition at line 119 of file pic24_i2c.c.
Referenced by read1I2C1(), read2I2C1(), readNI2C1(), write1I2C1(), write2I2C1(), and writeNI2C1().
Operation: Send one byte (u8_val), return the acknowledgement bit that comes back from the slave. This function does not error out if a NAK is returned.
u8_val | byte to send |
Definition at line 141 of file pic24_i2c.c.
Transaction: Read one byte from I2C slave at address u8_addr, save to *pu8_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 |
pu8_d1 | Pointer to location to store byte read from slave |
Definition at line 227 of file pic24_i2c.c.
Transaction: Read two bytes from I2C slave at address u8_addr, save to *pu8_d1, *pu8_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 |
pu8_d1 | Pointer to location to store first byte read from slave |
pu8_d2 | Pointer to location to store second byte read from slave |
Definition at line 240 of file pic24_i2c.c.
Transaction: Read u16_cnt bytes from I2C slave at address u8_addr, save to buffer *pu8_data. 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_data | Pointer to buffer for storing bytes read from slave |
u16_cnt | Number of bytes read from slave. |
Definition at line 254 of file pic24_i2c.c.
void rstartI2C1 | ( | void | ) |
Operation: Perform an I2C repeated start operation.
Definition at line 86 of file pic24_i2c.c.
void startI2C1 | ( | void | ) |
Operation: Perform an I2C start operation.
Definition at line 70 of file pic24_i2c.c.
Referenced by read1I2C1(), read2I2C1(), readNI2C1(), write1I2C1(), write2I2C1(), and writeNI2C1().
void stopI2C1 | ( | void | ) |
Operation: Perform an I2C stop operation.
Definition at line 102 of file pic24_i2c.c.
Transaction: Write 1 byte (u8_d1) to I2C slave at address u8_addr.
u8_addr | Slave I2C address |
u8_d1 | Byte to send |
Definition at line 185 of file pic24_i2c.c.
Transaction: Write 2 bytes (u8_d1, u8_d2) to I2C slave at address u8_addr.
u8_addr | Slave I2C address |
u8_d1 | First byte to send |
u8_d2 | Second byte to send |
Definition at line 197 of file pic24_i2c.c.
Transaction: Write u16_cnt bytes stored in buffer *pu8_data to I2C slave at address u8_addr.
u8_addr | Slave I2C address |
pu8_data | Pointer to buffer containing bytes to send |
u16_cnt | Number of bytes to send |
Definition at line 211 of file pic24_i2c.c.