upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Go to the source code of this file.
Data Structures | |
struct | _nunchuck_context |
Functions | |
nunchuck_context | nunchuck_init (int bus) |
void | nunchuck_close (nunchuck_context dev) |
upm_result_t | nunchuck_update (const nunchuck_context dev) |
void | nunchuck_get_stick (const nunchuck_context dev, int *x, int *y) |
void | nunchuck_get_acceleration (const nunchuck_context dev, int *x, int *y, int *z) |
void | nunchuck_get_buttons (const nunchuck_context dev, bool *c, bool *z) |
Typedefs | |
typedef struct _nunchuck_context * | nunchuck_context |
nunchuck_context nunchuck_init | ( | int | bus | ) |
NUNCHUCK constructor
bus | I2C bus to use |
void nunchuck_close | ( | nunchuck_context | dev | ) |
Close the device and deallocate all resources.
dev | Device context |
upm_result_t nunchuck_update | ( | const nunchuck_context | dev | ) |
Reads and updates the current state of the controller.
dev | Device context |
void nunchuck_get_stick | ( | const nunchuck_context | dev, |
int * | x, | ||
int * | y | ||
) |
Returns the current analog stick X and Y positions. nunchuck_update() must have been called prior to calling this function.
dev | Device context |
x | Pointer in which the X value will be stored |
y | Pointer in which the Y value will be stored |
void nunchuck_get_acceleration | ( | const nunchuck_context | dev, |
int * | x, | ||
int * | y, | ||
int * | z | ||
) |
Returns the current accelerometer values. nunchuck_update() must have been called prior to calling this function.
dev | Device context |
x | Pointer in which the X value will be stored |
y | Pointer in which the Y value will be stored |
z | Pointer in which the Z value will be stored |
void nunchuck_get_buttons | ( | const nunchuck_context | dev, |
bool * | c, | ||
bool * | z | ||
) |
Returns the current button values values. nunchuck_update() must have been called prior to calling this function.
dev | Device context |
c | Pointer in which the C button value will be stored |
z | Pointer in which the Z button value will be stored |
typedef struct _nunchuck_context * nunchuck_context |
Device context