This demo application for the C0-microSD supports the following operations:
- Arithmetic operations (add, sub mul, div) of two uniform distributions.
- Sampling from an example built-in distribution.
Folder python-host-application/
contains the source code that runs on the host that communicates with Signaloid C0-microSD.
Folder signaloid-soc-application/
contains the source code as a reference, and a pre-compiled binary for Signaloid C0-microSD.
The correct way to clone this repository to get the hardware and firmware submodules is:
git clone --recursive https://github.com/signaloid/Signaloid-C0-microSD-Demo-Calculator
To update all submodules:
git pull --recurse-submodules
git submodule update --remote --recursive
If you forgot to clone with --recursive
, and end up with empty submodule directories, you can remedy this with
git submodule update --init --recursive
This repo comes with a pre-built main.c
application binary under signaloid-soc-application/main.bin
, which you can flash right away and skip the building step.
If you want to build your own version, you can use the Signaloid Cloud Developer Platform API. To do that:
- Login to your Signaloid Cloud Developer Platform account on signaloid.io.
- Navigate to
Settings->Cloud Engine API
and generate a new key. Save the key somewhere safe, since you will not be able to view it again. - Navigate to the
signaloid-soc-application/
folder. - Modify the
API_KEY
flag in theMakefile
to point to your newly generated API key. - Run
make build
to build your application. Note that every build uses the resources available on your account.
To view more details on how to configure the Signaloid API core downloader tool, please read the corresponding docs.
- Navigate to the
signaloid-soc-application/
folder. - Modify the
DEVICE
flag in theMakefile
to point to your C0-microSD device path. - Run
make flash
andmake switch
(the green LED should blink). - Power cycle the C0-microSD (the green LED should light up).
To run the python based host application you first need to install the Ux plotting dependencies. To do that:
- Navigate to
python-host-application/
- Create a virtual environment:
python3 -m venv .env
- Activate virtual environment:
source .env/bin/activate
- Install the
signaloid-python
package:pip install git+https://github.com/signaloid/signaloid-python
- Run the application:
sudo python3 host_application.py /dev/diskX add "1.0(5)" "1.0(5)"
, where/dev/diskX
is the C0-microSD device path.
For more information regarding the different Signaloid C0-microSD operation modes refer to the official documentation page.
The host application is designed to parse two input arguments. Each argument specifies a uniform distribution, represented in the the concise form of uncertainty
notation, i.e., X.Y(Z)
.
The application supports addition, subtraction, multiplication, and division of the input arguments. The input arguments must be quoted in a linux shell.
usage: host_application.py [-h] device_path {add,sub,mul,div,sample} ...
Host application for C0-microSD calculator application
positional arguments:
device_path Path of C0-microSD
{add,sub,mul,div,sample}
Commands
add Add two uncertainty values
sub Subtract two uncertainty values
mul Multiply two uncertainty values
div Divide two uncertainty values
sample Get samples from example built-in distribution
optional arguments:
-h, --help show this help message and exit
For example, you can multiply the value 2.0
with a tolerance of +- 0.5
and the value 5.0
with a tolerance of +- 0.3
by running:
sudo python host_application.py /dev/disk4 mul "2.0(5)" "5.0(3)"
In the above example, we assume that the C0-microSD device is located at /dev/disk4
.
You can also generate 100 samples from the built-in example distribution:
sudo python host_application.py /dev/disk4 sample 100