From: Andrew Lunn <andrew@lunn.ch>
To: Rasmus Stougaard <stou.nospam@gmail.com>
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Problem reading buttons on AT91sam7s-ek
Date: Mon, 01 Oct 2007 14:28:00 -0000 [thread overview]
Message-ID: <20071001142828.GA22379@lunn.ch> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2007-10-01 14:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-01 12:27 Rasmus Stougaard
2007-10-01 14:28 ` Andrew Lunn [this message]
2007-10-02 11:40 ` Rasmus Stougaard
2007-10-02 11:47 ` Andrew Lunn
2007-10-02 13:04 ` Rasmus Stougaard
2007-10-02 13:40 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071001142828.GA22379@lunn.ch \
--to=andrew@lunn.ch \
--cc=ecos-discuss@ecos.sourceware.org \
--cc=stou.nospam@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).