-
Notifications
You must be signed in to change notification settings - Fork 1
/
cwkey_text.h
55 lines (49 loc) · 2.24 KB
/
cwkey_text.h
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
46
47
48
49
50
51
52
53
54
55
/* -*- mode: c++; tab-width: 8 -*- */
/*
* hasak (ham and swiss army knife) keyer for Teensy 4.X, 3.X
* Copyright (c) 2021 by Roger Critchlow, Charlestown, MA, USA
* ad5dz, [email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice, development funding notice, and this permission
* notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/*
** hasak text keyer component.
**
** I've adopted the compact code representation and the winkey convention
** of a prefix operator to form prosigns by concatenation, but I'm feeling
** a little queasy about corner cases.
**
** The morse table has moved into the NRPN array, so it can be augmented as
** required. It covers the 64 characters from ! to `, though many are undefined
** by default.
*/
#include "src/keyer_text.h"
static KeyerText cwkey_text(NOTE_TXT_TEXT, NOTE_ST_TEXT);
static KeyerText cwkey_text2(NOTE_TXT_TEXT2, NOTE_ST_TEXT2);
static void cwkey_text_listen(int note, int _) { cwkey_text.receive(); }
static void cwkey_text2_listen(int note, int _) { cwkey_text2.receive(); }
static void cwkey_text_sample(int nrpn, int _) {
cwkey_text.clock();
cwkey_text2.clock();
}
static void cwkey_text_setup(void) {
note_listen(cwkey_text.text_note, cwkey_text_listen);
note_listen(cwkey_text2.text_note, cwkey_text2_listen);
nrpn_listen(NRPN_SAMPLE, cwkey_text_sample);
}