From: arighi Date: Fri, 21 May 2010 12:33:32 +0000 (+0000) Subject: at91sam7s: implement hardware LED module. X-Git-Tag: 2.5.0~139 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=cc8f24edfd0894924d0f1c46e8df7b4039260c43;p=bertos.git at91sam7s: implement hardware LED module. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3778 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/boards/at91sam7s-ek/hw/hw_led.h b/boards/at91sam7s-ek/hw/hw_led.h index 615b071b..360a8251 100644 --- a/boards/at91sam7s-ek/hw/hw_led.h +++ b/boards/at91sam7s-ek/hw/hw_led.h @@ -30,7 +30,7 @@ * All Rights Reserved. * --> * - * \brief Led on/off macros. + * \brief Led on/off macros for AT91SAM7S. * * \author Daniele Basile */ @@ -38,11 +38,23 @@ #ifndef HW_LED_H #define HW_LED_H -#warning FIXME: This is an example implementation, you must implement it +#include +#include -#define LED_ON() do { /* implement me */} while(0) -#define LED_OFF() do { /* implement me */} while(0) +#define LED_PIN BV(0) -#define LED_INIT() do { /* implement me */} while(0) +#define LED_ON() PIOA_SODR = LED_PIN; +#define LED_OFF() PIOA_CODR = LED_PIN; + +#define LED_INIT() \ + do { \ + PIOA_PER = LED_PIN; \ + /* Disable pullups */ \ + PIOA_PUDR = LED_PIN; \ + /* Set PIO stepper power supply as output */ \ + PIOA_OER = LED_PIN; \ + /* Disable multidrive on all pins */ \ + PIOA_MDDR = LED_PIN; \ + } while(0) #endif /* HW_LED_H */