Lets you control your mbed from an easy to use GUI. Entire project is on git hub: https://github.com/navin-bhaskar/Controller For usage info follow this link http://navinbhaskar.blogspot.in/2013/02/arduino-controller-3.html

Dependencies:   mbed

Committer:
Navin
Date:
Tue Feb 26 03:51:46 2013 +0000
Revision:
1:9d3340bcd863
Parent:
0:fe5850ccdb6f
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Navin 0:fe5850ccdb6f 1 /*
Navin 0:fe5850ccdb6f 2 * This program is free software; you can redistribute it and/or modify
Navin 0:fe5850ccdb6f 3 * it under the terms of the GNU General Public License as published by
Navin 0:fe5850ccdb6f 4 * the Free Software Foundation; either version 2 of the License, or
Navin 0:fe5850ccdb6f 5 * (at your option) any later version.
Navin 0:fe5850ccdb6f 6 *
Navin 0:fe5850ccdb6f 7 * This program is distributed in the hope that it will be useful,
Navin 0:fe5850ccdb6f 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Navin 0:fe5850ccdb6f 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Navin 0:fe5850ccdb6f 10 * GNU General Public License for more details.
Navin 0:fe5850ccdb6f 11 *
Navin 0:fe5850ccdb6f 12 * You should have received a copy of the GNU General Public License
Navin 0:fe5850ccdb6f 13 * along with this program; if not, write to the Free Software
Navin 0:fe5850ccdb6f 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
Navin 0:fe5850ccdb6f 15 * MA 02110-1301, USA.
Navin 0:fe5850ccdb6f 16 *
Navin 0:fe5850ccdb6f 17 */
Navin 0:fe5850ccdb6f 18
Navin 0:fe5850ccdb6f 19 /**
Navin 0:fe5850ccdb6f 20 * \brief This file contains functions defines and definations
Navin 1:9d3340bcd863 21 * required by trans_layer.c
Navin 0:fe5850ccdb6f 22 * \author Navin Bhaskar
Navin 0:fe5850ccdb6f 23 */
Navin 0:fe5850ccdb6f 24
Navin 0:fe5850ccdb6f 25
Navin 0:fe5850ccdb6f 26 #ifndef __TRANS_LAYER_H
Navin 0:fe5850ccdb6f 27 #define __TRANS_LAYER_H
Navin 0:fe5850ccdb6f 28
Navin 0:fe5850ccdb6f 29 #include <stdlib.h>
Navin 0:fe5850ccdb6f 30 #include "Console.h"
Navin 0:fe5850ccdb6f 31 #include "PerAccess.h"
Navin 0:fe5850ccdb6f 32
Navin 0:fe5850ccdb6f 33
Navin 0:fe5850ccdb6f 34 typedef void(* call_back_ptr)(Console * cons, PerAccess * per, char*, int ); /**< typedef for callback function pointer for protocol packets*/
Navin 0:fe5850ccdb6f 35
Navin 0:fe5850ccdb6f 36 typedef struct service_list* service_ptr; /**< pointer to next service */
Navin 0:fe5850ccdb6f 37
Navin 0:fe5850ccdb6f 38 struct service_list /**< Struct for holding service list */
Navin 0:fe5850ccdb6f 39 {
Navin 0:fe5850ccdb6f 40 //char* service_name; /**< pointer to the name of the service */
Navin 0:fe5850ccdb6f 41 call_back_ptr service_function; /**< call back function pointer */
Navin 0:fe5850ccdb6f 42 char service_flag; /**< Packet service flag for which this service responds*/
Navin 0:fe5850ccdb6f 43 service_ptr next_service;
Navin 0:fe5850ccdb6f 44 };
Navin 0:fe5850ccdb6f 45
Navin 0:fe5850ccdb6f 46
Navin 0:fe5850ccdb6f 47 #define PACKET_START 'S' /**< Start of packet indicator */
Navin 0:fe5850ccdb6f 48 #define QUERY_ADC_DATA 'A' /**< Control pcaket for quering ADC data */
Navin 0:fe5850ccdb6f 49 #define SET_LCD_DATA 'L' /**< To transmit string to be displayed on LCD */
Navin 0:fe5850ccdb6f 50 #define PACKET_ACK 'V' /**< Acknowledgement flag */
Navin 0:fe5850ccdb6f 51 #define PACKET_NACK 'N' /**< Negative acknowledgement */
Navin 0:fe5850ccdb6f 52 #define PACKET_DAT 'D' /**< Data follows after length field */
Navin 0:fe5850ccdb6f 53 #define PACKET_CMD 'C' /**< Command follows this field */
Navin 0:fe5850ccdb6f 54
Navin 0:fe5850ccdb6f 55 #define PIN_OP 'P' /**< Flag indicating pin operations */
Navin 0:fe5850ccdb6f 56
Navin 0:fe5850ccdb6f 57 class TransLayer
Navin 0:fe5850ccdb6f 58 {
Navin 0:fe5850ccdb6f 59 private:
Navin 0:fe5850ccdb6f 60 service_ptr _head, _tail;
Navin 0:fe5850ccdb6f 61 public:
Navin 0:fe5850ccdb6f 62 TransLayer();
Navin 0:fe5850ccdb6f 63 int AddService(call_back_ptr, char flag);
Navin 0:fe5850ccdb6f 64 void MainLoop(Console *, PerAccess *);
Navin 0:fe5850ccdb6f 65 service_ptr LookForService(char flag);
Navin 0:fe5850ccdb6f 66 };
Navin 0:fe5850ccdb6f 67
Navin 0:fe5850ccdb6f 68 #define PRINT_OK Serial.println(" OK"); /**< A framing method */
Navin 0:fe5850ccdb6f 69
Navin 0:fe5850ccdb6f 70 #endif
Navin 0:fe5850ccdb6f 71