One file missing in the push...

This commit is contained in:
Pascal Langer 2021-02-09 18:31:13 +01:00
parent 3b8b2ef376
commit 97de2aaf3d

View File

@ -31,7 +31,7 @@ enum {
DSM_RX_DATA_CH2, DSM_RX_DATA_CH2,
}; };
static void __attribute__((unused)) DSM_Rx_init() static void __attribute__((unused)) DSM_RX_RF_init()
{ {
DSM_cyrf_config(); DSM_cyrf_config();
rx_disable_lna = IS_POWER_FLAG_on; rx_disable_lna = IS_POWER_FLAG_on;
@ -63,7 +63,7 @@ uint16_t convert_channel_DSM_nolimit(int32_t val)
return (uint16_t)val; return (uint16_t)val;
} }
static uint8_t __attribute__((unused)) DSM_Rx_check_packet() static uint8_t __attribute__((unused)) DSM_RX_check_packet()
{ {
uint8_t rx_status=CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS); uint8_t rx_status=CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
if((rx_status & 0x03) == 0x02) // RXC=1, RXE=0 then 2nd check is required (debouncing) if((rx_status & 0x03) == 0x02) // RXC=1, RXE=0 then 2nd check is required (debouncing)
@ -99,7 +99,7 @@ static uint8_t __attribute__((unused)) DSM_Rx_check_packet()
return rx_status; // Return error code return rx_status; // Return error code
} }
static void __attribute__((unused)) DSM_Rx_build_telemetry_packet() static void __attribute__((unused)) DSM_RX_build_telemetry_packet()
{ {
uint8_t nbr_bits = 11; uint8_t nbr_bits = 11;
if((DSM_rx_type&0xF0) == 0x00) if((DSM_rx_type&0xF0) == 0x00)
@ -157,7 +157,7 @@ static void __attribute__((unused)) DSM_Rx_build_telemetry_packet()
telemetry_link = 1; telemetry_link = 1;
} }
static bool __attribute__((unused)) DSM_Rx_bind_check_validity() static bool __attribute__((unused)) DSM_RX_bind_check_validity()
{ {
uint16_t sum = 384 - 0x10;// uint16_t sum = 384 - 0x10;//
for(uint8_t i = 0; i < 8; i++) for(uint8_t i = 0; i < 8; i++)
@ -173,7 +173,7 @@ static bool __attribute__((unused)) DSM_Rx_bind_check_validity()
return true; return true;
} }
static void __attribute__((unused)) DSM_Rx_build_bind_packet() static void __attribute__((unused)) DSM_RX_build_bind_packet()
{ {
uint16_t sum = 384 - 0x10;// uint16_t sum = 384 - 0x10;//
packet[0] = 0xff ^ cyrfmfg_id[0]; // ID packet[0] = 0xff ^ cyrfmfg_id[0]; // ID
@ -205,7 +205,7 @@ static void __attribute__((unused)) DSM_abort_channel_rx(uint8_t ch)
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x83); // Prepare to receive CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x83); // Prepare to receive
} }
uint16_t DSM_Rx_callback() uint16_t DSM_RX_callback()
{ {
uint8_t rx_status; uint8_t rx_status;
static uint8_t read_retry=0; static uint8_t read_retry=0;
@ -232,7 +232,7 @@ uint16_t DSM_Rx_callback()
if(len==16) if(len==16)
{ {
CYRF_ReadDataPacketLen(packet_in, 16); CYRF_ReadDataPacketLen(packet_in, 16);
if(DSM_Rx_bind_check_validity()) if(DSM_RX_bind_check_validity())
{ {
// store tx info into eeprom // store tx info into eeprom
uint16_t temp = DSM_RX_EEPROM_OFFSET; uint16_t temp = DSM_RX_EEPROM_OFFSET;
@ -279,7 +279,7 @@ uint16_t DSM_Rx_callback()
CYRF_SetTxRxMode(TX_EN); // Force end state TX CYRF_SetTxRxMode(TX_EN); // Force end state TX
CYRF_ConfigDataCode((const uint8_t *)"\x98\x88\x1B\xE4\x30\x79\x03\x84", 16); CYRF_ConfigDataCode((const uint8_t *)"\x98\x88\x1B\xE4\x30\x79\x03\x84", 16);
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00); // Clear abort RX CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00); // Clear abort RX
DSM_Rx_build_bind_packet(); DSM_RX_build_bind_packet();
bind_counter=500; bind_counter=500;
phase++; // DSM_RX_BIND2; phase++; // DSM_RX_BIND2;
return 1000; return 1000;
@ -346,7 +346,7 @@ uint16_t DSM_Rx_callback()
break; break;
case DSM2_RX_SCAN: // Scan for DSM2 frequencies case DSM2_RX_SCAN: // Scan for DSM2 frequencies
//Received something ? //Received something ?
rx_status = DSM_Rx_check_packet(); rx_status = DSM_RX_check_packet();
if(rx_status == 0x02) if(rx_status == 0x02)
{ // data received with no errors { // data received with no errors
debugln("CH%d:Found %d",rf_ch_num+1,hopping_frequency[rf_ch_num]); debugln("CH%d:Found %d",rf_ch_num+1,hopping_frequency[rf_ch_num]);
@ -401,13 +401,13 @@ uint16_t DSM_Rx_callback()
pps_counter = 0; pps_counter = 0;
} }
//Received something ? //Received something ?
rx_status = DSM_Rx_check_packet(); rx_status = DSM_RX_check_packet();
if(rx_status == 0x02) if(rx_status == 0x02)
{ // data received with no errors { // data received with no errors
#ifdef DSM_DEBUG_RF #ifdef DSM_DEBUG_RF
debugln("CH1:RX"); debugln("CH1:RX");
#endif #endif
DSM_Rx_build_telemetry_packet(); DSM_RX_build_telemetry_packet();
rx_data_started = true; rx_data_started = true;
pps_counter++; pps_counter++;
DSM_abort_channel_rx(2); // Abort RX operation, set sop&data&seed&rf using CH2, DSM2/X and receive DSM_abort_channel_rx(2); // Abort RX operation, set sop&data&seed&rf using CH2, DSM2/X and receive
@ -452,13 +452,13 @@ uint16_t DSM_Rx_callback()
} }
return 500; return 500;
case DSM_RX_DATA_CH2: case DSM_RX_DATA_CH2:
rx_status = DSM_Rx_check_packet(); rx_status = DSM_RX_check_packet();
if(rx_status == 0x02) if(rx_status == 0x02)
{ // data received with no errors { // data received with no errors
#ifdef DSM_DEBUG_RF #ifdef DSM_DEBUG_RF
debugln("CH2:RX"); debugln("CH2:RX");
#endif #endif
DSM_Rx_build_telemetry_packet(); DSM_RX_build_telemetry_packet();
pps_counter++; pps_counter++;
} }
#ifdef DSM_DEBUG_RF #ifdef DSM_DEBUG_RF
@ -476,9 +476,9 @@ uint16_t DSM_Rx_callback()
return 10000; return 10000;
} }
uint16_t initDSM_Rx() void DSM_RX_init()
{ {
DSM_Rx_init(); DSM_RX_RF_init();
hopping_frequency_no = 0; hopping_frequency_no = 0;
if (IS_BIND_IN_PROGRESS) if (IS_BIND_IN_PROGRESS)
@ -499,7 +499,6 @@ uint16_t initDSM_Rx()
debugln(", type=%02X", DSM_rx_type); debugln(", type=%02X", DSM_rx_type);
phase = DSM_RX_DATA_PREP; phase = DSM_RX_DATA_PREP;
} }
return 15000;
} }
#endif #endif