lorawan-device

wayland/m5stack-unit-lorawan/lorawan-device

Create an M5Stack LoRaWAN868 device.
lorawan-device
@/lorawan-device
Create an M5Stack LoRaWAN868 device.
UARTxod/uart/uart
A universal asynchronous receiver-transmitter (UART).
lorawan-device
UART
DEV
DEV@/lorawan-device
A lorawan-device.
To use the node in your project you should have the wayland/m5stack-unit-lorawan library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD require "https://github.com/WaylandM/M5Stack_UNIT_LoRaWAN"

#include <M5Stack_UNIT_LoRaWAN.h>

node {
    meta {
        using Type = M5Stack_UNIT_LoRaWAN*;
    }

    M5Stack_UNIT_LoRaWAN LoRaWAN = M5Stack_UNIT_LoRaWAN();

    void evaluate(Context ctx) {
        // It should be evaluated only once on the first (setup) transaction
        if (!isSettingUp())
            return;

        auto uart = getValue<input_UART>(ctx);

        LoRaWAN.Init(*(uart->toStream()));

        emitValue<output_DEV>(ctx, &LoRaWAN);
    }
}