Library for communicating with a Wii classic controller using the I2C bus.

Dependents:   WiiClassicControllerTest

Embed: (wiki syntax)

« Back to documentation index

WiiClassicController Class Reference

WiiClassicController Class Reference

Allows use of a Wii classic controller using an I2C bus. More...

#include <WiiClassicController.h>

Inherited by WiiClassicControllerWithCalibration.

Public Member Functions

 WiiClassicController (PinName sda, PinName scl)
 Constructor.
virtual ~WiiClassicController ()
 Destructor.
virtual bool Read (void)
 Read from the controller.
UInt8 GetLJoyX (void) const
 Read left joystick X axis.
UInt8 GetLJoyY (void) const
 Read left joystick Y axis.
UInt8 GetRJoyX (void) const
 Read right joystick X axis.
UInt8 GetRJoyY (void) const
 Read right joystick Y axis.
bool GetButtonX (void) const
 Read X button.
bool GetButtonY (void) const
 Read Y button.
bool GetButtonA (void) const
 Read A button.
bool GetButtonB (void) const
 Read B button.
bool GetButtonLT (void) const
 Read left trigger button.
bool GetButtonRT (void) const
 Read right trigger button.
UInt8 GetLeftTrigger (void) const
 Read left trigger reading.
UInt8 GetRightTrigger (void) const
 Read right trigger reading.
bool GetButtonZL (void) const
 Read ZL button.
bool GetButtonZR (void) const
 Read ZR button.
bool GetButtonSelect (void) const
 Read select (or minus) button.
bool GetButtonHome (void) const
 Read home button.
bool GetButtonStart (void) const
 Read start (or plus) button.
bool GetButtonUp (void) const
 Read up button.
bool GetButtonDown (void) const
 Read down button.
bool GetButtonLeft (void) const
 Read left button.
bool GetButtonRight (void) const
 Read right button.
UInt8 GetReadBufSize (void) const
 Get size of read buffer.
UInt8 * GetReadBuf (void)
 Get address of read buffer.

Detailed Description

Allows use of a Wii classic controller using an I2C bus.

Definition at line 21 of file WiiClassicController.h.


Constructor & Destructor Documentation

WiiClassicController ( PinName  sda,
PinName  scl 
)

Constructor.

Parameters:
sdapin to use for SDA.
sclpin to use for SCL.

Definition at line 18 of file WiiClassicController.cpp.

~WiiClassicController (  ) [virtual]

Destructor.

Definition at line 26 of file WiiClassicController.cpp.


Member Function Documentation

bool GetButtonA ( void   ) const

Read A button.

Returns:
true if button is pressed.

Definition at line 89 of file WiiClassicController.h.

bool GetButtonB ( void   ) const

Read B button.

Returns:
true if button is pressed.

Definition at line 96 of file WiiClassicController.h.

bool GetButtonDown ( void   ) const

Read down button.

Returns:
true if button is pressed.

Definition at line 176 of file WiiClassicController.h.

bool GetButtonHome ( void   ) const

Read home button.

Returns:
true if button is pressed.

Definition at line 155 of file WiiClassicController.h.

bool GetButtonLeft ( void   ) const

Read left button.

Returns:
true if button is pressed.

Definition at line 183 of file WiiClassicController.h.

bool GetButtonLT ( void   ) const

Read left trigger button.

Returns:
true if button is pressed.

Definition at line 103 of file WiiClassicController.h.

bool GetButtonRight ( void   ) const

Read right button.

Returns:
true if button is pressed.

Definition at line 190 of file WiiClassicController.h.

bool GetButtonRT ( void   ) const

Read right trigger button.

Returns:
true if button is pressed.

Definition at line 110 of file WiiClassicController.h.

bool GetButtonSelect ( void   ) const

Read select (or minus) button.

Returns:
true if button is pressed.

Definition at line 148 of file WiiClassicController.h.

bool GetButtonStart ( void   ) const

Read start (or plus) button.

Returns:
true if button is pressed.

Definition at line 162 of file WiiClassicController.h.

bool GetButtonUp ( void   ) const

Read up button.

Returns:
true if button is pressed.

Definition at line 169 of file WiiClassicController.h.

bool GetButtonX ( void   ) const

Read X button.

Returns:
true if button is pressed.

Definition at line 75 of file WiiClassicController.h.

bool GetButtonY ( void   ) const

Read Y button.

Returns:
true if button is pressed.

Definition at line 82 of file WiiClassicController.h.

bool GetButtonZL ( void   ) const

Read ZL button.

Returns:
true if button is pressed.

Definition at line 134 of file WiiClassicController.h.

bool GetButtonZR ( void   ) const

Read ZR button.

Returns:
true if button is pressed.

Definition at line 141 of file WiiClassicController.h.

UInt8 GetLeftTrigger ( void   ) const

Read left trigger reading.

Returns:
reading as a number between 0 and 31.

Definition at line 117 of file WiiClassicController.h.

UInt8 GetLJoyX ( void   ) const

Read left joystick X axis.

Returns:
joystick reading as number between 0 and 63.

Definition at line 43 of file WiiClassicController.h.

UInt8 GetLJoyY ( void   ) const

Read left joystick Y axis.

Returns:
joystick reading as number between 0 and 63.

Definition at line 50 of file WiiClassicController.h.

UInt8* GetReadBuf ( void   )

Get address of read buffer.

Returns:
pointer to read buffer.

Definition at line 204 of file WiiClassicController.h.

UInt8 GetReadBufSize ( void   ) const

Get size of read buffer.

Returns:
size of read buffer.

Definition at line 197 of file WiiClassicController.h.

UInt8 GetRightTrigger ( void   ) const

Read right trigger reading.

Returns:
reading as a number between 0 and 31.

Definition at line 127 of file WiiClassicController.h.

UInt8 GetRJoyX ( void   ) const

Read right joystick X axis.

Returns:
joystick reading as number between 0 and 31.

Definition at line 57 of file WiiClassicController.h.

UInt8 GetRJoyY ( void   ) const

Read right joystick Y axis.

Returns:
joystick reading as number between 0 and 31.

Definition at line 68 of file WiiClassicController.h.

bool Read ( void   ) [virtual]

Read from the controller.

Returns:
true on success, false on failure.

Reimplemented in WiiClassicControllerWithCalibration.

Definition at line 32 of file WiiClassicController.cpp.