Skip to content

Commit 4a84f9a

Browse files
committed
Format port bindings stubs
1 parent 20a96fd commit 4a84f9a

File tree

21 files changed

+94
-3
lines changed

21 files changed

+94
-3
lines changed

ports/atmel-samd/bindings/samd/Clock.c

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ MP_PROPERTY_GETTER(samd_clock_frequency_obj,
7474
//| calibration: int
7575
//| """Clock calibration. Not all clocks can be calibrated."""
7676
//|
77+
//|
7778
static mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) {
7879
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
7980
return mp_obj_new_int_from_uint(clock_get_calibration(self->type, self->index));

ports/atmel-samd/bindings/samd/__init__.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "bindings/samd/Clock.h"
1212

1313
//| """SAMD implementation settings"""
14+
//|
1415

1516
//| """:mod:`samd.clock` --- samd clock names
1617
//| --------------------------------------------------------

ports/broadcom/bindings/videocore/Framebuffer.c

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
//|
2727
//| A Framebuffer is often used in conjunction with a
2828
//| `framebufferio.FramebufferDisplay`."""
29+
//|
2930

3031
static mp_obj_t videocore_framebuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
3132
enum { ARG_width, ARG_height, };
@@ -51,6 +52,7 @@ static mp_obj_t videocore_framebuffer_make_new(const mp_obj_type_t *type, size_t
5152
//| rgbmatrix instance. After deinitialization, no further operations
5253
//| may be performed."""
5354
//| ...
55+
//|
5456
static mp_obj_t videocore_framebuffer_deinit(mp_obj_t self_in) {
5557
videocore_framebuffer_obj_t *self = (videocore_framebuffer_obj_t *)self_in;
5658
common_hal_videocore_framebuffer_deinit(self);
@@ -79,6 +81,7 @@ MP_PROPERTY_GETTER(videocore_framebuffer_width_obj,
7981
//| height: int
8082
//| """The height of the display, in pixels"""
8183
//|
84+
//|
8285
static mp_obj_t videocore_framebuffer_get_height(mp_obj_t self_in) {
8386
videocore_framebuffer_obj_t *self = (videocore_framebuffer_obj_t *)self_in;
8487
check_for_deinit(self);

ports/espressif/bindings/espcamera/Camera.c

+8
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
//| :param framebuffer_count: The number of framebuffers (1 for single-buffered and 2 for double-buffered)
7171
//| :param grab_mode: When to grab a new frame
7272
//| """
73+
//|
7374
static mp_obj_t espcamera_camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
7475
enum { ARG_data_pins, ARG_pixel_clock_pin, ARG_vsync_pin, ARG_href_pin, ARG_i2c, ARG_external_clock_pin, ARG_external_clock_frequency, ARG_powerdown_pin, ARG_reset_pin, ARG_pixel_format, ARG_frame_size, ARG_jpeg_quality, ARG_framebuffer_count, ARG_grab_mode, NUM_ARGS };
7576
static const mp_arg_t allowed_args[] = {
@@ -143,6 +144,7 @@ static mp_obj_t espcamera_camera_make_new(const mp_obj_type_t *type, size_t n_ar
143144
//| def deinit(self) -> None:
144145
//| """Deinitialises the camera and releases all memory resources for reuse."""
145146
//| ...
147+
//|
146148
static mp_obj_t espcamera_camera_deinit(mp_obj_t self_in) {
147149
espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
148150
common_hal_espcamera_camera_deinit(self);
@@ -159,12 +161,14 @@ static void check_for_deinit(espcamera_camera_obj_t *self) {
159161
//| def __enter__(self) -> Camera:
160162
//| """No-op used by Context Managers."""
161163
//| ...
164+
//|
162165
// Provided by context manager helper.
163166

164167
//| def __exit__(self) -> None:
165168
//| """Automatically deinitializes the hardware when exiting a context. See
166169
//| :ref:`lifetime-and-contextmanagers` for more info."""
167170
//| ...
171+
//|
168172
static mp_obj_t espcamera_camera_obj___exit__(size_t n_args, const mp_obj_t *args) {
169173
(void)n_args;
170174
return espcamera_camera_deinit(args[0]);
@@ -173,6 +177,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera___exit___obj, 4, 4,
173177

174178
//| frame_available: bool
175179
//| """True if a frame is available, False otherwise"""
180+
//|
176181

177182
static mp_obj_t espcamera_camera_frame_available_get(const mp_obj_t self_in) {
178183
espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -193,6 +198,7 @@ MP_PROPERTY_GETTER(espcamera_camera_frame_available_obj,
193198
//| If `pixel_format` is `PixelFormat.JPEG`, the returned value is a read-only `memoryview`.
194199
//| Otherwise, the returned value is a read-only `displayio.Bitmap`.
195200
//| """
201+
//|
196202
static mp_obj_t espcamera_camera_take(size_t n_args, const mp_obj_t *args) {
197203
espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(args[0]);
198204
mp_float_t timeout = n_args < 2 ? MICROPY_FLOAT_CONST(0.25) : mp_obj_get_float(args[1]);
@@ -229,6 +235,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera_take_obj, 1, 2, espc
229235
//| the other properties to set, they are set together in a single function call.
230236
//|
231237
//| If an argument is unspecified or None, then the setting is unchanged."""
238+
//|
232239

233240
static mp_obj_t espcamera_camera_reconfigure(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
234241
espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
@@ -912,6 +919,7 @@ MP_PROPERTY_GETTER(espcamera_camera_grab_mode_obj,
912919
//| framebuffer_count: int
913920
//| """True if double buffering is used"""
914921
//|
922+
//|
915923
static mp_obj_t espcamera_camera_get_framebuffer_count(const mp_obj_t self_in) {
916924
espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
917925
check_for_deinit(self);

ports/espressif/bindings/espcamera/__init__.c

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
//|
2727
//| """
2828
//|
29+
//|
2930

3031
//| class GrabMode:
3132
//| """Controls when a new frame is grabbed."""
@@ -36,6 +37,7 @@
3637
//| LATEST: GrabMode
3738
//| """Except when 1 frame buffer is used, queue will always contain the last ``fb_count`` frames"""
3839
//|
40+
//|
3941

4042
MAKE_ENUM_VALUE(espcamera_grab_mode_type, grab_mode, WHEN_EMPTY, CAMERA_GRAB_WHEN_EMPTY);
4143
MAKE_ENUM_VALUE(espcamera_grab_mode_type, grab_mode, LATEST, CAMERA_GRAB_LATEST);
@@ -65,6 +67,7 @@ camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name) {
6567
//| JPEG: PixelFormat
6668
//| """A compressed format"""
6769
//|
70+
//|
6871

6972
MAKE_ENUM_VALUE(espcamera_pixel_format_type, pixel_format, RGB565, PIXFORMAT_RGB565);
7073
MAKE_ENUM_VALUE(espcamera_pixel_format_type, pixel_format, GRAYSCALE, PIXFORMAT_GRAYSCALE);
@@ -153,6 +156,7 @@ pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name) {
153156
//| QSXGA: FrameSize
154157
//| """2560x1920"""
155158
//|
159+
//|
156160

157161
MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, R96X96, FRAMESIZE_96X96);
158162
MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, R240X240, FRAMESIZE_240X240);
@@ -222,6 +226,7 @@ framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name) {
222226
//| GAIN_64X: GainCeiling
223227
//| GAIN_128X: GainCeiling
224228
//|
229+
//|
225230

226231
MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_2X, GAINCEILING_2X);
227232
MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_4X, GAINCEILING_4X);

ports/espressif/bindings/espidf/__init__.c

+8
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
//| that could be implemented by other frameworks. It should only include ESP-IDF specific
2121
//| things."""
2222
//|
23+
//|
2324

2425
//| def heap_caps_get_total_size() -> int:
2526
//| """Return the total size of the ESP-IDF, which includes the CircuitPython heap."""
2627
//| ...
2728
//|
29+
//|
2830

2931
static mp_obj_t espidf_heap_caps_get_total_size(void) {
3032
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_total_size(MALLOC_CAP_8BIT));
@@ -35,6 +37,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_total_size_obj, espidf_heap_caps_
3537
//| """Return total free memory in the ESP-IDF heap."""
3638
//| ...
3739
//|
40+
//|
3841

3942
static mp_obj_t espidf_heap_caps_get_free_size(void) {
4043
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_free_size(MALLOC_CAP_8BIT));
@@ -45,6 +48,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_free_size_obj, espidf_heap_caps_g
4548
//| """Return the size of largest free memory block in the ESP-IDF heap."""
4649
//| ...
4750
//|
51+
//|
4852

4953
static mp_obj_t espidf_heap_caps_get_largest_free_block(void) {
5054
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_largest_free_block(MALLOC_CAP_8BIT));
@@ -58,6 +62,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he
5862
//| layout of data in nvs has changed. The old data will be lost when you perform this operation.
5963
//| """
6064
//|
65+
//|
6166
static mp_obj_t espidf_erase_nvs(void) {
6267
ESP_ERROR_CHECK(nvs_flash_deinit());
6368
ESP_ERROR_CHECK(nvs_flash_erase());
@@ -84,6 +89,7 @@ static void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_pr
8489
//|
8590
//| ...
8691
//|
92+
//|
8793
MP_DEFINE_CONST_OBJ_TYPE(
8894
mp_type_espidf_IDFError,
8995
MP_QSTR_IDFError,
@@ -99,6 +105,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
99105
//|
100106
//| ...
101107
//|
108+
//|
102109
NORETURN void mp_raise_espidf_MemoryError(void) {
103110
nlr_raise(mp_obj_new_exception(&mp_type_espidf_MemoryError));
104111
}
@@ -116,6 +123,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
116123
//| def get_total_psram() -> int:
117124
//| """Returns the number of bytes of psram detected, or 0 if psram is not present or not configured"""
118125
//|
126+
//|
119127
static mp_obj_t espidf_get_total_psram(void) {
120128
return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_total_psram());
121129
}

ports/espressif/bindings/espnow/ESPNow.c

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static void espnow_check_for_deinit(espnow_obj_t *self) {
4141
//| `wifi_phy_rate_t <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/network/esp_wifi.html#_CPPv415wifi_phy_rate_t>`_
4242
//| """
4343
//| ...
44+
//|
4445
static mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
4546
enum { ARG_buffer_size, ARG_phy_rate };
4647
static const mp_arg_t allowed_args[] = {
@@ -71,6 +72,7 @@ static mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args, size_t
7172
//| def deinit(self) -> None:
7273
//| """Deinitializes ESP-NOW and releases it for another program."""
7374
//| ...
75+
//|
7476
static mp_obj_t espnow_deinit(mp_obj_t self_in) {
7577
espnow_obj_t *self = MP_OBJ_TO_PTR(self_in);
7678
espnow_check_for_deinit(self);
@@ -82,12 +84,14 @@ static MP_DEFINE_CONST_FUN_OBJ_1(espnow_deinit_obj, espnow_deinit);
8284
//| def __enter__(self) -> ESPNow:
8385
//| """No-op used by Context Managers."""
8486
//| ...
87+
//|
8588
// Provided by context manager helper.
8689

8790
//| def __exit__(self) -> None:
8891
//| """Automatically deinitializes the hardware when exiting a context. See
8992
//| :ref:`lifetime-and-contextmanagers` for more info."""
9093
//| ...
94+
//|
9195
static mp_obj_t espnow_obj___exit__(size_t n_args, const mp_obj_t *args) {
9296
(void)n_args;
9397
return espnow_deinit(args[0]);
@@ -109,6 +113,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow___exit___obj, 4, 4, espnow_obj
109113
//| :param Peer peer: Send message to this peer. If `None`, send to all registered peers.
110114
//| """
111115
//| ...
116+
//|
112117
static mp_obj_t espnow_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
113118
enum { ARG_message, ARG_peer };
114119
static const mp_arg_t allowed_args[] = {
@@ -143,6 +148,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(espnow_send_obj, 2, espnow_send);
143148
//|
144149
//| :returns: An `ESPNowPacket` if available in the buffer, otherwise `None`."""
145150
//| ...
151+
//|
146152
static mp_obj_t espnow_read(mp_obj_t self_in) {
147153
espnow_obj_t *self = MP_OBJ_TO_PTR(self_in);
148154
espnow_check_for_deinit(self);
@@ -204,6 +210,7 @@ MP_PROPERTY_GETTER(espnow_read_failure_obj,
204210
//|
205211
//| :param ReadableBuffer pmk: The ESP-NOW Primary Master Key (length = 16 bytes)."""
206212
//| ...
213+
//|
207214
static mp_obj_t espnow_set_pmk(mp_obj_t self_in, mp_obj_t key) {
208215
espnow_obj_t *self = MP_OBJ_TO_PTR(self_in);
209216
espnow_check_for_deinit(self);
@@ -325,6 +332,7 @@ static const mp_stream_p_t espnow_stream_p = {
325332
//| """Return the number of `bytes` available to read. Used to implement ``len()``."""
326333
//| ...
327334
//|
335+
//|
328336
static mp_obj_t espnow_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
329337
espnow_obj_t *self = MP_OBJ_TO_PTR(self_in);
330338
espnow_check_for_deinit(self);

ports/espressif/bindings/espnow/ESPNowPacket.c

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
//| time: int
2222
//| """The time in milliseconds since the device last booted when the packet was received."""
2323
//|
24+
//|
2425

2526
const mp_obj_namedtuple_type_t espnow_packet_type_obj = {
2627
NAMEDTUPLE_TYPE_BASE_AND_SLOTS(MP_QSTR_ESPNowPacket),

ports/espressif/bindings/espnow/Peer.c

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
//| :param bool encrypted: Whether or not to use encryption.
3333
//| """
3434
//| ...
35+
//|
3536
static mp_obj_t espnow_peer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
3637
enum { ARG_mac, ARG_lmk, ARG_channel, ARG_interface, ARG_encrypted };
3738
static const mp_arg_t allowed_args[] = {
@@ -167,6 +168,7 @@ MP_PROPERTY_GETSET(espnow_peer_interface_obj,
167168
//| encrypted: bool
168169
//| """Whether or not to use encryption."""
169170
//|
171+
//|
170172
static mp_obj_t espnow_peer_get_encrypted(const mp_obj_t self_in) {
171173
espnow_peer_obj_t *self = MP_OBJ_TO_PTR(self_in);
172174
return mp_obj_new_bool(self->peer_info.encrypt);

ports/espressif/bindings/espnow/Peers.c

+3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
//| def __init__(self) -> None:
2222
//| """You cannot create an instance of `Peers`."""
2323
//| ...
24+
//|
2425

2526
//| def append(self, peer: Peer) -> None:
2627
//| """Append peer.
2728
//|
2829
//| :param Peer peer: The peer object to append.
2930
//| """
3031
//| ...
32+
//|
3133
static mp_obj_t espnow_peers_append(mp_obj_t self_in, mp_obj_t arg) {
3234
espnow_peer_obj_t *peer = MP_OBJ_TO_PTR(mp_arg_validate_type(arg, &espnow_peer_type, MP_QSTR_Peer));
3335
CHECK_ESP_RESULT(esp_now_add_peer(&peer->peer_info));
@@ -43,6 +45,7 @@ static MP_DEFINE_CONST_FUN_OBJ_2(espnow_peers_append_obj, espnow_peers_append);
4345
//| """
4446
//| ...
4547
//|
48+
//|
4649
static mp_obj_t espnow_peers_remove(mp_obj_t self_in, mp_obj_t arg) {
4750
espnow_peer_obj_t *peer = MP_OBJ_TO_PTR(mp_arg_validate_type(arg, &espnow_peer_type, MP_QSTR_Peer));
4851
CHECK_ESP_RESULT(esp_now_del_peer(peer->peer_info.peer_addr));

ports/espressif/bindings/espnow/__init__.c

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
//| for packet in packets:
5252
//| print(packet)
5353
//| """
54+
//|
5455
//| ...
5556
//|
5657

ports/espressif/bindings/espulp/Architecture.c

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ MAKE_ENUM_VALUE(espulp_architecture_type, architecture, RISCV, RISCV);
2020
//| RISCV: Architecture
2121
//| """The ULP RISC-V Coprocessor."""
2222
//|
23+
//|
2324
MAKE_ENUM_MAP(espulp_architecture) {
2425
MAKE_ENUM_MAP_ENTRY(architecture, FSM),
2526
MAKE_ENUM_MAP_ENTRY(architecture, RISCV),

0 commit comments

Comments
 (0)