From 514f69e1d5d3ccdac2c414fad3344532671820d9 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 3 Jun 2022 18:33:36 -0400 Subject: [PATCH] Move (unimplemented) OneWire from busio to onewireio --- docs/api.rst | 3 +++ setup.py | 1 + src/busio.py | 33 --------------------------------- src/onewireio.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 src/onewireio.py diff --git a/docs/api.rst b/docs/api.rst index b28e684..1480320 100755 --- a/docs/api.rst +++ b/docs/api.rst @@ -40,6 +40,9 @@ .. automodule:: neopixel_write :members: +.. automodule:: onewireio + :members: + .. automodule:: pulseio :members: diff --git a/setup.py b/setup.py index 0141b68..67ef7ee 100755 --- a/setup.py +++ b/setup.py @@ -64,6 +64,7 @@ setup( "keypad", "micropython", "neopixel_write", + "onewireio", "pulseio", "pwmio", "rainbowio", diff --git a/src/busio.py b/src/busio.py index 0605ee9..dd748a5 100644 --- a/src/busio.py +++ b/src/busio.py @@ -492,36 +492,3 @@ class UART(Lockable): def write(self, buf): """Write to the UART from a buffer""" return self._uart.write(buf) - - -class OneWire: - """ - Stub class for OneWire, which is currently not implemented - """ - - def __init__(self, pin): - raise NotImplementedError("OneWire has not been implemented") - - def deinit(self): - """ - Deinitialize the OneWire bus and release any hardware resources for reuse. - """ - raise NotImplementedError("OneWire has not been implemented") - - def reset(self): - """ - Reset the OneWire bus and read presence - """ - raise NotImplementedError("OneWire has not been implemented") - - def read_bit(self): - """ - Read in a bit - """ - raise NotImplementedError("OneWire has not been implemented") - - def write_bit(self, value): - """ - Write out a bit based on value. - """ - raise NotImplementedError("OneWire has not been implemented") diff --git a/src/onewireio.py b/src/onewireio.py new file mode 100644 index 0000000..4e37463 --- /dev/null +++ b/src/onewireio.py @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +""" +`onewireio` - 1-wire bus protocol +================================================= + +See `CircuitPython:onewireio` in CircuitPython for more details. + +* Author(s): cefn +""" + +# pylint: disable=import-outside-toplevel,too-many-branches,too-many-statements +# pylint: disable=too-many-arguments,too-many-function-args,too-many-return-statements + + +class OneWire: + """ + Stub class for OneWire, which is currently not implemented + """ + + def __init__(self, pin): + raise NotImplementedError("OneWire has not been implemented") + + def deinit(self): + """ + Deinitialize the OneWire bus and release any hardware resources for reuse. + """ + raise NotImplementedError("OneWire has not been implemented") + + def reset(self): + """ + Reset the OneWire bus and read presence + """ + raise NotImplementedError("OneWire has not been implemented") + + def read_bit(self): + """ + Read in a bit + """ + raise NotImplementedError("OneWire has not been implemented") + + def write_bit(self, value): + """ + Write out a bit based on value. + """ + raise NotImplementedError("OneWire has not been implemented") -- 2.49.0