42 #include "aducrf101-include.h"
45 #define RIE_ENGINE_MAJOR_VERSION 1UL
46 #define RIE_ENGINE_MINOR_VERSION 0UL
49 #define RADIO_SPI_CLK_FREQ 4000000 // 4 MHz SPI CLK for radio interface
50 #define SYSTEM_UCLK 16000000 // 16 MHz UCLK
52 #define DEFAULT_CHNL_FREQ 915000000
53 #define FREQ_CNVRT_VAL 0.00252061538
55 #define PACKETRAM_START 0x10
56 #define PACKETRAM_LEN 240
57 #define BBRAM_START 0x100
58 #define PR_var_tx_mode_ADR 0x00D
61 #define PARAM_TX_NORMAL_PACKET 0
62 #define PARAM_TX_PREAMBLE_FOREVER 2
63 #define PARAM_TX_CARRIER_FOREVER 3
65 #define gpio_configure_sport_mode_0 0xA0
66 #define gpio_configure_default 0x00
67 #define MCR_pa_level_mcr_Adr 0x307
68 #define MCR_rssi_readback_Adr 0x312
69 #define MCR_gpio_configure_Adr 0x3fa
70 #define MCR_ext_uc_clk_divide_Adr 0x32e
71 #define MCR_interrupt_source_0_Adr 0x336
72 #define MCR_interrupt_source_1_Adr 0x337
75 #define RADIO_MISO_IN GP2IN_IN0_BBA
77 #define RADIO_CSN_DEASSERT (pADI_GP2->GPSET = GP2SET_SET3)
78 #define RADIO_CSN_ASSERT (pADI_GP2->GPCLR = GP2CLR_CLR3)
80 #define SEND_SPI(x) pADI_SPI0->SPITX = x
81 #define WAIT_SPI_RX while((pADI_SPI0->SPISTA & SPISTA_RXFSTA_MSK) == 0x0);
82 #define READ_SPI pADI_SPI0->SPIRX
85 #define MSKSET_VAL(byte,numbits,offset,value) ((byte & ~(((0x1 << numbits)-1) << offset)) | value)
102 CMD_PHY_SLEEP = 0xBA,
103 CMD_CONFIG_DEV = 0xBB,
127 #define STATUS_BYTE_FW_STATE (0x1F << 0)
128 #define STATUS_BYTE_CMD_READY (0x1 << 5)
129 #define STATUS_BYTE_IRQ_STATUS (0x1 << 6)
130 #define STATUS_BYTE_SPI_READY (0x1 << 7)
134 #define SPI_MEMCMD_BYTE0_ADR_MSK (0x3 << 0)
135 #define SPI_MEMCMD_BYTE0_CMD_BITOFFSET 3
136 #define SPI_MEMCMD_BYTE0_CMD_MSK (0x1F << SPI_MEMCMD_BYTE0_CMD_BITOFFSET)
146 RIE_U8 interrupt_mask_0_r;
155 RIE_U8 channel_freq_0_r;
156 RIE_U8 channel_freq_1_r;
157 RIE_U8 channel_freq_2_r;
166 RIE_U8 radio_cfg_8_r;
167 RIE_U8 radio_cfg_9_r;
170 RIE_U8 image_reject_cal_phase_r;
171 RIE_U8 image_reject_cal_amplitude_r;
174 RIE_U8 symbol_mode_r;
182 RIE_U8 tx_base_adr_r;
183 RIE_U8 rx_base_adr_r;
184 RIE_U8 packet_length_control_r;
185 RIE_U8 packet_length_max_r;
210 } TyRadioConfiguration;
214 #define interrupt_mask_0_interrupt_tx_eof (0x1 << 4)
215 #define interrupt_mask_0_interrupt_crc_correct (0x1 << 2)
217 #define packet_length_control_length_offset_offset (0)
218 #define packet_length_control_length_offset_minus0 (0x4 << packet_length_control_length_offset_offset)
219 #define packet_length_control_data_mode_offset (3)
220 #define packet_length_control_data_mode_packet (0x0 << packet_length_control_data_mode_offset)
221 #define packet_length_control_crc_en_yes (0x1 << 5)
222 #define packet_length_control_packet_len_variable (0x0 << 6)
223 #define packet_length_control_packet_len_fixed (0x1 << 6)
224 #define packet_length_control_data_byte_lsb (0x0 << 7)
226 #define symbol_mode_symbol_length_8_bit (0 << 0)
227 #define symbol_mode_data_whitening_disabled (0 << 3)
228 #define symbol_mode_data_whitening_enabled (1 << 3)
229 #define symbol_mode_eight_ten_enc_disabled (0 << 4 )
230 #define symbol_mode_prog_crc_en_disabled (0 << 5)
231 #define symbol_mode_manchester_enc_enabled (1 << 6)
233 #define radio_cfg_8_pa_single_diff_sel_single_ended (0x0 << 7)
234 #define radio_cfg_8_pa_single_diff_sel_differential (0x1 << 7)
235 #define radio_cfg_8_pa_power_numbits (4)
236 #define radio_cfg_8_pa_power_offset (3)
237 #define radio_cfg_8_pa_power_setting_63 (0xF << radio_cfg_8_pa_power_offset)
238 #define radio_cfg_8_pa_ramp_numbits (3)
239 #define radio_cfg_8_pa_ramp_offset (0)
240 #define radio_cfg_8_pa_ramp_16 (0x5 << radio_cfg_8_pa_ramp_offset)
242 #define radio_cfg_9_demod_scheme_offset (0)
243 #define radio_cfg_9_demod_scheme_FSK (0x0 << radio_cfg_9_demod_scheme_offset)
244 #define radio_cfg_9_mod_scheme_numbits (3)
245 #define radio_cfg_9_mod_scheme_offset (3)
246 #define radio_cfg_9_mod_scheme_2_level_FSK (0x0 << radio_cfg_9_mod_scheme_offset)
247 #define radio_cfg_9_mod_scheme_2_level_GFSK (0x1 << radio_cfg_9_mod_scheme_offset)
248 #define radio_cfg_9_ifbw_numbits (2)
249 #define radio_cfg_9_ifbw_offset (6)
250 #define radio_cfg_9_ifbw_100kHz (0x0 << radio_cfg_9_ifbw_offset)
251 #define radio_cfg_9_ifbw_150kHz (0x1 << radio_cfg_9_ifbw_offset)
252 #define radio_cfg_9_ifbw_200kHz (0x2 << radio_cfg_9_ifbw_offset)
253 #define radio_cfg_9_ifbw_300kHz (0x3 << radio_cfg_9_ifbw_offset)
258 static TyRadioConfiguration RadioConfiguration;
261 static RIE_U32 DataRate = 38400;
265 const RIE_U8 DR_38_4kbps_Dev20kHz_Configuration[] =
267 0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x76,0x62,0x21,
270 0x80,0x01,0xC8,0x20,0x0E,0x00,0x00,0x00,0xFD,0x00,0x0B,0x37,
273 0x40,0x0C,0x00,0x0C,0x00,0x00,
274 0x10,0x00,0xC3,0x36,0x10,0x10,0x24,0xF0,0x2A,0x00,0x2F,0x19,0x5E,0x46,0x5F,0x78,
275 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
279 const RIE_U8 DR_300_0kbps_Dev75_0kHz_Configuration[] =
281 0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x76,0x62,0x21,
284 0xB8,0x2B,0xEE,0x0B,0x70,0x00,0x03,0x00,0xFD,0xC0,0x0B,0x37,
287 0x40,0x0C,0x00,0x0C,0x00,0x00,
288 0x10,0x00,0xC3,0x36,0x10,0x10,0x24,0xF0,0x2A,0x00,0x2F,0x19,0x5E,0x46,0x5F,0x78,
289 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
294 const RIE_U8 DR_1_0kbps_Dev10_0kHz_Configuration[] =
296 0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x76,0x62,0x21,
298 0x0A,0x00,0x64,0x41,0x01,0x00,0x02,0x00,0xFD,0x00,0x0B,0x37,
301 0x40,0x0C,0x00,0x0C,0x00,0x00,
302 0x10,0x00,0xC3,0x36,0x10,0x10,0x24,0xF0,0x2A,0x00,0x2F,0x19,0x5E,0x46,0x5F,0x78,
303 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
311 static RIE_Responses RadioSendCommandBytes (RIE_U8 * pCmdBytes,
313 static RIE_Responses RadioSendCommandNoWait (Radio_CmdCodes CmdCode);
314 static RIE_Responses RadioSendCommandWait (Radio_CmdCodes CmdCode);
322 static RIE_Responses RadioWaitOnState (RadioState FinalState);
352 *pVersion = RIE_ENGINE_MINOR_VERSION | (RIE_ENGINE_MAJOR_VERSION << 8);
373 Response = RadioToOffMode();
375 Response = SetRadioConfiguration(BaseConfig);
377 Response = RadioCommitRadioConfig();
379 Response = RadioToOnMode();
404 pADI_GP2->GPCON = GP2CON_CON0_SPI0MISO | GP2CON_CON1_SPI0SCLK |
405 GP2CON_CON2_SPI0MOSI | GP2CON_CON3_GPIO |
406 GP2CON_CON4_IRQ8 | GP2CON_CON5_GPIO |
407 GP2CON_CON6_GPIO | GP2CON_CON7_GPIOIRQ7;
409 pADI_GP2->GPOEN = GP2OEN_OEN0_IN | GP2OEN_OEN1_IN |
410 GP2OEN_OEN2_IN | GP2OEN_OEN3_OUT |
411 GP2OEN_OEN4_IN | GP2OEN_OEN5_IN |
412 GP2OEN_OEN6_IN | GP2OEN_OEN7_IN;
415 GP2PUL_PUL4_BBA = 0x0;
418 pADI_SPI0->SPIDIV = ((SYSTEM_UCLK/RADIO_SPI_CLK_FREQ)/2)-0x1;
419 pADI_SPI0->SPICON = SPICON_MASEN |
424 pADI_SPI0->SPICON = SPICON_MASEN |
439 pADI_INTERRUPT->EI2CFG = EI2CFG_IRQ8MDE_HIGHLEVEL | EI2CFG_IRQ8EN;
443 pADI_INTERRUPT->EICLR = EICLR_IRQ8;
449 Response = RadioWaitForPowerUp();
451 Response = RadioSyncComms();
453 Response = RadioToOffMode();
455 Response = SetRadioConfiguration(BaseConfig);
457 Response = RadioCommitRadioConfig();
459 Response = RadioToOnMode();
480 pADI_GP2->GPCON = GP2CON_CON0_SPI0MISO | GP2CON_CON1_SPI0SCLK |
481 GP2CON_CON2_SPI0MOSI | GP2CON_CON3_GPIO |
482 GP2CON_CON4_IRQ8 | GP2CON_CON5_GPIO |
483 GP2CON_CON6_GPIO | GP2CON_CON7_GPIOIRQ7;
485 pADI_GP2->GPOEN = GP2OEN_OEN0_IN | GP2OEN_OEN1_IN |
486 GP2OEN_OEN2_IN | GP2OEN_OEN3_OUT |
487 GP2OEN_OEN4_IN | GP2OEN_OEN5_IN |
488 GP2OEN_OEN6_IN | GP2OEN_OEN7_IN;
491 GP2PUL_PUL4_BBA = 0x1;
494 pADI_SPI0->SPIDIV = ((SYSTEM_UCLK/RADIO_SPI_CLK_FREQ)/2)-0x1;
495 pADI_SPI0->SPICON = SPICON_MASEN |
500 pADI_SPI0->SPICON = SPICON_MASEN |
508 Response = RadioSendCommandNoWait(CMD_HW_RESET);
523 volatile RIE_U32 ulDelay;
526 Response = RadioSendCommandNoWait(CMD_HW_RESET);
555 Response = RadioToOnMode();
577 RIE_U32 EncodedFrequency;
579 bRadioConfigurationChanged =
RIE_TRUE;
581 EncodedFrequency = (RIE_U32)(Frequency * FREQ_CNVRT_VAL);
582 RadioConfiguration.channel_freq_0_r = (EncodedFrequency >> 0) & 0xFF;
583 RadioConfiguration.channel_freq_1_r = (EncodedFrequency >> 8) & 0xFF;
584 RadioConfiguration.channel_freq_2_r = (EncodedFrequency >> 16)& 0xFF;
585 if (Frequency >= 862000000)
587 RadioConfiguration.image_reject_cal_amplitude_r = 0x07;
588 RadioConfiguration.image_reject_cal_phase_r = 0x16;
592 RadioConfiguration.image_reject_cal_amplitude_r = 0x03;
593 RadioConfiguration.image_reject_cal_phase_r = 0x08;
616 RIE_U8 ucNewRegVal = RadioConfiguration.radio_cfg_9_r;
618 switch (ModulationType)
621 ucNewCode = radio_cfg_9_mod_scheme_2_level_FSK;
624 ucNewCode = radio_cfg_9_mod_scheme_2_level_GFSK;
632 ucNewRegVal = MSKSET_VAL(RadioConfiguration.radio_cfg_9_r,
633 radio_cfg_9_mod_scheme_numbits,
634 radio_cfg_9_mod_scheme_offset,
636 if (ucNewRegVal != RadioConfiguration.radio_cfg_9_r )
638 bRadioConfigurationChanged =
RIE_TRUE;
639 RadioConfiguration.radio_cfg_9_r = ucNewRegVal;
673 RIE_U8 ucNewRegVal = RadioConfiguration.symbol_mode_r;
678 ucNewRegVal &= ~symbol_mode_manchester_enc_enabled;
681 ucNewRegVal |= symbol_mode_manchester_enc_enabled;
689 if (ucNewRegVal != RadioConfiguration.symbol_mode_r )
691 bRadioConfigurationChanged =
RIE_TRUE;
692 RadioConfiguration.symbol_mode_r = ucNewRegVal;
732 RIE_U8 ucNewRegVal = RadioConfiguration.symbol_mode_r;
737 ucNewRegVal &= ~symbol_mode_data_whitening_enabled;
740 ucNewRegVal |= symbol_mode_data_whitening_enabled;
748 if (ucNewRegVal != RadioConfiguration.symbol_mode_r )
750 bRadioConfigurationChanged =
RIE_TRUE;
751 RadioConfiguration.symbol_mode_r = ucNewRegVal;
777 if (Len > PACKETRAM_LEN)
780 Response = RadioToOnMode();
782 Response = RadioMMapWrite(PACKETRAM_START, Len, pData);
785 RadioConfiguration.packet_length_max_r = Len;
786 RadioConfiguration.packet_length_control_r |= packet_length_control_packet_len_fixed;
789 Response = RadioCommitRadioConfig();
791 Response = RadioToOnMode();
793 Response = RadioSendCommandWait(CMD_PHY_TX);
820 if (Len > PACKETRAM_LEN)
823 Response = RadioToOnMode();
825 Response = RadioMMapWrite(PACKETRAM_START, 0x1, &Len);
827 Response = RadioMMapWrite(PACKETRAM_START+0x1, Len-1, pData);
830 RadioConfiguration.packet_length_max_r = PACKETRAM_LEN;
831 RadioConfiguration.packet_length_control_r &= ~packet_length_control_packet_len_fixed;
834 Response = RadioCommitRadioConfig();
836 Response = RadioToOnMode();
838 Response = RadioSendCommandWait(CMD_PHY_TX);
882 RIE_U8 ucNewRegVal = 0x0;
883 unsigned long pa_level_mcr,pa_ramp, codes_per_bit,min_codes_per_bit;
888 ucNewRegVal |= radio_cfg_8_pa_single_diff_sel_differential;
891 ucNewRegVal |= radio_cfg_8_pa_single_diff_sel_single_ended;
917 ucNewRegVal |= ((RIE_U8)Power << radio_cfg_8_pa_power_offset);
919 pa_level_mcr = (((RIE_U8)Power)* 4) + 0x3;
920 min_codes_per_bit = (pa_level_mcr * 2500)/(DataRate/100);
923 while (codes_per_bit > min_codes_per_bit)
926 codes_per_bit = 512 >> pa_ramp;
930 ucNewRegVal |= ((RIE_U8)pa_ramp << radio_cfg_8_pa_ramp_offset);
940 if (ucNewRegVal != RadioConfiguration.radio_cfg_8_r )
942 bRadioConfigurationChanged =
RIE_TRUE;
943 RadioConfiguration.radio_cfg_8_r = ucNewRegVal;
962 RIE_U8 ParamTX = PARAM_TX_CARRIER_FOREVER;
965 Response = RadioCommitRadioConfig();
968 Response = RadioToOnMode();
971 Response = RadioMMapWrite(PR_var_tx_mode_ADR,
sizeof(ParamTX),&ParamTX);
973 Response = RadioSendCommandWait(CMD_PHY_TX);
990 RIE_U8 ParamTX = PARAM_TX_PREAMBLE_FOREVER;
993 Response = RadioCommitRadioConfig();
995 Response = RadioToOnMode();
999 Response = RadioMMapWrite(PR_var_tx_mode_ADR,
sizeof(ParamTX),&ParamTX);
1001 Response = RadioSendCommandWait(CMD_PHY_TX);
1022 if (Len > PACKETRAM_LEN)
1027 RadioConfiguration.packet_length_max_r = Len;
1028 RadioConfiguration.packet_length_control_r |= packet_length_control_packet_len_fixed;
1031 Response = RadioCommitRadioConfig();
1033 Response = RadioToOnMode();
1035 Response = RadioSendCommandWait(CMD_PHY_RX);
1058 RadioConfiguration.packet_length_max_r = PACKETRAM_LEN;
1059 RadioConfiguration.packet_length_control_r &= ~packet_length_control_packet_len_fixed;
1062 Response = RadioCommitRadioConfig();
1064 Response = RadioToOnMode();
1066 Response = RadioSendCommandWait(CMD_PHY_RX);
1132 if(RadioConfiguration.packet_length_control_r & packet_length_control_packet_len_fixed)
1135 *pPktLen = RadioConfiguration.packet_length_max_r;
1136 RdLen = RadioConfiguration.packet_length_max_r;
1137 if (RdLen > BufferLen)
1140 Response = RadioMMapRead(PACKETRAM_START,RdLen, pData);
1145 Response = RadioMMapRead(PACKETRAM_START,0x1, &RdLen);
1149 if (RdLen > BufferLen)
1152 Response = RadioMMapRead(PACKETRAM_START+0x1,RdLen, pData);
1158 Response = RadioMMapRead(MCR_rssi_readback_Adr,0x1, (RIE_U8 *)pRSSIdBm);
1192 pADI_MISC->RFTST = 0x7E1;
1195 Response = RadioCommitRadioConfig();
1199 Data = gpio_configure_sport_mode_0;
1201 Response = RadioMMapWrite(MCR_gpio_configure_Adr, 0x1, (RIE_U8 *)&Data);
1206 Response = RadioMMapWrite(MCR_ext_uc_clk_divide_Adr,
1210 Response = RadioSendCommandWait(CMD_PHY_RX);
1225 if(bTestModeEnabled)
1228 Data = gpio_configure_default;
1230 Response = RadioMMapWrite(MCR_gpio_configure_Adr, 0x1, (RIE_U8 *)&Data);
1233 Response = RadioMMapWrite(MCR_ext_uc_clk_divide_Adr,
1237 Data = PARAM_TX_NORMAL_PACKET;
1239 Response = RadioMMapWrite(PR_var_tx_mode_ADR,
sizeof(Data),&Data);
1242 if (bRadioConfigurationChanged)
1244 Response = RadioConfigure();
1264 Response = RadioSPIXferByte(SPI_NOP,
NULL);
1266 Response = RadioSPIXferByte(SPI_NOP,&StatusByte);
1270 *pState = (RadioState)(StatusByte & STATUS_BYTE_FW_STATE);
1280 static RIE_Responses RadioWaitOnState(RadioState FinalState)
1283 RadioState CurrState;
1286 Response = RadioReadState(&CurrState);
1288 while((Response ==
RIE_Success) && (CurrState != FinalState));
1307 Response = RadioSPIXferByte(SPI_NOP,
NULL);
1309 Response = RadioSPIXferByte(SPI_NOP,&StatusByte);
1313 if(StatusByte & STATUS_BYTE_CMD_READY)
1336 Response = RadioReadState(&FwState);
1338 while ((FwState != FW_ON) && (Response ==
RIE_Success))
1346 Response = RadioSendCommandNoWait(CMD_PHY_ON);
1348 Response = RadioWaitOnState (FW_ON);
1352 Response = RadioSendCommandNoWait(CMD_PHY_ON);
1354 Response = RadioWaitOnState (FW_ON);
1358 Response = RadioSendCommandNoWait(CMD_PHY_ON);
1360 Response = RadioWaitOnState (FW_ON);
1364 Response = RadioReadState(&FwState);
1385 Response = RadioReadState(&FwState);
1387 while ((FwState != FW_OFF) && (Response ==
RIE_Success))
1395 Response = RadioSendCommandNoWait(CMD_PHY_ON);
1397 Response = RadioWaitOnState (FW_ON);
1401 Response = RadioSendCommandNoWait(CMD_PHY_ON);
1403 Response = RadioWaitOnState (FW_ON);
1407 Response = RadioSendCommandNoWait(CMD_PHY_OFF);
1409 Response = RadioWaitOnState (FW_OFF);
1413 Response = RadioReadState(&FwState);
1428 Response = RadioSendCommandWait(CMD_SYNC);
1430 Response = RadioWaitOnCmdLdr();
1447 while (!RADIO_MISO_IN && (i < 1000))
1461 void Ext_Int8_Handler (
void)
1468 Response = RadioMMapRead(MCR_interrupt_source_0_Adr,0x1, &ucInt0);
1470 Response = RadioMMapRead(MCR_interrupt_source_1_Adr,0x1,&ucInt1);
1471 if (ucInt0 & interrupt_mask_0_interrupt_tx_eof)
1473 if (ucInt0 & interrupt_mask_0_interrupt_crc_correct) {
1479 Response = RadioMMapWrite(MCR_interrupt_source_0_Adr,0x1, &ucInt0);
1481 Response = RadioMMapWrite(MCR_interrupt_source_1_Adr,0x1,&ucInt1);
1483 pADI_INTERRUPT->EICLR = EICLR_IRQ8;
1495 static RIE_Responses RadioSPIXferByte(RIE_U8 ucByte,RIE_U8 *pData)
1521 static RIE_Responses RadioSendCommandBytes(RIE_U8 *pCmdBytes,RIE_U8 NumBytes)
1528 Response = RadioSPIXferByte(*(pCmdBytes++),
NULL);
1541 static RIE_Responses RadioSendCommandNoWait (Radio_CmdCodes CmdCode )
1543 RIE_U8 Command = (RIE_U8)CmdCode;
1544 return RadioSendCommandBytes(&Command,0x1);
1553 static RIE_Responses RadioSendCommandWait (Radio_CmdCodes CmdCode )
1556 RIE_U8 Command = (RIE_U8)CmdCode;
1559 Response = RadioWaitOnCmdLdr();
1561 Response = RadioSendCommandBytes(&Command,0x1);
1572 static RIE_Responses RadioMMapRead(RIE_U32 ulAdr, RIE_U32 ulLen, RIE_U8 *pData)
1580 Response = RadioSPIXferByte(SPI_MEM_RD | ((ulAdr & 0x700) >> 8),
NULL);
1582 Response = RadioSPIXferByte((RIE_U8)(ulAdr & 0xFF),
NULL);
1584 Response = RadioSPIXferByte((RIE_U8)SPI_NOP,
NULL);
1586 Response = RadioSPIXferByte(SPI_NOP,pData++);
1600 static RIE_Responses RadioMMapWrite(RIE_U32 ulAdr,RIE_U32 ulLen,RIE_U8 * pData)
1607 Response = RadioSPIXferByte(SPI_MEM_WR | ((ulAdr & 0x700) >> 8),
NULL);
1609 Response = RadioSPIXferByte((RIE_U8)(ulAdr & 0xFF),
NULL);
1611 Response = RadioSPIXferByte(*(pData++),
NULL);
1630 bRadioConfigurationChanged =
RIE_TRUE;
1634 memcpy((
void *)&RadioConfiguration,
1635 (
void *)DR_1_0kbps_Dev10_0kHz_Configuration,
1636 sizeof(TyRadioConfiguration));
1640 memcpy((
void *)&RadioConfiguration,
1641 (
void *)DR_38_4kbps_Dev20kHz_Configuration,
1642 sizeof(TyRadioConfiguration));
1646 memcpy((
void *)&RadioConfiguration,
1647 (
void *)DR_300_0kbps_Dev75_0kHz_Configuration,
1648 sizeof(TyRadioConfiguration));
1667 Response = RadioToOffMode();
1669 Response = RadioMMapWrite(BBRAM_START,
1670 sizeof(TyRadioConfiguration),
1671 (RIE_U8 *)&RadioConfiguration);
1673 Response = RadioSendCommandWait(CMD_CONFIG_DEV);
1675 Response = RadioToOnMode();
1697 Response = RadioCommitRadioConfig();
1699 Response = RadioToOnMode();
1701 Response = RadioSendCommandWait(CMD_GET_RSSI);
1703 Response = RadioSyncComms();
1707 Response = RadioMMapRead(MCR_rssi_readback_Adr,0x1, (RIE_U8 *)pRSSIdBm);
1730 RIE_U8 ucNewRegVal = RadioConfiguration.radio_cfg_8_r;
1731 unsigned long pa_level_mcr,pa_ramp, codes_per_bit,min_codes_per_bit;
1733 if (RadioConfiguration.radio_cfg_8_r & radio_cfg_8_pa_single_diff_sel_differential)
1734 ucNewRegVal = radio_cfg_8_pa_single_diff_sel_differential;
1736 ucNewRegVal = radio_cfg_8_pa_single_diff_sel_single_ended;
1758 ucNewRegVal |= ((RIE_U8)Power << radio_cfg_8_pa_power_offset);
1760 pa_level_mcr = (((RIE_U8)Power)* 4) + 0x3;
1761 min_codes_per_bit = (pa_level_mcr * 2500)/(DataRate/100);
1763 codes_per_bit = 256;
1764 while (codes_per_bit > min_codes_per_bit)
1767 codes_per_bit = 512 >> pa_ramp;
1771 ucNewRegVal |= ((RIE_U8)pa_ramp << radio_cfg_8_pa_ramp_offset);
1781 if (ucNewRegVal != RadioConfiguration.radio_cfg_8_r )
1785 Response = RadioMMapWrite(MCR_pa_level_mcr_Adr, 0x1, (RIE_U8 *)&ucNewRegVal);
1786 RadioConfiguration.radio_cfg_8_r = ucNewRegVal;
RIE_Responses RadioTxCarrier(void)
Transmit a carrier tone using the current radio configuration.
RIE_BOOL RadioTxPacketComplete(void)
Checks if a packet has finished transmitting.
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
Enable External Interrupt.
RIE_Responses RadioTerminateRadioOp(void)
Terminate a currently running radio RX or TX operation.
RIE_Responses RadioRxBERTestMode(void)
Enter receiver Bit Error Rate (BER) test mode where the clock and data appear on GPIO pins...
RIE_Responses RadioTxPreamble(void)
Transmit a pre-amble (alternating ones and zeros) using the current radio configuration.
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
Clear Pending Interrupt.
RIE_Responses RadioDeInit(void)
Deinitialise the Radio, and power it down.
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
Disable External Interrupt.
#define NULL
The null pointer.
RIE_Responses RadioRxPacketRead(RIE_U8 BufferLen, RIE_U8 *pPktLen, RIE_U8 *pData, RIE_S8 *pRSSIdBm)
Read the packet that was received by the radio.
void aducrf101_rx_packet_hook(void)
Trigger function called by ADI radio engine upon packet RX.
RIE_BOOL RadioRxPacketAvailable(void)
Checks if a packet has been received.
RIE_Responses RadioSetModulationType(RIE_ModulationTypes ModulationType)
Set the Radio Transmitter Modulation Type.
RIE_Responses RadioPowerOff(void)
Shutdown the radio and place it in its lowest power sleep mode.
RIE_Responses RadioRadioGetRSSI(RIE_S8 *pRSSIdBm)
Return a Received Signal Strength Indicator value.
RIE_Responses RadioSwitchConfig(RIE_BaseConfigs BaseConfig)
Change the Radio to using specified configuration.
RIE_Responses RadioPayldManchesterEncode(RIE_BOOL bEnable)
Enable or Disable Manchester Encoding of payload data.
RIE_Responses RadioSetFrequency(RIE_U32 Frequency)
Set frequency for radio communications.
RIE_Responses RadioTxSetPower(RIE_PAPowerLevel Power)
Set the Transmit Power Level for Radio Transmission.
RIE_Responses RadioRxPacketFixedLen(RIE_U8 Len)
Enter receive mode and wait for a packet to be received.
RIE_Responses RadioGetAPIVersion(RIE_U32 *pVersion)
Return the Radio Interface Engine API Version.
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
Set Interrupt Priority.
RIE_Responses RadioRxPacketVariableLen(void)
Enter receive mode and wait for a packet to be received.
RIE_Responses RadioTxSetPA(RIE_PATypes PAType, RIE_PAPowerLevel Power)
Set PA Type and the Transmit Power Level for Radio Transmission.
RIE_Responses RadioTxPacketVariableLen(RIE_U8 Len, RIE_U8 *pData)
Transmit a Variable length packet.
RIE_Responses RadioInit(RIE_BaseConfigs BaseConfig)
Initialise the Radio, using specified configuration.
RIE_Responses RadioPayldDataWhitening(RIE_BOOL bEnable)
Enable or Disable Data Whitening of payload data.
RIE_Responses RadioTxPacketFixedLen(RIE_U8 Len, RIE_U8 *pData)
Transmit a fixed length packet.