From 3d8e12c8c7952b7779da0a10873d992afa2b232e Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 17:15:37 +0100 Subject: [PATCH 01/18] Add protocol for Radiolink CC2530 module --- src/protocol/protocol.h | 3 + src/protocol/radiolink.c | 129 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 src/protocol/radiolink.c diff --git a/src/protocol/protocol.h b/src/protocol/protocol.h index 771f4774ff..e9c0ccd632 100644 --- a/src/protocol/protocol.h +++ b/src/protocol/protocol.h @@ -1,6 +1,9 @@ #ifndef PROTODEF #else +#ifdef PROTO_HAS_RADIOLINK_CC2530 +PROTODEF(PROTOCOL_DEVO, RADIOLINK_CC2530, AETRG, RADIOLINK_Cmds, "Radiolink") +#endif #ifdef PROTO_HAS_CYRF6936 PROTODEF(PROTOCOL_DEVO, CYRF6936, EATRG, DEVO_Cmds, "DEVO") PROTODEF(PROTOCOL_WK2801, CYRF6936, EATRG, WK2x01_Cmds, "WK2801") diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c new file mode 100644 index 0000000000..c18e8b03e0 --- /dev/null +++ b/src/protocol/radiolink.c @@ -0,0 +1,129 @@ +/* + This project is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Deviation is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Deviation. If not, see . + */ + +#include "common.h" +#include "interface.h" +#include "mixer.h" +#include "config/model.h" +#include "config/tx.h" +#include "telemetry.h" +#include "protospi.h" + +#ifdef PROTO_HAS_RADIOLINK_CC2530 + +#ifdef MODULAR + //Allows the linker to properly relocate + #define RADIOLINK_Cmds PROTO_Cmds + #pragma long_calls +#endif + +#define PACKET_SIZE 41 +#define PACKET_INTERVAL 4000 + +static u8 packet[PACKET_SIZE]; + +static u16 scale_channel(s32 chanval, s32 inMin, s32 inMax, u16 destMin, u16 destMax) +{ + s32 range = (s32)destMax - (s32)destMin; + s32 chanrange = inMax - inMin; + + if (chanval < inMin) + chanval = inMin; + else if (chanval > inMax) + chanval = inMax; + return (range * (chanval - inMin)) / chanrange + destMin; +} + +static void send_packet() +{ + u8 i = 0; + u8 chan; + u16 val; + packet[i++] = 0xaa; + packet[i++] = 0xaa; + packet[i++] = 0x29; + packet[i++] = 0x01; + // channels + for(chan = 0; chan < 10; chan++) { + // is 0-4000 for 100% endpoints ? can it be extended ? + val = scale_channel(Channels[chan], CHAN_MIN_VALUE, CHAN_MAX_VALUE, 4000, 0); + packet[i++] = val & 0xff; + packet[i++] = val >> 8; + } + // failsafe + for(chan = 0; chan < 8; chan++) { + // any way to disable failsafe on a channel ? (keep last received value) + val = scale_channel(Channels[chan], -100, 100, 4000, 0); + packet[i++] = val & 0xff; + packet[i++] = val >> 8; + } + // checksum + packet[40] = packet[4]; + for(i = 5; i < PACKET_SIZE-1; i++) + packet[40] += packet[i]; + + // send packet to Radiolink CC2530 module + PROTO_CS_LO(RADIOLINK_MODULE) + for(i = 0; i < PACKET_SIZE; i++) + packet[i] = PROTOSPI_xfer(packet[i]); + PROTO_CS_HI(RADIOLINK_MODULE) + + // todo: packet[] now contains the module's response, with telemetry data +} + +static u16 radiolink_cb() +{ + send_packet(); + return PACKET_INTERVAL; +} + +static void RADIOLINK_Reset() +{ + PROTO_CS_HI(RADIOLINK_MODULE) + PROTOSPI_pin_clear(RADIOLINK_MODULE_RESET_PIN); + Delay(100); + PROTOSPI_pin_set(RADIOLINK_MODULE_RESET_PIN); +} + +static void RADIOLINK_Stop() +{ + PROTO_CS_HI(RADIOLINK_MODULE); + PROTOSPI_pin_clear(RADIOLINK_MODULE_RESET_PIN); +} + +static void initialize() +{ + CLOCK_StopTimer(); + RADIOLINK_Reset(); + CLOCK_StartTimer(1000, radiolink_cb); +} + +uintptr_t RADIOLINK_Cmds(enum ProtoCmds cmd) +{ + switch(cmd) { + case PROTOCMD_INIT: initialize(); return 0; + case PROTOCMD_DEINIT: RADIOLINK_Stop(); return 0; + case PROTOCMD_CHECK_AUTOBIND: return 1L; + case PROTOCMD_BIND: initialize(); return 0; + case PROTOCMD_NUMCHAN: return 10; + case PROTOCMD_DEFAULT_NUMCHAN: return 10; + case PROTOCMD_CHANNELMAP: return AETR; + case PROTOCMD_TELEMETRYSTATE: return PROTO_TELEM_UNSUPPORTED; + default: break; + } + return 0; +} + +#endif From 9a0bb18779262a54aff30cca055139fc7f9c8670 Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 17:24:06 +0100 Subject: [PATCH 02/18] Fix typo --- src/protocol/radiolink.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index c18e8b03e0..247f618b10 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -75,10 +75,10 @@ static void send_packet() packet[40] += packet[i]; // send packet to Radiolink CC2530 module - PROTO_CS_LO(RADIOLINK_MODULE) + PROTO_CS_LO(RADIOLINK_MODULE); for(i = 0; i < PACKET_SIZE; i++) packet[i] = PROTOSPI_xfer(packet[i]); - PROTO_CS_HI(RADIOLINK_MODULE) + PROTO_CS_HI(RADIOLINK_MODULE); // todo: packet[] now contains the module's response, with telemetry data } @@ -91,12 +91,13 @@ static u16 radiolink_cb() static void RADIOLINK_Reset() { - PROTO_CS_HI(RADIOLINK_MODULE) + PROTO_CS_HI(RADIOLINK_MODULE); PROTOSPI_pin_clear(RADIOLINK_MODULE_RESET_PIN); Delay(100); PROTOSPI_pin_set(RADIOLINK_MODULE_RESET_PIN); } +// todo: call during transmitter startup ? static void RADIOLINK_Stop() { PROTO_CS_HI(RADIOLINK_MODULE); @@ -119,7 +120,7 @@ uintptr_t RADIOLINK_Cmds(enum ProtoCmds cmd) case PROTOCMD_BIND: initialize(); return 0; case PROTOCMD_NUMCHAN: return 10; case PROTOCMD_DEFAULT_NUMCHAN: return 10; - case PROTOCMD_CHANNELMAP: return AETR; + case PROTOCMD_CHANNELMAP: return AETRG; case PROTOCMD_TELEMETRYSTATE: return PROTO_TELEM_UNSUPPORTED; default: break; } From ce3ba61f5976a49d1817aed2a70b024407d010c2 Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 17:30:47 +0100 Subject: [PATCH 03/18] Fix lint errors --- src/protocol/radiolink.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index 247f618b10..06d2ff64ea 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -24,7 +24,7 @@ #ifdef PROTO_HAS_RADIOLINK_CC2530 #ifdef MODULAR - //Allows the linker to properly relocate + // Allows the linker to properly relocate #define RADIOLINK_Cmds PROTO_Cmds #pragma long_calls #endif @@ -56,14 +56,14 @@ static void send_packet() packet[i++] = 0x29; packet[i++] = 0x01; // channels - for(chan = 0; chan < 10; chan++) { + for (chan = 0; chan < 10; chan++) { // is 0-4000 for 100% endpoints ? can it be extended ? val = scale_channel(Channels[chan], CHAN_MIN_VALUE, CHAN_MAX_VALUE, 4000, 0); packet[i++] = val & 0xff; packet[i++] = val >> 8; } // failsafe - for(chan = 0; chan < 8; chan++) { + for (chan = 0; chan < 8; chan++) { // any way to disable failsafe on a channel ? (keep last received value) val = scale_channel(Channels[chan], -100, 100, 4000, 0); packet[i++] = val & 0xff; @@ -71,15 +71,15 @@ static void send_packet() } // checksum packet[40] = packet[4]; - for(i = 5; i < PACKET_SIZE-1; i++) + for (i = 5; i < PACKET_SIZE-1; i++) packet[40] += packet[i]; - + // send packet to Radiolink CC2530 module PROTO_CS_LO(RADIOLINK_MODULE); - for(i = 0; i < PACKET_SIZE; i++) + for (i = 0; i < PACKET_SIZE; i++) packet[i] = PROTOSPI_xfer(packet[i]); PROTO_CS_HI(RADIOLINK_MODULE); - + // todo: packet[] now contains the module's response, with telemetry data } @@ -113,7 +113,7 @@ static void initialize() uintptr_t RADIOLINK_Cmds(enum ProtoCmds cmd) { - switch(cmd) { + switch (cmd) { case PROTOCMD_INIT: initialize(); return 0; case PROTOCMD_DEINIT: RADIOLINK_Stop(); return 0; case PROTOCMD_CHECK_AUTOBIND: return 1L; From 168b6cd563053f17854381017a4aaf58cd407c3d Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 17:43:23 +0100 Subject: [PATCH 04/18] Fix protocol.h --- src/protocol/protocol.h | 2 +- src/protocol/radiolink.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protocol/protocol.h b/src/protocol/protocol.h index e9c0ccd632..27f5f527f9 100644 --- a/src/protocol/protocol.h +++ b/src/protocol/protocol.h @@ -2,7 +2,7 @@ #else #ifdef PROTO_HAS_RADIOLINK_CC2530 -PROTODEF(PROTOCOL_DEVO, RADIOLINK_CC2530, AETRG, RADIOLINK_Cmds, "Radiolink") +PROTODEF(PROTOCOL_RADIOLINK, RADIOLINK_CC2530, AETRG, RADIOLINK_Cmds, "Radiolink") #endif #ifdef PROTO_HAS_CYRF6936 PROTODEF(PROTOCOL_DEVO, CYRF6936, EATRG, DEVO_Cmds, "DEVO") diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index 06d2ff64ea..34c3979a43 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -116,7 +116,7 @@ uintptr_t RADIOLINK_Cmds(enum ProtoCmds cmd) switch (cmd) { case PROTOCMD_INIT: initialize(); return 0; case PROTOCMD_DEINIT: RADIOLINK_Stop(); return 0; - case PROTOCMD_CHECK_AUTOBIND: return 1L; + case PROTOCMD_CHECK_AUTOBIND: return 1; case PROTOCMD_BIND: initialize(); return 0; case PROTOCMD_NUMCHAN: return 10; case PROTOCMD_DEFAULT_NUMCHAN: return 10; From b949390e540214e58806d5ed9c44365f6533b06d Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 17:46:37 +0100 Subject: [PATCH 05/18] Fix failsafe --- src/protocol/radiolink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index 34c3979a43..6d430190fd 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -65,7 +65,7 @@ static void send_packet() // failsafe for (chan = 0; chan < 8; chan++) { // any way to disable failsafe on a channel ? (keep last received value) - val = scale_channel(Channels[chan], -100, 100, 4000, 0); + val = scale_channel(Model.limits[chan].failsafe, -100, 100, 4000, 0); packet[i++] = val & 0xff; packet[i++] = val >> 8; } From a6d98a5fd7911bfe3b467938b7b6824cca283634 Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 17:56:08 +0100 Subject: [PATCH 06/18] Support modular build --- src/protocol/Makefile.inc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/protocol/Makefile.inc b/src/protocol/Makefile.inc index cde6126294..09c412f429 100644 --- a/src/protocol/Makefile.inc +++ b/src/protocol/Makefile.inc @@ -58,6 +58,7 @@ PROTO_MODULES += $(ODIR)/protocol/gd00x.mod PROTO_MODULES += $(ODIR)/protocol/sbus.mod PROTO_MODULES += $(ODIR)/protocol/pxx.mod PROTO_MODULES += $(ODIR)/protocol/loli.mod +PROTO_MODULES += $(ODIR)/protocol/radiolin.mod ALL += $(PROTO_MODULES) else #BUILD_TARGET @@ -293,4 +294,8 @@ $(ODIR)/protocol/loli.mod : $(ODIR)/loli_nrf24l01.bin @echo Building 'loli' module /bin/mkdir -p $(ODIR)/protocol/ 2>/dev/null; /bin/cp $< $@ +$(ODIR)/protocol/radiolin.mod : $(ODIR)/radiolink.bin + @echo Building 'radiolink' module + /bin/mkdir -p $(ODIR)/protocol/ 2>/dev/null; /bin/cp $< $@ + endif #BUILD_TARGET From 9103899a946cf995995054a5a943425824bfacba Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 19:07:31 +0100 Subject: [PATCH 07/18] Rename module --- src/protocol/radiolink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index 6d430190fd..2994f7a0f5 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -75,10 +75,10 @@ static void send_packet() packet[40] += packet[i]; // send packet to Radiolink CC2530 module - PROTO_CS_LO(RADIOLINK_MODULE); + PROTO_CS_LO(RADIOLINK_CC2530); for (i = 0; i < PACKET_SIZE; i++) packet[i] = PROTOSPI_xfer(packet[i]); - PROTO_CS_HI(RADIOLINK_MODULE); + PROTO_CS_HI(RADIOLINK_CC2530); // todo: packet[] now contains the module's response, with telemetry data } @@ -91,7 +91,7 @@ static u16 radiolink_cb() static void RADIOLINK_Reset() { - PROTO_CS_HI(RADIOLINK_MODULE); + PROTO_CS_HI(RADIOLINK_CC2530); PROTOSPI_pin_clear(RADIOLINK_MODULE_RESET_PIN); Delay(100); PROTOSPI_pin_set(RADIOLINK_MODULE_RESET_PIN); @@ -100,7 +100,7 @@ static void RADIOLINK_Reset() // todo: call during transmitter startup ? static void RADIOLINK_Stop() { - PROTO_CS_HI(RADIOLINK_MODULE); + PROTO_CS_HI(RADIOLINK_CC2530); PROTOSPI_pin_clear(RADIOLINK_MODULE_RESET_PIN); } From cae7db20ebfc64227809b4209df04f67f0f6617d Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 19:09:41 +0100 Subject: [PATCH 08/18] Rename module --- src/protocol/radiolink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index 2994f7a0f5..7f788321f8 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -92,16 +92,16 @@ static u16 radiolink_cb() static void RADIOLINK_Reset() { PROTO_CS_HI(RADIOLINK_CC2530); - PROTOSPI_pin_clear(RADIOLINK_MODULE_RESET_PIN); + PROTOSPI_pin_clear(RADIOLINK_CC2530_RESET_PIN); Delay(100); - PROTOSPI_pin_set(RADIOLINK_MODULE_RESET_PIN); + PROTOSPI_pin_set(RADIOLINK_CC2530_RESET_PIN); } // todo: call during transmitter startup ? static void RADIOLINK_Stop() { PROTO_CS_HI(RADIOLINK_CC2530); - PROTOSPI_pin_clear(RADIOLINK_MODULE_RESET_PIN); + PROTOSPI_pin_clear(RADIOLINK_CC2530_RESET_PIN); } static void initialize() From db48e3872275e023af23e35436333b25053f87b5 Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 19:38:29 +0100 Subject: [PATCH 09/18] Rename RADIOLINK_Reset() --- src/protocol/radiolink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index 7f788321f8..c6f8f27625 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -89,7 +89,7 @@ static u16 radiolink_cb() return PACKET_INTERVAL; } -static void RADIOLINK_Reset() +static void RADIOLINK_Initialize() { PROTO_CS_HI(RADIOLINK_CC2530); PROTOSPI_pin_clear(RADIOLINK_CC2530_RESET_PIN); @@ -107,7 +107,7 @@ static void RADIOLINK_Stop() static void initialize() { CLOCK_StopTimer(); - RADIOLINK_Reset(); + RADIOLINK_Initialize(); CLOCK_StartTimer(1000, radiolink_cb); } From ff9d393e6af243ac96a4c550ba2cdcdecd8c79c5 Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 19:54:07 +0100 Subject: [PATCH 10/18] Add RADIOLINK_Reset() with module detection --- src/protocol/radiolink.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index c6f8f27625..e74d26b8c5 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -97,13 +97,24 @@ static void RADIOLINK_Initialize() PROTOSPI_pin_set(RADIOLINK_CC2530_RESET_PIN); } -// todo: call during transmitter startup ? static void RADIOLINK_Stop() { PROTO_CS_HI(RADIOLINK_CC2530); PROTOSPI_pin_clear(RADIOLINK_CC2530_RESET_PIN); } +// todo: call during transmitter startup +static int RADIOLINK_Reset() +{ + RADIOLINK_Initialize(); + send_packet(); + RADIOLINK_Stop(); +#ifdef EMULATOR + return 1; +#endif + return (packet[0] == 0x55) && (packet[1] == 0x55); +} + static void initialize() { CLOCK_StopTimer(); From 5cc75dba3b36f7935358b99dccc0eb6506e23987 Mon Sep 17 00:00:00 2001 From: Goebish Date: Mon, 18 Feb 2019 19:57:23 +0100 Subject: [PATCH 11/18] Fix lint --- src/protocol/radiolink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index e74d26b8c5..b276f0aa1f 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -112,7 +112,7 @@ static int RADIOLINK_Reset() #ifdef EMULATOR return 1; #endif - return (packet[0] == 0x55) && (packet[1] == 0x55); + return (packet[0] == 0x55) && (packet[1] == 0x55); } static void initialize() From ce40c9d7c231e9e954aea0b79d1f160c5390b0fc Mon Sep 17 00:00:00 2001 From: Goebish Date: Tue, 19 Feb 2019 00:03:36 +0100 Subject: [PATCH 12/18] Fix byte order --- src/protocol/radiolink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index b276f0aa1f..d1dd28bd20 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -59,15 +59,15 @@ static void send_packet() for (chan = 0; chan < 10; chan++) { // is 0-4000 for 100% endpoints ? can it be extended ? val = scale_channel(Channels[chan], CHAN_MIN_VALUE, CHAN_MAX_VALUE, 4000, 0); - packet[i++] = val & 0xff; packet[i++] = val >> 8; + packet[i++] = val & 0xff; } // failsafe for (chan = 0; chan < 8; chan++) { // any way to disable failsafe on a channel ? (keep last received value) val = scale_channel(Model.limits[chan].failsafe, -100, 100, 4000, 0); - packet[i++] = val & 0xff; packet[i++] = val >> 8; + packet[i++] = val & 0xff; } // checksum packet[40] = packet[4]; From 8edb4aea67a6ebe67a3044aeeabfbe881b90e95c Mon Sep 17 00:00:00 2001 From: Goebish Date: Tue, 19 Feb 2019 00:16:18 +0100 Subject: [PATCH 13/18] Add RADIOLINK_CC2530 module --- src/config/hardware.c | 1 + src/target.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/config/hardware.c b/src/config/hardware.c index 76fb3ed7fd..dba80d0aeb 100644 --- a/src/config/hardware.c +++ b/src/config/hardware.c @@ -49,6 +49,7 @@ const char * const MODULE_NAME[TX_MODULE_LAST] = { [CC2500] = "CC2500", [NRF24L01] = "NRF24l01", [MULTIMOD] = "MultiMod", + [RADIOLINK_CC2530] = "Radiolink", }; #define MATCH_SECTION(s) strcasecmp(section, s) == 0 diff --git a/src/target.h b/src/target.h index 0417513976..b98e87223e 100644 --- a/src/target.h +++ b/src/target.h @@ -49,6 +49,7 @@ enum Radio { CC2500, NRF24L01, MULTIMOD, + RADIOLINK_CC2530, R9M, TX_MODULE_LAST, }; From 435c0f2eeffed120a9ce55bb4621fb39dd446df9 Mon Sep 17 00:00:00 2001 From: Goebish Date: Wed, 20 Feb 2019 16:53:06 +0100 Subject: [PATCH 14/18] Use msleep instead of Delay --- src/protocol/radiolink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index d1dd28bd20..4d8588a542 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -93,7 +93,7 @@ static void RADIOLINK_Initialize() { PROTO_CS_HI(RADIOLINK_CC2530); PROTOSPI_pin_clear(RADIOLINK_CC2530_RESET_PIN); - Delay(100); + msleep(100); PROTOSPI_pin_set(RADIOLINK_CC2530_RESET_PIN); } From 6225c1d70027d366ce6f7c37f6909ea276c97ca8 Mon Sep 17 00:00:00 2001 From: Goebish Date: Wed, 20 Feb 2019 16:54:34 +0100 Subject: [PATCH 15/18] Remove from modular build --- src/protocol/Makefile.inc | 5 ----- src/protocol/radiolink.c | 6 ------ 2 files changed, 11 deletions(-) diff --git a/src/protocol/Makefile.inc b/src/protocol/Makefile.inc index 09c412f429..cde6126294 100644 --- a/src/protocol/Makefile.inc +++ b/src/protocol/Makefile.inc @@ -58,7 +58,6 @@ PROTO_MODULES += $(ODIR)/protocol/gd00x.mod PROTO_MODULES += $(ODIR)/protocol/sbus.mod PROTO_MODULES += $(ODIR)/protocol/pxx.mod PROTO_MODULES += $(ODIR)/protocol/loli.mod -PROTO_MODULES += $(ODIR)/protocol/radiolin.mod ALL += $(PROTO_MODULES) else #BUILD_TARGET @@ -294,8 +293,4 @@ $(ODIR)/protocol/loli.mod : $(ODIR)/loli_nrf24l01.bin @echo Building 'loli' module /bin/mkdir -p $(ODIR)/protocol/ 2>/dev/null; /bin/cp $< $@ -$(ODIR)/protocol/radiolin.mod : $(ODIR)/radiolink.bin - @echo Building 'radiolink' module - /bin/mkdir -p $(ODIR)/protocol/ 2>/dev/null; /bin/cp $< $@ - endif #BUILD_TARGET diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index 4d8588a542..a36ff3f4ee 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -23,12 +23,6 @@ #ifdef PROTO_HAS_RADIOLINK_CC2530 -#ifdef MODULAR - // Allows the linker to properly relocate - #define RADIOLINK_Cmds PROTO_Cmds - #pragma long_calls -#endif - #define PACKET_SIZE 41 #define PACKET_INTERVAL 4000 From 94d72339ba14aa1edafb5e98a8f30cb8d1b90309 Mon Sep 17 00:00:00 2001 From: Goebish Date: Wed, 20 Feb 2019 16:56:40 +0100 Subject: [PATCH 16/18] Remove module name --- src/config/hardware.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/config/hardware.c b/src/config/hardware.c index dba80d0aeb..76fb3ed7fd 100644 --- a/src/config/hardware.c +++ b/src/config/hardware.c @@ -49,7 +49,6 @@ const char * const MODULE_NAME[TX_MODULE_LAST] = { [CC2500] = "CC2500", [NRF24L01] = "NRF24l01", [MULTIMOD] = "MultiMod", - [RADIOLINK_CC2530] = "Radiolink", }; #define MATCH_SECTION(s) strcasecmp(section, s) == 0 From d3f79b5ee06499bfe6690784fe3218f484d0dd50 Mon Sep 17 00:00:00 2001 From: Goebish Date: Wed, 20 Feb 2019 17:03:33 +0100 Subject: [PATCH 17/18] Add PROTOCMD_RESET --- src/protocol/radiolink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index a36ff3f4ee..c1140fc636 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -97,7 +97,6 @@ static void RADIOLINK_Stop() PROTOSPI_pin_clear(RADIOLINK_CC2530_RESET_PIN); } -// todo: call during transmitter startup static int RADIOLINK_Reset() { RADIOLINK_Initialize(); @@ -120,7 +119,10 @@ uintptr_t RADIOLINK_Cmds(enum ProtoCmds cmd) { switch (cmd) { case PROTOCMD_INIT: initialize(); return 0; - case PROTOCMD_DEINIT: RADIOLINK_Stop(); return 0; + case PROTOCMD_RESET: + case PROTOCMD_DEINIT: + CLOCK_StopTimer(); + return (RADIOLINK_Reset() ? 1 : -1); case PROTOCMD_CHECK_AUTOBIND: return 1; case PROTOCMD_BIND: initialize(); return 0; case PROTOCMD_NUMCHAN: return 10; From 8f377eac4185353c4b24f5c4b0b25de4bbac5608 Mon Sep 17 00:00:00 2001 From: Goebish Date: Wed, 20 Feb 2019 17:21:57 +0100 Subject: [PATCH 18/18] Fix lint --- src/protocol/radiolink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/radiolink.c b/src/protocol/radiolink.c index c1140fc636..c2f3febdbe 100644 --- a/src/protocol/radiolink.c +++ b/src/protocol/radiolink.c @@ -120,7 +120,7 @@ uintptr_t RADIOLINK_Cmds(enum ProtoCmds cmd) switch (cmd) { case PROTOCMD_INIT: initialize(); return 0; case PROTOCMD_RESET: - case PROTOCMD_DEINIT: + case PROTOCMD_DEINIT: CLOCK_StopTimer(); return (RADIOLINK_Reset() ? 1 : -1); case PROTOCMD_CHECK_AUTOBIND: return 1;