Alex Allen / UM12

Dependents:   Balloon

Committer:
AlexAllen
Date:
Tue Jul 19 17:09:58 2011 +0000
Revision:
0:18297993986b
Child:
2:f2cf3a42e690
Child:
3:22a375fbcb3a
A library for the UM12 433MHz long range radio modules from HAC.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AlexAllen 0:18297993986b 1 #ifndef RADIO
AlexAllen 0:18297993986b 2
AlexAllen 0:18297993986b 3 #include "mbed.h"
AlexAllen 0:18297993986b 4
AlexAllen 0:18297993986b 5 class UM12 : private Serial
AlexAllen 0:18297993986b 6 {
AlexAllen 0:18297993986b 7 DigitalOut *sleepPin, *resetPin;
AlexAllen 0:18297993986b 8
AlexAllen 0:18297993986b 9 public:
AlexAllen 0:18297993986b 10
AlexAllen 0:18297993986b 11 UM12( PinName tx, PinName rx, PinName slp = LED1, PinName rst = LED2);
AlexAllen 0:18297993986b 12 virtual ~UM12();
AlexAllen 0:18297993986b 13
AlexAllen 0:18297993986b 14 void sleep(); // Send UM12 to sleep
AlexAllen 0:18297993986b 15 void wake(); // Wake UM12 from sleep
AlexAllen 0:18297993986b 16 void reset(); // Reset UM12
AlexAllen 0:18297993986b 17
AlexAllen 0:18297993986b 18 void send(char msg); // Send a single char
AlexAllen 0:18297993986b 19 void send(int msg); // Send a four byte integer
AlexAllen 0:18297993986b 20 void send(float msg); // Send a four byte floating point number
AlexAllen 0:18297993986b 21
AlexAllen 0:18297993986b 22 char receive(char &msg); // Receive a single char
AlexAllen 0:18297993986b 23 int receive(int &msg); // Receive a four byte integer
AlexAllen 0:18297993986b 24 float receive(float &msg); // Receive a four byte floating point number
AlexAllen 0:18297993986b 25
AlexAllen 0:18297993986b 26
AlexAllen 0:18297993986b 27 };
AlexAllen 0:18297993986b 28 #define RADIO 1
AlexAllen 0:18297993986b 29 #endif