Skip to content

Commit 6490137

Browse files
committed
Did usb_hid, usb_midi, ustack, wiznet
1 parent e458954 commit 6490137

File tree

8 files changed

+110
-110
lines changed

8 files changed

+110
-110
lines changed

shared-bindings/usb_hid/Device.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,28 @@
2727
#include "py/objproperty.h"
2828
#include "shared-bindings/usb_hid/Device.h"
2929

30-
//| .. currentmodule:: usb_hid
30+
//| class Device:
31+
//| """.. currentmodule:: usb_hid
3132
//|
32-
//| :class:`Device` -- HID Device
33-
//| ============================================
33+
//| :class:`Device` -- HID Device
34+
//| ============================================
3435
//|
35-
//| Usage::
36+
//| Usage::
3637
//|
37-
//| import usb_hid
38+
//| import usb_hid
3839
//|
39-
//| mouse = usb_hid.devices[0]
40+
//| mouse = usb_hid.devices[0]
4041
//|
41-
//| mouse.send_report()
42+
//| mouse.send_report()"""
4243
//|
4344

44-
//| .. class:: Device()
45+
//| def __init__(self, ):
46+
//| """Not currently dynamically supported."""
47+
//| ...
4548
//|
46-
//| Not currently dynamically supported.
47-
//|
48-
//| .. method:: send_report(buf)
49-
//|
50-
//| Send a HID report.
49+
//| def send_report(self, buf: Any) -> Any:
50+
//| """Send a HID report."""
51+
//| ...
5152
//|
5253
STATIC mp_obj_t usb_hid_device_send_report(mp_obj_t self_in, mp_obj_t buffer) {
5354
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) {
6061
}
6162
MP_DEFINE_CONST_FUN_OBJ_2(usb_hid_device_send_report_obj, usb_hid_device_send_report);
6263

63-
//| .. attribute:: usage_page
64-
//|
65-
//| The usage page of the device as an `int`. Can be thought of a category. (read-only)
64+
//| usage_page: Any = ...
65+
//| """The usage page of the device as an `int`. Can be thought of a category. (read-only)"""
6666
//|
6767
STATIC mp_obj_t usb_hid_device_obj_get_usage_page(mp_obj_t self_in) {
6868
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 = {
7777
(mp_obj_t)&mp_const_none_obj},
7878
};
7979

