Added type hints to pulseio

This commit is contained in:
dherrada 2020-07-03 11:04:03 -04:00
parent a2c7e2795b
commit 93d20077cc
3 changed files with 20 additions and 20 deletions

View File

@ -115,7 +115,7 @@ STATIC mp_obj_t pulseio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the PWMOut and releases any hardware resources for reuse."""
//| ...
//|
@ -132,13 +132,13 @@ STATIC void check_for_deinit(pulseio_pwmout_obj_t *self) {
}
}
//| def __enter__(self) -> Any:
//| def __enter__(self) -> PWMOut:
//| """No-op used by Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self) -> Any:
//| def __exit__(self) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
@ -150,7 +150,7 @@ STATIC mp_obj_t pulseio_pwmout_obj___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pwmout___exit___obj, 4, 4, pulseio_pwmout_obj___exit__);
//| duty_cycle: Any = ...
//| duty_cycle: Optional[int] = ...
//| """16 bit value that dictates how much of one cycle is high (1) versus low
//| (0). 0xffff will always be high, 0 will always be low and 0x7fff will
//| be half high and then half low.
@ -186,7 +186,7 @@ const mp_obj_property_t pulseio_pwmout_duty_cycle_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| frequency: Any = ...
//| frequency: Optional[int] = ...
//| """32 bit value that dictates the PWM frequency in Hertz (cycles per
//| second). Only writeable when constructed with ``variable_frequency=True``.
//|

View File

@ -96,7 +96,7 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the PulseIn and releases any hardware resources for reuse."""
//| ...
//|
@ -113,13 +113,13 @@ STATIC void check_for_deinit(pulseio_pulsein_obj_t *self) {
}
}
//| def __enter__(self) -> Any:
//| def __enter__(self) -> PulseIn:
//| """No-op used by Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self) -> Any:
//| def __exit__(self) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
@ -131,7 +131,7 @@ STATIC mp_obj_t pulseio_pulsein_obj___exit__(size_t n_args, const mp_obj_t *args
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulsein___exit___obj, 4, 4, pulseio_pulsein_obj___exit__);
//| def pause(self) -> Any:
//| def pause(self) -> None:
//| """Pause pulse capture"""
//| ...
//|
@ -144,7 +144,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_pause(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_pause_obj, pulseio_pulsein_obj_pause);
//| def resume(self, trigger_duration: int = 0) -> Any:
//| def resume(self, trigger_duration: int = 0) -> None:
//| """Resumes pulse capture after an optional trigger pulse.
//|
//| .. warning:: Using trigger pulse with a device that drives both high and
@ -171,7 +171,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_resume(size_t n_args, const mp_obj_t *pos_ar
}
MP_DEFINE_CONST_FUN_OBJ_KW(pulseio_pulsein_resume_obj, 1, pulseio_pulsein_obj_resume);
//| def clear(self) -> Any:
//| def clear(self) -> None:
//| """Clears all captured pulses"""
//| ...
//|
@ -184,7 +184,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_clear(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_clear_obj, pulseio_pulsein_obj_clear);
//| def popleft(self) -> Any:
//| def popleft(self) -> int:
//| """Removes and returns the oldest read pulse."""
//| ...
//|
@ -196,7 +196,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_popleft(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_popleft_obj, pulseio_pulsein_obj_popleft);
//| maxlen: Any = ...
//| maxlen: int = ...
//| """The maximum length of the PulseIn. When len() is equal to maxlen,
//| it is unclear which pulses are active and which are idle."""
//|
@ -215,7 +215,7 @@ const mp_obj_property_t pulseio_pulsein_maxlen_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| paused: Any = ...
//| paused: bool = ...
//| """True when pulse capture is paused as a result of :py:func:`pause` or an error during capture
//| such as a signal that is too fast."""
//|
@ -234,7 +234,7 @@ const mp_obj_property_t pulseio_pulsein_paused_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def __len__(self) -> Any:
//| def __len__(self) -> Union[bool, int, None]:
//| """Returns the current pulse length
//|
//| This allows you to::
@ -254,7 +254,7 @@ STATIC mp_obj_t pulsein_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
//| def __getitem__(self, index: Any) -> Any:
//| def __getitem__(self, index: int) -> Optional[int]:
//| """Returns the value at the given index or values in slice.
//|
//| This allows you to::

View File

@ -81,7 +81,7 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the PulseOut and releases any hardware resources for reuse."""
//| ...
//|
@ -92,13 +92,13 @@ 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);
//| def __enter__(self) -> Any:
//| def __enter__(self) -> PulseOut:
//| """No-op used by Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self) -> Any:
//| def __exit__(self) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
@ -110,7 +110,7 @@ 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__);
//| def send(self, pulses: array.array) -> Any:
//| def send(self, pulses: array.array) -> None:
//| """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).