[][src]Crate app

Sensor app that reads sensor data from a temperature sensor and sends the sensor data to a CoAP server over NB-IoT. Note that we are using a patched version of apps/my_sensor_app/src/vsscanf.c that fixes AT response parsing bugs. The patched file must be present in that location. This is the Rust version of https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/rust-nbiot/apps/my_sensor_app/OLDsrc/main.c

Modules

app_network

Transmit sensor data to a CoAP server like thethings.io. The CoAP payload will be encoded as JSON. The sensor data will be transmitted over NB-IoT. Note that we are using a patched version of apps/my_sensor_app/src/vsscanf.c that fixes response parsing bugs. The patched file must be present in that location. This is the Rust version of https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/rust-nbiot/apps/my_sensor_app/OLDsrc/network.c

app_sensor

Poll the temperature sensor every 10 seconds. Transmit the sensor data to the CoAP server after polling. This is the Rust version of https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/rust-nbiot/apps/my_sensor_app/OLDsrc/sensor.c

Functions

main

Main program that initialises the sensor, network driver and starts reading and sending sensor data in the background. main() will be called at Mynewt startup. It replaces the C version of the main() function.

panic

This function is called on panic, like an assertion failure. We display the filename and line number and pause in the debugger. From https://os.phil-opp.com/freestanding-rust-binary/