8000 Merge branch 'adafruit:main' into main · megacoder/circuitpython@3ea5d4e · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ea5d4e

Browse files
authored
Merge branch 'adafruit:main' into main
2 parents af081f5 + 3cd9f33 commit 3ea5d4e

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

ports/espressif/bindings/espidf/__init__.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include "nvs_flash.h"
3535
#include "components/heap/include/esp_heap_caps.h"
3636

37+
//| import builtins
38+
//|
3739
//| """Direct access to a few ESP-IDF details. This module *should not* include any functionality
3840
//| that could be implemented by other frameworks. It should only include ESP-IDF specific
3941
//| things."""
@@ -95,6 +97,13 @@ STATIC void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_pr
9597
mp_obj_exception_print(print, o_in, kind);
9698
}
9799

100+
//| class IDFError(builtins.OSError):
101+
//| """Raised when an ``ESP-IDF`` function returns an error code.
102+
//| `esp_err_t <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/error-codes.html>`_
103+
//| """
104+
//|
105+
//| ...
106+
//|
98107
const mp_obj_type_t mp_type_espidf_IDFError = {
99108
{ &mp_type_type },
100109
.name = MP_QSTR_IDFError,
@@ -104,11 +113,8 @@ const mp_obj_type_t mp_type_espidf_IDFError = {
104113
.parent = &mp_type_OSError,
105114
};
106115

107-
108-
//| import builtins
109-
//|
110116
//| class MemoryError(builtins.MemoryError):
111-
//| """Raised when an ESP IDF memory allocation fails."""
117+
//| """Raised when an ``ESP-IDF`` memory allocation fails."""
112118
//|
113119
//| ...
114120
//|

ports/espressif/bindings/espnow/ESPNow.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ static void espnow_check_for_deinit(espnow_obj_t *self) {
5757
//| """Allocate and initialize `ESPNow` instance as a singleton.
5858
//|
5959
//| :param int buffer_size: The size of the internal ring buffer. Default: 526 bytes.
60-
//| :param int phy_rate: The ESP-NOW physical layer rate. Default: 1 Mbps."""
60+
//| :param int phy_rate: The ESP-NOW physical layer rate. Default: 1 Mbps.
61+
//| `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>`_
62+
//| """
6163
//| ...
6264
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) {
6365
enum { ARG_buffer_size, ARG_phy_rate };
@@ -71,7 +73,7 @@ STATIC mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args, size_t
7173

7274
espnow_obj_t *self = MP_STATE_PORT(espnow_singleton);
7375

74-
if (self != NULL) {
76+
if (!common_hal_espnow_deinited(self)) {
7577
mp_raise_RuntimeError(translate("Already running"));
7678
}
7779

@@ -244,7 +246,9 @@ MP_PROPERTY_GETTER(espnow_buffer_size_obj,
244246
(mp_obj_t)&espnow_get_buffer_size_obj);
245247

246248
//| phy_rate: int
247-
//| """The ESP-NOW physical layer rate."""
249+
//| """The ESP-NOW physical layer rate.
250+
//| `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>`_
251+
//| """
248252
//|
249253
STATIC mp_obj_t espnow_get_phy_rate(const mp_obj_t self_in) {
250254
espnow_obj_t *self = MP_OBJ_TO_PTR(self_in);

ports/espressif/bindings/espnow/Peer.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
#include "bindings/espnow/Peer.h"
3232
#include "common-hal/espnow/__init__.h"
3333

34-
// TODO: check peer already exist
35-
// TODO: check peer doesn't exist
36-
3734
//| class Peer:
3835
//| """A data class to store parameters specific to a peer."""
3936
//|
@@ -62,7 +59,7 @@ STATIC mp_obj_t espnow_peer_make_new(const mp_obj_type_t *type, size_t n_args, s
6259
{ MP_QSTR_lmk, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = mp_const_none } },
6360
{ MP_QSTR_channel, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } },
6461
{ MP_QSTR_interface,MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } },
65-
{ MP_QSTR_encrypted,MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
62+
{ MP_QSTR_encrypted,MP_ARG_BOOL | MP_ARG_KW_ONLY,{ .u_bool = false } },
6663
};
6764

6865
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];

ports/espressif/bindings/espnow/Peers.c

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

3636
#include "esp_now.h"
3737

38-
// TODO: Check for deinit
39-
4038
//| class Peers:
4139
//| """Maintains a `list` of `Peer` internally and only exposes a subset of `list` methods."""
4240
//|

ports/espressif/bindings/espnow/__init__.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
//| """ESP-NOW Module
3434
//|
3535
//| The `espnow` module provides an interface to the
36-
//| `ESP-NOW <https://www.espressif.com/en/products/software/esp-now/overview>`_
37-
//| protocol provided by Espressif on its SoCs
38-
//| (`API docs <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/network/esp_now.html>`_).
36+
//| `ESP-NOW <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/network/esp_now.html>`_
37+
//| protocol provided by Espressif on its SoCs.
3938
//|
4039
//| **Sender**
4140
//|

0 commit comments

Comments
 (0)
0