Wii Classic Controller /Pro のライブラリです。

Dependents:   WiiClassicController_test

Committer:
kambara1415
Date:
Thu Jun 16 03:39:36 2016 +0000
Revision:
0:726fea07d08f
wii classic controller???????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kambara1415 0:726fea07d08f 1 /*********************************
kambara1415 0:726fea07d08f 2
kambara1415 0:726fea07d08f 3 TOTTORI_U
kambara1415 0:726fea07d08f 4 ROBOT_LABO
kambara1415 0:726fea07d08f 5
kambara1415 0:726fea07d08f 6 2016/6/16
kambara1415 0:726fea07d08f 7 **********************************/
kambara1415 0:726fea07d08f 8
kambara1415 0:726fea07d08f 9 #ifndef WII_CLASSIC_CONTROLLER_H
kambara1415 0:726fea07d08f 10 #define WII_CLASSIC_CONTROLLER_H
kambara1415 0:726fea07d08f 11
kambara1415 0:726fea07d08f 12 #include "mbed.h"
kambara1415 0:726fea07d08f 13
kambara1415 0:726fea07d08f 14 // I2C
kambara1415 0:726fea07d08f 15 #define CLASSIC_ADDR 0xA4 // 0x52 << 1
kambara1415 0:726fea07d08f 16 #define CLASSIC_REGADDR 0x40 //
kambara1415 0:726fea07d08f 17 #define CLASSIC_READLEN 0x06 //
kambara1415 0:726fea07d08f 18 #define I2C_ACK 0
kambara1415 0:726fea07d08f 19 #define I2C_READ_DELAY 0.01
kambara1415 0:726fea07d08f 20
kambara1415 0:726fea07d08f 21
kambara1415 0:726fea07d08f 22 class WiiClassicController{
kambara1415 0:726fea07d08f 23 public:
kambara1415 0:726fea07d08f 24 WiiClassicController(PinName p_sda, PinName p_scl);
kambara1415 0:726fea07d08f 25 //read();
kambara1415 0:726fea07d08f 26 unsigned char joy_LX();
kambara1415 0:726fea07d08f 27 unsigned char joy_LY();
kambara1415 0:726fea07d08f 28 unsigned char joy_RX();
kambara1415 0:726fea07d08f 29 unsigned char joy_RY();
kambara1415 0:726fea07d08f 30 bool button_DL();
kambara1415 0:726fea07d08f 31 bool button_DR();
kambara1415 0:726fea07d08f 32 bool button_DD();
kambara1415 0:726fea07d08f 33 bool button_DU();
kambara1415 0:726fea07d08f 34 bool button_minus();
kambara1415 0:726fea07d08f 35 bool button_plus();
kambara1415 0:726fea07d08f 36 bool button_home();
kambara1415 0:726fea07d08f 37 bool button_B();
kambara1415 0:726fea07d08f 38 bool button_Y();
kambara1415 0:726fea07d08f 39 bool button_A();
kambara1415 0:726fea07d08f 40 bool button_X();
kambara1415 0:726fea07d08f 41 bool button_R();
kambara1415 0:726fea07d08f 42 bool button_L();
kambara1415 0:726fea07d08f 43 bool button_ZL();
kambara1415 0:726fea07d08f 44 bool button_ZR();
kambara1415 0:726fea07d08f 45
kambara1415 0:726fea07d08f 46 private:
kambara1415 0:726fea07d08f 47 I2C i2c;
kambara1415 0:726fea07d08f 48 Timer timer;
kambara1415 0:726fea07d08f 49 bool WiiClaInitFlag; //= false;
kambara1415 0:726fea07d08f 50 char readBuf[CLASSIC_READLEN];
kambara1415 0:726fea07d08f 51 unsigned char joyRX, joyRY, joyLX, joyLY;
kambara1415 0:726fea07d08f 52 bool buttonA, buttonB, buttonX,
kambara1415 0:726fea07d08f 53 buttonY, buttonR, buttonL,
kambara1415 0:726fea07d08f 54 buttonZR, buttonZL, buttonDU,
kambara1415 0:726fea07d08f 55 buttonDD, buttonDL, buttonDR,
kambara1415 0:726fea07d08f 56 buttonPlus, buttonMinus, buttonHome;
kambara1415 0:726fea07d08f 57 bool init();
kambara1415 0:726fea07d08f 58 void read();
kambara1415 0:726fea07d08f 59 };
kambara1415 0:726fea07d08f 60
kambara1415 0:726fea07d08f 61
kambara1415 0:726fea07d08f 62 #endif