summaryrefslogtreecommitdiff
path: root/shared-bindings/bitbangio/OneWire.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared-bindings/bitbangio/OneWire.c')
-rw-r--r--shared-bindings/bitbangio/OneWire.c79
1 files changed, 39 insertions, 40 deletions
diff --git a/shared-bindings/bitbangio/OneWire.c b/shared-bindings/bitbangio/OneWire.c
index 95bbd0679..a236f4c2a 100644
--- a/shared-bindings/bitbangio/OneWire.c
+++ b/shared-bindings/bitbangio/OneWire.c
@@ -34,33 +34,32 @@
#include "shared-bindings/bitbangio/OneWire.h"
#include "shared-bindings/util.h"
-//| .. currentmodule:: bitbangio
+//| class OneWire:
+//| """Lowest-level of the Maxim OneWire protocol
//|
-//| :class:`OneWire` -- Lowest-level of the Maxim OneWire protocol
-//| ===============================================================
+//| :class:`~bitbangio.OneWire` implements the timing-sensitive foundation of
+//| the Maxim (formerly Dallas Semi) OneWire protocol.
//|
-//| :class:`~bitbangio.OneWire` implements the timing-sensitive foundation of
-//| the Maxim (formerly Dallas Semi) OneWire protocol.
+//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126"""
//|
-//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126
+//| def __init__(self, pin: microcontroller.Pin):
//|
-//| .. class:: OneWire(pin)
+//| """Create a OneWire object associated with the given pin. The object
+//| implements the lowest level timing-sensitive bits of the protocol.
//|
-//| Create a OneWire object associated with the given pin. The object
-//| implements the lowest level timing-sensitive bits of the protocol.
+//| :param ~microcontroller.Pin pin: Pin to read pulses from.
//|
-//| :param ~microcontroller.Pin pin: Pin to read pulses from.
+//| Read a short series of pulses::
//|
-//| Read a short series of pulses::
+//| import bitbangio
+//| import board
//|
-//| import bitbangio
-//| import board
-//|
-//| onewire = bitbangio.OneWire(board.D7)
-//| onewire.reset()
-//| onewire.write_bit(True)
-//| onewire.write_bit(False)
-//| print(onewire.read_bit())
+//| onewire = bitbangio.OneWire(board.D7)
+//| onewire.reset()
+//| onewire.write_bit(True)
+//| onewire.write_bit(False)
+//| print(onewire.read_bit())"""
+//| ...
//|
STATIC mp_obj_t bitbangio_onewire_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_pin };
@@ -79,9 +78,9 @@ STATIC mp_obj_t bitbangio_onewire_make_new(const mp_obj_type_t *type, size_t n_a
return MP_OBJ_FROM_PTR(self);
}
-//| .. method:: deinit()
-//|
-//| Deinitialize the OneWire bus and release any hardware resources for reuse.
+//| def deinit(self, ) -> Any:
+//| """Deinitialize the OneWire bus and release any hardware resources for reuse."""
+//| ...
//|
STATIC mp_obj_t bitbangio_onewire_deinit(mp_obj_t self_in) {
bitbangio_onewire_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -96,16 +95,16 @@ STATIC void check_for_deinit(bitbangio_onewire_obj_t *self) {
}
}
-//| .. method:: __enter__()
-//|
-//| No-op used by Context Managers.
+//| def __enter__(self, ) -> Any:
+//| """No-op used by Context Managers."""
+//| ...
//|
// Provided by context manager helper.
-//| .. method:: __exit__()
-//|
-//| Automatically deinitializes the hardware when exiting a context. See
-//| :ref:`lifetime-and-contextmanagers` for more info.
+//| def __exit__(self, ) -> Any:
+//| """Automatically deinitializes the hardware when exiting a context. See
+//| :ref:`lifetime-and-contextmanagers` for more info."""
+//| ...
//|
STATIC mp_obj_t bitbangio_onewire_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
@@ -114,9 +113,9 @@ STATIC mp_obj_t bitbangio_onewire_obj___exit__(size_t n_args, const mp_obj_t *ar
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_onewire___exit___obj, 4, 4, bitbangio_onewire_obj___exit__);
-//| .. method:: reset()
-//|
-//| Reset the OneWire bus
+//| def reset(self, ) -> Any:
+//| """Reset the OneWire bus"""
+//| ...
//|
STATIC mp_obj_t bitbangio_onewire_obj_reset(mp_obj_t self_in) {
bitbangio_onewire_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -126,12 +125,12 @@ STATIC mp_obj_t bitbangio_onewire_obj_reset(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_reset_obj, bitbangio_onewire_obj_reset);
-//| .. method:: read_bit()
-//|
-//| Read in a bit
+//| def read_bit(self, ) -> Any:
+//| """Read in a bit
//|
-//| :returns: bit state read
-//| :rtype: bool
+//| :returns: bit state read
+//| :rtype: bool"""
+//| ...
//|
STATIC mp_obj_t bitbangio_onewire_obj_read_bit(mp_obj_t self_in) {
bitbangio_onewire_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -141,9 +140,9 @@ STATIC mp_obj_t bitbangio_onewire_obj_read_bit(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_read_bit_obj, bitbangio_onewire_obj_read_bit);
-//| .. method:: write_bit(value)
-//|
-//| Write out a bit based on value.
+//| def write_bit(self, value: Any) -> Any:
+//| """Write out a bit based on value."""
+//| ...
//|
STATIC mp_obj_t bitbangio_onewire_obj_write_bit(mp_obj_t self_in, mp_obj_t bool_obj) {
bitbangio_onewire_obj_t *self = MP_OBJ_TO_PTR(self_in);