Fix EVK1101 board joystick driver movement masks.

pull/1469/head
Dean Camera 14 years ago
parent 29ba88cffd
commit 86a2be8536

@ -67,29 +67,27 @@
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
/* Macros: */ /* Macros: */
#define JOY_MOVE_PORT 1 #define JOY_MOVE_PORT 1
#define JOY_MOVE_MASK ((1 << 6) | (1 << 7) | (1 << 8) | (1 << 9)) #define JOY_MOVE_MASK ((1UL << 6) | (1UL << 7) | (1UL << 8) | (1UL << 9))
#define JOY_PRESS_PORT 0 #define JOY_PRESS_PORT 0
#define JOY_PRESS_MASK (1 << 13) #define JOY_PRESS_MASK (1UL << 13)
#define JOY_SHIFT_LEFT 6
#endif #endif
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Macros: */ /* Macros: */
/** Mask for the joystick being pushed in the left direction. */ /** Mask for the joystick being pushed in the left direction. */
#define JOY_LEFT (1 << 1) #define JOY_LEFT (1UL << 6)
/** Mask for the joystick being pushed in the right direction. */
#define JOY_RIGHT (1 << 2)
/** Mask for the joystick being pushed in the upward direction. */ /** Mask for the joystick being pushed in the upward direction. */
#define JOY_UP (1 << 3) #define JOY_UP (1UL << 7)
/** Mask for the joystick being pushed in the right direction. */
#define JOY_RIGHT (1UL << 8)
/** Mask for the joystick being pushed in the downward direction. */ /** Mask for the joystick being pushed in the downward direction. */
#define JOY_DOWN (1 << 4) #define JOY_DOWN (1UL << 9)
/** Mask for the joystick being pushed inward. */ /** Mask for the joystick being pushed inward. */
#define JOY_PRESS (1 << 7) #define JOY_PRESS (1UL << 13)
/* Inline Functions: */ /* Inline Functions: */
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
@ -105,8 +103,8 @@
static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint32_t Joystick_GetStatus(void) static inline uint32_t Joystick_GetStatus(void)
{ {
return (uint32_t)(~(((AVR32_GPIO.port[JOY_MOVE_PORT].pvr & JOY_MOVE_MASK) | return (uint32_t)(~((AVR32_GPIO.port[JOY_MOVE_PORT].pvr & JOY_MOVE_MASK) |
(AVR32_GPIO.port[JOY_PRESS_PORT].pvr & JOY_PRESS_MASK)) << JOY_SHIFT_LEFT)); (AVR32_GPIO.port[JOY_PRESS_PORT].pvr & JOY_PRESS_MASK)));
} }
#endif #endif

Loading…
Cancel
Save