-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- CMWX1ZZABZ now aggregates rather than inherits SX1276 - CMWX1ZZABZ now had its own SPI object and uses fixed pin names (since these connections are fixed) - updated examples/bare_mbed to suit CMWX1ZZABZ changes
- Loading branch information
Showing
16 changed files
with
898 additions
and
488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ pclint/* | |
secrets/* | ||
test/* | ||
vendor/* | ||
wrappers/arduino/* | ||
wrappers/ruby/* | ||
examples/* | ||
tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
This example runs shows how to run LDL::MAC on MBED with the bare metal | ||
profile. | ||
|
||
The target in this case is expected to be the DISCO_L072CZ_LRWAN1. | ||
The target in this case is expected to be the DISCO_L072CZ_LRWAN1 which | ||
features the Murata ABZ module. | ||
|
||
The wrapper for this module takes care of all the connections for you, | ||
the only option left to the integrator is which pin to use to switch | ||
TCXO. On the DISCO_L072CZ_LRWAN1 the default pin for controlling TCXO is PA_12 | ||
but this can be moved using jumper wire. | ||
|
||
If you are using this module on bespoke hardware, make sure you have completed | ||
the pin map correctly and used the STM32 names (e.g. PA_12). | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* Copyright (c) 2020 Cameron Harper | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* */ | ||
|
||
#include "cmwx1zzabz.h" | ||
#include "ldl_system.h" | ||
#include "ldl_radio.h" | ||
|
||
using namespace LDL; | ||
|
||
/* constructors *******************************************************/ | ||
|
||
CMWX1ZZABZ::CMWX1ZZABZ( | ||
PinName enable_tcxo, | ||
int16_t tx_gain | ||
) | ||
: | ||
Radio(), | ||
spi(PA_7, PA_6, PB_3), | ||
enable_boost(PC_1, 0), | ||
enable_rfo(PC_2, 0), | ||
enable_rfi(PA_1, 0), | ||
enable_tcxo(enable_tcxo, PIN_INPUT, PullNone, 1), | ||
radio( | ||
spi, | ||
PA_15, // nss | ||
PC_0, // reset | ||
PB_4, PB_1, NC, NC, NC, NC, // DIO0, DIO1, DIO2, DIO3, DIO4, DIO5 | ||
LDL_RADIO_PA_AUTO, | ||
tx_gain, | ||
LDL_RADIO_XTAL_TCXO, | ||
10UL, | ||
callback(this, &CMWX1ZZABZ::set_mode) | ||
) | ||
{ | ||
/* ensure that radio events can make it out of the real driver */ | ||
radio.set_event_handler(callback(this, &CMWX1ZZABZ::handle_event)); | ||
} | ||
|
||
/* protected **********************************************************/ | ||
|
||
void | ||
CMWX1ZZABZ::handle_event(enum ldl_radio_event event) | ||
{ | ||
_interrupt_handler((struct ldl_mac *)this, event); | ||
} | ||
|
||
void | ||
CMWX1ZZABZ::set_mode(enum ldl_chip_mode mode) | ||
{ | ||
/* we don't manpulate reset since that is the | ||
* domain of the radio driver and not of the module */ | ||
switch(mode){ | ||
case LDL_CHIP_MODE_RESET: | ||
enable_rfi = 0; | ||
enable_rfo = 0; | ||
enable_boost = 0; | ||
enable_tcxo.input(); | ||
break; | ||
case LDL_CHIP_MODE_SLEEP: | ||
enable_rfi = 0; | ||
enable_rfo = 0; | ||
enable_boost = 0; | ||
enable_tcxo.input(); | ||
break; | ||
case LDL_CHIP_MODE_STANDBY: | ||
enable_rfi = 0; | ||
enable_rfo = 0; | ||
enable_boost = 0; | ||
enable_tcxo.output(); | ||
break; | ||
case LDL_CHIP_MODE_RX: | ||
enable_rfi = 1; | ||
enable_rfo = 0; | ||
enable_boost = 0; | ||
break; | ||
case LDL_CHIP_MODE_TX_BOOST: | ||
enable_rfi = 0; | ||
enable_rfo = 0; | ||
enable_boost = 1; | ||
break; | ||
case LDL_CHIP_MODE_TX_RFO: | ||
enable_rfi = 0; | ||
enable_rfo = 1; | ||
enable_boost = 0; | ||
break; | ||
} | ||
} | ||
|
||
/* public *************************************************************/ | ||
|
||
Radio * | ||
CMWX1ZZABZ::get_state() | ||
{ | ||
return radio.get_state(); | ||
} | ||
|
||
const struct ldl_radio_interface * | ||
CMWX1ZZABZ::get_interface() | ||
{ | ||
return radio.get_interface(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* Copyright (c) 2020 Cameron Harper | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* */ | ||
|
||
#ifndef MBED_LDL_CMWX1ZZABZ_H | ||
#define MBED_LDL_CMWX1ZZABZ_H | ||
|
||
#include "sx1276.h" | ||
|
||
namespace LDL { | ||
|
||
/** | ||
* A module that aggregates: | ||
* | ||
* - SX1276 | ||
* - TCXO with power switch | ||
* - switches for engaging RFI, RFO, and BOOST | ||
* - dedicated SPI peripheral | ||
* | ||
* Inherits radio so that it can be passed to the MAC. | ||
* | ||
* */ | ||
class CMWX1ZZABZ : public Radio { | ||
|
||
protected: | ||
|
||
SPI spi; | ||
|
||
DigitalOut enable_boost; | ||
DigitalOut enable_rfo; | ||
DigitalOut enable_rfi; | ||
DigitalInOut enable_tcxo; | ||
|
||
SX1276 radio; | ||
|
||
void set_mode(enum ldl_chip_mode mode); | ||
|
||
void handle_event(enum ldl_radio_event event); | ||
|
||
public: | ||
|
||
CMWX1ZZABZ( | ||
PinName enable_tcxo, | ||
int16_t tx_gain = 0 | ||
); | ||
|
||
const struct ldl_radio_interface *get_interface(); | ||
Radio *get_state(); | ||
}; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.