Lab Checkoff
Dependencies: SDFileSystem TextLCD mbed-rtos mbed wave_player FATFileSystem
CommModule/CommModule.h@0:67dbd54e60d4, 2013-11-13 (annotated)
- Committer:
- doubster
- Date:
- Wed Nov 13 20:00:28 2013 +0000
- Revision:
- 0:67dbd54e60d4
Lab Checkoff
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
doubster | 0:67dbd54e60d4 | 1 | /********************************** |
doubster | 0:67dbd54e60d4 | 2 | * Author: Clifton Thomas |
doubster | 0:67dbd54e60d4 | 3 | * Date: 3/28/13 |
doubster | 0:67dbd54e60d4 | 4 | * Institution: Georgia Tech |
doubster | 0:67dbd54e60d4 | 5 | * |
doubster | 0:67dbd54e60d4 | 6 | * Title: Communication Module |
doubster | 0:67dbd54e60d4 | 7 | * Class: ECE2035 |
doubster | 0:67dbd54e60d4 | 8 | * Assignment: Project 2 |
doubster | 0:67dbd54e60d4 | 9 | **********************************/ |
doubster | 0:67dbd54e60d4 | 10 | |
doubster | 0:67dbd54e60d4 | 11 | #ifndef COMM_H |
doubster | 0:67dbd54e60d4 | 12 | #define COMM_H |
doubster | 0:67dbd54e60d4 | 13 | |
doubster | 0:67dbd54e60d4 | 14 | #include <string.h> |
doubster | 0:67dbd54e60d4 | 15 | #include "mbed.h" |
doubster | 0:67dbd54e60d4 | 16 | |
doubster | 0:67dbd54e60d4 | 17 | class commSerial: public Serial { |
doubster | 0:67dbd54e60d4 | 18 | public: |
doubster | 0:67dbd54e60d4 | 19 | //constructor |
doubster | 0:67dbd54e60d4 | 20 | commSerial(PinName tx, PinName rx, int baudrate): Serial(tx,rx) { |
doubster | 0:67dbd54e60d4 | 21 | Serial::baud(baudrate); |
doubster | 0:67dbd54e60d4 | 22 | } |
doubster | 0:67dbd54e60d4 | 23 | |
doubster | 0:67dbd54e60d4 | 24 | //fcn to send data |
doubster | 0:67dbd54e60d4 | 25 | void sendData(char *str) { |
doubster | 0:67dbd54e60d4 | 26 | Serial::printf(str); |
doubster | 0:67dbd54e60d4 | 27 | } |
doubster | 0:67dbd54e60d4 | 28 | |
doubster | 0:67dbd54e60d4 | 29 | //fcn to receive data |
doubster | 0:67dbd54e60d4 | 30 | void receiveData(char *buffer) { |
doubster | 0:67dbd54e60d4 | 31 | Serial::scanf("%s", buffer); |
doubster | 0:67dbd54e60d4 | 32 | } |
doubster | 0:67dbd54e60d4 | 33 | |
doubster | 0:67dbd54e60d4 | 34 | }; |
doubster | 0:67dbd54e60d4 | 35 | |
doubster | 0:67dbd54e60d4 | 36 | #endif |