📄 if101_communication.h
字号:
/* * Functions about Platform Definition Header * * The API define the available function call for IF101 Operations layer * * Innofidei Inc. * * By: Mason Chen <masonchen@innofidei.com> * * Release: * Version 0.1 : 20080106 * Version 0.2 : 20080123 * * * NOTE: Based on certain platform and OS, user should implement the functions defined in this header * IF101 operations layer calls for thest functions * */#ifndef INNO_COMMUNICATION_H#define INNO_COMMUNICATION_H/* * Init I2C interface * * Parameter: * enable <in> : enable or disable I2C interface * * Example: * INNO_I2C_Init(1); // Enable I2C interface * INNO_I2C_Init(0); // Enable I2C interface * * NOTE: * This API is for IO layer */INNO_RETURN_CODE INNO_I2C_Init(int enable);/* * Write One Byte to a I2C register of IF101 * IF101 is as slave in I2C communication and IF101 slave address is 0x10; * * Parameter: * addr <in> : Register address. * data <in> : The data want to write to addr. * */INNO_RETURN_CODE INNO_I2C_Write(unsigned char addr, unsigned char data);/* * Read one byte data from a I2C register of IF101 * IF101 is as slave in I2C communication and IF101 slave address is 0x10; * * Parameter: * addr <in> : Register address. * data <out> : The data want to write to addr. * */INNO_RETURN_CODE INNO_I2C_Read(unsigned char addr, unsigned char *data);/* * Init SPI interface * * Parameter: * enable <in> : enable or disable SPI interface * * Example: * INNO_SPI_Init(1); // Enable SPI interface * INNO_SPI_Init(0); // Enable SPI interface * * NOTE: * This API is for IO layer */INNO_RETURN_CODE INNO_SPI_Init(int enable);/* * Write one byte to SPI bus * * */INNO_RETURN_CODE INNO_SPI_Write_One_Byte(unsigned char data);/* * Read one byte from SPI bus * * Parameter: * data <out> : the data read from SPI bus * */INNO_RETURN_CODE INNO_SPI_Read_One_Byte(unsigned char *data);/* * Read several bytes from SPI bus * * Parameter: * buffer <out> : the buffer point to store data from SPI bus * len <in> : how many bytes will be read from SPI * * NOTE: * Please make sure SPI chip select is active(low) in the whole process of read bytes from SPI */INNO_RETURN_CODE INNO_SPI_Read_Bytes(unsigned char *buffer, int len);/* * Init GPIO interrrupt * * Parameter: * enable <in> : enable or disable GPIO interrupt * handler <in> : Interrupt handler function pointer * * NOTE: * This API is for IO layer */INNO_RETURN_CODE INNO_GPIO_INT_Init(int enable, void *handler);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -