diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-12-26 14:25:34 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-12-26 14:25:34 +0000 |
commit | 2073b96d82433607bd287e3b6529fd0d3cc428cd (patch) | |
tree | 680767a0fba855e26799e392a59d4b0b6d8be4df /LUFA/Drivers/Board/Joystick.h | |
parent | 39ac72f2d12a9c62b2e876de4eee6c34a864ff74 (diff) | |
download | lufa-2073b96d82433607bd287e3b6529fd0d3cc428cd.tar.gz lufa-2073b96d82433607bd287e3b6529fd0d3cc428cd.tar.bz2 lufa-2073b96d82433607bd287e3b6529fd0d3cc428cd.zip |
Added basic driver example use code to the library documentation.
Made the USARTStream global public and documented in the SerialStream module, allowing for the serial USART stream to be accessed via its handle rather than via the implicit stdout and stdin streams.
Diffstat (limited to 'LUFA/Drivers/Board/Joystick.h')
-rw-r--r-- | LUFA/Drivers/Board/Joystick.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/LUFA/Drivers/Board/Joystick.h b/LUFA/Drivers/Board/Joystick.h index 6bf786947..f3c5c9d26 100644 --- a/LUFA/Drivers/Board/Joystick.h +++ b/LUFA/Drivers/Board/Joystick.h @@ -59,6 +59,30 @@ * * For possible BOARD makefile values, see \ref Group_BoardTypes. * + * <b>Example Usage:</b> + * \code + * // Initialise the board Joystick driver before first use + * Joystick_Init(); + * + * printf("Waiting for joystick movement...\r\n"); + * + * // Loop until a the joystick has been moved + * uint8_t JoystickMovement; + * while (!(JoystickMovement = Joystick_GetStatus())) {}; + * + * // Display which direction the joystick was moved in + * printf("Joystick moved:\r\n"); + * + * if (JoystickMovement & (JOY_UP | JOY_DOWN)) + * printf("%s ", (JoystickMovement & JOY_UP) ? "Up" : "Down"); + * + * if (JoystickMovement & (JOY_LEFT | JOY_RIGHT)) + * printf("%s ", (JoystickMovement & JOY_LEFT) ? "Left" : "Right"); + * + * if (JoystickMovement & JOY_PRESSED) + * printf("Pressed"); + * \endcode + * * @{ */ |