summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordherrada <dylan.herrada@gmail.com>2020-04-27 13:06:47 -0400
committerdherrada <dylan.herrada@gmail.com>2020-04-27 13:06:47 -0400
commit8344fce9940c2c964663e541908069b03cbe14e5 (patch)
treed092e874cea68574df198848e0b7fd4e9c0c2612
parent27e085ec360fd625210fe70bf71019b8019363b3 (diff)
Added inline pyi to analogio
-rw-r--r--shared-bindings/analogio/AnalogIn.c71
-rw-r--r--shared-bindings/analogio/AnalogOut.c62
2 files changed, 61 insertions, 72 deletions
diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c
index b4eeb2af1..a8afe75bd 100644
--- a/shared-bindings/analogio/AnalogIn.c
+++ b/shared-bindings/analogio/AnalogIn.c
@@ -36,27 +36,25 @@
#include "shared-bindings/analogio/AnalogIn.h"
#include "shared-bindings/util.h"
-//| .. currentmodule:: analogio
+//|class AnalogIn:
+//| """:class:`AnalogIn` -- read analog voltage
+//| ============================================
//|
-//| :class:`AnalogIn` -- read analog voltage
-//| ============================================
+//| Usage::
//|
-//| Usage::
+//| import analogio
+//| from board import *
//|
-//| import analogio
-//| from board import *
+//| adc = analogio.AnalogIn(A1)
+//| val = adc.value"""
//|
-//| adc = analogio.AnalogIn(A1)
-//| val = adc.value
+//| def __init__(self, pin: microcontroller.Pin):
//|
-
-//| .. class:: AnalogIn(pin)
-//|
-//| Use the AnalogIn on the given pin. The reference voltage varies by
-//| platform so use ``reference_voltage`` to read the configured setting.
-//|
-//| :param ~microcontroller.Pin pin: the pin to read from
+//| """Use the AnalogIn on the given pin. The reference voltage varies by
+//| platform so use ``reference_voltage`` to read the configured setting.
//|
+//| :param ~microcontroller.Pin pin: the pin to read from"""
+//| ...
STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type,
mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// check number of arguments
@@ -72,10 +70,9 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type,
return MP_OBJ_FROM_PTR(self);
}
-//| .. method:: deinit()
-//|
-//| Turn off the AnalogIn and release the pin for other use.
-//|
+//| def deinit(self, ) -> Any:
+//| """Turn off the AnalogIn and release the pin for other use."""
+//| ...
STATIC mp_obj_t analogio_analogin_deinit(mp_obj_t self_in) {
analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_analogio_analogin_deinit(self);
@@ -88,17 +85,15 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) {
raise_deinited_error();
}
}
-//| .. 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 analogio_analogin___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_analogio_analogin_deinit(args[0]);
@@ -106,13 +101,12 @@ STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__);
-//| .. attribute:: value
-//|
-//| The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)
-//|
-//| Even if the underlying analog to digital converter (ADC) is lower
-//| resolution, the value is 16-bit.
+//| value: Any =
+//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)
//|
+//| Even if the underlying analog to digital converter (ADC) is lower
+//| resolution, the value is 16-bit."""
+//| ...
STATIC mp_obj_t analogio_analogin_obj_get_value(mp_obj_t self_in) {
analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);
@@ -127,11 +121,10 @@ const mp_obj_property_t analogio_analogin_value_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-//| .. attribute:: reference_voltage
-//|
-//| The maximum voltage measurable (also known as the reference voltage) as a
-//| `float` in Volts.
-//|
+//| reference_voltage: Any =
+//| """The maximum voltage measurable (also known as the reference voltage) as a
+//| `float` in Volts."""
+//| ...
STATIC mp_obj_t analogio_analogin_obj_get_reference_voltage(mp_obj_t self_in) {
analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);
diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c
index 89cf147b2..1b5808e6c 100644
--- a/shared-bindings/analogio/AnalogOut.c
+++ b/shared-bindings/analogio/AnalogOut.c
@@ -36,28 +36,27 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
-//| .. currentmodule:: analogio
+//|class AnalogOut:
+//| """.. currentmodule:: analogio
//|
-//| :class:`AnalogOut` -- output analog voltage
-//| ============================================
+//| :class:`AnalogOut` -- output analog voltage
+//| ============================================
//|
-//| The AnalogOut is used to output analog values (a specific voltage).
+//| The AnalogOut is used to output analog values (a specific voltage).
//|
-//| Example usage::
+//| Example usage::
//|
-//| import analogio
-//| from microcontroller import pin
+//| import analogio
+//| from microcontroller import pin
//|
-//| dac = analogio.AnalogOut(pin.PA02) # output on pin PA02
-//| dac.value = 32768 # makes PA02 1.65V
+//| dac = analogio.AnalogOut(pin.PA02) # output on pin PA02
+//| dac.value = 32768 # makes PA02 1.65V"""
+//| def __init__(self, pin: microcontroller.Pin):
//|
-
-//| .. class:: AnalogOut(pin)
-//|
-//| Use the AnalogOut on the given pin.
-//|
-//| :param ~microcontroller.Pin pin: the pin to output to
+//| """Use the AnalogOut on the given pin.
//|
+//| :param ~microcontroller.Pin pin: the pin to output to"""
+//| ...
STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// check arguments
mp_arg_check_num(n_args, kw_args, 1, 1, false);
@@ -71,10 +70,9 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t
return MP_OBJ_FROM_PTR(self);
}
-//| .. method:: deinit()
-//|
-//| Turn off the AnalogOut and release the pin for other use.
-//|
+//| def deinit(self, ) -> Any:
+//| """Turn off the AnalogOut and release the pin for other use."""
+//| ...
STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) {
analogio_analogout_obj_t *self = self_in;
@@ -84,17 +82,15 @@ STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogout_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 analogio_analogout___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_analogio_analogout_deinit(args[0]);
@@ -102,12 +98,12 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__);
-//| .. attribute:: value
-//|
-//| The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only)
+//| value: Any =
+//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only)
//|
-//| Even if the underlying digital to analog converter (DAC) is lower
-//| resolution, the value is 16-bit.
+//| Even if the underlying digital to analog converter (DAC) is lower
+//| resolution, the value is 16-bit."""
+//| ...
STATIC mp_obj_t analogio_analogout_obj_set_value(mp_obj_t self_in, mp_obj_t value) {
analogio_analogout_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (common_hal_analogio_analogout_deinited(self)) {