Morse Encoder/Decoder Library. Transforms char array to binary array and vice-versa.

Embed: (wiki syntax)

« Back to documentation index

Morse_data Struct Reference

Morse_data Struct Reference

A Morse Encoding/Decoding Library
Transforms char arrays into bool arrays and vice-versa. More...

#include <Morse.h>

Data Fields

int length
 Length of the data field.
bool * data
 data field containing 'length' booleans

Detailed Description

A Morse Encoding/Decoding Library
Transforms char arrays into bool arrays and vice-versa.

Morse code taken from http://en.wikipedia.org/wiki/Morse_code
Added some more characters :
minus : DOT DOT DASH DASH
_ : DASH DASH DASH DOT
. : DASH DASH DASH DASH
/ : DOT DASH DOT DASH
@ : DOT DOT DOT DASH DOT
? : DOT DOT DASH DOT DOT

Here is an quick hello-world that show how to use this library

    #include "mbed.h
    #include "Morse.h"
    
    Serial pc(USBTX, USBRX);
    
    int main() {
        int i;
        Morse_data* data;
        char message[] = "Hello World";
        
        data = morse_create(morse_getBoolSize(message));
        morse_encode(message, data);
        for (i=0; i<data->length; i++) pc.printf("%d", data->data[i]);
        
        morse_decode(data, message);
        pc.printf("\nMessage was : %s\n", message);
        
        while(1);
    }

Morse_data Structure

Definition at line 61 of file Morse.h.


Field Documentation

bool* data

data field containing 'length' booleans

Definition at line 63 of file Morse.h.

int length

Length of the data field.

Definition at line 62 of file Morse.h.