summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/machine_signal.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-01-01 19:09:25 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-01-29 18:57:36 +0300
commit7a7516d40ddc00b051dd8dcf8ab38b5f845dcec4 (patch)
tree41f2d8d20faa4a05b665de2601eb02dae470da05 /extmod/machine_signal.h
parent18b6835a9205d451082b288e50ea59356a49f8db (diff)
downloadmicropython-7a7516d40ddc00b051dd8dcf8ab38b5f845dcec4.tar.gz
micropython-7a7516d40ddc00b051dd8dcf8ab38b5f845dcec4.zip
extmod/machine_signal: Implement "signal" abstraction for machine module.
A signal is like a pin, but ca also be inverted (active low). As such, it abstracts properties of various physical devices, like LEDs, buttons, relays, buzzers, etc. To instantiate a Signal: pin = machine.Pin(...) signal = machine.Signal(pin, inverted=True) signal has the same .value() and __call__() methods as a pin.
Diffstat (limited to 'extmod/machine_signal.h')
-rw-r--r--extmod/machine_signal.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/extmod/machine_signal.h b/extmod/machine_signal.h
new file mode 100644
index 0000000000..7f88cbaa87
--- /dev/null
+++ b/extmod/machine_signal.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Paul Sokolovsky
+ *
+ * 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.
+ */
+
+
+#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__
+#define __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__
+
+#include "py/obj.h"
+
+extern const mp_obj_type_t machine_signal_type;
+
+#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__