diff options
Diffstat (limited to 'shared-bindings')
| -rw-r--r-- | shared-bindings/usb_hid/Device.c | 39 | ||||
| -rw-r--r-- | shared-bindings/usb_hid/__init__.c | 14 | ||||
| -rw-r--r-- | shared-bindings/usb_midi/PortIn.c | 46 | ||||
| -rw-r--r-- | shared-bindings/usb_midi/PortOut.c | 27 | ||||
| -rw-r--r-- | shared-bindings/usb_midi/__init__.c | 4 | ||||
| -rw-r--r-- | shared-bindings/ustack/__init__.c | 31 | ||||
| -rw-r--r-- | shared-bindings/wiznet/__init__.c | 4 | ||||
| -rw-r--r-- | shared-bindings/wiznet/wiznet5k.c | 55 |
8 files changed, 110 insertions, 110 deletions
diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index b1097fb24..bcea5b2c5 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -27,27 +27,28 @@ #include "py/objproperty.h" #include "shared-bindings/usb_hid/Device.h" -//| .. currentmodule:: usb_hid +//| class Device: +//| """.. currentmodule:: usb_hid //| -//| :class:`Device` -- HID Device -//| ============================================ +//| :class:`Device` -- HID Device +//| ============================================ //| -//| Usage:: +//| Usage:: //| -//| import usb_hid +//| import usb_hid //| -//| mouse = usb_hid.devices[0] +//| mouse = usb_hid.devices[0] //| -//| mouse.send_report() +//| mouse.send_report()""" //| -//| .. class:: Device() +//| def __init__(self, ): +//| """Not currently dynamically supported.""" +//| ... //| -//| Not currently dynamically supported. -//| -//| .. method:: send_report(buf) -//| -//| Send a HID report. +//| def send_report(self, buf: Any) -> Any: +//| """Send a HID report.""" +//| ... //| STATIC mp_obj_t usb_hid_device_send_report(mp_obj_t self_in, mp_obj_t buffer) { usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -60,9 +61,8 @@ STATIC mp_obj_t usb_hid_device_send_report(mp_obj_t self_in, mp_obj_t buffer) { } MP_DEFINE_CONST_FUN_OBJ_2(usb_hid_device_send_report_obj, usb_hid_device_send_report); -//| .. attribute:: usage_page -//| -//| The usage page of the device as an `int`. Can be thought of a category. (read-only) +//| usage_page: Any = ... +//| """The usage page of the device as an `int`. Can be thought of a category. (read-only)""" //| STATIC mp_obj_t usb_hid_device_obj_get_usage_page(mp_obj_t self_in) { usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -77,12 +77,11 @@ const mp_obj_property_t usb_hid_device_usage_page_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| .. attribute:: usage -//| -//| The functionality of the device as an int. (read-only) +//| usage: Any = ... +//| """The functionality of the device as an int. (read-only) //| //| For example, Keyboard is 0x06 within the generic desktop usage page 0x01. -//| Mouse is 0x02 within the same usage page. +//| Mouse is 0x02 within the same usage page.""" //| STATIC mp_obj_t usb_hid_device_obj_get_usage(mp_obj_t self_in) { usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/usb_hid/__init__.c b/shared-bindings/usb_hid/__init__.c index 3ad5b06e0..3d0978d62 100644 --- a/shared-bindings/usb_hid/__init__.c +++ b/shared-bindings/usb_hid/__init__.c @@ -31,27 +31,27 @@ #include "shared-bindings/usb_hid/__init__.h" #include "shared-bindings/usb_hid/Device.h" -//| :mod:`usb_hid` --- USB Human Interface Device +//| """:mod:`usb_hid` --- USB Human Interface Device //| =========================================================== //| //| .. module:: usb_hid //| :synopsis: USB Human Interface Device //| :platform: SAMD21 //| -//| The `usb_hid` module allows you to output data as a HID device. +//| The `usb_hid` module allows you to output data as a HID device.""" //| -//| .. attribute:: usb_hid.devices -//| -//| Tuple of all active HID device interfaces. +//| usb_hid.devices: Any = ... +//| """Tuple of all active HID device interfaces.""" //| -//| Libraries +//| """Libraries //| //| .. toctree:: //| :maxdepth: 3 //| -//| Device +//| Device""" +//| STATIC const mp_rom_map_elem_t usb_hid_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid) }, { MP_ROM_QSTR(MP_QSTR_devices), MP_ROM_PTR(&common_hal_usb_hid_devices) }, diff --git a/shared-bindings/usb_midi/PortIn.c b/shared-bindings/usb_midi/PortIn.c index e2df56e95..55a5865ca 100644 --- a/shared-bindings/usb_midi/PortIn.c +++ b/shared-bindings/usb_midi/PortIn.c @@ -35,39 +35,39 @@ #include "py/stream.h" #include "supervisor/shared/translate.h" - -//| .. currentmodule:: usb_midi -//| -//| :class:`PortIn` -- receives midi commands over USB -//| =================================================== +//| class PortIn: +//| """.. currentmodule:: usb_midi //| -//| .. class:: PortIn() +//| :class:`PortIn` -- receives midi commands over USB +//| ===================================================""" //| -//| You cannot create an instance of `usb_midi.PortIn`. +//| def __init__(self, ): +//| """You cannot create an instance of `usb_midi.PortIn`. //| -//| PortIn objects are constructed for every corresponding entry in the USB -//| descriptor and added to the ``usb_midi.ports`` tuple. +//| PortIn objects are constructed for every corresponding entry in the USB +//| descriptor and added to the ``usb_midi.ports`` tuple.""" +//| ... //| // These are standard stream methods. Code is in py/stream.c. // -//| .. method:: read(nbytes=None) -//| -//| Read characters. If ``nbytes`` is specified then read at most that many -//| bytes. Otherwise, read everything that arrives until the connection -//| times out. Providing the number of bytes expected is highly recommended -//| because it will be faster. -//| -//| :return: Data read -//| :rtype: bytes or None +//| def read(self, nbytes: Any = None) -> Any: +//| """Read characters. If ``nbytes`` is specified then read at most that many +//| bytes. Otherwise, read everything that arrives until the connection +//| times out. Providing the number of bytes expected is highly recommended +//| because it will be faster. //| -//| .. method:: readinto(buf, nbytes=None) +//| :return: Data read +//| :rtype: bytes or None""" +//| ... //| -//| Read bytes into the ``buf``. If ``nbytes`` is specified then read at most -//| that many bytes. Otherwise, read at most ``len(buf)`` bytes. +//| def readinto(self, buf: Any, nbytes: Any = None) -> Any: +//| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most +//| that many bytes. Otherwise, read at most ``len(buf)`` bytes. //| -//| :return: number of bytes read and stored into ``buf`` -//| :rtype: bytes or None +//| :return: number of bytes read and stored into ``buf`` +//| :rtype: bytes or None""" +//| ... //| // These three methods are used by the shared stream methods. diff --git a/shared-bindings/usb_midi/PortOut.c b/shared-bindings/usb_midi/PortOut.c index e3eddfaf5..d83eb53b6 100644 --- a/shared-bindings/usb_midi/PortOut.c +++ b/shared-bindings/usb_midi/PortOut.c @@ -35,28 +35,27 @@ #include "py/stream.h" #include "supervisor/shared/translate.h" - -//| .. currentmodule:: usb_midi -//| -//| :class:`PortOut` -- sends midi messages to a computer over USB -//| ============================================================== +//| class PortOut: +//| """.. currentmodule:: usb_midi //| -//| .. class:: PortOut() +//| :class:`PortOut` -- sends midi messages to a computer over USB +//| ==============================================================""" //| -//| You cannot create an instance of `usb_midi.PortOut`. +//| def __init__(self, ): +//| """You cannot create an instance of `usb_midi.PortOut`. //| -//| PortOut objects are constructed for every corresponding entry in the USB -//| descriptor and added to the ``usb_midi.ports`` tuple. +//| PortOut objects are constructed for every corresponding entry in the USB +//| descriptor and added to the ``usb_midi.ports`` tuple.""" //| // These are standard stream methods. Code is in py/stream.c. // -//| .. method:: write(buf) -//| -//| Write the buffer of bytes to the bus. +//| def write(self, buf: Any) -> Any: +//| """Write the buffer of bytes to the bus. //| -//| :return: the number of bytes written -//| :rtype: int or None +//| :return: the number of bytes written +//| :rtype: int or None""" +//| ... //| STATIC mp_uint_t usb_midi_portout_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) { diff --git a/shared-bindings/usb_midi/__init__.c b/shared-bindings/usb_midi/__init__.c index f57d3631b..2631d8a88 100644 --- a/shared-bindings/usb_midi/__init__.c +++ b/shared-bindings/usb_midi/__init__.c @@ -35,7 +35,7 @@ #include "py/runtime.h" -//| :mod:`usb_midi` --- MIDI over USB +//| """:mod:`usb_midi` --- MIDI over USB //| ================================================= //| //| .. module:: usb_midi @@ -49,7 +49,7 @@ //| :maxdepth: 3 //| //| PortIn -//| PortOut +//| PortOut""" //| //| mp_map_elem_t usb_midi_module_globals_table[] = { diff --git a/shared-bindings/ustack/__init__.c b/shared-bindings/ustack/__init__.c index 08b772e41..073840aba 100644 --- a/shared-bindings/ustack/__init__.c +++ b/shared-bindings/ustack/__init__.c @@ -31,17 +31,20 @@ #include "shared-bindings/ustack/__init__.h" -//| :mod:`ustack` --- Stack information and analysis + + + +//| """:mod:`ustack` --- Stack information and analysis //| ======================================================== //| //| .. module:: ustack -//| :synopsis: stack information functions +//| :synopsis: stack information functions""" //| #if MICROPY_MAX_STACK_USAGE -//| .. function:: max_stack_usage() -//| -//| Return the maximum excursion of the stack so far. +//| def max_stack_usage() -> Any: +//| """Return the maximum excursion of the stack so far.""" +//| ... //| STATIC mp_obj_t max_stack_usage(void) { return MP_OBJ_NEW_SMALL_INT(shared_module_ustack_max_stack_usage()); @@ -50,21 +53,21 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(max_stack_usage_obj, max_stack_usage); #endif // MICROPY_MAX_STACK_USAGE -//| .. function:: stack_size() -//| -//| Return the size of the entire stack. -//| Same as in micropython.mem_info(), but returns a value instead -//| of just printing it. +//| def stack_size() -> Any: +//| """Return the size of the entire stack. +//| Same as in micropython.mem_info(), but returns a value instead +//| of just printing it.""" +//| ... //| STATIC mp_obj_t stack_size(void) { return MP_OBJ_NEW_SMALL_INT(shared_module_ustack_stack_size()); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(stack_size_obj, stack_size); -//| .. function:: stack_usage() -//| -//| Return how much stack is currently in use. -//| Same as micropython.stack_use(); duplicated here for convenience. +//| def stack_usage() -> Any: +//| """Return how much stack is currently in use. +//| Same as micropython.stack_use(); duplicated here for convenience.""" +//| ... //| STATIC mp_obj_t stack_usage(void) { return MP_OBJ_NEW_SMALL_INT(shared_module_ustack_stack_usage()); diff --git a/shared-bindings/wiznet/__init__.c b/shared-bindings/wiznet/__init__.c index e230deecc..5c8e8d3fd 100644 --- a/shared-bindings/wiznet/__init__.c +++ b/shared-bindings/wiznet/__init__.c @@ -35,7 +35,7 @@ #include "shared-module/network/__init__.h" -//| :mod:`wiznet` --- Support for WizNet hardware +//| """:mod:`wiznet` --- Support for WizNet hardware //| ============================================= //| //| .. module:: wiznet @@ -49,7 +49,7 @@ //| .. toctree:: //| :maxdepth: 3 //| -//| wiznet5k +//| wiznet5k""" //| extern const mod_network_nic_type_t mod_network_nic_type_wiznet5k; diff --git a/shared-bindings/wiznet/wiznet5k.c b/shared-bindings/wiznet/wiznet5k.c index 786978bfe..2e2ee3949 100644 --- a/shared-bindings/wiznet/wiznet5k.c +++ b/shared-bindings/wiznet/wiznet5k.c @@ -46,25 +46,26 @@ #include "shared-module/network/__init__.h" #include "shared-module/wiznet/wiznet5k.h" -//| .. currentmodule:: wiznet +//| class WIZNET5K: +//| """.. currentmodule:: wiznet //| -//| :class:`WIZNET5K` -- wrapper for Wiznet 5500 Ethernet interface -//| =============================================================== +//| :class:`WIZNET5K` -- wrapper for Wiznet 5500 Ethernet interface +//| ===============================================================""" //| -//| .. class:: WIZNET5K(spi, cs, rst, dhcp=True) +//| def __init__(self, spi: busio.SPI, cs: microcontroller.Pin, rst: microcontroller.Pin, dhcp: bool = True): +//| """Create a new WIZNET5500 interface using the specified pins //| -//| Create a new WIZNET5500 interface using the specified pins +//| :param ~busio.SPI spi: spi bus to use +//| :param ~microcontroller.Pin cs: pin to use for Chip Select +//| :param ~microcontroller.Pin rst: pin to use for Reset (optional) +//| :param bool dhcp: boolean flag, whether to start DHCP automatically (optional, keyword only, default True) //| -//| :param ~busio.SPI spi: spi bus to use -//| :param ~microcontroller.Pin cs: pin to use for Chip Select -//| :param ~microcontroller.Pin rst: pin to use for Reset (optional) -//| :param bool dhcp: boolean flag, whether to start DHCP automatically (optional, keyword only, default True) -//| -//| * The reset pin is optional: if supplied it is used to reset the -//| wiznet board before initialization. -//| * The SPI bus will be initialized appropriately by this library. -//| * At present, the WIZNET5K object is a singleton, so only one WizNet -//| interface is supported at a time. +//| * The reset pin is optional: if supplied it is used to reset the +//| wiznet board before initialization. +//| * The SPI bus will be initialized appropriately by this library. +//| * At present, the WIZNET5K object is a singleton, so only one WizNet +//| interface is supported at a time.""" +//| ... //| STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -86,9 +87,8 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, cons return ret; } -//| .. attribute:: connected -//| -//| (boolean, readonly) is this device physically connected? +//| connected: Any = ... +//| """(boolean, readonly) is this device physically connected?""" //| STATIC mp_obj_t wiznet5k_connected_get_value(mp_obj_t self_in) { @@ -104,11 +104,10 @@ const mp_obj_property_t wiznet5k_connected_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| .. attribute:: dhcp +//| dhcp: Any = ... +//| """(boolean, readwrite) is DHCP active on this device? //| -//| (boolean, readwrite) is DHCP active on this device? -//| -//| * set to True to activate DHCP, False to turn it off +//| * set to True to activate DHCP, False to turn it off""" //| STATIC mp_obj_t wiznet5k_dhcp_get_value(mp_obj_t self_in) { @@ -138,13 +137,13 @@ const mp_obj_property_t wiznet5k_dhcp_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| .. method:: ifconfig(params=None) -//| -//| Called without parameters, returns a tuple of -//| (ip_address, subnet_mask, gateway_address, dns_server) +//| def ifconfig(self, params: Any = None) -> Any: +//| """Called without parameters, returns a tuple of +//| (ip_address, subnet_mask, gateway_address, dns_server) //| -//| Or can be called with the same tuple to set those parameters. -//| Setting ifconfig parameters turns DHCP off, if it was on. +//| Or can be called with the same tuple to set those parameters. +//| Setting ifconfig parameters turns DHCP off, if it was on.""" +//| ... //| STATIC mp_obj_t wiznet5k_ifconfig(size_t n_args, const mp_obj_t *args) { |
