This is a demo CircuitPython host application on the M5Stack CardPuter for the Signaloid C0-microSD Calculator Demo.
cardputer.demo.mp4
This demo application supports the following arithmetic operations of two uniform distributions:
- Addition
- Subtraction
- Multiplication
- Division
Folder src
contains the CircuitPython source code that runs on the CardPuter. The CardPuter acts as the host that communicates with a Signaloid C0-microSD through its integrated microSD card slot.
Folder submodules/C0-microSD-utilities/
contains the interface.py
library, which is symlinked to the src
folder, that defines the interface between the host and the Signaloid C0-microSD.
Folder submodules/signaloid-python/
contains the distributional.py
and plot_histogram_dirac_deltas.py
libraries, which are symlinked to the src
folder, that define the parsing and plotting of the distributional information from the Signaloid C0-microSD results.
The correct way to clone this repository is:
git clone --recursive https://github.com/signaloid/Signaloid-C0-microSD-CardPuter-Demo
If you forgot to clone with --recursive
, and end up with empty submodule directories, you can remedy this with
git submodule update --init --recursive
To build and flash the C0-microSD application, follow the instructions in the Signaloid C0-microSD Calculator Demo. This is mandatory before running the host application, so that the Signaloid C0-microSD is initialized with the correct firmware, and able to communicate with the host.
To prepare the CardPuter for the CircuitPython application, you have to flash it with the CircuitPython firmware following the instructions in the CircuitPython M5Stack CardPuter documentation.
To run the Python host application you first need to bundle all library dependencies. To do that run this command from the root
folder:
make
This command will do the following:
- Initialize & update all submodules.
- Apply the necessary patches to the Signaloid Python library, so that it can be used with the CardPuter using CircuitPython.
- Create the
CircuitPythonLibs/
folder, where the Adafruit CircuitPython bundle and the Community CircuitPython bundle libraries are downloaded and extracted. - Create the
src/lib/
folder, where the CircuitPython libraries are symlinked to.
To copy the CircuitPython application to the CardPuter, run this command from the root
folder:
make sync
This command will hard copy all the files and folders from the src
folder to the CardPuter. Make sure that you have mounted your CardPuter to your computer, and that the mount path is correctly specified at the DEVICE
variable in the Makefile
(default is /run/media/<user>/CIRCUITPY
).
To live sync the CircuitPython application to the CardPuter, while you are developing or making changes, run this command from the root
folder:
make live-sync
This command will first sync all the files and folders from the src
folder to the CardPuter, then watch for any changes in the src
folder, and live sync them to the CardPuter. Make sure that you have mounted your CardPuter to your computer, and that the mount path is correctly specified at the DEVICE
variable in the Makefile
(default is /run/media/<user>/CIRCUITPY
).
To clean the project, run this command from the root
folder:
make clean
This command will delete the CircuitPythonLibs/
, and the src/lib/
folders.
To clean the CardPuter, run this command from the root
folder:
make clean-device
This command will delete all files and folders from the CardPuter, and will create a new "Hello World" code.py
file. Make sure that you have mounted your CardPuter to your computer and that the mount path is correctly specified at the DEVICE
variable in the Makefile
(default is /run/media/<user>/CIRCUITPY
).
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.
usage: {add,sub,mul,div} uniform_distribution1 uniform_distribution2
Host application for C0-microSD calculator application
positional arguments:
{add,sub,mul,div}
Commands
add Add two uniformly distributed random variables
sub Subtract two uniformly distributed random variables
mul Multiply two uniformly distributed random variables
div Divide two uniformly distributed random variables
uniform_distribution1 uniform_distribution2
Two uniform distributions
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:
mul "2.0(5)" "5.0(3)"