我使用CC3235SF的定时器中断去读取数据的时候,进入中断后,在IIC读取数据函数上数据读取失败,但是不在中断里去读取数据时却能正常进行寄存器读写,这是为什么呢?
定时器初始化
中断调用数据读取接口
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I2C使用的是阻塞还是回调模式,I2C_transfer()只会返回true或false,Null是怎么来的:
bool I2C_transfer ( I2C_Handle handle, I2C_Transaction * transaction ) Perform an I2C transaction with an I2C slave peripheral. This function will perform an I2C transfer, as specified by an I2C_Transaction structure. Note When using I2C_MODE_BLOCKING, this must be called from a thread context. Parameters [in] handle An I2C_Handle returned from I2C_open() [in] transaction A pointer to an I2C_Transaction. The application is responsible for allocating and initializing an I2C_Transaction structure prior to passing it to I2C_Transfer(). This structure must persist in memory unmodified until the transfer is complete. Note I2C_Transaction structures cannot be re-used until the previous transaction has completed. Upon the completion of a transaction, the I2C_Transaction.status may be used for error handling. Returns In I2C_MODE_BLOCKING: true for a successful transfer; false for an error (for example, an I2C bus fault (NACK)). In I2C_MODE_CALLBACK: always true. The I2C_CallbackFxn bool argument will be true to indicate success, and false to indicate an error.
另外注意定时器定时时间内是否可以读完数据
在中断程序中不应有任何形式的阻塞,这可能会导致中断程序不能及时处理
请问这个callbackfxn的作用是什么呢?我应该怎么写这个callbackfxn函数
callback说明及使用查看里面的说明:https://dev.ti.com/tirex/content/simplelink_cc32xx_sdk_5_20_00_06/docs/drivers/doxygen/html/_i2_c_8h.html