...
Files Critical to Abstraction:
Application/config_notecard_config.h
Provides
#define
variables that can be used to force override Notecard specific settings.Application/Framework/sched.h
Declares application callback signatures and the scheduled application configuration structure,
schedAppConfig
.Application/Framework/sched.c
Contains application array, implements the Sparrow task scheduler functions, and performs application callbacks (”Application Host”).
Application/Gateway/auth.c
Used by the gateway to receive/process Notes by adding additional information before forwarding to the Notecard.
Application/Sensor/init.c
Implements the weakly linked
schedAppInit()
function, which loads the example applications into the “Application Host”.
...
Invoking this API causes a cascade of changes to be made to the applications runtime.
The current state is send to
STATE_SENDING_REQUEST
and if you indicated you were expecting a response, the state will change toSTATE_RECEIVING_RESPONSE
after sending the request.
However, both the success and failure states are set toSTATE_DEACTIVATED
, which means whether your application succeeds or fails at it’s attempt to send the Note (or receive a response), it will ultimately become deactivated. If you wish to alter the success and failure states, thenschedSetCompletionState()
can be called promptly afternoteSendToGatewayAsync()
has returned.If a response has been requested, then the application will continue running - blocking the main thread of execution. This, in turn, prevents other applications from running.
Note Tracking
If you have requested a response, then an arbitrary number can be added to the id
tag of the Note, which allows you to match the response with the original request. When "id"
is supplied to a Note, then the response (which comes as the rsp
parameter of diagResponse()
callback) will contain a matching "id"
tag.
...
To add an application to the Sparrow firmware, you will be able to do everything from the sparrow-application
folder by following these steps:
Create a new folder for your application in the
sparrow-application
folder.Create an application module (
.c
/.h
files) in your new folder.Multiple working examples exist, each in their own folder, listed under the
sparrow-application
folder.Update
sparrow-application/CMakeLists.txt
to build your source file (.c
) and include your header (.h
)Each of the samples is also built by this
CMakeLists.txt
file.
Collecting Logs
Use an STLINK-V3MINI to connect to your device, you can use a terminal emulator to view the debugging output on the serial port that appears on your computer.
...