Alex Allen / UM12

Dependents:   Balloon

Committer:
AlexAllen
Date:
Sat Oct 13 11:51:43 2012 +0000
Revision:
3:22a375fbcb3a
Parent:
0:18297993986b
Child:
4:c947442469dd
Added licence

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AlexAllen 3:22a375fbcb3a 1 /* Copyright (c) 2011 Alex Allen, MIT License
AlexAllen 3:22a375fbcb3a 2 *
AlexAllen 3:22a375fbcb3a 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
AlexAllen 3:22a375fbcb3a 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
AlexAllen 3:22a375fbcb3a 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
AlexAllen 3:22a375fbcb3a 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
AlexAllen 3:22a375fbcb3a 7 * furnished to do so, subject to the following conditions:
AlexAllen 3:22a375fbcb3a 8 *
AlexAllen 3:22a375fbcb3a 9 * The above copyright notice and this permission notice shall be included in all copies or
AlexAllen 3:22a375fbcb3a 10 * substantial portions of the Software.
AlexAllen 3:22a375fbcb3a 11 *
AlexAllen 3:22a375fbcb3a 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
AlexAllen 3:22a375fbcb3a 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
AlexAllen 3:22a375fbcb3a 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
AlexAllen 3:22a375fbcb3a 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AlexAllen 3:22a375fbcb3a 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AlexAllen 3:22a375fbcb3a 17 */
AlexAllen 3:22a375fbcb3a 18
AlexAllen 0:18297993986b 19 #ifndef RADIO
AlexAllen 0:18297993986b 20
AlexAllen 0:18297993986b 21 #include "mbed.h"
AlexAllen 0:18297993986b 22
AlexAllen 0:18297993986b 23 class UM12 : private Serial
AlexAllen 0:18297993986b 24 {
AlexAllen 0:18297993986b 25 DigitalOut *sleepPin, *resetPin;
AlexAllen 0:18297993986b 26
AlexAllen 0:18297993986b 27 public:
AlexAllen 0:18297993986b 28
AlexAllen 0:18297993986b 29 UM12( PinName tx, PinName rx, PinName slp = LED1, PinName rst = LED2);
AlexAllen 0:18297993986b 30 virtual ~UM12();
AlexAllen 0:18297993986b 31
AlexAllen 0:18297993986b 32 void sleep(); // Send UM12 to sleep
AlexAllen 0:18297993986b 33 void wake(); // Wake UM12 from sleep
AlexAllen 0:18297993986b 34 void reset(); // Reset UM12
AlexAllen 0:18297993986b 35
AlexAllen 0:18297993986b 36 void send(char msg); // Send a single char
AlexAllen 0:18297993986b 37 void send(int msg); // Send a four byte integer
AlexAllen 0:18297993986b 38 void send(float msg); // Send a four byte floating point number
AlexAllen 0:18297993986b 39
AlexAllen 0:18297993986b 40 char receive(char &msg); // Receive a single char
AlexAllen 0:18297993986b 41 int receive(int &msg); // Receive a four byte integer
AlexAllen 0:18297993986b 42 float receive(float &msg); // Receive a four byte floating point number
AlexAllen 0:18297993986b 43
AlexAllen 0:18297993986b 44
AlexAllen 0:18297993986b 45 };
AlexAllen 0:18297993986b 46 #define RADIO 1
AlexAllen 0:18297993986b 47 #endif