USB Host Shield 2.0
|
#include <Wii.h>
Public Member Functions | |
WII (BTD *p, bool pair=false) | |
Wii Controller functions | |
bool | getButtonPress (ButtonEnum b) |
bool | getButtonClick (ButtonEnum b) |
void | pair (void) |
uint8_t | getAnalogHat (HatEnum a) |
uint16_t | getAnalogHat (AnalogHatEnum a) |
double | getPitch () |
double | getRoll () |
double | getYaw () |
void | setAllOff () |
void | setRumbleOff () |
void | setRumbleOn () |
void | setRumbleToggle () |
void | setLedRaw (uint8_t value) |
void | setLedOff () |
void | setLedOff (LEDEnum a) |
void | setLedOn (LEDEnum a) |
void | setLedToggle (LEDEnum a) |
void | setLedStatus () |
uint8_t | getBatteryLevel () |
uint8_t | getWiiState () |
double | getWiimotePitch () |
double | getWiimoteRoll () |
double | getNunchuckPitch () |
double | getNunchuckRoll () |
Wiimote IR camera functions | |
You will have to set ENABLE_WII_IR_CAMERA in settings.h to 1 in order use the IR camera. | |
void | IRinitialize () |
uint16_t | getIRx1 () |
uint16_t | getIRy1 () |
uint8_t | getIRs1 () |
uint16_t | getIRx2 () |
uint16_t | getIRy2 () |
uint8_t | getIRs2 () |
uint16_t | getIRx3 () |
uint16_t | getIRy3 () |
uint8_t | getIRs3 () |
uint16_t | getIRx4 () |
uint16_t | getIRy4 () |
uint8_t | getIRs4 () |
bool | isIRCameraEnabled () |
Public Member Functions inherited from BluetoothService | |
BluetoothService (BTD *p) | |
void | attachOnInit (void(*funcOnInit)(void)) |
Public Attributes | |
double | gyroPitch |
double | gyroRoll |
double | gyroYaw |
bool | wiimoteConnected |
bool | nunchuckConnected |
bool | motionPlusConnected |
bool | wiiUProControllerConnected |
int16_t | accXwiimote |
int16_t | accYwiimote |
int16_t | accZwiimote |
int16_t | accXnunchuck |
int16_t | accYnunchuck |
int16_t | accZnunchuck |
double | pitchGyroSpeed |
double | rollGyroSpeed |
double | yawGyroSpeed |
uint16_t | pitchGyroScale |
uint16_t | rollGyroScale |
uint16_t | yawGyroScale |
int16_t | gyroYawRaw |
int16_t | gyroRollRaw |
int16_t | gyroPitchRaw |
int16_t | gyroYawZero |
int16_t | gyroRollZero |
int16_t | gyroPitchZero |
BluetoothService implementation | |
void | disconnect () |
void | ACLData (uint8_t *ACLData) |
void | Run () |
void | Reset () |
void | onInit () |
Additional Inherited Members | |
Protected Member Functions inherited from BluetoothService | |
bool | checkHciHandle (uint8_t *buf, uint16_t handle) |
Protected Attributes inherited from BluetoothService | |
void(* | pFuncOnInit )(void) |
BTD * | pBtd |
uint16_t | hci_handle |
uint32_t | l2cap_event_flag |
uint8_t | identifier |
This BluetoothService class implements support for the Wiimote including the Nunchuck and Motion Plus extension.
It also support the Wii U Pro Controller.
WII::WII | ( | BTD * | p, |
bool | pair = false |
||
) |
|
virtual |
Used this to disconnect any of the controllers.
Implements BluetoothService.
bool WII::getButtonPress | ( | ButtonEnum | b | ) |
getButtonPress(Button b) will return true as long as the button is held down.
While getButtonClick(Button b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).
b | ButtonEnum to read. |
bool WII::getButtonClick | ( | ButtonEnum | b | ) |
getButtonPress(Button b) will return true as long as the button is held down.
While getButtonClick(Button b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).
b | ButtonEnum to read. |
|
inline |
uint8_t WII::getAnalogHat | ( | HatEnum | a | ) |
uint16_t WII::getAnalogHat | ( | AnalogHatEnum | a | ) |
|
inline |
|
inline |
|
inline |
void WII::setAllOff | ( | ) |
void WII::setLedRaw | ( | uint8_t | value | ) |
void WII::setLedOff | ( | LEDEnum | a | ) |
void WII::setLedOn | ( | LEDEnum | a | ) |
void WII::setLedToggle | ( | LEDEnum | a | ) |
void WII::setLedStatus | ( | ) |
uint8_t WII::getBatteryLevel | ( | ) |
|
inline |
Return the Wiimote state.
|
inline |
|
inline |
|
inline |
|
inline |
void WII::IRinitialize | ( | ) |
Initialises the camera as per the steps from: http://wiibrew.org/wiki/Wiimote#IR_Camera
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Use this to check if the camera is enabled or not. If not call WII::IRinitialize to initialize the IR camera.
|
protectedvirtual |
Used to pass acldata to the services.
ACLData | Incoming acldata. |
Implements BluetoothService.
|
protectedvirtual |
Used to run part of the state machine.
Implements BluetoothService.
|
protectedvirtual |
|
protectedvirtual |
Called when the controller is successfully initialized. Use attachOnInit(void (*funcOnInit)(void)) to call your own function. This is useful for instance if you want to set the LEDs in a specific way.
Implements BluetoothService.
bool WII::wiimoteConnected |
bool WII::nunchuckConnected |
bool WII::motionPlusConnected |
bool WII::wiiUProControllerConnected |
int16_t WII::accXwiimote |
int16_t WII::accYwiimote |
int16_t WII::accZwiimote |
int16_t WII::accXnunchuck |
int16_t WII::accYnunchuck |
int16_t WII::accZnunchuck |
double WII::gyroPitch |
This is the pitch calculated by the gyro - use this to tune WII::pitchGyroScale.
double WII::gyroRoll |
This is the roll calculated by the gyro - use this to tune WII::rollGyroScale.
double WII::gyroYaw |
This is the yaw calculated by the gyro - use this to tune WII::yawGyroScale.
uint16_t WII::pitchGyroScale |
uint16_t WII::rollGyroScale |
uint16_t WII::yawGyroScale |
int16_t WII::gyroYawRaw |
int16_t WII::gyroRollRaw |
int16_t WII::gyroPitchRaw |
int16_t WII::gyroYawZero |
int16_t WII::gyroRollZero |
int16_t WII::gyroPitchZero |