From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28465 invoked by alias); 2 Oct 2007 13:04:24 -0000 Received: (qmail 28452 invoked by uid 22791); 2 Oct 2007 13:04:22 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.189) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 02 Oct 2007 13:04:20 +0000 Received: by nf-out-0910.google.com with SMTP id b21so2614237nfd for ; Tue, 02 Oct 2007 06:04:17 -0700 (PDT) Received: by 10.78.134.2 with SMTP id h2mr7875648hud.1191330256864; Tue, 02 Oct 2007 06:04:16 -0700 (PDT) Received: by 10.78.191.20 with HTTP; Tue, 2 Oct 2007 06:04:16 -0700 (PDT) Message-ID: Date: Tue, 02 Oct 2007 13:04:00 -0000 From: "Rasmus Stougaard" To: "Rasmus Stougaard" , ecos-discuss@ecos.sourceware.org In-Reply-To: <20071002114722.GA30037@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20071001142828.GA22379@lunn.ch> <20071002114722.GA30037@lunn.ch> Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Problem reading buttons on AT91sam7s-ek X-SW-Source: 2007-10/txt/msg00023.txt.bz2 > > // Enable the clock to the GPIO (enable input sampling) > > HAL_WRITE_UINT32(AT91_PMC + AT91_PMC_PCER, AT91_PMC_PCER_PIOA); > > You only need to enable the clock once. You could move this outside of > the read function. Ok thanks again, will do that. I also plan to convert my example to a macro, to save the overhead of making the function call. > > Maybe i should add a macro to var_io.h to enable/disable the clock? That might be a good idea, or add a comment to HAL_ARM_AT91_GPIO_CFG_DIRECTION and HAL_ARM_AT91_GPIO_GET stating that the clock must be enabled to receive inputs. At least it was not obvios to me, and others might benefit too :-) By the way can you point me to an example/documentation of how to use HAL_ARM_AT91_GPIO_CFG_INTERRUPT I want to setup the buttons to generate interupts for handling user input. I have found some domentation of how to set up ISR and DSR using cyg_interrupt_create(). However, I can figure out how to map a GPIO pin to trigger the interrupt vector? Cheers Rasmus -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss