Chromium Code Reviews| 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 |