Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2175)

Unified Diff: app/dartino/leds.c

Issue 1684433003: Add a small LED interface and demo app. (Closed) Base URL: git@github.com:domokit/sod.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | app/dartino/main.c » ('j') | app/dartino/main.c » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/dartino/leds.c
diff --git a/app/dartino/leds.c b/app/dartino/leds.c
new file mode 100644
index 0000000000000000000000000000000000000000..832bc2792712ec12362d7b97d151a7fe49701a60
--- /dev/null
+++ b/app/dartino/leds.c
@@ -0,0 +1,37 @@
+
+// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
Søren Gjesse 2016/02/09 09:16:01 2016
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+#include <kernel/port.h>
+
+#if defined(TARGET_DARTUINOP0)
+#include <dev/gpio.h>
+#include <target/gpioconfig.h>
+
+int change_led_status(int led, int on) {
+ int gpioid;
+ switch (led) {
+ case 0:
+ gpioid = GPIO_LED108;
+ break;
+ case 1:
+ gpioid = GPIO_LED109;
+ break;
+ case 2:
+ gpioid = GPIO_LED110;
+ break;
+ case 3:
+ gpioid = GPIO_LED111;
+ break;
+ default:
+ return 0;
+ }
+ gpio_set(gpioid, on);
+ return 1;
+}
+#else
Søren Gjesse 2016/02/09 09:16:01 Can't we just say #error here?
herhut 2016/02/09 10:10:15 No, cause then it won't build on qemu, which is us
+int change_led_status(int led, bool on) {
+ return 0;
+}
+#endif
« no previous file with comments | « no previous file | app/dartino/main.c » ('j') | app/dartino/main.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698