PSI3422_Aula3
Fork of NunchukLib by
Diff: Nunchuk.h
- Revision:
- 1:72d62147e2b8
- Parent:
- 0:37e9a0644485
- Child:
- 2:0a8f43931041
--- a/Nunchuk.h Fri Nov 15 14:45:23 2013 +0000 +++ b/Nunchuk.h Sun Nov 17 13:35:01 2013 +0000 @@ -4,6 +4,23 @@ #include "mbed.h" /** Class to interface with a Nintendo wii Nunchuk. +Exemple +@code +#include "mbed.h" +#include "Nunchuk.h" + +Serial pc(USBTX,USBRX); +Nunchuk device(p28,p27,0.05); +int main() +{ +while(1) { + + pc.printf("> :%d : %d : %d: %d \r\n",device.getJoyX(),device.getJoyY(),device.getAccX(),device.getBtnZ()); + + wait(1); + } +} +@endcode */ class Nunchuk @@ -20,44 +37,44 @@ ~Nunchuk(void); - /** Get the joyStick position - returns -1: joyStick in left position - returns +1: joyStick in righ position - returns 0: center position + /// 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 + //! 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) + /** @returns The acceleration in axis X (10 bits) */ int getAccX(void); - /** Get the acceleration in axis Y (10 bits) + /** @returns The acceleration in axis Y (10 bits) */ int getAccY(void); - /** Get the acceleration in axis Z (10 bits) + /** @returns The acceleration in axis Z (10 bits) */ int getAccZ(void); - /** Get the Button C state - *returns true if button pressed - */ + + + //! @returns true if button C pressed + bool getBtnC(void); - /** Get the Button Z state - *returns true if button pressed - */ + + //! @returns true if button Z pressed + bool getBtnZ(void); - /** returns the sampling period + /** @returns The sampling period */ float getPeriodeTe(void);