Joystick for SLVM

Dependencies:   mbed

Committer:
jnagendran3
Date:
Tue Dec 09 01:23:36 2014 +0000
Revision:
0:636b2ff1fa0b
first

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jnagendran3 0:636b2ff1fa0b 1 /* Copyright (c) 2012 Tristan Hughes, MIT License
jnagendran3 0:636b2ff1fa0b 2 *
jnagendran3 0:636b2ff1fa0b 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
jnagendran3 0:636b2ff1fa0b 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
jnagendran3 0:636b2ff1fa0b 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
jnagendran3 0:636b2ff1fa0b 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
jnagendran3 0:636b2ff1fa0b 7 * furnished to do so, subject to the following conditions:
jnagendran3 0:636b2ff1fa0b 8 *
jnagendran3 0:636b2ff1fa0b 9 * The above copyright notice and this permission notice shall be included in all copies or
jnagendran3 0:636b2ff1fa0b 10 * substantial portions of the Software.
jnagendran3 0:636b2ff1fa0b 11 *
jnagendran3 0:636b2ff1fa0b 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
jnagendran3 0:636b2ff1fa0b 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
jnagendran3 0:636b2ff1fa0b 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
jnagendran3 0:636b2ff1fa0b 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
jnagendran3 0:636b2ff1fa0b 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
jnagendran3 0:636b2ff1fa0b 17 */
jnagendran3 0:636b2ff1fa0b 18 #include "mbed.h"
jnagendran3 0:636b2ff1fa0b 19
jnagendran3 0:636b2ff1fa0b 20 /** Xbee interface class for configuring, sending and recieving data using an Xbee */
jnagendran3 0:636b2ff1fa0b 21 class xbee
jnagendran3 0:636b2ff1fa0b 22 {
jnagendran3 0:636b2ff1fa0b 23 private:
jnagendran3 0:636b2ff1fa0b 24 PinName _tx;
jnagendran3 0:636b2ff1fa0b 25 PinName _rx;
jnagendran3 0:636b2ff1fa0b 26 PinName _reset;
jnagendran3 0:636b2ff1fa0b 27 public:
jnagendran3 0:636b2ff1fa0b 28 /** Configure serial data pin.
jnagendran3 0:636b2ff1fa0b 29 * @param tx The serial tx pin the xbee is conected to.
jnagendran3 0:636b2ff1fa0b 30 * @param rx The serial rx pin the xbee is conected to.
jnagendran3 0:636b2ff1fa0b 31 * @param reset The pin connected to the Xbee reset pin.
jnagendran3 0:636b2ff1fa0b 32 */
jnagendran3 0:636b2ff1fa0b 33 xbee(PinName tx, PinName rx, PinName reset);
jnagendran3 0:636b2ff1fa0b 34 ~xbee();
jnagendran3 0:636b2ff1fa0b 35 /** Puts the Xbee into config mode.
jnagendran3 0:636b2ff1fa0b 36 * @return Returns 1 on success.
jnagendran3 0:636b2ff1fa0b 37 */
jnagendran3 0:636b2ff1fa0b 38 int ConfigMode();
jnagendran3 0:636b2ff1fa0b 39 /** Gets the serial number/mac address of the Xbee and places it into serial_no.
jnagendran3 0:636b2ff1fa0b 40 * @param serial_no array to store the serial of Xbee (must be 8 long).
jnagendran3 0:636b2ff1fa0b 41 * @return Returns 1 on success.
jnagendran3 0:636b2ff1fa0b 42 */
jnagendran3 0:636b2ff1fa0b 43 int GetSerial(int*);
jnagendran3 0:636b2ff1fa0b 44 /** Sets the encryption key to the one stored in security_key.
jnagendran3 0:636b2ff1fa0b 45 * @param key Pointer to the network key to set.
jnagendran3 0:636b2ff1fa0b 46 * @return Returns 1 on success.
jnagendran3 0:636b2ff1fa0b 47 */
jnagendran3 0:636b2ff1fa0b 48 int SetKey(int*);
jnagendran3 0:636b2ff1fa0b 49 /** Sets the id of the PAN network for the Xbee to use
jnagendran3 0:636b2ff1fa0b 50 * @param pan_id The id of the PAN for the Xbee to use.
jnagendran3 0:636b2ff1fa0b 51 * @return Returns 1 on success.
jnagendran3 0:636b2ff1fa0b 52 */
jnagendran3 0:636b2ff1fa0b 53 int SetPanId(int);
jnagendran3 0:636b2ff1fa0b 54 /** Writes the settings to the Non volatile memory on the Xbee
jnagendran3 0:636b2ff1fa0b 55 * @param key Pointer to the network key to set.
jnagendran3 0:636b2ff1fa0b 56 * @return Returns 1 on success.
jnagendran3 0:636b2ff1fa0b 57 */
jnagendran3 0:636b2ff1fa0b 58 int WriteSettings();
jnagendran3 0:636b2ff1fa0b 59 /** Exits config mode
jnagendran3 0:636b2ff1fa0b 60 * @return Returns 1 on success.
jnagendran3 0:636b2ff1fa0b 61 */
jnagendran3 0:636b2ff1fa0b 62 int ExitConfigMode();
jnagendran3 0:636b2ff1fa0b 63 /** Sends data in the send_Data buffer.
jnagendran3 0:636b2ff1fa0b 64 * @param data_buf Pointer to the buffer of data to send.
jnagendran3 0:636b2ff1fa0b 65 * @returns 1 on success.
jnagendran3 0:636b2ff1fa0b 66 */
jnagendran3 0:636b2ff1fa0b 67 int SendData(char*);
jnagendran3 0:636b2ff1fa0b 68 /** Recieves data sent to the xbee.
jnagendran3 0:636b2ff1fa0b 69 * @param data_buf Pointer to the buffer to put recieved data into.
jnagendran3 0:636b2ff1fa0b 70 * @param numchar Number of characters to read. If 0, will use the size of data_buf.
jnagendran3 0:636b2ff1fa0b 71 */
jnagendran3 0:636b2ff1fa0b 72 void RecieveData(char*, int);
jnagendran3 0:636b2ff1fa0b 73 /** Resets the Xbee.
jnagendran3 0:636b2ff1fa0b 74 */
jnagendran3 0:636b2ff1fa0b 75 void Reset();
jnagendran3 0:636b2ff1fa0b 76
jnagendran3 0:636b2ff1fa0b 77 };