diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-06-07 14:39:12 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-06-07 14:39:12 -0700 |
| commit | 714521a4c7a6814c365c061bcf967c4c45692e3d (patch) | |
| tree | c490c22fd15137be6b7def7311da9da0aef3457d /shared-bindings/pulseio/PulseIn.c | |
| parent | c5e515b8fe38a346125265fcebb86f857f29e053 (diff) | |
shared-bindings: Update docs to remove with statements from examples but add more detail to the design guide about their use.
Diffstat (limited to 'shared-bindings/pulseio/PulseIn.c')
| -rw-r--r-- | shared-bindings/pulseio/PulseIn.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index a5d5d0c72..89196e841 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -61,22 +61,23 @@ //| import pulseio //| import board //| -//| with pulseio.PulseIn(board.D7) as pulses: -//| # Wait for an active pulse -//| while len(pulses) == 0: -//| pass -//| # Pause while we do something with the pulses -//| pulses.pause() +//| pulses = pulseio.PulseIn(board.D7) //| -//| # Print the pulses. pulses[0] is an active pulse unless the length -//| # reached max length and idle pulses are recorded. -//| print(pulses) +//| # Wait for an active pulse +//| while len(pulses) == 0: +//| pass +//| # Pause while we do something with the pulses +//| pulses.pause() //| -//| # Clear the rest -//| pulse_in.clear() +//| # Print the pulses. pulses[0] is an active pulse unless the length +//| # reached max length and idle pulses are recorded. +//| print(pulses) //| -//| # Resume with an 80 microsecond active pulse -//| pulse_in.resume(80) +//| # Clear the rest +//| pulse_in.clear() +//| +//| # Resume with an 80 microsecond active pulse +//| pulse_in.resume(80) //| STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) { mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true); @@ -122,7 +123,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_deinit_obj, pulseio_pulsein_dei //| .. method:: __exit__() //| -//| Automatically deinitializes the hardware when exiting a context. +//| Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info. //| STATIC mp_obj_t pulseio_pulsein_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; |
