summaryrefslogtreecommitdiff
path: root/src/arch/posix
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-23 10:07:31 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-23 10:07:31 +0200
commit7dac0cccc846d4452293b47b40d43f6b50ebcc33 (patch)
tree8efcb0c13a5ddfd6616caf76ad109fec290977ca /src/arch/posix
parent1865935a9e7d335b7afff3a6a159a4fd81db1275 (diff)
POSIX: Improve GPIO emulation
Diffstat (limited to 'src/arch/posix')
-rw-r--r--src/arch/posix/Makefile.inc4
-rw-r--r--src/arch/posix/driver/gpio.cc28
2 files changed, 4 insertions, 28 deletions
diff --git a/src/arch/posix/Makefile.inc b/src/arch/posix/Makefile.inc
index 9e27b3e..a4bc653 100644
--- a/src/arch/posix/Makefile.inc
+++ b/src/arch/posix/Makefile.inc
@@ -14,6 +14,10 @@ TARGETS += src/arch/posix/driver/stdout.cc src/arch/posix/driver/uptime.cc
OBJECTS = ${TARGETS:.cc=.o}
+ifneq (${gpio_trace}, )
+ COMMON_FLAGS += -DGPIO_TRACE
+endif
+
.cc.o:
${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc}
diff --git a/src/arch/posix/driver/gpio.cc b/src/arch/posix/driver/gpio.cc
index 25eed39..1403aed 100644
--- a/src/arch/posix/driver/gpio.cc
+++ b/src/arch/posix/driver/gpio.cc
@@ -1,31 +1,3 @@
#include "driver/gpio.h"
-#include <stdio.h>
-
-void GPIO::led_on(unsigned char id)
-{
- if (id < 8) {
- printf("▶ LED %3d on\n", id);
- ledstate |= (1 << id);
- }
-}
-
-void GPIO::led_off(unsigned char id)
-{
- if (id < 8) {
- printf("▶ LED %3d off\n", id);
- ledstate &= ~(1 << id);
- }
-}
-
-void GPIO::led_toggle(unsigned char id)
-{
- if (id < 8) {
- if (ledstate & (1 << id)) {
- led_off(id);
- } else {
- led_on(id);
- }
- }
-}
GPIO gpio;