/*! * Gets a command response from the radio chip * * @param cmd Command ID * @param pollCts Set to poll CTS * @param byteCount Number of bytes to get from the radio chip * @param pData Pointer to where to put the data */ void radio_comm_WriteData(U8 cmd, U8 pollCts, U8 byteCount, U8* pData) { if(pollCts) { while(!ctsWentHigh) { radio_comm_PollCTS(); } } radio_hal_ClearNsel(); radio_hal_SpiWriteByte(cmd); radio_hal_SpiWriteData(byteCount, pData); radio_hal_SetNsel(); ctsWentHigh = 0; }
/*! * Sends a command to the radio chip * * @param byteCount Number of bytes in the command to send to the radio device * @param pData Pointer to the command to send. */ void radio_comm_SendCmd(U8 byteCount, U8* pData) { /* There was a bug in A1 hardware that will not handle 1 byte commands. It was supposedly fixed in B0 but the fix didn't make it at the last minute, so here we go again */ if (byteCount == 1) byteCount++; while (!ctsWentHigh) { radio_comm_PollCTS(); } radio_hal_ClearNsel(); radio_hal_SpiWriteData(byteCount, pData); radio_hal_SetNsel(); ctsWentHigh = 0; }
/*! * Gets a command response from the radio chip * * @param cmd Command ID * @param pollCts Set to poll CTS * @param byteCount Number of bytes to get from the radio chip * @param pData Pointer to where to put the data */ void radio_comm_WriteData(U8 cmd, uint8 pollCts, U16 byteCount, U8* pData) { if(pollCts) { while(!ctsWentHigh) { radio_comm_PollCTS(); } } radio_hal_ClearNsel(); radio_hal_SpiWriteByte(cmd); //int TimBaseVal=GetTimingBase(); radio_hal_SpiWriteData(byteCount, pData); radio_hal_SetNsel(); ctsWentHigh = 0; }