3 This file is part of a program that implements a Software-Defined Radio.
5 The code in this file is derived from routines originally written by
6 Pierre-Philippe Coupard for his CWirc X-chat program. That program
7 is issued under the GPL and is
8 Copyright (C) Pierre-Philippe Coupard - 18/06/2003
10 This derived version is
11 Copyright (C) 2004 by Frank Brickle, AB2KT and Bob McGwier, N4HY
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 The authors can be reached by email at
35 The DTTS Microwave Society
45 #include <splitfields.h>
46 #include <datatypes.h>
48 //========================================================================
50 #define DSR_LINE_CLOSED_KEY (1)
51 #define CTS_LINE_CLOSED_KEY (1)
52 #define DTR_LINE_SET (0)
53 #define RTS_LINE_SET (0)
55 #define NO_TIMEOUTS_SCHED (-2)
56 #define NO_ELEMENT (-1)
61 #define NO_PADDLE_SQUEEZE (0)
62 #define PADDLES_SQUEEZED (1)
63 #define PADDLES_RELEASED (2)
65 #define CHAR_SPACING_DELAY (1)
66 #define WORD_SPACING_DELAY (2)
67 #define DEBOUNCE_BUF_MAX_SIZE (30)
69 //========================================================================
76 BOOLEAN iambic, // iambic or straight
78 revpdl; // paddles reversed
90 int debounce, // # seconds to read paddles
91 mode, // 0 = mode A, 1 = mode B
94 double wpm; // for iambic keyer
96 } KeyerStateInfo, *KeyerState;
98 extern KeyerState newKeyerState(void);
99 extern void delKeyerState(KeyerState ks);
101 //------------------------------------------------------------------------
104 struct _keyer_logic {
116 BOOLEAN invtd, // insert inverted element
117 psqam; // paddles squeezed after mid-element
118 int curr, // -1 = nothing, 0 = dit, 1 = dah
119 iamb, // 0 = none, 1 = squeezed, 2 = released
120 last; // -1 = nothing, 0 = dit, 1 = dah
124 double beep, dlay, elem, midl;
127 int dlay_type; // 0 = none, 1 = interchar, 2 = interword
129 } KeyerLogicInfo, *KeyerLogic;
131 extern KeyerLogic newKeyerLogic(void);
132 extern void delKeyerLogic(KeyerLogic kl);
134 //========================================================================
136 extern BOOLEAN klogic(KeyerLogic kl,
141 BOOLEAN midelementmodeB,
144 BOOLEAN autocharspacing,
145 BOOLEAN autowordspacing,
149 extern BOOLEAN read_straight_key_serial(KeyerState ks, int fd);
150 extern BOOLEAN read_iambic_key_serial(KeyerState ks, int fd, KeyerLogic kl, double ticklen);
152 //========================================================================