summaryrefslogtreecommitdiff
path: root/shared-bindings/pulseio/PulseOut.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared-bindings/pulseio/PulseOut.c')
-rw-r--r--shared-bindings/pulseio/PulseOut.c83
1 files changed, 42 insertions, 41 deletions
diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c
index 172459e5d..9c650731b 100644
--- a/shared-bindings/pulseio/PulseOut.c
+++ b/shared-bindings/pulseio/PulseOut.c
@@ -36,37 +36,38 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
-//| .. currentmodule:: pulseio
+//| class PulseOut:
+//| """.. currentmodule:: pulseio
//|
-//| :class:`PulseOut` -- Output a pulse train
-//| ========================================================
+//| :class:`PulseOut` -- Output a pulse train
+//| ========================================================
//|
-//| PulseOut is used to pulse PWM "carrier" output on and off. This is commonly
-//| used in infrared remotes. The pulsed signal consists of timed on and off
-//| periods. Unlike PWM, there is no set duration for on and off pairs.
+//| PulseOut is used to pulse PWM "carrier" output on and off. This is commonly
+//| used in infrared remotes. The pulsed signal consists of timed on and off
+//| periods. Unlike PWM, there is no set duration for on and off pairs."""
//|
-//| .. class:: PulseOut(carrier)
+//| def __init__(self, carrier: pulseio.PWMOut):
+//| """Create a PulseOut object associated with the given PWMout object.
//|
-//| Create a PulseOut object associated with the given PWMout object.
+//| :param ~pulseio.PWMOut carrier: PWMOut that is set to output on the desired pin.
//|
-//| :param ~pulseio.PWMOut carrier: PWMOut that is set to output on the desired pin.
+//| Send a short series of pulses::
//|
-//| Send a short series of pulses::
+//| import array
+//| import pulseio
+//| import board
//|
-//| import array
-//| import pulseio
-//| import board
+//| # 50% duty cycle at 38kHz.
+//| pwm = pulseio.PWMOut(board.D13, frequency=38000, duty_cycle=32768)
+//| pulse = pulseio.PulseOut(pwm)
+//| # on off on off on
+//| pulses = array.array('H', [65000, 1000, 65000, 65000, 1000])
+//| pulse.send(pulses)
//|
-//| # 50% duty cycle at 38kHz.
-//| pwm = pulseio.PWMOut(board.D13, frequency=38000, duty_cycle=32768)
-//| pulse = pulseio.PulseOut(pwm)
-//| # on off on off on
-//| pulses = array.array('H', [65000, 1000, 65000, 65000, 1000])
-//| pulse.send(pulses)
-//|
-//| # Modify the array of pulses.
-//| pulses[0] = 200
-//| pulse.send(pulses)
+//| # Modify the array of pulses.
+//| pulses[0] = 200
+//| pulse.send(pulses)"""
+//| ...
//|
STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 1, 1, false);
@@ -85,9 +86,9 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
-//| .. method:: deinit()
-//|
-//| Deinitialises the PulseOut and releases any hardware resources for reuse.
+//| def deinit(self, ) -> Any:
+//| """Deinitialises the PulseOut and releases any hardware resources for reuse."""
+//| ...
//|
STATIC mp_obj_t pulseio_pulseout_deinit(mp_obj_t self_in) {
pulseio_pulseout_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -96,16 +97,16 @@ STATIC mp_obj_t pulseio_pulseout_deinit(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulseout_deinit_obj, pulseio_pulseout_deinit);
-//| .. 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 pulseio_pulseout_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
@@ -114,16 +115,16 @@ STATIC mp_obj_t pulseio_pulseout_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulseout___exit___obj, 4, 4, pulseio_pulseout_obj___exit__);
-//| .. method:: send(pulses)
-//|
-//| Pulse alternating on and off durations in microseconds starting with on.
-//| ``pulses`` must be an `array.array` with data type 'H' for unsigned
-//| halfword (two bytes).
+//| def send(self, pulses: array.array) -> Any:
+//| """Pulse alternating on and off durations in microseconds starting with on.
+//| ``pulses`` must be an `array.array` with data type 'H' for unsigned
+//| halfword (two bytes).
//|
-//| This method waits until the whole array of pulses has been sent and
-//| ensures the signal is off afterwards.
+//| This method waits until the whole array of pulses has been sent and
+//| ensures the signal is off afterwards.
//|
-//| :param array.array pulses: pulse durations in microseconds
+//| :param array.array pulses: pulse durations in microseconds"""
+//| ...
//|
STATIC mp_obj_t pulseio_pulseout_obj_send(mp_obj_t self_in, mp_obj_t pulses) {
pulseio_pulseout_obj_t *self = MP_OBJ_TO_PTR(self_in);