/*! * Power up the Radio, set GPIOs to HiZ state, get Part Info * then set Sleep mode. * * @note * */ void vRadio_PowerUp(void) { SEGMENT_VARIABLE(wDelay, U16, SEG_XDATA) = 0u; si4455_reset(); for (; wDelay < pRadioConfiguration->Radio_Delay_Cnt_After_Reset; wDelay++); si4455_power_up(pRadioConfiguration->Radio_BOOT_OPTIONS, pRadioConfiguration->Radio_XTAL_OPTIONS, pRadioConfiguration->Radio_XO_FREQ); radio_comm_PollCTS(); }
/*! * 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; }
void radio_comm_ReadData(U8 cmd, uint8 pollCts, U16 byteCount, U8* pData) { if(pollCts) { while(!ctsWentHigh) { radio_comm_PollCTS(); } } radio_hal_ClearNsel(); //int TimBaseVal=GetTimingBase(); radio_hal_SpiWriteByte(cmd); radio_hal_SpiReadData(byteCount, pData); radio_hal_SetNsel(); ctsWentHigh = 0; }