MCPcopy Create free account
hub / github.com/El-EnderJ/NeoCalculator / KeyMatrix

Method KeyMatrix

src/input/KeyMatrix.cpp:22–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#include "KeyMatrix.h"
21
22KeyMatrix::KeyMatrix() {
23 // Reset state
24 for(int r=0; r<6; r++) {
25 for(int c=0; c<8; c++) {
26 _keyState[r][c] = 0;
27 _lastDebounceTime[r][c] = 0;
28 _map[r][c] = KeyCode::NONE;
29 }
30 }
31
32 // --- Define Layout Map ---
33 // Row 0
34 _map[0][0] = KeyCode::SHIFT; _map[0][1] = KeyCode::ALPHA; _map[0][2] = KeyCode::MODE; _map[0][3] = KeyCode::SETUP;
35 _map[0][4] = KeyCode::F1; _map[0][5] = KeyCode::F2; _map[0][6] = KeyCode::F3; _map[0][7] = KeyCode::F4;
36
37 // Row 1
38 _map[1][0] = KeyCode::ON; _map[1][1] = KeyCode::AC; _map[1][2] = KeyCode::DEL; _map[1][3] = KeyCode::FREE_EQ;
39 _map[1][4] = KeyCode::LEFT; _map[1][5] = KeyCode::UP; _map[1][6] = KeyCode::DOWN; _map[1][7] = KeyCode::RIGHT;
40
41 // Row 2
42 _map[2][0] = KeyCode::VAR_X; _map[2][1] = KeyCode::VAR_Y; _map[2][2] = KeyCode::TABLE; _map[2][3] = KeyCode::GRAPH;
43 _map[2][4] = KeyCode::ZOOM; _map[2][5] = KeyCode::TRACE; _map[2][6] = KeyCode::SHOW_STEPS; _map[2][7] = KeyCode::SOLVE;
44
45 // Row 3
46 _map[3][0] = KeyCode::NUM_7; _map[3][1] = KeyCode::NUM_8; _map[3][2] = KeyCode::NUM_9; _map[3][3] = KeyCode::LPAREN;
47 _map[3][4] = KeyCode::RPAREN; _map[3][5] = KeyCode::DIV; _map[3][6] = KeyCode::POW; _map[3][7] = KeyCode::SQRT;
48
49 // Row 4
50 _map[4][0] = KeyCode::NUM_4; _map[4][1] = KeyCode::NUM_5; _map[4][2] = KeyCode::NUM_6; _map[4][3] = KeyCode::MUL;
51 _map[4][4] = KeyCode::SUB; _map[4][5] = KeyCode::SIN; _map[4][6] = KeyCode::COS; _map[4][7] = KeyCode::TAN;
52
53 // Row 5
54 _map[5][0] = KeyCode::NUM_1; _map[5][1] = KeyCode::NUM_2; _map[5][2] = KeyCode::NUM_3; _map[5][3] = KeyCode::ADD;
55 _map[5][4] = KeyCode::NEG; _map[5][5] = KeyCode::NUM_0; _map[5][6] = KeyCode::DOT; _map[5][7] = KeyCode::ENTER;
56}
57
58void KeyMatrix::begin() {
59 // Rows as Inputs with Pullup

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected