Skip to content

Commit

Permalink
OMP Protocol support. only use cc2500 for tx&rx. telemetry support !
Browse files Browse the repository at this point in the history
  • Loading branch information
smaller09 committed Mar 9, 2021
1 parent c84450e commit a727342
Show file tree
Hide file tree
Showing 8 changed files with 954 additions and 48 deletions.
5 changes: 5 additions & 0 deletions src/protocol/Makefile.inc
Expand Up @@ -60,6 +60,7 @@ PROTO_MODULES += $(ODIR)/protocol/pxx.mod
PROTO_MODULES += $(ODIR)/protocol/loli.mod
PROTO_MODULES += $(ODIR)/protocol/e016h.mod
PROTO_MODULES += $(ODIR)/protocol/sumd.mod
PROTO_MODULES += $(ODIR)/protocol/omp.mod
ifeq "$(SUPPORT_SCANNER)" "1"
PROTO_MODULES += $(ODIR)/protocol/scancyrf.mod
endif
Expand Down Expand Up @@ -328,6 +329,10 @@ $(ODIR)/protocol/e010.mod : $(ODIR)/e010_cc2500.bin
@echo Building 'e010' module
/bin/mkdir -p $(ODIR)/protocol/ 2>/dev/null; /bin/cp $< $@

$(ODIR)/protocol/omp.mod : $(ODIR)/omp_cc2500.bin
@echo Building 'omp' module
/bin/mkdir -p $(ODIR)/protocol/ 2>/dev/null; /bin/cp $< $@

$(ODIR)/protocol/v761.mod : $(ODIR)/v761_nrf24l01.bin
@echo Building 'v761' module
/bin/mkdir -p $(ODIR)/protocol/ 2>/dev/null; /bin/cp $< $@
Expand Down
4 changes: 3 additions & 1 deletion src/protocol/e010_cc2500.c
Expand Up @@ -106,6 +106,7 @@ e010_tx_rf_map[] = { {{0x4F, 0x1C}, {0x3A, 0x35, 0x4A, 0x45}},
{{0xFD, 0x4F}, {0x33, 0x3B, 0x43, 0x4B}},
{{0x86, 0x3C}, {0x34, 0x3E, 0x44, 0x4E}} };

/*
// xn297 emulation
////////////////////
static u8 xn297_addr_len;
Expand Down Expand Up @@ -213,6 +214,7 @@ static void XN297L_WritePayload(const u8* msg, u8 len)
// end of xn297 emulation
///////////////////////////
*/

// Bit vector from bit position
#define BV(bit) (1 << bit)
Expand Down Expand Up @@ -300,7 +302,7 @@ static void send_packet(u8 bind)
static void e010_init()
{
u8 rx_tx_addr[ADDRESS_LENGTH];
XN297L_init(); // setup cc2500 for xn297L@250kbps emulation
XN297L_Configure(XN297L_SCRAMBLED, XN297L_CRC, PACKET_SIZE+8); // setup cc2500 for xn297L@250kbps emulation packet_size(16) + 5byte address + + 2byte crc + 1byte preamble (0x55)
CC2500_WriteReg(CC2500_0C_FSCTRL0, fine);
memcpy(rx_tx_addr, "\x6d\x6a\x77\x77\x77", sizeof(rx_tx_addr));
memcpy(rf_channels, "\x36\x3e\x46\x2e", sizeof(rf_channels));
Expand Down
20 changes: 20 additions & 0 deletions src/protocol/iface_cc2500.h
Expand Up @@ -135,4 +135,24 @@ void CC2500_WriteData(u8 *packet, u8 length);
void CC2500_ReadData(u8 *dpbuffer, int len);
void CC2500_SetTxRxMode(enum TXRX_State);
void CC2500_SetPower(int power);

void XN297L_Configure(u8 scramble_en, u8 crc_en, u8 cc2500_packet_len);
void XN297L_SetTXAddr(const u8* addr, u8 len);
void XN297L_SetRXAddr(const u8* addr, u8 len);
void XN297L_WritePayload(u8* msg, u8 len);
void XN297L_SetChannel(u8 ch);
void XN297L_SetScrambledMode(const u8 mode);
void XN297L_WriteEnhancedPayload(u8* msg, u8 len, u8 noack);
u8 _xn297l_write_enhancedpayload(const u8* msg, u8 len, u8* out, u8 noack);
u8 _xn297l_write_payload(const u8* msg, u8 len, u8* out);
u8 XN297L_ReadPayload(u8* msg, u8 len);
u8 XN297L_ReadEnhancedPayload(u8* msg, u8 len);
#define XN297L_UNSCRAMBLED 0
#define XN297L_SCRAMBLED 1
#define XN297L_NOCRC 0
#define XN297L_CRC 1

u16 crc16_update(u16 crc, u8 a, u8 bits);
u8 bit_reverse(u8 b_in);

#endif
17 changes: 10 additions & 7 deletions src/protocol/iface_nrf24l01.h
Expand Up @@ -145,17 +145,20 @@ enum {
extern const u8 xn297_scramble[];
extern const u16 xn297_crc_xorout_scrambled[];
extern const u16 xn297_crc_xorout[];
uint8_t bit_reverse(uint8_t b_in);
extern const u16 xn297_crc_xorout_scrambled_enhanced[];
extern const u16 xn297_crc_xorout_enhanced[];

void XN297_SetTXAddr(const u8* addr, int len);
void XN297_SetRXAddr(const u8* addr, int len);
// uint8_t bit_reverse(uint8_t b_in);

void XN297_SetTXAddr(const u8* addr, u8 len);
void XN297_SetRXAddr(const u8* addr, u8 len);
void XN297_Configure(u8 flags);
void XN297_SetScrambledMode(const u8 mode);
u8 XN297_WritePayload(u8* msg, int len);
u8 XN297_WriteEnhancedPayload(u8* msg, int len, int noack, u16 crc_xorout);
u8 XN297_ReadPayload(u8* msg, int len);
u8 XN297_ReadEnhancedPayload(u8* msg, int len);
u16 crc16_update(u16 crc, u8 a, u8 bits);
u8 XN297_WriteEnhancedPayload(u8* msg, u8 len, u8 noack, u16 crc_xorout);
u8 XN297_ReadPayload(u8* msg, u8 len);
u8 XN297_ReadEnhancedPayload(u8* msg, u8 len);
// u16 crc16_update(u16 crc, u8 a, u8 bits);

// HS6200 emulation layer
void HS6200_SetTXAddr(const u8* addr, u8 len);
Expand Down

0 comments on commit a727342

Please sign in to comment.