-
Notifications
You must be signed in to change notification settings - Fork 7
/
morseGen.cpp
45 lines (35 loc) · 1003 Bytes
/
morseGen.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: GNU General Public License v3.0 or later
#include <Arduino.h>
#include "global.h"
#include "rgb_lcd.h"
#include "morseGen.h"
extern rgb_lcd lcd;
// WARNING - the teensy 4.0 onboard led on pin13 is also shared with the SDcard on the
// audio daughterboard - so, if we ever go to use that SD slot, we'll need to find another
// LED to use...
//#define ledPin 13
#define ledPin 22
void morsePrint(char c)
{
static char buf[17] = " ";
memcpy(buf, buf+1, 15);
buf[15] = c;
if (display ) {
lcd.setCursor(0, 0);
lcd.print(buf);
}
}
void morseLed(bool on)
{
if (on) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
//---------------------------------------------------------------------------------
void morseInit() { // Speak callsign on boot
toneDetect.frequency(morse_frequency, morse_cycles);
toneDetect.threshold(morse_threshold);
pinMode(ledPin, OUTPUT);
}