#include
#include
#include
#include "definitions.h"
#include "wiiuse_internal.h"
#include "events.h"
#include "io.h"
Functions |
|
const char * | wiiuse_version () |
void | wiiuse_cleanup (struct wiimote_t **wm, int wiimotes) |
Clean up wiimote_t array created by wiiuse_init(). |
|
struct wiimote_t ** | wiiuse_init (int wiimotes) |
Initialize an array of wiimote structures. |
|
void | wiiuse_disconnected (struct wiimote_t *wm) |
The wiimote disconnected. |
|
void | wiiuse_rumble (struct wiimote_t *wm, int status) |
Enable or disable the rumble. |
|
void | wiiuse_toggle_rumble (struct wiimote_t *wm) |
Toggle the state of the rumble. |
|
void | wiiuse_set_leds (struct wiimote_t *wm, int leds) |
Set the enabled LEDs. |
|
void | wiiuse_motion_sensing (struct wiimote_t *wm, int status) |
Set if the wiimote should report motion sensing. |
|
int | wiiuse_set_report_type (struct wiimote_t *wm) |
Set the report type based on the current wiimote state. |
|
int | wiiuse_read_data_cb (struct wiimote_t *wm, wiiuse_read_cb read_cb, byte *buffer, unsigned int addr, unsigned short len) |
Read data from the wiimote (callback version). |
|
int | wiiuse_read_data (struct wiimote_t *wm, byte *buffer, unsigned int addr, unsigned short len) |
Read data from the wiimote (event version). |
|
void | wiiuse_send_next_pending_read_request (struct wiimote_t *wm) |
Send the next pending data read request to the wiimote. |
|
void | wiiuse_status (struct wiimote_t *wm) |
Request the wiimote controller status. |
|
struct wiimote_t * | wiiuse_get_by_id (struct wiimote_t **wm, int wiimotes, int unid) |
Find a wiimote_t structure by its unique identifier. |
|
int | wiiuse_write_data (struct wiimote_t *wm, unsigned int addr, byte *data, byte len) |
Write data to the wiimote. |
|
int | wiiuse_send (struct wiimote_t *wm, byte report_type, byte *msg, int len) |
Send a packet to the wiimote. |
|
int | wiiuse_set_flags (struct wiimote_t *wm, int enable, int disable) |
Set flags for the specified wiimote. |
|
float | wiiuse_set_smooth_alpha (struct wiimote_t *wm, float alpha) |
Set the wiimote smoothing alpha value. |
|
void | wiiuse_set_bluetooth_stack (struct wiimote_t **wm, int wiimotes, enum win_bt_stack_t type) |
Set the bluetooth stack type to use. |
|
void | wiiuse_set_orient_threshold (struct wiimote_t *wm, float threshold) |
Set the orientation event threshold. |
|
void | wiiuse_set_accel_threshold (struct wiimote_t *wm, int threshold) |
Set the accelerometer event threshold. |
|
void | wiiuse_resync (struct wiimote_t *wm) |
Try to resync with the wiimote by starting a new handshake. |
|
void | wiiuse_set_timeout (struct wiimote_t **wm, int wiimotes, byte normal_timeout, byte exp_timeout) |
Set the normal and expansion handshake timeouts. |
|
Variables |
|
static int | g_banner = 0 |
The file includes functions that handle general tasks. Most of these are functions that are part of the API.
void wiiuse_disconnected | ( | struct wiimote_t * | wm | ) |
The wiimote disconnected.
wm | Pointer to a wiimote_t structure. |
struct wiimote_t** wiiuse_init | ( | int | wiimotes | ) | [read] |
Initialize an array of wiimote structures.
wiimotes | Number of wiimote_t structures to create. |
void wiiuse_motion_sensing | ( | struct wiimote_t * | wm, | |
int | status | |||
) |
Set if the wiimote should report motion sensing.
wm | Pointer to a wiimote_t structure. | |
status | 1 to enable, 0 to disable. |
int wiiuse_read_data | ( | struct wiimote_t * | wm, | |
byte * | buffer, | |||
unsigned int | addr, | |||
unsigned short | len | |||
) |
Read data from the wiimote (event version).
wm | Pointer to a wiimote_t structure. | |
buffer | An allocated buffer to store the data as it arrives from the wiimote. Must be persistent in memory and large enough to hold the data. | |
addr | The address of wiimote memory to read from. | |
len | The length of the block to be read. |
int wiiuse_read_data_cb | ( | struct wiimote_t * | wm, | |
wiiuse_read_cb | read_cb, | |||
byte * | buffer, | |||
unsigned int | addr, | |||
unsigned short | len | |||
) |
Read data from the wiimote (callback version).
wm | Pointer to a wiimote_t structure. | |
read_cb | Function pointer to call when the data arrives from the wiimote. | |
buffer | An allocated buffer to store the data as it arrives from the wiimote. Must be persistent in memory and large enough to hold the data. | |
addr | The address of wiimote memory to read from. | |
len | The length of the block to be read. |
void wiiuse_resync | ( | struct wiimote_t * | wm | ) |
Try to resync with the wiimote by starting a new handshake.
wm | Pointer to a wiimote_t structure. |
void wiiuse_rumble | ( | struct wiimote_t * | wm, | |
int | status | |||
) |
Enable or disable the rumble.
wm | Pointer to a wiimote_t structure. | |
status | 1 to enable, 0 to disable. |
int wiiuse_send | ( | struct wiimote_t * | wm, | |
byte | report_type, | |||
byte * | msg, | |||
int | len | |||
) |
Send a packet to the wiimote.
This function should replace any write()s directly to the wiimote device.void wiiuse_send_next_pending_read_request | ( | struct wiimote_t * | wm | ) |
Send the next pending data read request to the wiimote.
wm | Pointer to a wiimote_t structure. |
void wiiuse_set_accel_threshold | ( | struct wiimote_t * | wm, | |
int | threshold | |||
) |
Set the accelerometer event threshold.
wm | Pointer to a wiimote_t structure. | |
threshold | The decimal place that should be considered a significant change. |
void wiiuse_set_bluetooth_stack | ( | struct wiimote_t ** | wm, | |
int | wiimotes, | |||
enum win_bt_stack_t | type | |||
) |
Set the bluetooth stack type to use.
wm | Array of wiimote_t structures. | |
wiimotes | Number of objects in the wm array. | |
type | The type of bluetooth stack to use. |
int wiiuse_set_flags | ( | struct wiimote_t * | wm, | |
int | enable, | |||
int | disable | |||
) |
Set flags for the specified wiimote.
wm | Pointer to a wiimote_t structure. | |
enable | Flags to enable. | |
disable | Flags to disable. |
void wiiuse_set_leds | ( | struct wiimote_t * | wm, | |
int | leds | |||
) |
Set the enabled LEDs.
wm | Pointer to a wiimote_t structure. | |
leds | What LEDs to enable. |
void wiiuse_set_orient_threshold | ( | struct wiimote_t * | wm, | |
float | threshold | |||
) |
Set the orientation event threshold.
wm | Pointer to a wiimote_t structure. | |
threshold | The decimal place that should be considered a significant change. |
int wiiuse_set_report_type | ( | struct wiimote_t * | wm | ) |
Set the report type based on the current wiimote state.
wm | Pointer to a wiimote_t structure. |
float wiiuse_set_smooth_alpha | ( | struct wiimote_t * | wm, | |
float | alpha | |||
) |
Set the wiimote smoothing alpha value.
wm | Pointer to a wiimote_t structure. | |
alpha | The alpha value to set. Between 0 and 1. |
Smoothing is only performed if the WIIMOTE_USE_SMOOTHING is set.
void wiiuse_set_timeout | ( | struct wiimote_t ** | wm, | |
int | wiimotes, | |||
byte | normal_timeout, | |||
byte | exp_timeout | |||
) |
Set the normal and expansion handshake timeouts.
wm | Array of wiimote_t structures. | |
wiimotes | Number of objects in the wm array. | |
normal_timeout | The timeout in milliseconds for a normal read. | |
exp_timeout | The timeout in millisecondsd to wait for an expansion handshake. |
void wiiuse_status | ( | struct wiimote_t * | wm | ) |
Request the wiimote controller status.
wm | Pointer to a wiimote_t structure. |
void wiiuse_toggle_rumble | ( | struct wiimote_t * | wm | ) |
Toggle the state of the rumble.
wm | Pointer to a wiimote_t structure. |
const char* wiiuse_version | ( | ) |
Returns the version of the library.
int wiiuse_write_data | ( | struct wiimote_t * | wm, | |
unsigned int | addr, | |||
byte * | data, | |||
byte | len | |||
) |
Write data to the wiimote.
wm | Pointer to a wiimote_t structure. | |
addr | The address to write to. | |
data | The data to be written to the memory location. | |
len | The length of the block to be written. |