mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-10 00:08:13 +00:00
Change Looptimes
state => bind_counter
This commit is contained in:
parent
d940a7e49a
commit
a7ea8e012e
@ -17,8 +17,8 @@
|
||||
|
||||
#include "iface_cc2500.h"
|
||||
|
||||
#define REDPINE_LOOPTIME_FAST 9 //9ms
|
||||
#define REDPINE_LOOPTIME_SLOW 22 //22ms
|
||||
#define REDPINE_LOOPTIME_FAST 25 //2.5ms
|
||||
#define REDPINE_LOOPTIME_SLOW 6 //6ms
|
||||
|
||||
#define REDPINE_BIND 1000
|
||||
#define REDPINE_PACKET_SIZE 11
|
||||
@ -98,46 +98,47 @@ static void REDPINE_data_frame() {
|
||||
|
||||
static uint16_t ReadREDPINE()
|
||||
{
|
||||
if ( prev_option != option )
|
||||
{ // Frequency adjust
|
||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
||||
prev_option = option ;
|
||||
}
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
if(bind_counter== REDPINE_BIND)
|
||||
REDPINE_init(0);
|
||||
if(state == REDPINE_BIND/2)
|
||||
REDPINE_init(1);
|
||||
REDPINE_set_channel(49);
|
||||
CC2500_SetPower();
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
REDPINE_build_bind_packet();
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_WriteData(packet, REDPINE_PACKET_SIZE);
|
||||
if(--bind_counter==0)
|
||||
{
|
||||
BIND_DONE;
|
||||
REDPINE_init(sub_protocol);
|
||||
}
|
||||
return 9000;
|
||||
}
|
||||
else
|
||||
{
|
||||
CC2500_SetTxRxMode(TX_EN);
|
||||
REDPINE_set_channel(hopping_frequency_no);
|
||||
CC2500_SetPower();
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
REDPINE_data_frame();
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
hopping_frequency_no = (hopping_frequency_no + 1) % 49;
|
||||
CC2500_WriteData(packet, REDPINE_PACKET_SIZE);
|
||||
if (sub_protocol==0)
|
||||
return REDPINE_LOOPTIME_FAST*100;
|
||||
else
|
||||
return REDPINE_LOOPTIME_SLOW*100;
|
||||
}
|
||||
return 1;
|
||||
if ( prev_option != option )
|
||||
{ // Frequency adjust
|
||||
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
||||
prev_option = option ;
|
||||
}
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
if(bind_counter == REDPINE_BIND)
|
||||
REDPINE_init(0);
|
||||
if(bind_counter == REDPINE_BIND/2)
|
||||
REDPINE_init(1);
|
||||
REDPINE_set_channel(49);
|
||||
CC2500_SetTxRxMode(TX_EN);
|
||||
CC2500_SetPower();
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
REDPINE_build_bind_packet();
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
CC2500_WriteData(packet, REDPINE_PACKET_SIZE);
|
||||
if(--bind_counter==0)
|
||||
{
|
||||
BIND_DONE;
|
||||
REDPINE_init(sub_protocol);
|
||||
}
|
||||
return 9000;
|
||||
}
|
||||
else
|
||||
{
|
||||
CC2500_SetTxRxMode(TX_EN);
|
||||
REDPINE_set_channel(hopping_frequency_no);
|
||||
CC2500_SetPower();
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
REDPINE_data_frame();
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
hopping_frequency_no = (hopping_frequency_no + 1) % 49;
|
||||
CC2500_WriteData(packet, REDPINE_PACKET_SIZE);
|
||||
if (sub_protocol==0)
|
||||
return REDPINE_LOOPTIME_FAST*100;
|
||||
else
|
||||
return REDPINE_LOOPTIME_SLOW*1000;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// register, fast 250k, slow
|
||||
|
Loading…
x
Reference in New Issue
Block a user