Skip to content

Commit

Permalink
Merge pull request #2 from etherkit/v1.0.1
Browse files Browse the repository at this point in the history
V1.0.1
  • Loading branch information
NT7S authored May 14, 2018
2 parents 9d0dac7 + fd389e8 commit be54b45
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ The sending speed can be changed on-the-fly by using the _setWPM()_ method. The

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.

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.

Startup Conditions and Constraints
----------------------------------
The default output pin is defined as LED_BUILTIN while the default sending speed is 25 words per minute.
Expand Down Expand Up @@ -113,6 +115,7 @@ Public Variables
bool tx_enable;
uint8_t output_pin;
bool busy;
bool preamble_enable;

Valid Characters
----------------
Expand All @@ -128,6 +131,10 @@ The standard uppercase and lowercase letters 'A' through 'Z' and digits '0' thro
Changelog
---------

* v1.0.1

* Add support for preamble.

* v1.0.0

* Initial release
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tx KEYWORD2
tx_enable KEYWORD2
output_pin KEYWORD2
busy KEYWORD2
preamble_enable KEYWORD2
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Etherkit Morse
version=1.0.0
version=1.0.1
author=Jason Milldrum <[email protected]>
maintainer=Jason Milldrum <[email protected]>
sentence=Generate Morse Code for transmission on an digital I/O pin.
Expand Down
13 changes: 10 additions & 3 deletions src/Morse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ void Morse::update()
#ifdef DEBUG
Serial.println("Start of message");
#endif
if(preamble_enable)
{
cur_state = State::PREAMBLE;
cur_state_end = cur_state_end = cur_timer + (dit_length * MULT_WORDDELAY);
return;
}
}

// Get the current element in the current character
Expand Down Expand Up @@ -225,16 +231,17 @@ void Morse::update()
break;

case State::PREAMBLE:
// Transmitter on
tx = true;
// Transmitter off
tx = false;
if(output_pin)
{
digitalWrite(output_pin, HIGH);
digitalWrite(output_pin, LOW);
}

// When done waiting, go back to IDLE state to start the message
if(cur_timer > cur_state_end)
{
preamble_enable = false;
cur_state = State::IDLE;
}
break;
Expand Down
1 change: 1 addition & 0 deletions src/Morse.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Morse
bool tx_enable = true;
uint8_t output_pin;
bool busy = true;
bool preamble_enable = false;

private:
uint32_t getMsgDelay(uint8_t);
Expand Down

0 comments on commit be54b45

Please sign in to comment.