mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 21:08:12 +00:00
SLT: fix going from NRF to CC2500
This commit is contained in:
parent
5124c2a96d
commit
5503502bad
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 0
|
||||
#define VERSION_PATCH_LEVEL 69
|
||||
#define VERSION_PATCH_LEVEL 70
|
||||
|
||||
//******************
|
||||
// Protocols
|
||||
|
@ -353,7 +353,11 @@ static void __attribute__((unused)) XN297L_SetFreqOffset()
|
||||
|
||||
static void __attribute__((unused)) NRF250K_SetTXAddr(uint8_t* addr, uint8_t len)
|
||||
{
|
||||
if (len > 5) len = 5;
|
||||
if (len < 3) len = 3;
|
||||
#ifdef CC2500_INSTALLED
|
||||
xn297_addr_len = len;
|
||||
memcpy(xn297_tx_addr, addr, len);
|
||||
if(option==0)
|
||||
#endif
|
||||
{//NRF
|
||||
@ -361,12 +365,6 @@ static void __attribute__((unused)) NRF250K_SetTXAddr(uint8_t* addr, uint8_t len
|
||||
return;
|
||||
}
|
||||
//CC2500
|
||||
#ifdef CC2500_INSTALLED
|
||||
if (len > 5) len = 5;
|
||||
if (len < 3) len = 3;
|
||||
xn297_addr_len = len;
|
||||
memcpy(xn297_tx_addr, addr, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) NRF250K_WritePayload(uint8_t* msg, uint8_t len)
|
||||
@ -388,16 +386,15 @@ static void __attribute__((unused)) NRF250K_WritePayload(uint8_t* msg, uint8_t l
|
||||
|
||||
//nrf preamble
|
||||
if(xn297_tx_addr[xn297_addr_len - 1] & 0x80)
|
||||
buf[0]=0x55;
|
||||
else
|
||||
buf[0]=0xAA;
|
||||
else
|
||||
buf[0]=0x55;
|
||||
last++;
|
||||
// address
|
||||
for (i = 0; i < xn297_addr_len; ++i)
|
||||
buf[last++] = xn297_tx_addr[xn297_addr_len - i - 1];
|
||||
// payload
|
||||
for (i = 0; i < len; ++i)
|
||||
// bit-reverse bytes in packet
|
||||
buf[last++] = msg[i];
|
||||
|
||||
// crc
|
||||
@ -407,6 +404,9 @@ static void __attribute__((unused)) NRF250K_WritePayload(uint8_t* msg, uint8_t l
|
||||
buf[last++] = crc >> 8;
|
||||
buf[last++] = crc & 0xff;
|
||||
|
||||
//for(uint8_t i=0;i<last;i++)
|
||||
// debug("%02X ",buf[i]);
|
||||
//debugln("");
|
||||
// stop TX/RX
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
// flush tx FIFO
|
||||
|
@ -49,7 +49,8 @@ enum {
|
||||
SLT_DATA2,
|
||||
SLT_DATA3,
|
||||
SLT_BIND1,
|
||||
SLT_BIND2
|
||||
SLT_BIND2,
|
||||
SLT_TEST
|
||||
};
|
||||
|
||||
static void __attribute__((unused)) SLT_init()
|
||||
@ -120,6 +121,7 @@ static void __attribute__((unused)) SLT_build_packet()
|
||||
static uint8_t calib_counter=0;
|
||||
|
||||
// Set radio channel - once per packet batch
|
||||
NRF250K_SetFreqOffset(); // Set frequency offset
|
||||
NRF250K_Hopping(hopping_frequency_no);
|
||||
if (++hopping_frequency_no >= SLT_NFREQCHANNELS)
|
||||
hopping_frequency_no = 0;
|
||||
@ -258,7 +260,13 @@ uint16_t SLT_callback()
|
||||
return 20000-SLT_TIMING_BUILD-SLT_V1_TIMING_BIND2;
|
||||
else //V2
|
||||
return 13730-SLT_TIMING_BUILD-SLT_V2_TIMING_BIND1-SLT_V2_TIMING_BIND2;
|
||||
}
|
||||
/* case SLT_TEST:
|
||||
for(uint8_t i=0;i<10;i++)
|
||||
packet[i]=0x10+i;
|
||||
NRF250K_WritePayload(packet,10);
|
||||
NRF250K_SetFreqOffset(); // Set frequency offset
|
||||
return 5000;
|
||||
*/ }
|
||||
return 19000;
|
||||
}
|
||||
|
||||
@ -279,6 +287,11 @@ uint16_t initSLT()
|
||||
SLT_set_freq();
|
||||
SLT_init();
|
||||
phase = SLT_BUILD;
|
||||
|
||||
/* phase=SLT_TEST;
|
||||
NRF250K_SetTXAddr((uint8_t*)"\x01\x02\x03\x04\x05",5);
|
||||
NRF250K_RFChannel(0);
|
||||
*/
|
||||
return 50000;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user