Skip to content

Commit be54b45

Browse files
authored
Merge pull request #2 from etherkit/v1.0.1
V1.0.1
2 parents 9d0dac7 + fd389e8 commit be54b45

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ The sending speed can be changed on-the-fly by using the _setWPM()_ method. The
4646

4747
If you don't want to have the library directly control a digital I/O pin, you may have your sketch poll the boolean _tx_ member variable and act on it accordingly within their periodic 1 ms function. Set the output pin parameter in the constructor to 0.
4848

49+
When you are using this library for the DFCW mode (continuous wave Morse Code with frequency modulation), you can specify a preamble period to happen with the carrier on before the message begins. Set member variable _preamble_enable_ to true to enable this for a transmission. Keep in mind that this member variable acts like a one-shot, so you will need to set it every time you intend to use it.
50+
4951
Startup Conditions and Constraints
5052
----------------------------------
5153
The default output pin is defined as LED_BUILTIN while the default sending speed is 25 words per minute.
@@ -113,6 +115,7 @@ Public Variables
113115
bool tx_enable;
114116
uint8_t output_pin;
115117
bool busy;
118+
bool preamble_enable;
116119

117120
Valid Characters
118121
----------------
@@ -128,6 +131,10 @@ The standard uppercase and lowercase letters 'A' through 'Z' and digits '0' thro
128131
Changelog
129132
---------
130133

134+
* v1.0.1
135+
136+
* Add support for preamble.
137+
131138
* v1.0.0
132139

133140
* Initial release

keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ tx KEYWORD2
99
tx_enable KEYWORD2
1010
output_pin KEYWORD2
1111
busy KEYWORD2
12+
preamble_enable KEYWORD2

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Etherkit Morse
2-
version=1.0.0
2+
version=1.0.1
33
author=Jason Milldrum <[email protected]>
44
maintainer=Jason Milldrum <[email protected]>
55
sentence=Generate Morse Code for transmission on an digital I/O pin.

src/Morse.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ void Morse::update()
103103
#ifdef DEBUG
104104
Serial.println("Start of message");
105105
#endif
106+
if(preamble_enable)
107+
{
108+
cur_state = State::PREAMBLE;
109+
cur_state_end = cur_state_end = cur_timer + (dit_length * MULT_WORDDELAY);
110+
return;
111+
}
106112
}
107113

108114
// Get the current element in the current character
@@ -225,16 +231,17 @@ void Morse::update()
225231
break;
226232

227233
case State::PREAMBLE:
228-
// Transmitter on
229-
tx = true;
234+
// Transmitter off
235+
tx = false;
230236
if(output_pin)
231237
{
232-
digitalWrite(output_pin, HIGH);
238+
digitalWrite(output_pin, LOW);
233239
}
234240

235241
// When done waiting, go back to IDLE state to start the message
236242
if(cur_timer > cur_state_end)
237243
{
244+
preamble_enable = false;
238245
cur_state = State::IDLE;
239246
}
240247
break;

src/Morse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Morse
5353
bool tx_enable = true;
5454
uint8_t output_pin;
5555
bool busy = true;
56+
bool preamble_enable = false;
5657

5758
private:
5859
uint32_t getMsgDelay(uint8_t);

0 commit comments

Comments
 (0)