IDF release/v4.0 e7ac221b4

This commit is contained in:
me-no-dev
2020-06-16 00:23:34 +00:00
parent d2761a9eab
commit 2fbbae762b
94 changed files with 413 additions and 293 deletions

View File

@ -373,6 +373,9 @@
#define CONFIG_PTHREAD_TASK_NAME_DEFAULT "pthread"
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
#define CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS 1
#define CONFIG_SPI_FLASH_YIELD_DURING_ERASE 1
#define CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS 20
#define CONFIG_SPI_FLASH_ERASE_YIELD_TICKS 1
#define CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP 1
#define CONFIG_SPI_FLASH_SUPPORT_GD_CHIP 1
#define CONFIG_SPIFFS_MAX_PARTITIONS 3
@ -2186,5 +2189,5 @@
#define CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
#endif
#define CONFIG_ARDUINO_IDF_COMMIT "4c81978a3"
#define CONFIG_ARDUINO_IDF_COMMIT "e7ac221b4"
#define CONFIG_ARDUINO_IDF_BRANCH "release/v4.0"

View File

@ -21,6 +21,7 @@ extern "C" {
#include <stdint.h>
#include "esp_err.h"
#include "driver/gpio.h"
#include "soc/dac_periph.h"
typedef enum {

View File

@ -101,7 +101,7 @@ esp_err_t sigmadelta_set_prescale(sigmadelta_channel_t channel, uint8_t prescale
*/
esp_err_t sigmadelta_set_pin(sigmadelta_channel_t channel, gpio_num_t gpio_num);
#ifdef _cplusplus
#ifdef __cplusplus
}
#endif

View File

@ -23,7 +23,7 @@ extern "C" {
/** Minor version number (x.X.x) */
#define ESP_IDF_VERSION_MINOR 0
/** Patch version number (x.x.X) */
#define ESP_IDF_VERSION_PATCH 0
#define ESP_IDF_VERSION_PATCH 1
/**
* Macro to convert IDF version number into an integer

View File

@ -73,6 +73,30 @@ struct esp_eth_mac_s {
*/
esp_err_t (*deinit)(esp_eth_mac_t *mac);
/**
* @brief Start Ethernet MAC
*
* @param[in] mac: Ethernet MAC instance
*
* @return
* - ESP_OK: start Ethernet MAC successfully
* - ESP_FAIL: start Ethernet MAC failed because some other error occurred
*
*/
esp_err_t (*start)(esp_eth_mac_t *mac);
/**
* @brief Stop Ethernet MAC
*
* @param[in] mac: Ethernet MAC instance
*
* @return
* - ESP_OK: stop Ethernet MAC successfully
* - ESP_FAIL: stop Ethernet MAC failed because some error occurred
*
*/
esp_err_t (*stop)(esp_eth_mac_t *mac);
/**
* @brief Transmit packet from Ethernet MAC
*
@ -251,6 +275,7 @@ typedef struct {
} eth_mac_config_t;
#define ETH_MAC_FLAG_WORK_WITH_CACHE_DISABLE (1 << 0) /*!< MAC driver can work when cache is disabled */
#define ETH_MAC_FLAG_PIN_TO_CORE (1 << 1) /*!< Pin MAC task to the CPU core where driver installation happened */
/**
* @brief Default configuration for Ethernet MAC object

View File

@ -805,6 +805,21 @@ esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
*/
esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
/**
* @brief Get AID of STA connected with soft-AP
*
* @param mac STA's mac address
* @param[out] aid Store the AID corresponding to STA mac
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_NOT_FOUND: Requested resource not found
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
* - ESP_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid
*/
esp_err_t esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid);
/**
* @brief Set the WiFi API configuration storage type
@ -861,28 +876,59 @@ esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_v
esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);
/**
* @brief Set maximum WiFi transmitting power
* @brief Set maximum transmitting power after WiFi start.
*
* @param power Maximum WiFi transmitting power, unit is 0.25dBm, range is [40, 82] corresponding to 10dBm - 20.5dBm here.
* @attention 1. Maximum power before wifi startup is limited by PHY init data bin.
* @attention 2. The value set by this API will be mapped to the max_tx_power of the structure wifi_country_t variable.
* @attention 3. Mapping Table {Power, max_tx_power} = {{8, 2}, {20, 5}, {28, 7}, {34, 8}, {44, 11},
* {52, 13}, {56, 14}, {60, 15}, {66, 16}, {72, 18}, {78, 20}}.
* @attention 4. Param power unit is 0.25dBm, range is [8, 78] corresponding to 2dBm - 20dBm.
* @attention 5. Relationship between set value and actual value. As follows:
* +------------+--------------+
* | set value | actual value |
* +============+==============+
* | [8, 19] | 8 |
* +------------+--------------+
* | [20, 27] | 20 |
* +------------+--------------+
* | [28, 33] | 28 |
* +------------+--------------+
* | [34, 43] | 34 |
* +------------+--------------+
* | [44, 51] | 44 |
* +------------+--------------+
* | [52, 55] | 52 |
* +------------+--------------+
* | [56, 59] | 56 |
* +------------+--------------+
* | [60, 65] | 60 |
* +------------+--------------+
* | [66, 71] | 66 |
* +------------+--------------+
* | [72, 77] | 72 |
* +------------+--------------+
* | 78 | 78 |
* +------------+--------------+
* @param power Maximum WiFi transmitting power.
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_NOT_ARG: invalid argument
* - ESP_ERR_WIFI_ARG: invalid argument, e.g. parameter is out of range
*/
esp_err_t esp_wifi_set_max_tx_power(int8_t power);
/**
* @brief Get maximum WiFi transmiting power
* @brief Get maximum transmiting power after WiFi start
*
* @param power Maximum WiFi transmitting power, unit is 0.25dBm.
* @param power Maximum WiFi transmitting power, unit is 0.25dBm.
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_WIFI_ARG: invalid argument
*/
esp_err_t esp_wifi_get_max_tx_power(int8_t *power);

View File

@ -94,6 +94,7 @@ typedef enum {
WIFI_REASON_ASSOC_FAIL = 203,
WIFI_REASON_HANDSHAKE_TIMEOUT = 204,
WIFI_REASON_CONNECTION_FAIL = 205,
WIFI_REASON_AUTH_CHANGED = 206,
} wifi_err_reason_t;
typedef enum {
@ -115,7 +116,7 @@ typedef struct {
} wifi_active_scan_time_t;
/** @brief Aggregate of active & passive scan time per channel */
typedef union {
typedef struct {
wifi_active_scan_time_t active; /**< active scan time per channel, units: millisecond. */
uint32_t passive; /**< passive scan time per channel, units: millisecond, values above 1500ms may
cause station to disconnect from AP and are not recommended. */

View File

@ -538,6 +538,11 @@
*/
#define LWIP_TCP_KEEPALIVE 1
/**
* LWIP_SO_LINGER==1: Enable SO_LINGER processing.
*/
#define LWIP_SO_LINGER CONFIG_LWIP_SO_LINGER
/**
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
*/

View File

@ -37,6 +37,7 @@ typedef struct esp_mqtt_client *esp_mqtt_client_handle_t;
*
*/
typedef enum {
MQTT_EVENT_ANY = -1,
MQTT_EVENT_ERROR = 0, /*!< on error event, additional context: connection return code, error handle from esp_tls (if supported) */
MQTT_EVENT_CONNECTED, /*!< connected event, additional context: session_present flag */
MQTT_EVENT_DISCONNECTED, /*!< disconnected event */
@ -88,6 +89,15 @@ typedef enum {
MQTT_TRANSPORT_OVER_WSS /*!< MQTT over Websocket Secure, using scheme: ``wss`` */
} esp_mqtt_transport_t;
/**
* MQTT protocol version used for connection
*/
typedef enum {
MQTT_PROTOCOL_UNDEFINED = 0,
MQTT_PROTOCOL_V_3_1,
MQTT_PROTOCOL_V_3_1_1
} esp_mqtt_protocol_ver_t;
/**
* @brief MQTT error code structure to be passed as a contextual information into ERROR event
*
@ -155,7 +165,7 @@ typedef struct {
void *user_context; /*!< pass user context to this option, then can receive that context in ``event->user_context`` */
int task_prio; /*!< MQTT task priority, default is 5, can be changed in ``make menuconfig`` */
int task_stack; /*!< MQTT task stack size, default is 6144 bytes, can be changed in ``make menuconfig`` */
int buffer_size; /*!< size of MQTT send/receive buffer, default is 1024 */
int buffer_size; /*!< size of MQTT send/receive buffer, default is 1024 (only receive buffer size if ``out_buffer_size`` defined) */
const char *cert_pem; /*!< Pointer to certificate data in PEM or DER format for server verify (with SSL), default is NULL, not required to verify the server. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in cert_len. */
size_t cert_len; /*!< Length of the buffer pointed to by cert_pem. May be 0 for null-terminated pem */
const char *client_cert_pem; /*!< Pointer to certificate data in PEM or DER format for SSL mutual authentication, default is NULL, not required if mutual authentication is not needed. If it is not NULL, also `client_key_pem` has to be provided. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in client_cert_len. */
@ -170,6 +180,8 @@ typedef struct {
const char **alpn_protos; /*!< NULL-terminated list of supported application protocols to be used for ALPN */
const char *clientkey_password; /*!< Client key decryption password string */
int clientkey_password_len; /*!< String length of the password pointed to by clientkey_password */
esp_mqtt_protocol_ver_t protocol_ver; /*!< MQTT protocol version used for connection, defaults to value from menuconfig*/
int out_buffer_size; /*!< size of MQTT output buffer. If not defined, both output and input buffers have the same size defined as ``buffer_size`` */
} esp_mqtt_client_config_t;
/**
@ -213,6 +225,15 @@ esp_err_t esp_mqtt_client_start(esp_mqtt_client_handle_t client);
*/
esp_err_t esp_mqtt_client_reconnect(esp_mqtt_client_handle_t client);
/**
* @brief This api is typically used to force disconnection from the broker
*
* @param client mqtt client handle
*
* @return ESP_OK on success
*/
esp_err_t esp_mqtt_client_disconnect(esp_mqtt_client_handle_t client);
/**
* @brief Stops mqtt client tasks
*
@ -261,6 +282,9 @@ int esp_mqtt_client_unsubscribe(esp_mqtt_client_handle_t client, const char *top
* @brief Client to send a publish message to the broker
*
* Notes:
* - This API might block for several seconds, either due to network timeout (10s)
* or if publishing payloads longer than internal buffer (due to message
* fragmentation)
* - Client doesn't have to be connected to send publish message
* (although it would drop all qos=0 messages, qos>1 messages would be enqueued)
* - It is thread safe, please refer to `esp_mqtt_client_subscribe` for details

View File

@ -8,7 +8,10 @@
#include "sdkconfig.h"
#define MQTT_PROTOCOL_311 CONFIG_MQTT_PROTOCOL_311
#ifdef CONFIG_MQTT_PROTOCOL_311
#define MQTT_PROTOCOL_311
#endif
#define MQTT_RECON_DEFAULT_MS (10*1000)
#define MQTT_POLL_READ_TIMEOUT_MS (1000)
@ -24,7 +27,12 @@
#define MQTT_MAX_PASSWORD_LEN 65
#define MQTT_MAX_LWT_TOPIC 32
#define MQTT_MAX_LWT_MSG 128
#if CONFIG_MQTT_TASK_PRIORITY
#define MQTT_TASK_PRIORITY CONFIG_MQTT_TASK_PRIORITY
#else
#define MQTT_TASK_PRIORITY 5
#endif
#if CONFIG_MQTT_TASK_STACK_SIZE
#define MQTT_TASK_STACK CONFIG_MQTT_TASK_STACK_SIZE

View File

@ -20,6 +20,7 @@ typedef enum ws_transport_opcodes {
WS_TRANSPORT_OPCODES_CLOSE = 0x08,
WS_TRANSPORT_OPCODES_PING = 0x09,
WS_TRANSPORT_OPCODES_PONG = 0x0a,
WS_TRANSPORT_OPCODES_FIN = 0x80,
} ws_transport_opcodes_t;
/**