wiiuse
Macros | Functions
io.c File Reference

Handles device I/O (non-OS specific). More...

#include "io.h"
#include "dynamics.h"
#include "events.h"
#include "ir.h"
#include "wiiuse_internal.h"
#include "os.h"
#include <stdlib.h>
Include dependency graph for io.c:

Macros

#define ACCEL_CALIBRATION_LEN   7
 Get initialization data from the wiimote. More...
 

Functions

int wiiuse_find (struct wiimote_t **wm, int max_wiimotes, int timeout)
 Find a wiimote or wiimotes. More...
 
int wiiuse_connect (struct wiimote_t **wm, int wiimotes)
 Connect to a wiimote or wiimotes once an address is known. More...
 
void wiiuse_disconnect (struct wiimote_t *wm)
 Disconnect a wiimote. More...
 
int wiiuse_wait_report (struct wiimote_t *wm, int report, byte *buffer, int bufferLength, unsigned long timeout_ms)
 Wait until specified report arrives and return it. More...
 
void wiiuse_read_data_sync (struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data)
 Read memory/register data synchronously. More...
 
void wiiuse_decode_accel_calibration_lsb (struct accel_t *accel, byte *buf)
 Decode the extra low-order accelerometer calibration bits packed into the EEPROM calibration block. More...
 
void wiiuse_handshake (struct wiimote_t *wm, byte *data, uint16_t len)
 

Detailed Description

Handles device I/O (non-OS specific).

Macro Definition Documentation

◆ ACCEL_CALIBRATION_LEN

#define ACCEL_CALIBRATION_LEN   7

Get initialization data from the wiimote.

Parameters
wmPointer to a wiimote_t structure.
dataunused
lenunused

When first called for a wiimote_t structure, a request is sent to the wiimote for initialization information. This includes factory set accelerometer data. The handshake will be concluded when the wiimote responds with this data.