Merge branch 'adafruit:main' into main

This commit is contained in:
Ozgur BOSTAN 2023-03-29 19:12:49 +03:00 committed by GitHub
commit 3ea5d4e91c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 16 deletions

View File

@ -34,6 +34,8 @@
#include "nvs_flash.h"
#include "components/heap/include/esp_heap_caps.h"
//| import builtins
//|
//| """Direct access to a few ESP-IDF details. This module *should not* include any functionality
//| that could be implemented by other frameworks. It should only include ESP-IDF specific
//| things."""
@ -95,6 +97,13 @@ STATIC void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_pr
mp_obj_exception_print(print, o_in, kind);
}
//| class IDFError(builtins.OSError):
//| """Raised when an ``ESP-IDF`` function returns an error code.
//| `esp_err_t <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/error-codes.html>`_
//| """
//|
//| ...
//|
const mp_obj_type_t mp_type_espidf_IDFError = {
{ &mp_type_type },
.name = MP_QSTR_IDFError,
@ -104,11 +113,8 @@ const mp_obj_type_t mp_type_espidf_IDFError = {
.parent = &mp_type_OSError,
};
//| import builtins
//|
//| class MemoryError(builtins.MemoryError):
//| """Raised when an ESP IDF memory allocation fails."""
//| """Raised when an ``ESP-IDF`` memory allocation fails."""
//|
//| ...
//|

View File

@ -57,7 +57,9 @@ static void espnow_check_for_deinit(espnow_obj_t *self) {
//| """Allocate and initialize `ESPNow` instance as a singleton.
//|
//| :param int buffer_size: The size of the internal ring buffer. Default: 526 bytes.
//| :param int phy_rate: The ESP-NOW physical layer rate. Default: 1 Mbps."""
//| :param int phy_rate: The ESP-NOW physical layer rate. Default: 1 Mbps.
//| `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>`_
//| """
//| ...
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) {
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
espnow_obj_t *self = MP_STATE_PORT(espnow_singleton);
if (self != NULL) {
if (!common_hal_espnow_deinited(self)) {
mp_raise_RuntimeError(translate("Already running"));
}
@ -244,7 +246,9 @@ MP_PROPERTY_GETTER(espnow_buffer_size_obj,
(mp_obj_t)&espnow_get_buffer_size_obj);
//| phy_rate: int
//| """The ESP-NOW physical layer rate."""
//| """The ESP-NOW physical layer rate.
//| `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>`_
//| """
//|
STATIC mp_obj_t espnow_get_phy_rate(const mp_obj_t self_in) {
espnow_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -31,9 +31,6 @@
#include "bindings/espnow/Peer.h"
#include "common-hal/espnow/__init__.h"
// TODO: check peer already exist
// TODO: check peer doesn't exist
//| class Peer:
//| """A data class to store parameters specific to a peer."""
//|
@ -62,7 +59,7 @@ STATIC mp_obj_t espnow_peer_make_new(const mp_obj_type_t *type, size_t n_args, s
{ MP_QSTR_lmk, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = mp_const_none } },
{ MP_QSTR_channel, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } },
{ MP_QSTR_interface,MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } },
{ MP_QSTR_encrypted,MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
{ MP_QSTR_encrypted,MP_ARG_BOOL | MP_ARG_KW_ONLY,{ .u_bool = false } },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];

View File

@ -35,8 +35,6 @@
#include "esp_now.h"
// TODO: Check for deinit
//| class Peers:
//| """Maintains a `list` of `Peer` internally and only exposes a subset of `list` methods."""
//|

View File

@ -33,9 +33,8 @@
//| """ESP-NOW Module
//|
//| The `espnow` module provides an interface to the
//| `ESP-NOW <https://www.espressif.com/en/products/software/esp-now/overview>`_
//| protocol provided by Espressif on its SoCs
//| (`API docs <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/network/esp_now.html>`_).
//| `ESP-NOW <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/network/esp_now.html>`_
//| protocol provided by Espressif on its SoCs.
//|
//| **Sender**
//|