summaryrefslogtreecommitdiff
path: root/ucoo/hal
diff options
context:
space:
mode:
authorNicolas Schodet2015-08-12 09:55:46 +0200
committerNicolas Schodet2019-10-07 00:44:50 +0200
commit77a43c6de3d34abc6d4a3683a220e99c5908e7b2 (patch)
treee30621c5b8b8cadb73c3ee90e55312df2eb4d03e /ucoo/hal
parent53615d468132616a1254950c67926df53bf2b7ba (diff)
ucoo/hal/gpio: add dummy GPIO
Diffstat (limited to 'ucoo/hal')
-rw-r--r--ucoo/hal/gpio/Module3
-rw-r--r--ucoo/hal/gpio/gpio_dummy.cc64
-rw-r--r--ucoo/hal/gpio/gpio_dummy.hh52
3 files changed, 118 insertions, 1 deletions
diff --git a/ucoo/hal/gpio/Module b/ucoo/hal/gpio/Module
index b6f0b42..2cfbd11 100644
--- a/ucoo/hal/gpio/Module
+++ b/ucoo/hal/gpio/Module
@@ -1 +1,2 @@
-ucoo_hal_gpio_SOURCES = gpio.host.cc gpio.stm32f4.cc gpio.stm32f1.cc
+ucoo_hal_gpio_SOURCES := gpio.host.cc gpio.stm32f4.cc gpio.stm32f1.cc \
+ gpio_dummy.cc
diff --git a/ucoo/hal/gpio/gpio_dummy.cc b/ucoo/hal/gpio/gpio_dummy.cc
new file mode 100644
index 0000000..3576e7b
--- /dev/null
+++ b/ucoo/hal/gpio/gpio_dummy.cc
@@ -0,0 +1,64 @@
+// ucoolib - Microcontroller object oriented library. {{{
+//
+// Copyright (C) 2015 Nicolas Schodet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+//
+// }}}
+#include "gpio_dummy.hh"
+
+namespace ucoo {
+
+void
+GpioDummy::set ()
+{
+}
+
+void
+GpioDummy::reset ()
+{
+}
+
+void
+GpioDummy::set (bool state)
+{
+}
+
+void
+GpioDummy::toggle ()
+{
+}
+
+bool
+GpioDummy::get () const
+{
+ return false;
+}
+
+void
+GpioDummy::input ()
+{
+}
+
+void
+GpioDummy::output ()
+{
+}
+
+} // namespace ucoo
diff --git a/ucoo/hal/gpio/gpio_dummy.hh b/ucoo/hal/gpio/gpio_dummy.hh
new file mode 100644
index 0000000..76783a5
--- /dev/null
+++ b/ucoo/hal/gpio/gpio_dummy.hh
@@ -0,0 +1,52 @@
+#ifndef ucoo_hal_gpio_gpio_dummy_hh
+#define ucoo_hal_gpio_gpio_dummy_hh
+// ucoolib - Microcontroller object oriented library. {{{
+//
+// Copyright (C) 2015 Nicolas Schodet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+//
+// }}}
+#include "ucoo/intf/io.hh"
+
+namespace ucoo {
+
+/// Dummy GPIO, do nothing, always read 0.
+class GpioDummy : public Io
+{
+ public:
+ /// See Io::set.
+ void set ();
+ /// See Io::reset.
+ void reset ();
+ /// See Io::set.
+ void set (bool state);
+ /// See Io::toggle.
+ void toggle ();
+ /// See Io::get.
+ bool get () const;
+ /// See Io::input.
+ void input ();
+ /// See Io::output.
+ void output ();
+};
+
+} // namespace ucoo
+
+#endif // ucoo_hal_gpio_gpio_dummy_hh