This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Problem reading buttons on AT91sam7s-ek
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Rasmus Stougaard <stou dot nospam at gmail dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Mon, 1 Oct 2007 16:28:28 +0200
- Subject: Re: [ECOS] Problem reading buttons on AT91sam7s-ek
- References: <dbc951020710010527k4a2c5560y8607359108066f47@mail.gmail.com>
On Mon, Oct 01, 2007 at 02:27:32PM +0200, Rasmus Stougaard wrote:
> Hi
>
> I am trying to read the state of the buttons on a AT91sam7s-ek
> evaluation kit from atmel.
>
> I figure that something like:
>
> cyg_uint32 value;
> HAL_ARM_AT91_GPIO_CFG_DIRECTION(AT91_GPIO_PA20, AT91_PIN_IN);
> HAL_ARM_AT91_GPIO_CFG_PULLUP(AT91_GPIO_PA20, AT91_PIN_PULLUP_ENABLE);
> HAL_ARM_AT91_GPIO_GET(AT91_GPIO_PA20, value);
> trace(" AT91_GPIO_PA20 %d\n", value);
>
> Should configure the pin for input and print the current state of the
> of the pin.
In general that looks O.K. Have you tried the other 3 switches?
One idea i have. Is the clock to the GPIO device enabled? Check bit
AT91_PMC_PCER_PIOA in AT91_PMC_PCER. Without a clock you can do
output. But to do input you need the clock enabled.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss