Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE Physac-MBED PinDetect SDFileSystem mbed-rtos mbed
bluefruit_controller.h
00001 00002 #ifndef __BLUEFRUIT_CONTROLLER_HPP 00003 #define __BLUEFRUIT_CONTROLLER_HPP 00004 00005 #include "mbed.h" 00006 00007 enum ButtonId { 00008 BUTTON_A = 0, 00009 BUTTON_B = 1, 00010 BUTTON_X = 2, 00011 BUTTON_Y = 3, 00012 BUTTON_UP = 4, 00013 BUTTON_DOWN = 5, 00014 BUTTON_LEFT = 6, 00015 BUTTON_RIGHT = 7 00016 }; 00017 00018 /** 00019 * \brief Encapsulates the controller functionality of the Bluefruit module 00020 * through the default app. 00021 */ 00022 class BluefruitController : public Serial 00023 { 00024 public: 00025 BluefruitController(PinName tx, PinName rx, int baud = 9600); 00026 00027 void parseMessage(); 00028 00029 void reset(); 00030 00031 float quaternion[4]; 00032 bool button[8]; 00033 00034 private: 00035 static const int BUFFER_SIZE = 20; 00036 00037 void parseButton(); 00038 void parseQuaternion(); 00039 00040 /// Holds the parse state 00041 int state; 00042 char msg_tag; 00043 00044 // Buffer in which messages are read 00045 char buff[BUFFER_SIZE]; 00046 int buff_i; 00047 int buff_len; 00048 }; 00049 00050 #endif
Generated on Fri Dec 9 2022 21:28:43 by
1.7.2