80-
//| .. attribute:: usage
81-
//|
82-
//| The functionality of the device as an int. (read-only)
80+
//| usage: Any = ...
81+
//| """The functionality of the device as an int. (read-only)
8382
//|
8483
//| For example, Keyboard is 0x06 within the generic desktop usage page 0x01.
85-
//| Mouse is 0x02 within the same usage page.
84+
//| Mouse is 0x02 within the same usage page."""
8685
//|
8786
STATIC mp_obj_t usb_hid_device_obj_get_usage(mp_obj_t self_in) {
8887
usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(self_in);

shared-bindings/usb_hid/__init__.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,27 @@
3131
#include "shared-bindings/usb_hid/__init__.h"
3232
#include "shared-bindings/usb_hid/Device.h"
3333

34-
//| :mod:`usb_hid` --- USB Human Interface Device
34+
//| """:mod:`usb_hid` --- USB Human Interface Device
3535
//| ===========================================================
3636
//|
3737
//| .. module:: usb_hid
3838
//| :synopsis: USB Human Interface Device
3939
//| :platform: SAMD21
4040
//|
41-
//| The `usb_hid` module allows you to output data as a HID device.
41+
//| The `usb_hid` module allows you to output data as a HID device."""
4242
//|
4343

44-
//| .. attribute:: usb_hid.devices
45-
//|
46-
//| Tuple of all active HID device interfaces.
44+
//| usb_hid.devices: Any = ...
45+
//| """Tuple of all active HID device interfaces."""
4746
//|
4847

49-
//| Libraries
48+
//| """Libraries
5049
//|
5150
//| .. toctree::
5251
//| :maxdepth: 3
5352
//|
54-
//| Device
53+
//| Device"""
54+
//|
5555
STATIC const mp_rom_map_elem_t usb_hid_module_globals_table[] = {
5656
{ MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid) },
5757
{ MP_ROM_QSTR(MP_QSTR_devices), MP_ROM_PTR(&common_hal_usb_hid_devices) },

shared-bindings/usb_midi/PortIn.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,39 +35,39 @@
3535
#include "py/stream.h"
3636
#include "supervisor/shared/translate.h"
3737

38-
39-
//| .. currentmodule:: usb_midi
40-
//|
41-
//| :class:`PortIn` -- receives midi commands over USB
42-
//| ===================================================
38+
//| class PortIn:
39+
//| """.. currentmodule:: usb_midi
4340
//|
44-
//| .. class:: PortIn()
41+
//| :class:`PortIn` -- receives midi commands over USB
42+
//| ==================================================="""
4543
//|
46-
//| You cannot create an instance of `usb_midi.PortIn`.
44+
//| def __init__(self, ):
45+
//| """You cannot create an instance of `usb_midi.PortIn`.
4746
//|
48-
//| PortIn objects are constructed for every corresponding entry in the USB
49-
//| descriptor and added to the ``usb_midi.ports`` tuple.
47+
//| PortIn objects are constructed for every corresponding entry in the USB
48+
//| descriptor and added to the ``usb_midi.ports`` tuple."""
49+
//| ...
5050
//|
5151

5252
// These are standard stream methods. Code is in py/stream.c.
5353
//
54-
//| .. method:: read(nbytes=None)
55-
//|
56-
//| Read characters. If ``nbytes`` is specified then read at most that many
57-
//| bytes. Otherwise, read everything that arrives until the connection
58-
//| times out. Providing the number of bytes expected is highly recommended
59-
//| because it will be faster.
60-
//|
61-
//| :return: Data read
62-
//| :rtype: bytes or None
54+
//| def read(self, nbytes: Any = None) -> Any:
55+
//| """Read characters. If ``nbytes`` is specified then read at most that many
56+
//| bytes. Otherwise, read everything that arrives until the connection
57+
//| times out. Providing the number of bytes expected is highly recommended
58+
//| because it will be faster.
6359
//|
64-
//| .. method:: readinto(buf, nbytes=None)
60+
//| :return: Data read
61+
//| :rtype: bytes or None"""
62+
//| ...
6563
//|
66-
//| Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
67-
//| that many bytes. Otherwise, read at most ``len(buf)`` bytes.
64+
//| def readinto(self, buf: Any, nbytes: Any = None) -> Any:
65+
//| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
66+
//| that many bytes. Otherwise, read at most ``len(buf)`` bytes.
6867
//|
69-
//| :return: number of bytes read and stored into ``buf``
70-
//| :rtype: bytes or None
68+
//| :return: number of bytes read and stored into ``buf``
69+
//| :rtype: bytes or None"""
70+
//| ...
7171
//|
7272

7373
// These three methods are used by the shared stream methods.

shared-bindings/usb_midi/PortOut.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,27 @@
3535
#include "py/stream.h"
3636
#include "supervisor/shared/translate.h"
3737

38-
39-
//| .. currentmodule:: usb_midi
40-
//|
41-
//| :class:`PortOut` -- sends midi messages to a computer over USB
42-
//| ==============================================================
38+
//| class PortOut:
39+
//| """.. currentmodule:: usb_midi
4340
//|
44-
//| .. class:: PortOut()
41+
//| :class:`PortOut` -- sends midi messages to a computer over USB
42+
//| =============================================================="""
4543
//|
46-
//| You cannot create an instance of `usb_midi.PortOut`.
44+
//| def __init__(self, ):
45+
//| """You cannot create an instance of `usb_midi.PortOut`.
4746
//|
48-
//| PortOut objects are constructed for every corresponding entry in the USB
49-
//| descriptor and added to the ``usb_midi.ports`` tuple.
47+
//| PortOut objects are constructed for every corresponding entry in the USB
48+
//| descriptor and added to the ``usb_midi.ports`` tuple."""
5049
//|
5150

5251
// These are standard stream methods. Code is in py/stream.c.
5352
//
54-
//| .. method:: write(buf)
55-
//|
56-
//| Write the buffer of bytes to the bus.
53+
//| def write(self, buf: Any) -> Any:
54+
//| """Write the buffer of bytes to the bus.
5755
//|
58-
//| :return: the number of bytes written
59-
//| :rtype: int or None
56+
//| :return: the number of bytes written
57+
//| :rtype: int or None"""
58+
//| ...
6059
//|
6160

6261
STATIC mp_uint_t usb_midi_portout_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {

shared-bindings/usb_midi/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
#include "py/runtime.h"
3737

38-
//| :mod:`usb_midi` --- MIDI over USB
38+
//| """:mod:`usb_midi` --- MIDI over USB
3939
//| =================================================
4040
//|
4141
//| .. module:: usb_midi
@@ -49,7 +49,7 @@
4949
//| :maxdepth: 3
5050
//|
5151
//| PortIn
52-
//| PortOut
52+
//| PortOut"""
5353
//|
5454
//|
5555
mp_map_elem_t usb_midi_module_globals_table[] = {

shared-bindings/ustack/__init__.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,20 @@
3131

3232
#include "shared-bindings/ustack/__init__.h"
3333

34-
//| :mod:`ustack` --- Stack information and analysis
34+
35+
36+
37+
//| """:mod:`ustack` --- Stack information and analysis
3538
//| ========================================================
3639
//|
3740
//| .. module:: ustack
38-
//| :synopsis: stack information functions
41+
//| :synopsis: stack information functions"""
3942
//|
4043

4144
#if MICROPY_MAX_STACK_USAGE
42-
//| .. function:: max_stack_usage()
43-
//|
44-
//| Return the maximum excursion of the stack so far.
45+
//| def max_stack_usage() -> Any:
46+
//| """Return the maximum excursion of the stack so far."""
47+
//| ...
4548
//|
4649
STATIC mp_obj_t max_stack_usage(void) {
4750
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);
5053

5154
#endif // MICROPY_MAX_STACK_USAGE
5255

53-
//| .. function:: stack_size()
54-
//|
55-
//| Return the size of the entire stack.
56-
//| Same as in micropython.mem_info(), but returns a value instead
57-
//| of just printing it.
56+
//| def stack_size() -> Any:
57+
//| """Return the size of the entire stack.
58+
//| Same as in micropython.mem_info(), but returns a value instead
59+
//| of just printing it."""
60+
//| ...
5861
//|
5962
STATIC mp_obj_t stack_size(void) {
6063
return MP_OBJ_NEW_SMALL_INT(shared_module_ustack_stack_size());
6164
}
6265
STATIC MP_DEFINE_CONST_FUN_OBJ_0(stack_size_obj, stack_size);
6366

64-
//| .. function:: stack_usage()
65-
//|
66-
//| Return how much stack is currently in use.
67-
//| Same as micropython.stack_use(); duplicated here for convenience.
67+
//| def stack_usage() -> Any:
68+
//| """Return how much stack is currently in use.
69+
//| Same as micropython.stack_use(); duplicated here for convenience."""
70+
//| ...
6871
//|
6972
STATIC mp_obj_t stack_usage(void) {
7073
return MP_OBJ_NEW_SMALL_INT(shared_module_ustack_stack_usage());

shared-bindings/wiznet/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
#include "shared-module/network/__init__.h"
3737

38-
//| :mod:`wiznet` --- Support for WizNet hardware
38+
//| """:mod:`wiznet` --- Support for WizNet hardware
3939
//| =============================================
4040
//|
4141
//| .. module:: wiznet
@@ -49,7 +49,7 @@
4949
//| .. toctree::
5050
//| :maxdepth: 3
5151
//|
52-
//| wiznet5k
52+
//| wiznet5k"""
5353
//|
5454

5555
extern const mod_network_nic_type_t mod_network_nic_type_wiznet5k;

shared-bindings/wiznet/wiznet5k.c

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,26 @@
4646
#include "shared-module/network/__init__.h"
4747
#include "shared-module/wiznet/wiznet5k.h"
4848

49-
//| .. currentmodule:: wiznet
49+
//| class WIZNET5K:
50+
//| """.. currentmodule:: wiznet
5051
//|
51-
//| :class:`WIZNET5K` -- wrapper for Wiznet 5500 Ethernet interface
52-
//| ===============================================================
52+
//| :class:`WIZNET5K` -- wrapper for Wiznet 5500 Ethernet interface
53+
//| ==============================================================="""
5354
//|
54-
//| .. class:: WIZNET5K(spi, cs, rst, dhcp=True)
55+
//| def __init__(self, spi: busio.SPI, cs: microcontroller.Pin, rst: microcontroller.Pin, dhcp: bool = True):
56+
//| """Create a new WIZNET5500 interface using the specified pins
5557
//|
56-
//| Create a new WIZNET5500 interface using the specified pins
58+
//| :param ~busio.SPI spi: spi bus to use
59+
//| :param ~microcontroller.Pin cs: pin to use for Chip Select
60+
//| :param ~microcontroller.Pin rst: pin to use for Reset (optional)
61+
//| :param bool dhcp: boolean flag, whether to start DHCP automatically (optional, keyword only, default True)
5762
//|
58-
//| :param ~busio.SPI spi: spi bus to use
59-
//| :param ~microcontroller.Pin cs: pin to use for Chip Select
60-
//| :param ~microcontroller.Pin rst: pin to use for Reset (optional)
61-
//| :param bool dhcp: boolean flag, whether to start DHCP automatically (optional, keyword only, default True)
62-
//|
63-
//| * The reset pin is optional: if supplied it is used to reset the
64-
//| wiznet board before initialization.
65-
//| * The SPI bus will be initialized appropriately by this library.
66-
//| * At present, the WIZNET5K object is a singleton, so only one WizNet
67-
//| interface is supported at a time.
63+
//| * The reset pin is optional: if supplied it is used to reset the
64+
//| wiznet board before initialization.
65+
//| * The SPI bus will be initialized appropriately by this library.
66+
//| * At present, the WIZNET5K object is a singleton, so only one WizNet
67+
//| interface is supported at a time."""
68+
//| ...
6869
//|
6970

7071
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
8687
return ret;
8788
}
8889

89-
//| .. attribute:: connected
90-
//|
91-
//| (boolean, readonly) is this device physically connected?
90+
//| connected: Any = ...
91+
//| """(boolean, readonly) is this device physically connected?"""
9292
//|
9393

9494
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 = {
104104
(mp_obj_t)&mp_const_none_obj},
105105
};
106106

107-
//| .. attribute:: dhcp
107+
//| dhcp: Any = ...
108+
//| """(boolean, readwrite) is DHCP active on this device?
108109
//|
109-
//| (boolean, readwrite) is DHCP active on this device?
110-
//|
111-
//| * set to True to activate DHCP, False to turn it off
110+
//| * set to True to activate DHCP, False to turn it off"""
112111
//|
113112

114113
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 = {
138137
(mp_obj_t)&mp_const_none_obj},
139138
};
140139

141-
//| .. method:: ifconfig(params=None)
142-
//|
143-
//| Called without parameters, returns a tuple of
144-
//| (ip_address, subnet_mask, gateway_address, dns_server)
140+
//| def ifconfig(self, params: Any = None) -> Any:
141+
//| """Called without parameters, returns a tuple of
142+
//| (ip_address, subnet_mask, gateway_address, dns_server)
145143
//|
146-
//| Or can be called with the same tuple to set those parameters.
147-
//| Setting ifconfig parameters turns DHCP off, if it was on.
144+
//| Or can be called with the same tuple to set those parameters.
145+
//| Setting ifconfig parameters turns DHCP off, if it was on."""
146+
//| ...
148147
//|
149148

150149
STATIC mp_obj_t wiznet5k_ifconfig(size_t n_args, const mp_obj_t *args) {

0 commit comments

Comments
 (0)