-
Notifications
You must be signed in to change notification settings - Fork 2
Code sequences
An important data type used by the pykob modules is something we call a code sequence. A code sequence is a tuple of integers that specifies the timing of Morse code elements. A positive number represents the duration of a mark (key down) in milliseconds, and a negative number corresponds to a space (key up). For example, a V sent at 20 words per minute might be represented by the code sequence (-180, +60, -60, +60, -60, +60, -60, +180)
.
Typically a code sequence will represent a single Morse character, but this is not a requirement and often is not the case. By convention, there is always an even number of elements in a code sequence, starting with a negative number and alternating between negative and positive.
If a code sequence element has the special value of +1, this indicates that the circuit should be left latched in a mark state. A value of +2 unlatches the circuit and returns it to a space state. This is an extension to the original CWCom protocol, enabling the closed-circuit mode of landline telegraphy.