My Project 1
Yet another Wii Balance Board Driver
|
Core file for funktions predefined in YAWiiBBessentials.h. More...
#include "YAWiiBBessentials.h"
Functions | |
void | print_info (const LogLevel *is_debug_level, const char *message, const unsigned char *buffer, int length, const WiiBalanceBoard *board) |
Logs messages with different verbosity levels, providing diagnostics and raw data output. More... | |
int | find_wii_balance_board (WiiBalanceBoard *board) |
Finds the Wii Balance Board by scanning nearby Bluetooth devices. More... | |
void | send_command (int sock, const unsigned char *command, int length) |
Sends a command to the Wii Balance Board over the control socket. More... | |
int | connect_l2cap (const char *bdaddr_str, uint16_t psm) |
Establishes a L2CAP connection with the Wii Balance Board. More... | |
void | handle_status (WiiBalanceBoard *board) |
Processes sending a status command to the Wii Balance Board. More... | |
void | handle_calibration (WiiBalanceBoard *board) |
Processes sending a calibration command to the Wii Balance Board. More... | |
void | handle_led_on (WiiBalanceBoard *board) |
Processes sending an LED on command to the Wii Balance Board. More... | |
void | handle_activation (WiiBalanceBoard *board) |
Processes sending an activation command to the Wii Balance Board. More... | |
void | handle_data_dump (WiiBalanceBoard *board) |
Processes sending a data dump command (continous report of readings) to the Wii Balance Board. More... | |
void | process_received_data (int bytes_read, unsigned char *buffer, WiiBalanceBoard *board) |
Processes received data from the Wii Balance Board. More... | |
void * | threadFunction (void *arg) |
Thread function for monitoring user input to control the Wii Balance Board. More... | |
void | createThread (WiiBalanceBoard *board, pthread_t *threadId) |
Creates a new thread and starts the threadFunction to monitor user control. More... | |
int | is_valid_mac (int argc, char *argv[]) |
Validates a given MAC address for format and content. More... | |
uint16_t | bytes_to_int_big_endian (const unsigned char *buffer, size_t position, int *max) |
Converts two consecutive bytes in the buffer from Big-Endian representation to a decimal integer. More... | |
void | process_calibration_data (int *bytes_read, unsigned char *buffer, WiiBalanceBoard *board) |
Processes the calibration data from the Wii Balance Board. More... | |
uint16_t | calc_mass (const WiiBalanceBoard *board, uint16_t raw, int pos) |
Calculates the weight in grams from the raw data of the Wii Balance Board. More... | |
void | print_calibration_data (const WiiBalanceBoard *board) |
Displays the stored calibration data. More... | |
Variables | |
const unsigned char | status_command [] = { 0x52, 0x12, 0x00, 0x32 } |
const unsigned char | activate_command [] = { 0x52, 0x13, 0x04 } |
const unsigned char | calibration_command [] = { 0x52, 0x17, 0x04, 0xa4, 0x00, 0x24, 0x00, 0x18 } |
const unsigned char | led_on_command [] = { 0x52, 0x11, 0x10 } |
const unsigned char | data_dump_command [] = { 0x52, 0x15, 0x00, 0x32 } |
unsigned char | buffer [BUFFER_SIZE] |
Buffer for storing responses from the Wii Balance Board. More... | |
Core file for funktions predefined in YAWiiBBessentials.h.
unsigned char buffer[BUFFER_SIZE] |
Buffer for storing responses from the Wii Balance Board.
This buffer holds incoming data from the Balance Board, with a fixed maximum length of bytes, as defined in BUFFER_SIZE