This is a roll-up ticket for centralizing the application framework material that is now scattered all over the place. This gives a ticket to reference for the development branch.
The application framework handles the following.
turning on the 3.3V boost regulator if needed (4612, 4618, 4630)
set up SPI flash interface (if SPI flash is available on this platform).
I2C initialization (ditto)
Serial port initialization at default speed (115200).
LED initialization (if available)
FRAM initialization (if available)
if there are operating flags, checks bit zero of the operating flags, and delays if zero and no serial port is attached.
Command-line interface via Serial, with standard commands
Command-line firmware download if the platform supports MCCI trusted boot loader and SPI flash.
Sensor initialization for the platform (e.g., put BME280 in standby)
LoRaWAN setup with LMIC if enabled by user
provides a consistent sleep API
on STM32L0, turning on the 32kHz clock and using it to discipline the ms/micros timebase
abstracting the built-in sensors (T, RH, optional P)
allows for one or more extensions (for FeatherWings) to provide setup, initialization, sleep, and recovery methods.
detecting first boot after update by comparing stashed hash (from FRAM) to live hash
In addition, we want to centralize some common things:
the makeVersion and version-comparison functions
the file base-name extraction constexpr.
You must do the following:
Create a standard application for your board. McciCatena::Catena gCatena;.
In setup(), add options: for example, gCatena.useLoRaWAN(); if using LoRaWAN, or gCatena.useSigfox(); if using Sigfox. Note that these imply useStandardFramework(). gCatena.useSerialBaudrate(n) sets the baudrate to n.
Then call gCatena.setup() to invoke the standard setup.
Then in loop(), call gCatena.loop().
We're going to need to add some slots on the various concrete Catenas. For convenience, we should consider adding a vanilla Catena that allows use of the command-line interface and some other things on any Arduino.
New classes
class Catena_SpiFlash: the abstract wrapper for the concrete flash drivers.
Methods
SPIClass *Catena::getExternalSpi() const;
Return pointer to the external SPI that's driving MOSI, MISO and SCK. By default, it's SPI, but on MCCI Catenas using the Murata module, it may be gSPI2.
Globals from the application framework
SPIClass gSPI2; for the second SPI bus, on MCCI Catenas -- this is because the primary SPI interface, SPI, is not brought to pins and is used with the LoRaWAN radio.
Catena_SpiFlash gFlash;
cDownload McciCatena::gDownload;
cBootloaderApi McciCatena::gBootloaderApi;
cSerial<decltype(Serial)> McciCatena::gSerial;
StatusLed McciCatena::gLed;
cLog McciCatena::gLog;
These are all set up (and exported) by Catena::setup(), which calls Catena::begin() for legacy use.
This is a roll-up ticket for centralizing the application framework material that is now scattered all over the place. This gives a ticket to reference for the development branch.
The application framework handles the following.
Serial
, with standard commandsIn addition, we want to centralize some common things:
constexpr
.You must do the following:
McciCatena::Catena gCatena;
.setup()
, add options: for example,gCatena.useLoRaWAN();
if using LoRaWAN, orgCatena.useSigfox();
if using Sigfox. Note that these implyuseStandardFramework()
.gCatena.useSerialBaudrate(n)
sets the baudrate to n.gCatena.setup()
to invoke the standard setup.Then in
loop()
, callgCatena.loop()
.We're going to need to add some slots on the various concrete Catenas. For convenience, we should consider adding a vanilla Catena that allows use of the command-line interface and some other things on any Arduino.
New classes
class Catena_SpiFlash
: the abstract wrapper for the concrete flash drivers.Methods
Return pointer to the external SPI that's driving MOSI, MISO and SCK. By default, it's
SPI
, but on MCCI Catenas using the Murata module, it may begSPI2
.Globals from the application framework
SPIClass gSPI2;
for the second SPI bus, on MCCI Catenas -- this is because the primary SPI interface,SPI
, is not brought to pins and is used with the LoRaWAN radio.These are all set up (and exported) by
Catena::setup()
, which callsCatena::begin()
for legacy use.