From 77a43c6de3d34abc6d4a3683a220e99c5908e7b2 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 12 Aug 2015 09:55:46 +0200 Subject: ucoo/hal/gpio: add dummy GPIO --- ucoo/hal/gpio/Module | 3 ++- ucoo/hal/gpio/gpio_dummy.cc | 64 +++++++++++++++++++++++++++++++++++++++++++++ ucoo/hal/gpio/gpio_dummy.hh | 52 ++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 ucoo/hal/gpio/gpio_dummy.cc create mode 100644 ucoo/hal/gpio/gpio_dummy.hh (limited to 'ucoo/hal/gpio') 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 -- cgit v1.2.3