This repository was initially created to test the features of spie. However, it can be used to bootstrap your PlatformIO
project with a modern embedded system workflow.
The firmware itself provides a simple implementation of an AT command interface for configuring a sine wave generator.
- Configure sine wave generation in real-time using AT commands.
- Command validation and error handling for invalid inputs.
- Unit-tested with mocks using
ArduinoFake
. - CI/CD workflows with proper versioning and release routines.
- Clone the repository
git clone https://github.com/robsonos/spie-firmware
-
Open the repository with VSCode and install the recommended extensions
-
Familiarise yourself with PlatformIO
- Build the code:
pio run -e uno
- Upload code:
pio run -e uno -t upload
- Run
cppcheck
:
pio check
- Run unit tests:
pio test
Set or query configuration parameters using the following AT commands:
Command | Description | Example | Response |
---|---|---|---|
AT+NUMPHASES=<value> |
Sets the number of phases (positive integer). | AT+NUMPHASES=3 |
OK |
AT+NUMPHASES? |
Queries the current number of phases. | AT+NUMPHASES? |
+NUMPHASES: 3 |
AT+SIGNALFREQ=<value> |
Sets the signal frequency (positive integer). | AT+SIGNALFREQ=50 |
OK |
AT+SIGNALFREQ? |
Queries the current signal frequency. | AT+SIGNALFREQ? |
+SIGNALFREQ: 50 |
AT+SAMPLINGFREQ=<value> |
Sets the sampling frequency (positive integer). | AT+SAMPLINGFREQ=1000 |
OK |
AT+SAMPLINGFREQ? |
Queries the current sampling frequency. | AT+SAMPLINGFREQ? |
+SAMPLINGFREQ: 1000 |
AT+AMPLITUDE=<value> |
Sets the amplitude (zero or positive integer). | AT+AMPLITUDE=2000 |
OK |
AT+AMPLITUDE? |
Queries the current amplitude. | AT+AMPLITUDE? |
+AMPLITUDE: 2000 |
AT+OFFSET=<value> |
Sets the offset (integer between -10000 and 10000). | AT+OFFSET=500 |
OK |
AT+OFFSET? |
Queries the current offset. | AT+OFFSET? |
+OFFSET: 500 |
AT+ERRORPERCENT=<value> |
Sets the error percentage (float between 0.0 and 100.0). | AT+ERRORPERCENT=5.5 |
OK |
AT+ERRORPERCENT? |
Queries the current error percentage. | AT+ERRORPERCENT? |
+ERRORPERCENT: 5.5 |
AT+VERSION? |
Queries the current firmware version. | AT+VERSION? |
+VERSION: 1.0.0 |
AT+ALL? |
Queries all current configuration parameters. |
If a command is invalid, the interface responds with a descriptive error message:
ERROR: Invalid AT command format.
ERROR: Unknown command.
ERROR: <parameter> must be <valid range>.
There are many ways CD/CI/Release workflow can be implemented. I chose the most convenient one and here is how it is meant to work:
dev
: holds the development code. Pushes to this will trigger theCI workflow
, test your code, and create a PR to merge it intomain
.main
: holds the code for the latest release. Pushes to this will trigger theCD workflow
and create a new github release and tag. You should never need to push commits tomain
; usedev
and create a PR instead. The code on this branch should always come from merges fromdev
.- Once a new release is done, the
Release
workflow will be triggered to build and add the binaries to the release. - If you need to maintain more release channels, like
main
is atv3.x.x
but you need to supportv1.x.x
, I would recommend using a similar approach:main
forv3.x.x
main/v1
forv1.x.x
dev
forv3.x.x
developmentdev/v1
forv1.x.x
development
- I may look into exemplifying the above and
pre-releases
in the feature
- You may need to update the following for unit testing the code:
[env:native]
platform = native; or windows_x86, or linux_x86_64 ...
...
For more information, check out PlatformIO's Development Platforms