SAMA5D3 Xplained: A few fixes for the AJoystick driver (still not working)

This commit is contained in:
Gregory Nutt 2014-12-03 14:33:00 -06:00
parent 6574b27abb
commit d4efa9eb9c
3 changed files with 19 additions and 14 deletions

View File

@ -2605,6 +2605,9 @@ Shields
A1 Joystick X Output J17 pin 2 PD21 AD1 (function 1)
--------- ----------------- ---------- ----------------------
All buttons are pulled on the shield. A sensed low value indicates
when the button is pressed.
Possible conflicts:
---- ----- --------------------------------------------------
@ -2672,8 +2675,11 @@ Shields
Library routines
CONFIG_SCHED_WORKQUEUE=y : Work queue support is needed
This enables the analog joystick example at apps/examples/ajoystick:
There is nothing in the configuration that currently uses the joystick.
For testing, you can add the following configuration options to enable the
analog joystick example at apps/examples/ajoystick:
CONFIG_NSH_ARCHINIT=y
CONFIG_EXAMPLES_AJOYSTICK=y
CONFIG_EXAMPLES_AJOYSTICK_DEVNAME="/dev/ajoy0"
CONFIG_EXAMPLES_AJOYSTICK_SIGNO=13

View File

@ -157,7 +157,7 @@ static FAR void *g_ajoyarg;
* Name: ajoy_supported
*
* Description:
* Return the set of buttons supported on the button joystick device
* Return the set of buttons supported on the button joystick device
*
****************************************************************************/
@ -260,22 +260,19 @@ static int ajoy_sample(FAR const struct ajoy_lowerhalf_s *lower,
static ajoy_buttonset_t ajoy_buttons(FAR const struct ajoy_lowerhalf_s *lower)
{
ajoy_buttonset_t ret = 0;
ajoy_buttonset_t bit;
bool released;
int i;
/* Read each joystick GPIO value */
for (i = 0; i < AJOY_NGPIOS; i++)
{
bit = (1 << i);
if ((bit & AJOY_SUPPORTED) != 0)
/* Button outputs are pulled high. So a sensed low level means that the
* button is pressed.
*/
if (!sam_pioread(g_joypio[i]))
{
released = sam_pioread(g_joypio[i]);
if (!released)
{
ret |= bit;
}
ret |= (1 << i);
}
}
@ -336,7 +333,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower,
* interrupts.
*/
sam_pioirqenable(g_joypio[i]);
sam_pioirqenable(g_joyirq[i]);
}
}
}

View File

@ -506,6 +506,9 @@
* A0 Joystick Y Output J17 pin 1 PC18 AD0 (function 4)
* A1 Joystick X Output J17 pin 2 PD21 AD1 (function 1)
* --------- ----------------- ---------- ----------------------
*
* All buttons are pulled on the shield. A sensed low value indicates
* when the button is pressed.
*/
#define ADC_XOUPUT 1 /* X output is on ADC channel 1 */
@ -570,7 +573,6 @@
#define PIO_JUMP PIO_BUTTON_3
#define IRQ_JUMP IRQ_BUTTON_3
/************************************************************************************
* Public Types
************************************************************************************/
@ -697,7 +699,7 @@ bool sam_writeprotected(int slotno);
* Name: sam_usbinitialize
*
* Description:
* Called from sam_usbinitialize very early in inialization to setup USB-related
* Called from sam_usbinitialize very early in initialization to setup USB-related
* PIO pins for the SAMA5D3-Xplained board.
*
************************************************************************************/