PSI3422_Aula3
Fork of NunchukLib by
Nunchuk.h
- Committer:
- adelino
- Date:
- 2013-11-15
- Revision:
- 0:37e9a0644485
- Child:
- 1:72d62147e2b8
File content as of revision 0:37e9a0644485:
#ifndef NUNCHUK_H #define NUNCHUK_H #include "mbed.h" /** Class to interface with a Nintendo wii Nunchuk. */ class Nunchuk { public: /** Construct a Nunchuk object. * * @param sda I2C channel to use. * @param scl I2C channel * @param mTe the sampling time for the internal Ticker */ Nunchuk(PinName sda,PinName scl,float mTe); ~Nunchuk(void); /** Get the joyStick position returns -1: joyStick in left position returns +1: joyStick in righ position returns 0: center position */ signed char getJoyX(void); /** Get the joyStick position returns -1: joyStick in left position returns +1: joyStick in righ position returns 0: center position */ signed char getJoyY(void); /** Get the acceleration in axis X (10 bits) */ int getAccX(void); /** Get the acceleration in axis Y (10 bits) */ int getAccY(void); /** Get the acceleration in axis Z (10 bits) */ int getAccZ(void); /** Get the Button C state *returns true if button pressed */ bool getBtnC(void); /** Get the Button Z state *returns true if button pressed */ bool getBtnZ(void); /** returns the sampling period */ float getPeriodeTe(void); protected: I2C myI2C; // Ticker myTicker; // bool setup(void); // bool request(void); // char decode(char data); // void action(void); //datas static const int ADRESSE=0xA4; signed char joyX; //-1 0 +1 signed char joyY; //-1 0 +1 int accX; int accY; int accZ; bool btnC; bool btnZ; float periodeTe; }; #endif