うおーるぼっと用プログラム Wiiリモコンからのダイレクト操作モードのみ BlueUSBをベースに使用しています。
Dependencies: BD6211F mbed SimpleFilter
Wiimote/Wiimote.h@0:4f749f62c6d7, 2011-04-29 (annotated)
- Committer:
- jksoft
- Date:
- Fri Apr 29 15:50:23 2011 +0000
- Revision:
- 0:4f749f62c6d7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:4f749f62c6d7 | 1 | /* Copyright (c) 2011, mbed |
jksoft | 0:4f749f62c6d7 | 2 | * |
jksoft | 0:4f749f62c6d7 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
jksoft | 0:4f749f62c6d7 | 4 | * of this software and associated documentation files (the "Software"), to deal |
jksoft | 0:4f749f62c6d7 | 5 | * in the Software without restriction, including without limitation the rights |
jksoft | 0:4f749f62c6d7 | 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
jksoft | 0:4f749f62c6d7 | 7 | * copies of the Software, and to permit persons to whom the Software is |
jksoft | 0:4f749f62c6d7 | 8 | * furnished to do so, subject to the following conditions: |
jksoft | 0:4f749f62c6d7 | 9 | * |
jksoft | 0:4f749f62c6d7 | 10 | * The above copyright notice and this permission notice shall be included in |
jksoft | 0:4f749f62c6d7 | 11 | * all copies or substantial portions of the Software. |
jksoft | 0:4f749f62c6d7 | 12 | * |
jksoft | 0:4f749f62c6d7 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
jksoft | 0:4f749f62c6d7 | 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
jksoft | 0:4f749f62c6d7 | 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
jksoft | 0:4f749f62c6d7 | 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
jksoft | 0:4f749f62c6d7 | 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
jksoft | 0:4f749f62c6d7 | 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
jksoft | 0:4f749f62c6d7 | 19 | * THE SOFTWARE. |
jksoft | 0:4f749f62c6d7 | 20 | */ |
jksoft | 0:4f749f62c6d7 | 21 | |
jksoft | 0:4f749f62c6d7 | 22 | // Simple decoder class for Wii Remote data |
jksoft | 0:4f749f62c6d7 | 23 | |
jksoft | 0:4f749f62c6d7 | 24 | #ifndef WIIMOTE_H |
jksoft | 0:4f749f62c6d7 | 25 | #define WIIMOTE_H |
jksoft | 0:4f749f62c6d7 | 26 | |
jksoft | 0:4f749f62c6d7 | 27 | #include <stdint.h> |
jksoft | 0:4f749f62c6d7 | 28 | |
jksoft | 0:4f749f62c6d7 | 29 | class Wiimote { |
jksoft | 0:4f749f62c6d7 | 30 | |
jksoft | 0:4f749f62c6d7 | 31 | public: |
jksoft | 0:4f749f62c6d7 | 32 | |
jksoft | 0:4f749f62c6d7 | 33 | void decode(char *data); |
jksoft | 0:4f749f62c6d7 | 34 | void dump(); |
jksoft | 0:4f749f62c6d7 | 35 | |
jksoft | 0:4f749f62c6d7 | 36 | // buttons |
jksoft | 0:4f749f62c6d7 | 37 | uint32_t left:1; |
jksoft | 0:4f749f62c6d7 | 38 | uint32_t right:1; |
jksoft | 0:4f749f62c6d7 | 39 | uint32_t down:1; |
jksoft | 0:4f749f62c6d7 | 40 | uint32_t up:1; |
jksoft | 0:4f749f62c6d7 | 41 | uint32_t plus:1; |
jksoft | 0:4f749f62c6d7 | 42 | uint32_t two:1; |
jksoft | 0:4f749f62c6d7 | 43 | uint32_t one:1; |
jksoft | 0:4f749f62c6d7 | 44 | uint32_t a:1; |
jksoft | 0:4f749f62c6d7 | 45 | uint32_t b:1; |
jksoft | 0:4f749f62c6d7 | 46 | uint32_t minus:1; |
jksoft | 0:4f749f62c6d7 | 47 | uint32_t home:1; |
jksoft | 0:4f749f62c6d7 | 48 | |
jksoft | 0:4f749f62c6d7 | 49 | // accelerometers |
jksoft | 0:4f749f62c6d7 | 50 | uint16_t rawx; |
jksoft | 0:4f749f62c6d7 | 51 | uint16_t rawy; |
jksoft | 0:4f749f62c6d7 | 52 | uint16_t rawz; |
jksoft | 0:4f749f62c6d7 | 53 | |
jksoft | 0:4f749f62c6d7 | 54 | float x; |
jksoft | 0:4f749f62c6d7 | 55 | float y; |
jksoft | 0:4f749f62c6d7 | 56 | float z; |
jksoft | 0:4f749f62c6d7 | 57 | float wheel; |
jksoft | 0:4f749f62c6d7 | 58 | }; |
jksoft | 0:4f749f62c6d7 | 59 | |
jksoft | 0:4f749f62c6d7 | 60 | #endif |
jksoft | 0:4f749f62c6d7 | 61 |