Sound update
Dependencies: 4DGL-uLCD-SE Physac-MBED PinDetect SDFileSystem mbed-rtos mbed
bluefruit_controller.h@31:b08cc3c126d6, 21 months ago (annotated)
- Committer:
- jaybalar
- Date:
- Fri Dec 09 21:28:32 2022 +0000
- Revision:
- 31:b08cc3c126d6
- Parent:
- 12:5d913b57da7c
update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jstephens78 | 12:5d913b57da7c | 1 | |
jstephens78 | 12:5d913b57da7c | 2 | #ifndef __BLUEFRUIT_CONTROLLER_HPP |
jstephens78 | 12:5d913b57da7c | 3 | #define __BLUEFRUIT_CONTROLLER_HPP |
jstephens78 | 12:5d913b57da7c | 4 | |
jstephens78 | 12:5d913b57da7c | 5 | #include "mbed.h" |
jstephens78 | 12:5d913b57da7c | 6 | |
jstephens78 | 12:5d913b57da7c | 7 | enum ButtonId { |
jstephens78 | 12:5d913b57da7c | 8 | BUTTON_A = 0, |
jstephens78 | 12:5d913b57da7c | 9 | BUTTON_B = 1, |
jstephens78 | 12:5d913b57da7c | 10 | BUTTON_X = 2, |
jstephens78 | 12:5d913b57da7c | 11 | BUTTON_Y = 3, |
jstephens78 | 12:5d913b57da7c | 12 | BUTTON_UP = 4, |
jstephens78 | 12:5d913b57da7c | 13 | BUTTON_DOWN = 5, |
jstephens78 | 12:5d913b57da7c | 14 | BUTTON_LEFT = 6, |
jstephens78 | 12:5d913b57da7c | 15 | BUTTON_RIGHT = 7 |
jstephens78 | 12:5d913b57da7c | 16 | }; |
jstephens78 | 12:5d913b57da7c | 17 | |
jstephens78 | 12:5d913b57da7c | 18 | /** |
jstephens78 | 12:5d913b57da7c | 19 | * \brief Encapsulates the controller functionality of the Bluefruit module |
jstephens78 | 12:5d913b57da7c | 20 | * through the default app. |
jstephens78 | 12:5d913b57da7c | 21 | */ |
jstephens78 | 12:5d913b57da7c | 22 | class BluefruitController : public Serial |
jstephens78 | 12:5d913b57da7c | 23 | { |
jstephens78 | 12:5d913b57da7c | 24 | public: |
jstephens78 | 12:5d913b57da7c | 25 | BluefruitController(PinName tx, PinName rx, int baud = 9600); |
jstephens78 | 12:5d913b57da7c | 26 | |
jstephens78 | 12:5d913b57da7c | 27 | void parseMessage(); |
jstephens78 | 12:5d913b57da7c | 28 | |
jstephens78 | 12:5d913b57da7c | 29 | void reset(); |
jstephens78 | 12:5d913b57da7c | 30 | |
jstephens78 | 12:5d913b57da7c | 31 | float quaternion[4]; |
jstephens78 | 12:5d913b57da7c | 32 | bool button[8]; |
jstephens78 | 12:5d913b57da7c | 33 | |
jstephens78 | 12:5d913b57da7c | 34 | private: |
jstephens78 | 12:5d913b57da7c | 35 | static const int BUFFER_SIZE = 20; |
jstephens78 | 12:5d913b57da7c | 36 | |
jstephens78 | 12:5d913b57da7c | 37 | void parseButton(); |
jstephens78 | 12:5d913b57da7c | 38 | void parseQuaternion(); |
jstephens78 | 12:5d913b57da7c | 39 | |
jstephens78 | 12:5d913b57da7c | 40 | /// Holds the parse state |
jstephens78 | 12:5d913b57da7c | 41 | int state; |
jstephens78 | 12:5d913b57da7c | 42 | char msg_tag; |
jstephens78 | 12:5d913b57da7c | 43 | |
jstephens78 | 12:5d913b57da7c | 44 | // Buffer in which messages are read |
jstephens78 | 12:5d913b57da7c | 45 | char buff[BUFFER_SIZE]; |
jstephens78 | 12:5d913b57da7c | 46 | int buff_i; |
jstephens78 | 12:5d913b57da7c | 47 | int buff_len; |
jstephens78 | 12:5d913b57da7c | 48 | }; |
jstephens78 | 12:5d913b57da7c | 49 | |
jstephens78 | 12:5d913b57da7c | 50 | #endif |