Fix USB, DOS line endings, integrate and reorganize project
[rapper.git] / new_cmsis / led.h
diff --git a/new_cmsis/led.h b/new_cmsis/led.h
new file mode 100644 (file)
index 0000000..ef0be5d
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef LED_H
+#define LED_H
+
+#include <board.h>
+
+extern uint32_t msTicks;                               /* counts 1ms timeTicks */
+
+/*------------------------------------------------------------------------------
+  delays number of tick Systicks (happens every 1 ms)
+ *------------------------------------------------------------------------------*/
+__inline static void Delay (uint32_t dlyTicks) {
+  uint32_t curTicks;
+
+  curTicks = msTicks;
+  while ((msTicks - curTicks) < dlyTicks);
+}
+
+/*------------------------------------------------------------------------------
+  configer LED pins
+ *------------------------------------------------------------------------------*/
+__inline static void LED_Config(void) {
+
+  GPIO1->FIODIR = (1<<29)|(1<<18);     /* LEDs on PORT1 18 & 29 are Output */
+}
+
+/*------------------------------------------------------------------------------
+  Switch on LEDs
+ *------------------------------------------------------------------------------*/
+__inline static void LED_On (uint32_t led) {
+
+  GPIO1->FIOPIN |=  (led);                      /* Turn On  LED */
+}
+
+
+/*------------------------------------------------------------------------------
+  Switch off LEDs
+ *------------------------------------------------------------------------------*/
+__inline static void LED_Off (uint32_t led) {
+
+  GPIO1->FIOPIN &= ~(led);                      /* Turn Off LED */
+}
+
+#endif