Skip to content

Commit

Permalink
RadioLib/RadioLib: Use new Tock HAL names
Browse files Browse the repository at this point in the history
Signed-off-by: Alistair Francis <[email protected]>
  • Loading branch information
alistair23 committed Nov 7, 2024
1 parent 90a7091 commit e54c7f0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
url = https://github.com/openthread/openthread.git
[submodule "RadioLib/RadioLib"]
path = RadioLib/RadioLib
url = https://github.com/jgromes/RadioLib.git
url = https://github.com/alistair23/RadioLib.git
9 changes: 5 additions & 4 deletions examples/lora/sensor-lorawan/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main(void) {
printf("[SX1261] Initialising Radio ... \r\n");

// create a new instance of the HAL class
TockHal* hal = new TockHal();
TockRadioLibHal* hal = new TockRadioLibHal();
int state;

// now we can create the radio module
Expand All @@ -44,7 +44,8 @@ int main(void) {
// DIO1 pin: 2
// NRST pin: 4
// BUSY pin: 1
SX1262 tock_module = new Module(hal, RADIO_NSS, RADIO_DIO_1, RADIO_RESET, RADIO_BUSY);
SX1262 tock_module = new Module(hal, RADIOLIB_RADIO_NSS, RADIOLIB_RADIO_DIO_1, RADIOLIB_RADIO_RESET,
RADIOLIB_RADIO_BUSY);
LoRaWANNode node(&tock_module, Region, subBand);

// Setup the radio
Expand All @@ -69,8 +70,8 @@ int main(void) {

printf("success!\r\n");

hal->detachInterrupt(RADIO_DIO_1);
hal->pinMode(RADIO_DIO_1, PIN_INPUT);
hal->detachInterrupt(RADIOLIB_RADIO_DIO_1);
hal->pinMode(RADIOLIB_RADIO_DIO_1, TOCK_RADIOLIB_PIN_INPUT);

int temp = 0;
int humi = 0;
Expand Down
7 changes: 4 additions & 3 deletions examples/lora/sensor-receive/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ int main(void) {
printf("[SX1261] Initialising Radio ... \n");

// create a new instance of the HAL class
TockHal* hal = new TockHal();
TockRadioLibHal* hal = new TockRadioLibHal();

// now we can create the radio module
// pinout corresponds to the SparkFun LoRa Thing Plus - expLoRaBLE
// NSS pin: 0
// DIO1 pin: 2
// NRST pin: 4
// BUSY pin: 1
Module* tock_module = new Module(hal, RADIO_NSS, RADIO_DIO_1, RADIO_RESET, RADIO_BUSY);
SX1262* radio = new SX1262(tock_module);
Module* tock_module = new Module(hal, RADIOLIB_RADIO_NSS, RADIOLIB_RADIO_DIO_1, RADIOLIB_RADIO_RESET,
RADIOLIB_RADIO_BUSY);
SX1262* radio = new SX1262(tock_module);

// Setup the radio
// The settings here work for the SparkFun LoRa Thing Plus - expLoRaBLE
Expand Down
7 changes: 4 additions & 3 deletions examples/lora/sensor-transmit/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ int main(void) {
printf("[SX1261] Initialising Radio ... \n");

// create a new instance of the HAL class
TockHal* hal = new TockHal();
TockRadioLibHal* hal = new TockRadioLibHal();

// now we can create the radio module
// pinout corresponds to the SparkFun LoRa Thing Plus - expLoRaBLE
// NSS pin: 0
// DIO1 pin: 2
// NRST pin: 4
// BUSY pin: 1
Module* tock_module = new Module(hal, RADIO_NSS, RADIO_DIO_1, RADIO_RESET, RADIO_BUSY);
SX1262* radio = new SX1262(tock_module);
Module* tock_module = new Module(hal, RADIOLIB_RADIO_NSS, RADIOLIB_RADIO_DIO_1, RADIOLIB_RADIO_RESET,
RADIOLIB_RADIO_BUSY);
SX1262* radio = new SX1262(tock_module);

// Setup the radio
// The settings here work for the SparkFun LoRa Thing Plus - expLoRaBLE
Expand Down

0 comments on commit e54c7f0

Please sign in to comment.