Re-organize and comment the new functionality
This commit is contained in:
52
src/wiiuse.h
52
src/wiiuse.h
@@ -688,6 +688,26 @@ typedef struct wiimote_t {
|
|||||||
WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */
|
WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */
|
||||||
} wiimote;
|
} wiimote;
|
||||||
|
|
||||||
|
/** @brief Data passed to a callback during wiiuse_update() */
|
||||||
|
typedef struct WiimoteState_t {
|
||||||
|
WCONST int uid;
|
||||||
|
WCONST byte leds;
|
||||||
|
WCONST float battery_level;
|
||||||
|
WCONST struct vec3b_t accel;
|
||||||
|
WCONST struct orient_t orient;
|
||||||
|
WCONST struct gforce_t gforce;
|
||||||
|
WCONST struct ir_t ir;
|
||||||
|
WCONST uint16_t buttons;
|
||||||
|
WCONST uint16_t buttons_held;
|
||||||
|
WCONST uint16_t buttons_released;
|
||||||
|
WCONST WIIUSE_EVENT_TYPE event;
|
||||||
|
WCONST int state;
|
||||||
|
WCONST struct expansion_t expansion;
|
||||||
|
} WiimoteState;
|
||||||
|
|
||||||
|
/** @brief Callback type */
|
||||||
|
typedef void (*wiiuse_update_cb)(struct WiimoteState_t* wm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loglevels supported by wiiuse.
|
* @brief Loglevels supported by wiiuse.
|
||||||
*/
|
*/
|
||||||
@@ -758,6 +778,15 @@ WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm);
|
|||||||
/* events.c */
|
/* events.c */
|
||||||
WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes);
|
WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Poll Wiimotes, and call the provided callback with information
|
||||||
|
* on each Wiimote that had an event.
|
||||||
|
*
|
||||||
|
* Alternative to calling wiiuse_poll yourself, and provides the same
|
||||||
|
* information struct on all platforms.
|
||||||
|
*/
|
||||||
|
WIIUSE_EXPORT extern int wiiuse_update(struct wiimote_t** wm, int wiimotes, wiiuse_update_cb callback);
|
||||||
|
|
||||||
/* ir.c */
|
/* ir.c */
|
||||||
WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status);
|
WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status);
|
||||||
WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y);
|
WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y);
|
||||||
@@ -773,29 +802,6 @@ WIIUSE_EXPORT extern void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t* w
|
|||||||
/* this function not currently implemented... */
|
/* this function not currently implemented... */
|
||||||
WIIUSE_EXPORT extern void wiiuse_set_wii_board_calib(struct wiimote_t *wm);
|
WIIUSE_EXPORT extern void wiiuse_set_wii_board_calib(struct wiimote_t *wm);
|
||||||
|
|
||||||
/* wiiuse.c harts API */
|
|
||||||
typedef struct WiimoteState_t {
|
|
||||||
WCONST int uid;
|
|
||||||
WCONST byte leds;
|
|
||||||
WCONST float battery_level;
|
|
||||||
WCONST struct vec3b_t accel;
|
|
||||||
WCONST struct orient_t orient;
|
|
||||||
WCONST struct gforce_t gforce;
|
|
||||||
WCONST struct ir_t ir;
|
|
||||||
WCONST uint16_t buttons;
|
|
||||||
WCONST uint16_t buttons_held;
|
|
||||||
WCONST uint16_t buttons_released;
|
|
||||||
WCONST WIIUSE_EVENT_TYPE event;
|
|
||||||
WCONST int state;
|
|
||||||
WCONST struct expansion_t expansion;
|
|
||||||
} WiimoteState;
|
|
||||||
|
|
||||||
typedef void (*wiiuse_update_cb)(struct WiimoteState_t* wm);
|
|
||||||
|
|
||||||
WIIUSE_EXPORT extern int wiiuse_update(struct wiimote_t** wm, int wiimotes, wiiuse_update_cb callback);
|
|
||||||
|
|
||||||
/* end harts API */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user