Command arrays for interacting with the Wii Balance Board based on the Wiimote protocol.
More...
Command arrays for interacting with the Wii Balance Board based on the Wiimote protocol.
This section contains predefined command arrays that follow the Wiimote protocol structure, as outlined in Wiibrew documentation. Each command array begins with the byte 0x52
, which addresses the Wii Balance Board, followed by specific instructions to execute various functions (e.g., status request, activation, LED control, calibration, and continuous data reporting).
Command Structure
Each command array uses a consistent structure:
0x52
as the first byte to address the Wii Balance Board.
- A second byte that specifies the command function (e.g.,
0x12
for status request).
- Additional bytes as required by each function, providing parameters or configuration settings.
Command Arrays
- Status Request (
status_command
): Retrieves the current status of the Balance Board, such as connection state and battery level.
const unsigned char status_command[] = { 0x52, 0x12, 0x00, 0x32 };
- Structure:
0x52
(address) | 0x12
(status command) | 0x00
(reserved) | 0x32
(end byte).
- Note: The
0x32
byte at the end may act as a terminator, checksum byte, or something else I do not fully understand.
- Activation Command (
activate_command
): Activates the Balance Board sensors, preparing the board to send data.
const unsigned char activate_command[] = { 0x52, 0x13, 0x04 };
- Structure:
0x52
(address) | 0x13
(activate command) | 0x04
(activation flag).
- Note: The role of
0x04
as an activation flag is unclear. I included it because some protocols suggest this might act as a "start data" signal. More testing is needed to determine its necessity, but I do not fully understand its purpose.
- Calibration Command (
calibration_command
): Initiates calibration to capture sensor baselines.
const unsigned char calibration_command[] = { 0x52, 0x17, 0x04, 0xa4, 0x00, 0x24, 0x00, 0x18 };
- Structure:
0x52
(address) | 0x17
(calibration command) | Sequence of bytes for calibration.
- Note: The sequence following
0x17
is protocol-defined calibration data, likely setting initial sensor baselines. I copied this from other implementations without fully understanding its function.
- LED Control Command (
led_on_command
): Controls the LED on the Balance Board. This command can toggle the LED based on the specified mask.
const unsigned char led_on_command[] = { 0x52, 0x11, 0x10 };
- Structure:
0x52
(address) | 0x11
(LED command) | 0x10
(LED mask for on state).
- Note: The mask
0x10
represents the bit to turn on the single LED on the Balance Board. This part is clear from Wiibrew’s Wiimote documentation.
- Data Dump Command (
data_dump_command
): Starts continuous data reporting from the Balance Board, sending real-time sensor readings.
const unsigned char data_dump_command[] = { 0x52, 0x15, 0x00, 0x32 };
- Structure:
0x52
(address) | 0x15
(data dump command) | 0x00
(reserved) | 0x32
(end byte).
- Note: The
0x32
byte here might act as an end marker or handshake byte to confirm readiness for data streaming, or something completely different—I am unsure.
Future Extensions
Additional commands may be added as necessary to extend functionality. In the future, command arrays could be dynamically filled based on inputs from stdin
within a monitoring thread, allowing real-time command adjustments. For now, the command arrays are statically defined in YAWiiBBessentials.c
, ensuring core commands are readily available.
◆ activate_command
const unsigned char activate_command[] |
|
extern |
◆ calibration_command
const unsigned char calibration_command[] |
|
extern |
◆ data_dump_command
const unsigned char data_dump_command[] |
|
extern |
◆ led_on_command
const unsigned char led_on_command[] |
|
extern |
◆ status_command
const unsigned char status_command[] |
|
extern |