|
|
@ -67,22 +67,22 @@
|
|
|
|
* \code
|
|
|
|
* \code
|
|
|
|
* // Initialize the board Joystick driver before first use
|
|
|
|
* // Initialize the board Joystick driver before first use
|
|
|
|
* Joystick_Init();
|
|
|
|
* Joystick_Init();
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* printf("Waiting for joystick movement...\r\n");
|
|
|
|
* printf("Waiting for joystick movement...\r\n");
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* // Loop until a the joystick has been moved
|
|
|
|
* // Loop until a the joystick has been moved
|
|
|
|
* uint8_t JoystickMovement;
|
|
|
|
* uint8_t JoystickMovement;
|
|
|
|
* while (!(JoystickMovement = Joystick_GetStatus())) {};
|
|
|
|
* while (!(JoystickMovement = Joystick_GetStatus())) {};
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* // Display which direction the joystick was moved in
|
|
|
|
* // Display which direction the joystick was moved in
|
|
|
|
* printf("Joystick moved:\r\n");
|
|
|
|
* printf("Joystick moved:\r\n");
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* if (JoystickMovement & (JOY_UP | JOY_DOWN))
|
|
|
|
* if (JoystickMovement & (JOY_UP | JOY_DOWN))
|
|
|
|
* printf("%s ", (JoystickMovement & JOY_UP) ? "Up" : "Down");
|
|
|
|
* printf("%s ", (JoystickMovement & JOY_UP) ? "Up" : "Down");
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* if (JoystickMovement & (JOY_LEFT | JOY_RIGHT))
|
|
|
|
* if (JoystickMovement & (JOY_LEFT | JOY_RIGHT))
|
|
|
|
* printf("%s ", (JoystickMovement & JOY_LEFT) ? "Left" : "Right");
|
|
|
|
* printf("%s ", (JoystickMovement & JOY_LEFT) ? "Left" : "Right");
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* if (JoystickMovement & JOY_PRESS)
|
|
|
|
* if (JoystickMovement & JOY_PRESS)
|
|
|
|
* printf("Pressed");
|
|
|
|
* printf("Pressed");
|
|
|
|
* \endcode
|
|
|
|
* \endcode
|
|
|
@ -100,7 +100,13 @@
|
|
|
|
#include "../../Common/Common.h"
|
|
|
|
#include "../../Common/Common.h"
|
|
|
|
|
|
|
|
|
|
|
|
#if (BOARD == BOARD_NONE)
|
|
|
|
#if (BOARD == BOARD_NONE)
|
|
|
|
#error The Board Joystick driver cannot be used if the makefile BOARD option is not set.
|
|
|
|
#define JOY_UP 0
|
|
|
|
|
|
|
|
#define JOY_DOWN 0
|
|
|
|
|
|
|
|
#define JOY_LEFT 0
|
|
|
|
|
|
|
|
#define JOY_RIGHT 0
|
|
|
|
|
|
|
|
#define JOY_PRESS 0
|
|
|
|
|
|
|
|
static inline void Joystick_Init(void) {};
|
|
|
|
|
|
|
|
static inline uint_reg_t Joystick_GetStatus(void) { return 0; };
|
|
|
|
#elif (BOARD == BOARD_USBKEY)
|
|
|
|
#elif (BOARD == BOARD_USBKEY)
|
|
|
|
#include "AVR8/USBKEY/Joystick.h"
|
|
|
|
#include "AVR8/USBKEY/Joystick.h"
|
|
|
|
#elif (BOARD == BOARD_STK525)
|
|
|
|
#elif (BOARD == BOARD_STK525)
|
|
|
|