summaryrefslogtreecommitdiffstats
path: root/radiator-plc/stm32/app/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'radiator-plc/stm32/app/led.c')
-rw-r--r--radiator-plc/stm32/app/led.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/radiator-plc/stm32/app/led.c b/radiator-plc/stm32/app/led.c
new file mode 100644
index 0000000..390ed2e
--- /dev/null
+++ b/radiator-plc/stm32/app/led.c
@@ -0,0 +1,53 @@
+#include "project.h"
+
+#define LED0 GPIO3
+#define LED0_PORT GPIOC
+
+#define LED1 GPIO2
+#define LED1_PORT GPIOC
+
+static int led = 0;
+
+void
+led_init (void)
+{
+ MAP_OUTPUT_PP (LED0);
+ MAP_OUTPUT_PP (LED1);
+
+ SET (LED0);
+ SET (LED1);
+}
+
+void led1_set (void)
+{
+ CLEAR (LED1);
+}
+
+void led1_clear (void)
+{
+ SET (LED1);
+}
+
+
+
+void
+led_tick (void)
+{
+ static unsigned i;
+
+ i++;
+
+ if (i < 1000) return;
+
+ i = 0;
+
+ led ^= 1;
+
+ if (!led)
+ CLEAR (LED0);
+
+ if (led)
+ SET (LED0);
+
+}
+