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

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

Morse code taken from http://en.wikipedia.org/wiki/Morse_code Added some more characters :
- : 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);
}
Committer:
rominos2
Date:
Tue Sep 16 16:51:31 2014 +0000
Revision:
0:4648894e0d80
Child:
1:84ef66bf435d
Initial Release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rominos2 0:4648894e0d80 1 #ifndef INCLUDE_MORSE_H
rominos2 0:4648894e0d80 2 #define INCLUDE_MORSE_H
rominos2 0:4648894e0d80 3
rominos2 0:4648894e0d80 4 #ifndef NULL
rominos2 0:4648894e0d80 5 #define NULL 0
rominos2 0:4648894e0d80 6 #endif
rominos2 0:4648894e0d80 7
rominos2 0:4648894e0d80 8 #define DOT false
rominos2 0:4648894e0d80 9 #define DASH true
rominos2 0:4648894e0d80 10
rominos2 0:4648894e0d80 11 #endif