X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=boards%2Fat91sam7s-ek%2Fhw%2Fhw_led.h;h=360a82516714533dec3ff95a68a8f590b8a7b0f6;hb=HEAD;hp=615b071b3e51ad5fb49b9fe4387335e4537dc3f7;hpb=a22efc8dcc90c5fcb3811cf2667efb8a4e448134;p=bertos.git 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 */