#include #include #include "esp32-hal-gpio.h" /* * AES256 Seed Phrase Encryptor * * Copyright (C) 2026 SCHAUAUS GmbH * */ // pin definitions #define KEYBOARD_COL1_PIN 1 #define KEYBOARD_COL2_PIN 2 #define KEYBOARD_COL3_PIN 3 #define KEYBOARD_COL4_PIN 0 #define KEYBOARD_COL5_PIN 5 #define KEYBOARD_ROW1_PIN 18 #define KEYBOARD_ROW2_PIN 19 #define KEYBOARD_ROW3_PIN 20 #define KEYBOARD_ROW4_PIN 23 // project includes #include "matrix_keyboard.h" char keyboardCharacters[] = "0123456789ABCDEF"; int colPins[] = { KEYBOARD_COL1_PIN, KEYBOARD_COL2_PIN, KEYBOARD_COL3_PIN, KEYBOARD_COL4_PIN }; int rowPins[] = { KEYBOARD_ROW1_PIN, KEYBOARD_ROW2_PIN, KEYBOARD_ROW3_PIN, KEYBOARD_ROW4_PIN }; void initKeyboard () { // set column pins as input pulled low for ( int i = 0; i < sizeof(colPins) / sizeof(colPins[0]); i++ ) pinMode(colPins[i], INPUT_PULLDOWN); //set row pins as output for ( int j = 0; j < sizeof(rowPins) / sizeof(rowPins[0]); j++ ) { pinMode(rowPins[j], OUTPUT); digitalWrite(rowPins[j], 0); } } char readKeyboard () { for ( int i = 0; i < sizeof(rowPins) / sizeof(rowPins[0]); i++ ) { // walk through each row of keys on the matrix keyboard digitalWrite(rowPins[i], 1); delay(100); for ( int j = 0; j < sizeof(colPins) / sizeof(colPins[0]); j++ ) { // read each column of the keyboard to identify a pressed key if ( digitalRead( colPins[j] ) ) { // check if button is pressed while ( digitalRead( colPins[j] ) ); // wait until button is released again digitalWrite(rowPins[i], 0); return keyboardCharacters[i*4 + j]; // return key } } digitalWrite(rowPins[i], 0); } return '\0'; }