From 2073b96d82433607bd287e3b6529fd0d3cc428cd Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 26 Dec 2010 14:25:34 +0000 Subject: 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. --- LUFA/Drivers/Board/Joystick.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'LUFA/Drivers/Board/Joystick.h') 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. * + * Example Usage: + * \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 + * * @{ */ -- cgit v1.2.3