1 unstable release

0.1.0 Jun 17, 2020

#12 in #morse

Download history 5/week @ 2024-02-12 30/week @ 2024-02-19 23/week @ 2024-02-26 68/week @ 2024-03-04 15/week @ 2024-03-11 9/week @ 2024-03-18 5/week @ 2024-03-25 37/week @ 2024-04-01 21/week @ 2024-04-08 126/week @ 2024-04-15

190 downloads per month
Used in spectrodraw

MIT license

14KB
342 lines

Morse code generation library for Rust

License: MIT

Features

  • Supports no_std
  • Easy Iterator-based interface
  • Letters, numbers, and punctuation all fully supported
  • Support for Farnsworth delays (longer delays between letters and words to help learn morse code)

There are currently no plans to support decoding of Morse code.

Example

fn wait_for(duration: u8) {
    // ...
}
fn beep_for(duration: u8) {
    // ...
}

for action in small_morse::encode("Hello in morse code!") {
    if action.state == small_morse::State::On {
        beep_for(action.duration);
    } else {
        wait_for(action.duration);
    }
}

Intended use

The natural extension to your simple embedded project of blinking an LED is to blink it in morse code. The goal of this library is to make it easy to emit morse code from any environment, and with any type of output.


lib.rs:

Iterators over text in morse code.

fn wait_for(duration: u8) {
    // ...
}
fn beep_for(duration: u8) {
    // ...
}

for action in small_morse::encode("Hello in morse code!") {
    if action.state == small_morse::State::On {
        beep_for(action.duration);
    } else {
        wait_for(action.duration);
    }
}

This library is for encoding text into morse code (not the other way around yet).

It works without the standard library.

No runtime deps