Skip to content

Latest commit

 

History

History
90 lines (51 loc) · 3.51 KB

calculator.md

File metadata and controls

90 lines (51 loc) · 3.51 KB

Calculator Guide

The calculator is integrated and can be accessed by toggling the layer key until you see the following on the OLED screen:

CalculatorLayer

From here the key matrix acts as the input method for the calculator, following this mapping:

CalculatorLayout

Supported operands and operations

The calculator supports 2 operands , called term_1 and term_2 in the code (for reference). A series of checks is implemented so that the state of the calculator is always valid.

4 basic operations and signs

The input flow is as follows for the 4 basic operations:

  1. user enters digits for term_1

    1.1 user presses ± to change term_1 sing

  2. user selects an operation + , - , * or /

  3. user enters digits for term_2

    3.1 user presses ± to change term_2 sing

  4. user presses = to calculate the result

When the calculation result is displayed, the calculator will wait for the user to reset the state to the initial state via the AC key.

Note: if an operation is selected before any digit has being pressed the calculator treats term_1 as a 0. In this case when * or / is selected the return value will be 0 as the result. The indetermination case is also handled, returning 0.

Square Root

The SQRT function calculates the square root of the term_1 operand by itself or the result of an operation between term_1 and term_2. Therefore the term_1 operand or the result of the operation between term_1 and term_2 must be a positive number, otherwise the calculator will display Imaginary Root! as a result.

The input flow is as follows:

term_1 only

  1. user enters digits for term_1

  2. user presses SQRT to calculate the result

term_1 and term_2

  1. user enters digits for term_1

    1.1 user presses ± to change term_1 sing

  2. user selects an operation + , - , * or /

  3. user enters digits for term_2

    3.1 user presses ± to change term_2 sing

  4. user presses SQRT to calculate the result, evaluated as sqrt( term_1|operand|term_2)

As for the 4 basic operations, when the calculation result is displayed, the calculator will wait for the user to reset the state to the initial state via the AC key.

Notes:

* The SQRT function is not supported for term_2 operands. If you try to execute one of the 4 basic operations and then press SQRT this won't produce any output (the SQRT command is ignored).

* Again if no digits are entered for term_1 the calculator will treat it as a 0 and return 0 as the result if SQRT is pressed.

Implementation of the SQRT function as above (term1operationterm__2SQRT) is in the work.

Implementation status

This table summarize the implementation status of the calculator.

Legend: ✅ Supported 🚧 Under Development 💡 Planned
Feature Status
+
-
*
/
±
AC
SQRT
C 💡
. aka decimal operands 🚧

Calculator