1.低功耗问题
使用结束后,必须将spi反初始化,设置为输入悬空,不然会有大概500uA的漏电。
2.SPI读取的问题
在实际使用中,SPI总线可能不止挂载一个SPI器件,所以要控制不同的SPI的CS引脚,这就需要对SDK的源码进行修改,以下是SDK的源码;
/**
* @brief This function serves to read a bulk of data from the SPI slave
* device specified by the CS pin
* @param[in] Cmd - pointer to the command bytes needed written into the
* slave device first before the reading operation of actual data
* @param[in] CmdLen - length in byte of the command bytes
* @param[out] Data - pointer to the buffer that will cache the reading out data
* @param[in] DataLen - length in byte of the data need to read
* @param[in] CSPin - the CS pin specifing the slave device
* @return none
*/
void spi_read(unsigned char *Cmd, int CmdLen, unsigned char *Data, int DataLen, GPIO_PinTypeDef CSPin)
{
int i = 0;
unsigned char te