Labview

Dependencies:   C12832_lcd LCD_fonts LM75B analogintest3 MMA7660 mbed

Fork of analogintest3 by Peter Mertens

Committer:
u0068206
Date:
Tue Apr 28 11:41:25 2015 +0000
Revision:
0:e4782112c3fd
Analoog in

Who changed what in which revision?

UserRevisionLine numberNew contents of line
u0068206 0:e4782112c3fd 1 /**
u0068206 0:e4782112c3fd 2 * @section LICENSE
u0068206 0:e4782112c3fd 3 *Copyright (c) 2010 ARM Ltd.
u0068206 0:e4782112c3fd 4 *
u0068206 0:e4782112c3fd 5 *Permission is hereby granted, free of charge, to any person obtaining a copy
u0068206 0:e4782112c3fd 6 *of this software and associated documentation files (the "Software"), to deal
u0068206 0:e4782112c3fd 7 *in the Software without restriction, including without limitation the rights
u0068206 0:e4782112c3fd 8 *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
u0068206 0:e4782112c3fd 9 *copies of the Software, and to permit persons to whom the Software is
u0068206 0:e4782112c3fd 10 *furnished to do so, subject to the following conditions:
u0068206 0:e4782112c3fd 11 *
u0068206 0:e4782112c3fd 12 *The above copyright notice and this permission notice shall be included in
u0068206 0:e4782112c3fd 13 *all copies or substantial portions of the Software.
u0068206 0:e4782112c3fd 14 *
u0068206 0:e4782112c3fd 15 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
u0068206 0:e4782112c3fd 16 *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
u0068206 0:e4782112c3fd 17 *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
u0068206 0:e4782112c3fd 18 *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
u0068206 0:e4782112c3fd 19 *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
u0068206 0:e4782112c3fd 20 *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
u0068206 0:e4782112c3fd 21 *THE SOFTWARE.
u0068206 0:e4782112c3fd 22 *
u0068206 0:e4782112c3fd 23 *
u0068206 0:e4782112c3fd 24 * @section DESCRIPTION
u0068206 0:e4782112c3fd 25 *
u0068206 0:e4782112c3fd 26 *This class sets up RPC communication over serial.
u0068206 0:e4782112c3fd 27 */
u0068206 0:e4782112c3fd 28 #ifndef INTERFACE
u0068206 0:e4782112c3fd 29 #define INTERFACE
u0068206 0:e4782112c3fd 30
u0068206 0:e4782112c3fd 31 /**
u0068206 0:e4782112c3fd 32 *Includes
u0068206 0:e4782112c3fd 33 */
u0068206 0:e4782112c3fd 34 #include "mbed.h"
u0068206 0:e4782112c3fd 35 #include "platform.h"
u0068206 0:e4782112c3fd 36 #include "rpc.h"
u0068206 0:e4782112c3fd 37 #include "RPCFunction.h"
u0068206 0:e4782112c3fd 38 #include "RPCVariable.h"
u0068206 0:e4782112c3fd 39
u0068206 0:e4782112c3fd 40
u0068206 0:e4782112c3fd 41 namespace mbed{
u0068206 0:e4782112c3fd 42 /**
u0068206 0:e4782112c3fd 43 *Provides an Interface to mbed over RPC.
u0068206 0:e4782112c3fd 44 *
u0068206 0:e4782112c3fd 45 *For the chosen communication type this class sets up the necessary interrupts to receive RPC messages. Receives the messages, passes them to the rpc function and then returns the result.
u0068206 0:e4782112c3fd 46 */
u0068206 0:e4782112c3fd 47 class SerialRPCInterface{
u0068206 0:e4782112c3fd 48 public:
u0068206 0:e4782112c3fd 49 /**
u0068206 0:e4782112c3fd 50 *Constructor
u0068206 0:e4782112c3fd 51 *
u0068206 0:e4782112c3fd 52 *Sets up RPC communication using serial communication.
u0068206 0:e4782112c3fd 53 *
u0068206 0:e4782112c3fd 54 *@param tx The transmit pin of the serial port.
u0068206 0:e4782112c3fd 55 *@param rx The receive pin of the serial port.
u0068206 0:e4782112c3fd 56 *@param baud Set the baud rate, default is 9600.
u0068206 0:e4782112c3fd 57 */
u0068206 0:e4782112c3fd 58 SerialRPCInterface(PinName tx, PinName rx, int baud = 9600);
u0068206 0:e4782112c3fd 59
u0068206 0:e4782112c3fd 60 /**
u0068206 0:e4782112c3fd 61 *Disable the RPC.
u0068206 0:e4782112c3fd 62 *
u0068206 0:e4782112c3fd 63 *This will stop RPC messages being recevied and interpreted by this library. This might be used to prevent RPC commands interrupting an important piece of code on mbed.
u0068206 0:e4782112c3fd 64 */
u0068206 0:e4782112c3fd 65 void Disable(void);
u0068206 0:e4782112c3fd 66
u0068206 0:e4782112c3fd 67 /**
u0068206 0:e4782112c3fd 68 *Enable the RPC
u0068206 0:e4782112c3fd 69 *
u0068206 0:e4782112c3fd 70 *This will set this class to receiving and executing RPC commands. The class starts in this mode so this function only needs to be called if you have previosuly disabled the RPC.
u0068206 0:e4782112c3fd 71 *
u0068206 0:e4782112c3fd 72 */
u0068206 0:e4782112c3fd 73 void Enable(void);
u0068206 0:e4782112c3fd 74
u0068206 0:e4782112c3fd 75 //The Serial Port
u0068206 0:e4782112c3fd 76 Serial pc;
u0068206 0:e4782112c3fd 77
u0068206 0:e4782112c3fd 78
u0068206 0:e4782112c3fd 79 private:
u0068206 0:e4782112c3fd 80 //Handle messgaes and take appropriate action
u0068206 0:e4782112c3fd 81 void _MsgProcess(void);
u0068206 0:e4782112c3fd 82 void _RegClasses(void);
u0068206 0:e4782112c3fd 83 void _RPCSerial();
u0068206 0:e4782112c3fd 84 bool _enabled;
u0068206 0:e4782112c3fd 85 char _command[256];
u0068206 0:e4782112c3fd 86 char _response[256];
u0068206 0:e4782112c3fd 87 bool _RPCflag;
u0068206 0:e4782112c3fd 88 };
u0068206 0:e4782112c3fd 89 }
u0068206 0:e4782112c3fd 90 #endif