This is the project for the Old Model Robots for OU's Dr. Davis's Configurable Robots Research. This is being published so future robots can be set up easily.
Dependencies: FatFileSystem MCP3008 Motor PinDetect QTR_8A SRF05 SSD1308_128x64_I2C mbed
Wiimote/Wiimote.h@0:bcad524c1856, 2017-11-01 (annotated)
- Committer:
- DrewSchaef
- Date:
- Wed Nov 01 15:57:59 2017 +0000
- Revision:
- 0:bcad524c1856
Published the project to allow access for future work on the Configurable Robots Research Project(s).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DrewSchaef | 0:bcad524c1856 | 1 | /* Copyright (c) 2011, mbed |
DrewSchaef | 0:bcad524c1856 | 2 | * |
DrewSchaef | 0:bcad524c1856 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
DrewSchaef | 0:bcad524c1856 | 4 | * of this software and associated documentation files (the "Software"), to deal |
DrewSchaef | 0:bcad524c1856 | 5 | * in the Software without restriction, including without limitation the rights |
DrewSchaef | 0:bcad524c1856 | 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
DrewSchaef | 0:bcad524c1856 | 7 | * copies of the Software, and to permit persons to whom the Software is |
DrewSchaef | 0:bcad524c1856 | 8 | * furnished to do so, subject to the following conditions: |
DrewSchaef | 0:bcad524c1856 | 9 | * |
DrewSchaef | 0:bcad524c1856 | 10 | * The above copyright notice and this permission notice shall be included in |
DrewSchaef | 0:bcad524c1856 | 11 | * all copies or substantial portions of the Software. |
DrewSchaef | 0:bcad524c1856 | 12 | * |
DrewSchaef | 0:bcad524c1856 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
DrewSchaef | 0:bcad524c1856 | 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
DrewSchaef | 0:bcad524c1856 | 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
DrewSchaef | 0:bcad524c1856 | 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
DrewSchaef | 0:bcad524c1856 | 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
DrewSchaef | 0:bcad524c1856 | 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
DrewSchaef | 0:bcad524c1856 | 19 | * THE SOFTWARE. |
DrewSchaef | 0:bcad524c1856 | 20 | */ |
DrewSchaef | 0:bcad524c1856 | 21 | |
DrewSchaef | 0:bcad524c1856 | 22 | // Simple decoder class for Wii Remote data |
DrewSchaef | 0:bcad524c1856 | 23 | |
DrewSchaef | 0:bcad524c1856 | 24 | #ifndef WIIMOTE_H |
DrewSchaef | 0:bcad524c1856 | 25 | #define WIIMOTE_H |
DrewSchaef | 0:bcad524c1856 | 26 | |
DrewSchaef | 0:bcad524c1856 | 27 | #include <stdint.h> |
DrewSchaef | 0:bcad524c1856 | 28 | |
DrewSchaef | 0:bcad524c1856 | 29 | class Wiimote { |
DrewSchaef | 0:bcad524c1856 | 30 | |
DrewSchaef | 0:bcad524c1856 | 31 | public: |
DrewSchaef | 0:bcad524c1856 | 32 | |
DrewSchaef | 0:bcad524c1856 | 33 | void decode(char *data); |
DrewSchaef | 0:bcad524c1856 | 34 | void dump(); |
DrewSchaef | 0:bcad524c1856 | 35 | |
DrewSchaef | 0:bcad524c1856 | 36 | // buttons |
DrewSchaef | 0:bcad524c1856 | 37 | uint32_t left:1; |
DrewSchaef | 0:bcad524c1856 | 38 | uint32_t right:1; |
DrewSchaef | 0:bcad524c1856 | 39 | uint32_t down:1; |
DrewSchaef | 0:bcad524c1856 | 40 | uint32_t up:1; |
DrewSchaef | 0:bcad524c1856 | 41 | uint32_t plus:1; |
DrewSchaef | 0:bcad524c1856 | 42 | uint32_t two:1; |
DrewSchaef | 0:bcad524c1856 | 43 | uint32_t one:1; |
DrewSchaef | 0:bcad524c1856 | 44 | uint32_t a:1; |
DrewSchaef | 0:bcad524c1856 | 45 | uint32_t b:1; |
DrewSchaef | 0:bcad524c1856 | 46 | uint32_t minus:1; |
DrewSchaef | 0:bcad524c1856 | 47 | uint32_t home:1; |
DrewSchaef | 0:bcad524c1856 | 48 | |
DrewSchaef | 0:bcad524c1856 | 49 | // accelerometers |
DrewSchaef | 0:bcad524c1856 | 50 | uint16_t rawx; |
DrewSchaef | 0:bcad524c1856 | 51 | uint16_t rawy; |
DrewSchaef | 0:bcad524c1856 | 52 | uint16_t rawz; |
DrewSchaef | 0:bcad524c1856 | 53 | |
DrewSchaef | 0:bcad524c1856 | 54 | float x; |
DrewSchaef | 0:bcad524c1856 | 55 | float y; |
DrewSchaef | 0:bcad524c1856 | 56 | float z; |
DrewSchaef | 0:bcad524c1856 | 57 | float wheel; |
DrewSchaef | 0:bcad524c1856 | 58 | }; |
DrewSchaef | 0:bcad524c1856 | 59 | |
DrewSchaef | 0:bcad524c1856 | 60 | #endif |
DrewSchaef | 0:bcad524c1856 | 61 |