iic
Vitis Drivers API Documentation
|
This file contains an interrupt based design example which uses the Xilinx IIC device and driver to exercise the temperature sensor on the ML300 board.
This example only performs read operations (receive) from the IIC temperature sensor of the platform.
The XIic_MasterRecv() API is used to receive the data.
This example assumes that there is an interrupt controller in the hardware system and the IIC device is connected to the interrupt controller.
7-bit addressing is used to access the tempsensor.
None
MODIFICATION HISTORY:
Ver Who Date Changes
1.00a jhl 09/10/03 Created 1.00a sv 05/09/05 Minor changes to comply to Doxygen and coding guidelines 3.4 ms 01/23/17 Added xil_printf statement in main function to ensure that "Successfully ran" and "Failed" strings are available in all examples. This is a fix for CR-965028. 3.10 gm 07/09/23 Added SDT support.
Functions | |
int | TempSensorExample (u16 IicDeviceId, u8 TempSensorAddress, u8 *TemperaturePtr) |
The function reads the temperature of the IIC temperature sensor on the IIC bus. More... | |
int | main (void) |
The purpose of this function is to illustrate how to use the IIC driver to read the temperature. More... | |
int main | ( | void | ) |
The purpose of this function is to illustrate how to use the IIC driver to read the temperature.
References TempSensorExample().
int TempSensorExample | ( | u16 | IicDeviceId, |
u8 | TempSensorAddress, | ||
u8 * | TemperaturePtr | ||
) |
The function reads the temperature of the IIC temperature sensor on the IIC bus.
It initializes the IIC device driver and sets it up to communicate with the temperature sensor. This function does contain a loop that polls for completion of the IIC processing such that it may not return if interrupts or the hardware are not working.
IicDeviceId | is the XPAR_<IIC_instance>_DEVICE_ID value from xparameters.h for the IIC Device |
TempSensorAddress | is the address of the Temperature Sensor device on the IIC bus |
TemperaturePtr | is the data byte read from the temperature sensor |
References XIic_Config::BaseAddress, XII_ADDR_TO_SEND_TYPE, XIic_CfgInitialize(), XIic_InterruptHandler(), XIic_LookupConfig(), XIic_MasterRecv(), XIic_SetAddress(), XIic_SetRecvHandler(), XIic_SetStatusHandler(), and XIic_Start().
Referenced by main().