cardcalc

This is an RPN calculator for the M5 Cardputer. It’s currently a work in progress.

Build & Install

Clone the repo, open it in the Arduino IDE (you can follow this: https://docs.m5stack.com/en/arduino/m5cardputer/program), build it, and deploy it.
Alternatively, you can download the .bin from the Releases page, then flash it or put it on the SD card if you have a launcher.

todo

Internal-workings (WIP)

This is intended to be the place where I explain the architecture of the project for newcomers (and my future self once come back to this project in 5 months and forget everything)
Here’s how most of it works:

Code examples:

Chord keymap definition

// In keys.h

// ...

// Chord starters
#define CALC_KEY_CHORD_LOG       'l'
// ...

// Chord sub-keys
#define CALC_KEY_LOG_10      'l'
#define CALC_KEY_LOG_2       '2'
#define CALC_KEY_LOG_X       'x'
#define CALC_KEY_LOG_NATURAL 'e'
// ...

Power operation

X -> Y^X

// In cardcalc.ino
void onKeyPress(char key) {
    // ...
    if (chord != 0) {
        // ...
    } else {
        // ...
        switch (key) {
            // ...
            case CALC_KEY_POWER:
                X = pow(Y, X);
                afterOperation();
                break;
            // ...
        }
        // ...
    }
    // ...
}