#include "Globals.h"
#include "InputHandler.h"
#include "Menu.h"
#include "T9Input.h"
#include "Morse.h"
void setup() {
Serial.begin(115200);
lcd.init();
lcd.backlight();
lcd.createChar(0, charUp);
lcd.createChar(1, charDown);
lcd.createChar(2, charUpDown);
lcd.createChar(3, charEnter);
//Pin Mode
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, LOW);
pinMode(AUDIO_IN_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
pinMode(SPEAKER_PIN, OUTPUT);
digitalWrite(SPEAKER_PIN, LOW);
noTone(SPEAKER_PIN);
// Setup DSP for Morse reception
int k = (int)(0.5 + ((n * targetFreq) / samplingFreq));
float omega = (2.0 * PI * k) / n;
sine = sin(omega);
cosine = cos(omega);
coeff = 2.0 * cosine;
// Show welcome screen
currentMenu = MENU_WELCOME;
updateLCD();
}
void loop() {
processKeypad();
// In message-entry mode, commit any pending T9 letter if the timeout has elapsed.
if (currentMenu == MENU_ENTER_MSG && currentT9Key != '\0' && (millis() - lastT9PressTime > t9Timeout)) {
commitT9Letter();
updateEnterMsgDisplay();
}
}