|
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) |
| 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 152 of file pic24_i2c.c.
Referenced by read1I2C1(), read2I2C1(), and readNI2C1().
| 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 112 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 134 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 220 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 233 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 247 of file pic24_i2c.c.
| void rstartI2C1 | ( | void | ) |
Operation: Perform an I2C repeated start operation.
Definition at line 79 of file pic24_i2c.c.
| void startI2C1 | ( | void | ) |
Operation: Perform an I2C start operation.
Definition at line 63 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 95 of file pic24_i2c.c.
Referenced by read1I2C1(), read2I2C1(), readNI2C1(), write1I2C1(), write2I2C1(), and writeNI2C1().
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 178 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 190 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 204 of file pic24_i2c.c.
1.8.4