2 This project is free software: you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation, either version 3 of the License, or
5 (at your option) any later version.
7 Multiprotocol is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
16 #if defined(FAKE_NRF24L01_INO)
18 #include "iface_nrf250k.h"
20 static void __attribute__((unused)) FAKE_send_packet()
22 for(uint8_t i=0;i<5;i++)
24 NRF24L01_WriteReg(NRF24L01_07_STATUS, (_BV(NRF24L01_07_RX_DR) | _BV(NRF24L01_07_TX_DS) | _BV(NRF24L01_07_MAX_RT)));
26 NRF24L01_WritePayload(packet, 5);
29 static void __attribute__((unused)) FAKE_init()
36 CC2500_WriteReg(CC2500_07_PKTCTRL1, 0x01); // Packet Automation Control
37 CC2500_WriteReg(CC2500_08_PKTCTRL0, 0x00); // Packet Automation Control
38 CC2500_WriteReg(CC2500_12_MDMCFG2, 0x12); // Modem Configuration
39 CC2500_WriteReg(CC2500_13_MDMCFG1, 0x13); // Modem Configuration
40 CC2500_WriteReg(CC2500_04_SYNC1, 0x11);
41 CC2500_WriteReg(CC2500_05_SYNC0, 0x33);
42 CC2500_WriteReg(CC2500_09_ADDR, 0x99);
43 CC2500_WriteReg(CC2500_06_PKTLEN, 10);
45 CC2500_SetTxRxMode(RX_EN);
46 CC2500_Strobe(CC2500_SIDLE);
47 CC2500_Strobe(CC2500_SRX);
48 //CC2500_SetTxRxMode(TX_EN);
53 PE1_on; //NRF24L01 antenna RF3 by default
54 PE2_off; //NRF24L01 antenna RF3 by default
55 NRF24L01_Initialize();
56 NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x7f);
57 NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00);//0x3f); // AA on all pipes
58 NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x3f); // Enable all pipes
59 NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03); // 5-byte address
60 NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x36); // retransmit 1ms, 6 times
61 NRF24L01_SetBitrate(NRF24L01_BR_250K); // 1Mbps
63 NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t *)"\x99\x33\x11\xAA\xAA", 5); //Bind address
64 NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t *)"\x99\x33\x11\xAA\xAA", 5); //Bind address
65 NRF24L01_WriteReg(NRF24L01_05_RF_CH, 0);
66 NRF24L01_Activate(0x73); // Activate feature register
67 NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3f); // Enable dynamic payload length
68 NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x07); // Enable all features
71 NRF24L01_SetTxRxMode(TX_EN);*/
74 uint16_t FAKE_callback()
76 len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
77 if(len) debug("L=%d, ",len);
78 if(len && len < sizeof(packet_in))
80 CC2500_ReadData(packet_in, len);
82 for(uint8_t i=0;i<len;i++)
83 debug(" %02X", packet_in[i]);
86 CC2500_Strobe(CC2500_SFRX);
87 CC2500_Strobe(CC2500_SIDLE);
88 CC2500_Strobe(CC2500_SRX);
93 PE1_off; //antenna RF2
96 for(uint8_t i=1;i<5;i++)
98 CC2500_WriteData(packet, 5);*/