Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Käppler
ampel-firmware
Commits
a3057742
Commit
a3057742
authored
Dec 25, 2020
by
Eric Duminil
Browse files
Automatic pin mapping for LoRa
parent
207a7d38
Changes
2
Show whitespace changes
Inline
Side-by-side
lorawan.cpp
View file @
a3057742
...
@@ -9,9 +9,6 @@ namespace config {
...
@@ -9,9 +9,6 @@ namespace config {
static
const
u1_t
PROGMEM
DEVEUI
[
8
]
=
LORAWAN_DEVICE_EUI
;
static
const
u1_t
PROGMEM
DEVEUI
[
8
]
=
LORAWAN_DEVICE_EUI
;
static
const
u1_t
PROGMEM
APPKEY
[
16
]
=
LORAWAN_APPLICATION_KEY
;
static
const
u1_t
PROGMEM
APPKEY
[
16
]
=
LORAWAN_APPLICATION_KEY
;
}
}
// Pin mapping for TTGO LoRa32 V1
// More info : https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436
const
lmic_pinmap
lmic_pins
=
{
.
nss
=
18
,
.
rxtx
=
LMIC_UNUSED_PIN
,
.
rst
=
14
,
.
dio
=
{
26
,
33
,
32
}
};
// Payloads will be automatically sent via MQTT by TheThingsNetwork, and can be seen with:
// Payloads will be automatically sent via MQTT by TheThingsNetwork, and can be seen with:
// mosquitto_sub -h eu.thethings.network -t '+/devices/+/up' -u 'APPLICATION-NAME' -P 'ttn-account-v2.4xxxxxxxx-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxx' -v
// mosquitto_sub -h eu.thethings.network -t '+/devices/+/up' -u 'APPLICATION-NAME' -P 'ttn-account-v2.4xxxxxxxx-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxx' -v
...
@@ -167,8 +164,11 @@ namespace lorawan {
...
@@ -167,8 +164,11 @@ namespace lorawan {
void
initialize
()
{
void
initialize
()
{
Serial
.
println
(
F
(
"Starting LoRaWAN."
));
Serial
.
println
(
F
(
"Starting LoRaWAN."
));
// More info about pin mapping : https://github.com/mcci-catena/arduino-lmic#pin-mapping
// Has been tested successfully with ESP32 TTGO LoRa32 V1, and might work with other ESP32+LoRa boards.
const
lmic_pinmap
*
pPinMap
=
Arduino_LMIC
::
GetPinmap_ThisBoard
();
// LMIC init.
// LMIC init.
os_init
(
);
os_init
_ex
(
pPinMap
);
// Reset the MAC state. Session and pending data transfers will be discarded.
// Reset the MAC state. Session and pending data transfers will be discarded.
LMIC_reset
();
LMIC_reset
();
// Join, but don't send anything yet.
// Join, but don't send anything yet.
...
...
lorawan.h
View file @
a3057742
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
// Tested successfully with v3.2.0 and connected to a thethingsnetwork.org app.
// Tested successfully with v3.2.0 and connected to a thethingsnetwork.org app.
#include
<lmic.h>
#include
<lmic.h>
#include
<hal/hal.h>
#include
<hal/hal.h>
#include
<arduino_lmic_hal_boards.h>
#include
<SPI.h>
#include
<SPI.h>
typedef
uint8_t
u1_t
;
typedef
uint8_t
u1_t
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment