at91sam7s: implement hardware LED module.
authorarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 21 May 2010 12:33:32 +0000 (12:33 +0000)
committerarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 21 May 2010 12:33:32 +0000 (12:33 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3778 38d2e660-2303-0410-9eaa-f027e97ec537

boards/at91sam7s-ek/hw/hw_led.h

index 615b071b3e51ad5fb49b9fe4387335e4537dc3f7..360a82516714533dec3ff95a68a8f590b8a7b0f6 100644 (file)
@@ -30,7 +30,7 @@
  * All Rights Reserved.
  * -->
  *
- * \brief Led on/off macros.
+ * \brief Led on/off macros for AT91SAM7S.
  *
  * \author Daniele Basile <asterix@develer.com>
  */
 #ifndef HW_LED_H
 #define HW_LED_H
 
-#warning FIXME: This is an example implementation, you must implement it
+#include <cfg/macros.h>
+#include <io/arm.h>
 
-#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 */