mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 16:38:12 +00:00
CYRF data codes are always 16
Removed useless function argument LOSI now points to the DSM data codes = dependency on DSM
This commit is contained in:
parent
61cbe45ce2
commit
7da6d52a84
@ -195,11 +195,11 @@ void CYRF_ConfigSOPCode(const uint8_t *sopcodes)
|
|||||||
CYRF_WriteRegisterMulti(CYRF_22_SOP_CODE, sopcodes, 8);
|
CYRF_WriteRegisterMulti(CYRF_22_SOP_CODE, sopcodes, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CYRF_ConfigDataCode(const uint8_t *datacodes, uint8_t len)
|
void CYRF_ConfigDataCode(const uint8_t *datacodes)
|
||||||
{
|
{
|
||||||
//NOTE: This can also be implemented as:
|
//NOTE: This can also be implemented as:
|
||||||
//for(i = 0; i < len; i++) WriteRegister)0x23, datacodes[i];
|
//for(i = 0; i < 16; i++) WriteRegister)0x23, datacodes[i];
|
||||||
CYRF_WriteRegisterMulti(CYRF_23_DATA_CODE, datacodes, len);
|
CYRF_WriteRegisterMulti(CYRF_23_DATA_CODE, datacodes, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CYRF_WritePreamble(uint32_t preamble)
|
void CYRF_WritePreamble(uint32_t preamble)
|
||||||
|
@ -65,7 +65,7 @@ const uint8_t PROGMEM DSM_pncodes[5][9][8] = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __attribute__((unused)) DSM_read_code(uint8_t *buf, uint8_t row, uint8_t col, uint8_t len)
|
static void __attribute__((unused)) DSM_read_code(uint8_t *buf, uint8_t row, uint8_t col)
|
||||||
{
|
{
|
||||||
for(uint8_t i=0;i<len;i++)
|
for(uint8_t i=0;i<len;i++)
|
||||||
buf[i]=pgm_read_byte_near( &DSM_pncodes[row][col][i] );
|
buf[i]=pgm_read_byte_near( &DSM_pncodes[row][col][i] );
|
||||||
@ -137,11 +137,11 @@ static void __attribute__((unused)) DSM_set_sop_data_crc(bool ch2, bool dsmx)
|
|||||||
debug_time();
|
debug_time();
|
||||||
debug(" crc:%04X,row:%d,col:%d,rf:%02X",(~seed)&0xffff,pn_row,sop_col,hopping_frequency[hopping_frequency_no]);
|
debug(" crc:%04X,row:%d,col:%d,rf:%02X",(~seed)&0xffff,pn_row,sop_col,hopping_frequency[hopping_frequency_no]);
|
||||||
#endif
|
#endif
|
||||||
DSM_read_code(code,pn_row,sop_col,8); // pn_row between 0 and 4, sop_col between 1 and 7
|
DSM_read_code(code,pn_row,sop_col); // pn_row between 0 and 4, sop_col between 1 and 7
|
||||||
CYRF_ConfigSOPCode(code);
|
CYRF_ConfigSOPCode(code);
|
||||||
DSM_read_code(code,pn_row,7 - sop_col,8); // 7-sop_col between 0 and 6
|
DSM_read_code(code,pn_row,7 - sop_col); // 7-sop_col between 0 and 6
|
||||||
DSM_read_code(code+8,pn_row,7 - sop_col + 1,8); // 7-sop_col+1 between 1 and 7
|
DSM_read_code(code+8,pn_row,7 - sop_col + 1); // 7-sop_col+1 between 1 and 7
|
||||||
CYRF_ConfigDataCode(code, 16);
|
CYRF_ConfigDataCode(code);
|
||||||
|
|
||||||
CYRF_ConfigRFChannel(hopping_frequency[hopping_frequency_no]);
|
CYRF_ConfigRFChannel(hopping_frequency[hopping_frequency_no]);
|
||||||
hopping_frequency_no++;
|
hopping_frequency_no++;
|
||||||
|
@ -39,8 +39,8 @@ static void __attribute__((unused)) DSM_RX_RF_init()
|
|||||||
{
|
{
|
||||||
//64 SDR Mode is configured so only the 8 first values are needed but need to write 16 values...
|
//64 SDR Mode is configured so only the 8 first values are needed but need to write 16 values...
|
||||||
uint8_t code[16];
|
uint8_t code[16];
|
||||||
DSM_read_code(code,0,8,8);
|
DSM_read_code(code,0,8);
|
||||||
CYRF_ConfigDataCode(code, 16);
|
CYRF_ConfigDataCode(code);
|
||||||
CYRF_ConfigRFChannel(1);
|
CYRF_ConfigRFChannel(1);
|
||||||
CYRF_SetTxRxMode(RX_EN); // Force end state read
|
CYRF_SetTxRxMode(RX_EN); // Force end state read
|
||||||
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x83); // Prepare to receive
|
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x83); // Prepare to receive
|
||||||
@ -277,7 +277,7 @@ uint16_t DSM_RX_callback()
|
|||||||
eeprom_write_byte((EE_ADDR)temp, DSM_rx_type);
|
eeprom_write_byte((EE_ADDR)temp, DSM_rx_type);
|
||||||
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x20); // Abort RX operation
|
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x20); // Abort RX operation
|
||||||
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");
|
||||||
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;
|
||||||
|
@ -118,8 +118,8 @@ static void __attribute__((unused)) DSM_initialize_bind_phase()
|
|||||||
CYRF_ConfigRFChannel(DSM_BIND_CHANNEL); //This seems to be random?
|
CYRF_ConfigRFChannel(DSM_BIND_CHANNEL); //This seems to be random?
|
||||||
//64 SDR Mode is configured so only the 8 first values are needed but need to write 16 values...
|
//64 SDR Mode is configured so only the 8 first values are needed but need to write 16 values...
|
||||||
uint8_t code[16];
|
uint8_t code[16];
|
||||||
DSM_read_code(code,0,8,8);
|
DSM_read_code(code,0,8);
|
||||||
CYRF_ConfigDataCode(code, 16);
|
CYRF_ConfigDataCode(code);
|
||||||
DSM_build_bind_packet();
|
DSM_build_bind_packet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,8 +292,8 @@ uint16_t DSM_callback()
|
|||||||
return 10000;
|
return 10000;
|
||||||
#if defined DSM_TELEMETRY
|
#if defined DSM_TELEMETRY
|
||||||
case DSM_BIND_CHECK:
|
case DSM_BIND_CHECK:
|
||||||
//64 SDR Mode is configured so only the 8 first values are needed but we need to write 16 values...
|
//64 SDR Mode is configured so only the 8 first values are needed
|
||||||
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");
|
||||||
CYRF_SetTxRxMode(RX_EN); //Receive mode
|
CYRF_SetTxRxMode(RX_EN); //Receive mode
|
||||||
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //Prepare to receive
|
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //Prepare to receive
|
||||||
bind_counter=2*DSM_BIND_COUNT; //Timeout of 4.2s if no packet received
|
bind_counter=2*DSM_BIND_COUNT; //Timeout of 4.2s if no packet received
|
||||||
|
@ -86,7 +86,7 @@ static void __attribute__((unused)) j6pro_cyrf_init()
|
|||||||
CYRF_WriteRegister(CYRF_1E_RX_OVERRIDE, 0x00);
|
CYRF_WriteRegister(CYRF_1E_RX_OVERRIDE, 0x00);
|
||||||
|
|
||||||
//Same as default reset but issues if not configured...
|
//Same as default reset but issues if not configured...
|
||||||
CYRF_ConfigDataCode(j6pro_data_code, 16);
|
CYRF_ConfigDataCode(j6pro_data_code);
|
||||||
CYRF_WritePreamble(0x333302);
|
CYRF_WritePreamble(0x333302);
|
||||||
|
|
||||||
CYRF_GetMfgData(cyrfmfg_id);
|
CYRF_GetMfgData(cyrfmfg_id);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
//#define LOSI_FORCE_ID
|
//#define LOSI_FORCE_ID
|
||||||
|
|
||||||
|
/* Using DSM.ino data codes since they are the same
|
||||||
const uint8_t LOSI_data_code[][8] = {
|
const uint8_t LOSI_data_code[][8] = {
|
||||||
//(Freq-1)%5=0
|
//(Freq-1)%5=0
|
||||||
{ 0x83, 0xF7, 0xA8, 0x2D, 0x7A, 0x44, 0x64, 0xD3 },
|
{ 0x83, 0xF7, 0xA8, 0x2D, 0x7A, 0x44, 0x64, 0xD3 },
|
||||||
@ -67,7 +68,7 @@ const uint8_t LOSI_data_code[][8] = {
|
|||||||
{ 0x40, 0xBA, 0x97, 0xD5, 0x86, 0x4F, 0xCC, 0xD1 },
|
{ 0x40, 0xBA, 0x97, 0xD5, 0x86, 0x4F, 0xCC, 0xD1 },
|
||||||
//Bind
|
//Bind
|
||||||
{ 0xD7, 0xA1, 0x54, 0xB1, 0x5E, 0x89, 0xAE, 0x86 }
|
{ 0xD7, 0xA1, 0x54, 0xB1, 0x5E, 0x89, 0xAE, 0x86 }
|
||||||
};
|
};*/
|
||||||
|
|
||||||
static uint16_t __attribute__((unused)) LOSI_check(uint16_t val)
|
static uint16_t __attribute__((unused)) LOSI_check(uint16_t val)
|
||||||
{
|
{
|
||||||
@ -137,7 +138,9 @@ static void __attribute__((unused)) LOSI_cyrf_init()
|
|||||||
CYRF_WriteRegister(CYRF_1F_TX_OVERRIDE, 0x04); // No CRC
|
CYRF_WriteRegister(CYRF_1F_TX_OVERRIDE, 0x04); // No CRC
|
||||||
//CYRF_WriteRegister(CYRF_1E_RX_OVERRIDE, 0x14);
|
//CYRF_WriteRegister(CYRF_1E_RX_OVERRIDE, 0x14);
|
||||||
//CYRF_WriteRegister(CYRF_14_EOP_CTRL, 0x02);
|
//CYRF_WriteRegister(CYRF_14_EOP_CTRL, 0x02);
|
||||||
CYRF_ConfigDataCode(LOSI_data_code[40], 16); // Load bind data code by default
|
uint8_t code[16];
|
||||||
|
DSM_read_code(code,0,8); // Load bind data code by default
|
||||||
|
CYRF_ConfigDataCode(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t LOSI_callback()
|
uint16_t LOSI_callback()
|
||||||
@ -152,7 +155,9 @@ uint16_t LOSI_callback()
|
|||||||
{
|
{
|
||||||
BIND_DONE;
|
BIND_DONE;
|
||||||
// Load normal data code
|
// Load normal data code
|
||||||
CYRF_ConfigDataCode(LOSI_data_code[(((hopping_frequency[0] - 1) % 5) << 3) + ((rx_tx_addr[0] + rx_tx_addr[1] + rx_tx_addr[2]) % 8)], 16);
|
uint8_t code[16];
|
||||||
|
DSM_read_code(code,hopping_frequency[0] % 5,(rx_tx_addr[0] + rx_tx_addr[1] + rx_tx_addr[2]) % 8);
|
||||||
|
CYRF_ConfigDataCode(code);
|
||||||
packet_period = 19738;
|
packet_period = 19738;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +183,7 @@ void LOSI_init()
|
|||||||
rx_tx_addr[3] = 0xAA;
|
rx_tx_addr[3] = 0xAA;
|
||||||
crc8 = 0x0B;
|
crc8 = 0x0B;
|
||||||
num_ch = 0x07;
|
num_ch = 0x07;
|
||||||
//Data codes hopping_frequency[0] % 5
|
//Data codes for hopping_frequency[0] % 5
|
||||||
//{ 0x40, 0xBA, 0x97, 0xD5, 0x86, 0x4F, 0xCC, 0xD1, 0xD7, 0xA1, 0x54, 0xB1, 0x5E, 0x89, 0xAE, 0x86 },
|
//{ 0x40, 0xBA, 0x97, 0xD5, 0x86, 0x4F, 0xCC, 0xD1, 0xD7, 0xA1, 0x54, 0xB1, 0x5E, 0x89, 0xAE, 0x86 },
|
||||||
//{ 0x62, 0xF5, 0x2B, 0xAA, 0xFC, 0x33, 0xBF, 0xAF, 0x40, 0x56, 0x32, 0xD9, 0x0F, 0xD9, 0x5D, 0x97 },
|
//{ 0x62, 0xF5, 0x2B, 0xAA, 0xFC, 0x33, 0xBF, 0xAF, 0x40, 0x56, 0x32, 0xD9, 0x0F, 0xD9, 0x5D, 0x97 },
|
||||||
//{ 0x9E, 0x08, 0xD1, 0xAE, 0x59, 0x5E, 0xE8, 0xF0, 0xC0, 0x90, 0x8F, 0xBB, 0x7C, 0x8E, 0x2B, 0x8E },
|
//{ 0x9E, 0x08, 0xD1, 0xAE, 0x59, 0x5E, 0xE8, 0xF0, 0xC0, 0x90, 0x8F, 0xBB, 0x7C, 0x8E, 0x2B, 0x8E },
|
||||||
@ -191,7 +196,7 @@ void LOSI_init()
|
|||||||
rx_tx_addr[3] = 0x8A;
|
rx_tx_addr[3] = 0x8A;
|
||||||
crc8 = 0x0F;
|
crc8 = 0x0F;
|
||||||
num_ch = 0x02;
|
num_ch = 0x02;
|
||||||
//Data codes hopping_frequency[0] % 5
|
//Data codes for hopping_frequency[0] % 5
|
||||||
//{ 0xF1, 0x94, 0x30, 0x21, 0xA1, 0x1C, 0x88, 0xA9, 0xD0, 0xD2, 0x8E, 0xBC, 0x82, 0x2F, 0xE3, 0xB4 },
|
//{ 0xF1, 0x94, 0x30, 0x21, 0xA1, 0x1C, 0x88, 0xA9, 0xD0, 0xD2, 0x8E, 0xBC, 0x82, 0x2F, 0xE3, 0xB4 },
|
||||||
//{ 0x17, 0xFF, 0x9E, 0x21, 0x36, 0x90, 0xC7, 0x82, 0xBC, 0x5D, 0x9A, 0x5B, 0xEE, 0x7F, 0x42, 0xEB },
|
//{ 0x17, 0xFF, 0x9E, 0x21, 0x36, 0x90, 0xC7, 0x82, 0xBC, 0x5D, 0x9A, 0x5B, 0xEE, 0x7F, 0x42, 0xEB },
|
||||||
//{ 0x4C, 0x97, 0x9D, 0xBF, 0xB8, 0x3D, 0xB5, 0xBE, 0x0C, 0x5D, 0x24, 0x30, 0x9F, 0xCA, 0x6D, 0xBD },
|
//{ 0x4C, 0x97, 0x9D, 0xBF, 0xB8, 0x3D, 0xB5, 0xBE, 0x0C, 0x5D, 0x24, 0x30, 0x9F, 0xCA, 0x6D, 0xBD },
|
||||||
@ -199,7 +204,7 @@ void LOSI_init()
|
|||||||
//{ 0xC3, 0x0E, 0x01, 0x16, 0x0E, 0x32, 0x06, 0xBA, 0xE0, 0x83, 0x01, 0xFA, 0xAB, 0x3E, 0x8F, 0xAC }
|
//{ 0xC3, 0x0E, 0x01, 0x16, 0x0E, 0x32, 0x06, 0xBA, 0xE0, 0x83, 0x01, 0xFA, 0xAB, 0x3E, 0x8F, 0xAC }
|
||||||
|
|
||||||
// Note: crc8=00..0F and num_ch=00..07
|
// Note: crc8=00..0F and num_ch=00..07
|
||||||
// num_ch = ((rx_tx_addr[0] + rx_tx_addr[1] + rx_tx_addr[2]) % 8);
|
// num_ch = (rx_tx_addr[0] + rx_tx_addr[1] + rx_tx_addr[2]) % 8;
|
||||||
// crc8 = (uint16_t)LOSI_check(((rx_tx_addr[2]&0x0F) << 8) + rx_tx_addr[3]) >> 12;
|
// crc8 = (uint16_t)LOSI_check(((rx_tx_addr[2]&0x0F) << 8) + rx_tx_addr[3]) >> 12;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ uint16_t MLINK_callback()
|
|||||||
|
|
||||||
|
|
||||||
case MLINK_PREP_DATA:
|
case MLINK_PREP_DATA:
|
||||||
CYRF_ConfigDataCode(MLINK_Data_Code,16);
|
CYRF_ConfigDataCode(MLINK_Data_Code);
|
||||||
MLINK_CRC_Init += 0xED;
|
MLINK_CRC_Init += 0xED;
|
||||||
hopping_frequency_no = 0x00;
|
hopping_frequency_no = 0x00;
|
||||||
CYRF_ConfigRFChannel(hopping_frequency[hopping_frequency_no]);
|
CYRF_ConfigRFChannel(hopping_frequency[hopping_frequency_no]);
|
||||||
@ -597,7 +597,7 @@ void MLINK_init()
|
|||||||
{
|
{
|
||||||
packet_count = 0;
|
packet_count = 0;
|
||||||
bind_counter = MLINK_BIND_COUNT;
|
bind_counter = MLINK_BIND_COUNT;
|
||||||
CYRF_ConfigDataCode((uint8_t*)"\x6F\xBE\x32\x01\xDB\xF1\x2B\x01\xE3\x5C\xFA\x02\x97\x93\xF9\x02",16); //Bind data code
|
CYRF_ConfigDataCode((uint8_t*)"\x6F\xBE\x32\x01\xDB\xF1\x2B\x01\xE3\x5C\xFA\x02\x97\x93\xF9\x02"); //Bind data code
|
||||||
CYRF_ConfigRFChannel(MLINK_BIND_CHANNEL);
|
CYRF_ConfigRFChannel(MLINK_BIND_CHANNEL);
|
||||||
phase = MLINK_BIND_TX;
|
phase = MLINK_BIND_TX;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 3
|
#define VERSION_REVISION 3
|
||||||
#define VERSION_PATCH_LEVEL 40
|
#define VERSION_PATCH_LEVEL 41
|
||||||
|
|
||||||
#define MODE_SERIAL 0
|
#define MODE_SERIAL 0
|
||||||
|
|
||||||
|
@ -352,6 +352,9 @@
|
|||||||
#undef V911S_CCNRF_INO
|
#undef V911S_CCNRF_INO
|
||||||
#undef XK_CCNRF_INO
|
#undef XK_CCNRF_INO
|
||||||
#endif
|
#endif
|
||||||
|
#if not defined(DSM_CYRF6936_INO)
|
||||||
|
#undef LOSI_CYRF6936_INO
|
||||||
|
#endif
|
||||||
#if not defined(STM32_BOARD)
|
#if not defined(STM32_BOARD)
|
||||||
//RF2500 emulation does not work on atmega...
|
//RF2500 emulation does not work on atmega...
|
||||||
#undef E010R5_CYRF6936_INO
|
#undef E010R5_CYRF6936_INO
|
||||||
|
@ -191,7 +191,7 @@
|
|||||||
//#define E01X_CYRF6936_INO
|
//#define E01X_CYRF6936_INO
|
||||||
#define E129_CYRF6936_INO
|
#define E129_CYRF6936_INO
|
||||||
#define J6PRO_CYRF6936_INO
|
#define J6PRO_CYRF6936_INO
|
||||||
//#define LOSI_CYRF6936_INO
|
#define LOSI_CYRF6936_INO //Need DSM to be enabled
|
||||||
#define MLINK_CYRF6936_INO
|
#define MLINK_CYRF6936_INO
|
||||||
#define SCORPIO_CYRF6936_INO
|
#define SCORPIO_CYRF6936_INO
|
||||||
#define TRAXXAS_CYRF6936_INO
|
#define TRAXXAS_CYRF6936_INO
|
||||||
|
@ -85,7 +85,7 @@ void CYRF_SetPower(u8 power);
|
|||||||
void CYRF_ConfigCRCSeed(u16 crc);
|
void CYRF_ConfigCRCSeed(u16 crc);
|
||||||
static void CYRF_StartReceive();
|
static void CYRF_StartReceive();
|
||||||
void CYRF_ConfigSOPCode(const u8 *sopcodes);
|
void CYRF_ConfigSOPCode(const u8 *sopcodes);
|
||||||
void CYRF_ConfigDataCode(const u8 *datacodes, u8 len);
|
void CYRF_ConfigDataCode(const u8 *datacodes);
|
||||||
static u8 CYRF_ReadRSSI(u32 dodummyread);
|
static u8 CYRF_ReadRSSI(u32 dodummyread);
|
||||||
static void CYRF_ReadDataPacket(u8 dpbuffer[]);
|
static void CYRF_ReadDataPacket(u8 dpbuffer[]);
|
||||||
void CYRF_WriteDataPacket(const u8 dpbuffer[]);
|
void CYRF_WriteDataPacket(const u8 dpbuffer[]);
|
||||||
|
@ -640,8 +640,6 @@ A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
|
|||||||
## Losi - *89*
|
## Losi - *89*
|
||||||
TX: LSR-3000
|
TX: LSR-3000
|
||||||
|
|
||||||
**Only 1 ID available**. More IDs can be added if you dump your original TX.
|
|
||||||
|
|
||||||
Extended limits supported
|
Extended limits supported
|
||||||
|
|
||||||
CH1|CH2|CH3
|
CH1|CH2|CH3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user