Describes the HPI master function prototypes.
Functions | |
cy_hpi_master_status_t | Cy_HPI_Master_Init (cy_hpi_master_context_t *context, cy_hpi_master_app_cbk_t *appCbk) |
Initializes the HPI master context members, application callbacks pointer, and initialize the slave devices. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_DeInit (cy_hpi_master_context_t *context) |
Deinitializes all the global variables and data structure values. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_SlaveDeviceInit (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint8_t intrGpioPort, uint8_t intrGpioPin, uint8_t portCount) |
Configures the HPI slave device information to allow the HPI master to communicate. More... | |
void | Cy_HPI_Master_InterruptHandler (cy_hpi_master_context_t *context, uint8_t gpioPort, uint8_t gpioPin) |
Sets the interrupt mask bit and the interrupt is handled by the Cy_HPI_Master_Task function. More... | |
void | Cy_HPI_Master_Task (cy_hpi_master_context_t *context) |
Handle the events from the slave devices. More... | |
uint8_t | Cy_HPI_Master_GetSlaveIndexByAddr (cy_hpi_master_context_t *context, uint8_t slaveAddr) |
Function return the index of slave devices for the given slave address. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_RegisterRead (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint16_t regAddress, uint8_t *readBuff, uint16_t readLen) |
Performs the register read operation using a 16-bit register address. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_RegisterWrite (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint16_t regAddress, void *writeBuff, uint16_t writeLen) |
Performs the register write operation using a 16-bit register address. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_DevRegRead (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint8_t deviceReg, uint8_t *readBuff, uint16_t readLen) |
Reads data from device-specific registers. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_DevRegWrite (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint8_t deviceReg, void *writeBuff, uint16_t writeLen) |
Writes data to the device-specific registers. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_FlashMemoryRead (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint8_t *readBuff, uint16_t readLen) |
Reads data from the HPI flash memory region. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_FlashMemoryWrite (cy_hpi_master_context_t *context, uint8_t slaveAddr, void *writeBuff, uint16_t writeLen) |
Writes data to the HPI flash memory region. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_PortRegRead (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint8_t port, uint8_t portReg, void *readBuff, uint16_t readLen) |
Port register reads the API will be used to read all port-specific registers. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_PortRegWrite (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint8_t port, uint8_t portReg, void *writeBuff, uint16_t writeLen) |
Port register write API to all the port-specific registers. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_PdResponseRegRead (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint8_t port, uint16_t offset, void *readData, uint16_t readLen) |
PD Response register read API is used for response register read operations. More... | |
cy_hpi_master_status_t | Cy_HPI_Master_PdResponseRegWrite (cy_hpi_master_context_t *context, uint8_t slaveAddr, uint8_t port, uint16_t offset, void *writeBuff, uint16_t writeLen) |
PD Response register write API is used for response register write operations. More... | |
bool | Cy_HPI_Master_SleepAllowed (cy_hpi_master_context_t *context) |
Checks if the device enters into Deep Sleep mode. More... | |
cy_hpi_master_status_t Cy_HPI_Master_Init | ( | cy_hpi_master_context_t * | context, |
cy_hpi_master_app_cbk_t * | appCbk | ||
) |
Initializes the HPI master context members, application callbacks pointer, and initialize the slave devices.
Call this function before calling any APIs from this library.
Initializes the following structure members in the cy_hpi_master_context_t before calling this function:
context | HPI master library context pointer. |
appCbk | Requires application callbacks from the HPI master library. |
cy_hpi_master_status_t Cy_HPI_Master_DeInit | ( | cy_hpi_master_context_t * | context | ) |
Deinitializes all the global variables and data structure values.
context | HPI master library context pointer. |
cy_hpi_master_status_t Cy_HPI_Master_SlaveDeviceInit | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint8_t | intrGpioPort, | ||
uint8_t | intrGpioPin, | ||
uint8_t | portCount | ||
) |
Configures the HPI slave device information to allow the HPI master to communicate.
Call this function for each slave device on the same I2C bus.
context | HPI master library context pointer. |
slaveAddr | HPI slave device I2C address (7 bits). |
intrGpioPort | HPI interrupt GPIO port number. |
intrGpioPin | HPI interrupt GPIO pin number. |
portCount | Number of PD ports supported by the slave device. |
void Cy_HPI_Master_InterruptHandler | ( | cy_hpi_master_context_t * | context, |
uint8_t | gpioPort, | ||
uint8_t | gpioPin | ||
) |
Sets the interrupt mask bit and the interrupt is handled by the Cy_HPI_Master_Task function.
To get the HPI interrupt pin status, call from the GPIO interrupt routine or periodically from the main loop.
context | HPI master library context pointer. |
gpioPort | HPI interrupt GPIO port number. |
gpioPin | HPI interrupt GPIO pin number. |
void Cy_HPI_Master_Task | ( | cy_hpi_master_context_t * | context | ) |
Handle the events from the slave devices.
This function handles the HPI port events from the slave in the interrupt context and the associated data in queue and is called periodically from the main loop of the application firmware.
context | HPI master library context pointer. |
uint8_t Cy_HPI_Master_GetSlaveIndexByAddr | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr | ||
) |
Function return the index of slave devices for the given slave address.
context | HPI master library context pointer. |
slaveAddr | I2C address of the slave device. |
cy_hpi_master_status_t Cy_HPI_Master_RegisterRead | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint16_t | regAddress, | ||
uint8_t * | readBuff, | ||
uint16_t | readLen | ||
) |
Performs the register read operation using a 16-bit register address.
context | HPI master library context pointer. |
slaveAddr | Slave device I2C address (7 bits). |
regAddress | HPI register address (16 bits). |
readBuff | Reads the data buffer pointer. |
readLen | Read the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_RegisterWrite | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint16_t | regAddress, | ||
void * | writeBuff, | ||
uint16_t | writeLen | ||
) |
Performs the register write operation using a 16-bit register address.
context | Pointer of the HPI master context structure. |
slaveAddr | I2C address (7 bits) of the slave device. |
regAddress | HPI register address (16 bits). |
writeBuff | Writes the data buffer pointer. |
writeLen | Write the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_DevRegRead | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint8_t | deviceReg, | ||
uint8_t * | readBuff, | ||
uint16_t | readLen | ||
) |
Reads data from device-specific registers.
context | HPI master library context pointer. |
slaveAddr | Slave device I2C address (7 bits). |
deviceReg | HPI device-specific register address. |
readBuff | Reads the data buffer pointer. |
readLen | Read the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_DevRegWrite | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint8_t | deviceReg, | ||
void * | writeBuff, | ||
uint16_t | writeLen | ||
) |
Writes data to the device-specific registers.
context | Pointer of the HPI master context structure. |
slaveAddr | I2C address (7 bits) of the slave device. |
deviceReg | HPI device-specific register address. |
writeBuff | Writes the data buffer pointer. |
writeLen | Write the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_FlashMemoryRead | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint8_t * | readBuff, | ||
uint16_t | readLen | ||
) |
Reads data from the HPI flash memory region.
context | HPI master library context pointer. |
slaveAddr | Slave device I2C address (7 bits). |
readBuff | Read the data buffer pointer. |
readLen | Read the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_FlashMemoryWrite | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
void * | writeBuff, | ||
uint16_t | writeLen | ||
) |
Writes data to the HPI flash memory region.
context | HPI master library context pointer. |
slaveAddr | Slave device I2C address (7 bits). |
writeBuff | Write the data buffer pointer. |
writeLen | Writes the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_PortRegRead | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint8_t | port, | ||
uint8_t | portReg, | ||
void * | readBuff, | ||
uint16_t | readLen | ||
) |
Port register reads the API will be used to read all port-specific registers.
context | HPI master library context pointer. |
slaveAddr | Slave device I2C address (7 bits). |
port | Reads the slave port number associated with the register. |
portReg | Port register address. |
readBuff | Reads the data buffer pointer. |
readLen | Read the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_PortRegWrite | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint8_t | port, | ||
uint8_t | portReg, | ||
void * | writeBuff, | ||
uint16_t | writeLen | ||
) |
Port register write API to all the port-specific registers.
context | HPI master library context pointer. |
slaveAddr | Slave device I2C address (7 bits). |
port | Writes the Slave port number associated with the register. |
portReg | Port register address. |
writeBuff | Writes the data buffer pointer. |
writeLen | Write the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_PdResponseRegRead | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint8_t | port, | ||
uint16_t | offset, | ||
void * | readData, | ||
uint16_t | readLen | ||
) |
PD Response register read API is used for response register read operations.
context | HPI master library context pointer. |
slaveAddr | Slave device I2C address (7 bits). |
port | Slave device port number. |
offset | Offset from the response register base address. |
readData | Reads the data buffer pointer. |
readLen | Read the number of bytes. |
cy_hpi_master_status_t Cy_HPI_Master_PdResponseRegWrite | ( | cy_hpi_master_context_t * | context, |
uint8_t | slaveAddr, | ||
uint8_t | port, | ||
uint16_t | offset, | ||
void * | writeBuff, | ||
uint16_t | writeLen | ||
) |
PD Response register write API is used for response register write operations.
context | HPI master library context pointer. |
slaveAddr | Slave device I2C address (7 bits). |
port | Slave device port number. |
offset | Offset from the response register base address. |
writeBuff | Writes the data buffer pointer. |
writeLen | Write the number of bytes. |
bool Cy_HPI_Master_SleepAllowed | ( | cy_hpi_master_context_t * | context | ) |
Checks if the device enters into Deep Sleep mode.
context | HPI master library context pointer. |