PSoC-FDC1004Q
PSoC FDC1004Q Library
|
Hardware specific I2C interface. More...
#include "cytypes.h"
Go to the source code of this file.
Enumerations | |
enum | I2C_ErrorCode { I2C_NO_ERROR, I2C_ERROR } |
Error codes returned by the I2C Functions. More... | |
enum | I2C_Connection { I2C_DEV_CONNECTED, I2C_DEV_UNCONNECTED } |
Values returned to determine if device connected or not. More... | |
Functions | |
I2C_ErrorCode | I2C_Peripheral_Start (void) |
Start the I2C peripheral. More... | |
I2C_ErrorCode | I2C_Peripheral_Stop (void) |
Stop the I2C peripheral. More... | |
I2C_ErrorCode | I2C_Peripheral_ReadRegister (uint8_t device_address, uint8_t register_address, uint8_t *data) |
Read one byte over I2C. More... | |
I2C_ErrorCode | I2C_Peripheral_ReadRegisterMulti (uint8_t device_address, uint8_t register_address, uint8_t register_count, uint8_t *data) |
Read multiple bytes over I2C. More... | |
I2C_ErrorCode | I2C_Peripheral_WriteRegister (uint8_t device_address, uint8_t register_address, uint8_t data) |
Write a byte over I2C. More... | |
I2C_ErrorCode | I2C_Peripheral_WriteRegisterMulti (uint8_t device_address, uint8_t register_address, uint8_t register_count, uint8_t *data) |
Write multiple bytes over I2C. More... | |
I2C_ErrorCode | I2C_Peripheral_WriteRegisterNoData (uint8_t device_address, uint8_t register_address) |
Write single byte over I2C. More... | |
I2C_ErrorCode | I2C_Peripheral_IsDeviceConnected (uint8_t device_address, I2C_Connection *connection) |
Check if device is connected over I2C. More... | |
Hardware specific I2C interface.
This is an interface to the I2C peripheral. If you need to port this C-code to another platform, you could simply replace this interface and still use the code.
Definition in file I2C_Interface.h.
enum I2C_Connection |
Values returned to determine if device connected or not.
Enumerator | |
---|---|
I2C_DEV_CONNECTED |
Device is connected |
I2C_DEV_UNCONNECTED |
Device is not connected on the bus |
Definition at line 33 of file I2C_Interface.h.
enum I2C_ErrorCode |
Error codes returned by the I2C Functions.
Enumerator | |
---|---|
I2C_NO_ERROR |
No error occurred during I2C communication |
I2C_ERROR |
An error occurred during I2C communication |
Definition at line 22 of file I2C_Interface.h.
I2C_ErrorCode I2C_Peripheral_IsDeviceConnected | ( | uint8_t | device_address, |
I2C_Connection * | connection | ||
) |
Check if device is connected over I2C.
This function checks if a device is connected over the I2C lines.
device_address | I2C address of the device to be checked. |
connection | pointer where the connection status will be stored |
Definition at line 204 of file I2C_Interface.c.
I2C_ErrorCode I2C_Peripheral_ReadRegister | ( | uint8_t | device_address, |
uint8_t | register_address, | ||
uint8_t * | data | ||
) |
Read one byte over I2C.
This function performs a complete reading operation over I2C from a single register.
device_address | I2C address of the device to talk to. |
register_address | Address of the register to be read. |
data | Pointer to a variable where the byte will be saved. |
Definition at line 41 of file I2C_Interface.c.
I2C_ErrorCode I2C_Peripheral_ReadRegisterMulti | ( | uint8_t | device_address, |
uint8_t | register_address, | ||
uint8_t | register_count, | ||
uint8_t * | data | ||
) |
Read multiple bytes over I2C.
This function performs a complete reading operation over I2C from multiple registers.
device_address | I2C address of the device to talk to. |
register_address | Address of the first register to be read. |
register_count | Number of registers we want to read. |
data | Pointer to an array where data will be saved. |
Definition at line 71 of file I2C_Interface.c.
I2C_ErrorCode I2C_Peripheral_Start | ( | void | ) |
Start the I2C peripheral.
This function starts the I2C peripheral so that it is ready to work.
Definition at line 23 of file I2C_Interface.c.
I2C_ErrorCode I2C_Peripheral_Stop | ( | void | ) |
Stop the I2C peripheral.
This function stops the I2C peripheral from working.
Definition at line 33 of file I2C_Interface.c.
I2C_ErrorCode I2C_Peripheral_WriteRegister | ( | uint8_t | device_address, |
uint8_t | register_address, | ||
uint8_t | data | ||
) |
Write a byte over I2C.
This function performs a complete writing operation over I2C to a single register.
device_address | I2C address of the device to talk to. |
register_address | Address of the register to be written. |
data | Data to be written |
Definition at line 112 of file I2C_Interface.c.
I2C_ErrorCode I2C_Peripheral_WriteRegisterMulti | ( | uint8_t | device_address, |
uint8_t | register_address, | ||
uint8_t | register_count, | ||
uint8_t * | data | ||
) |
Write multiple bytes over I2C.
This function performs a complete writing operation over I2C to multiple registers
device_address | I2C address of the device to talk to. |
register_address | Address of the first register to be written. |
register_count | Number of registers that need to be written. |
data | Array of data to be written |
Definition at line 165 of file I2C_Interface.c.
I2C_ErrorCode I2C_Peripheral_WriteRegisterNoData | ( | uint8_t | device_address, |
uint8_t | register_address | ||
) |
Write single byte over I2C.
This function performs a complete writing operation over I2C to multiple registers
device_address | I2C address of the device to talk to. |
register_address | Address of the first register to be written. |
Definition at line 141 of file I2C_Interface.c.