Skip to content

Commit

Permalink
Update IDF to afe4c76 and BLE lib (#2130)
Browse files Browse the repository at this point in the history
* Update BLE

* Update IDF to afe4c76

* Update CMakeLists.txt

* Update BLE to fix compilation issues

* Update BLE
  • Loading branch information
me-no-dev committed Nov 30, 2018
1 parent ce340fa commit a15b7e9
Show file tree
Hide file tree
Showing 79 changed files with 551 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ set(BLE_SRCS
libraries/BLE/src/BLEDescriptor.cpp
libraries/BLE/src/BLEDescriptorMap.cpp
libraries/BLE/src/BLEDevice.cpp
libraries/BLE/src/BLEEddystoneTLM.cpp
libraries/BLE/src/BLEEddystoneURL.cpp
libraries/BLE/src/BLEExceptions.cpp
libraries/BLE/src/BLEHIDDevice.cpp
libraries/BLE/src/BLERemoteCharacteristic.cpp
Expand Down
2 changes: 1 addition & 1 deletion libraries/BLE
Submodule BLE updated 59 files
+46 −20 examples/BLE_client/BLE_client.ino
+2 −3 examples/BLE_iBeacon/BLE_iBeacon.ino
+10 −5 examples/BLE_notify/BLE_notify.ino
+10 −6 examples/BLE_scan/BLE_scan.ino
+9 −3 examples/BLE_server/BLE_server.ino
+111 −0 examples/BLE_server_multiconnect/BLE_server_multiconnect.ino
+3 −3 library.properties
+5 −12 src/BLE2902.cpp
+7 −7 src/BLE2904.cpp
+14 −15 src/BLEAddress.cpp
+29 −20 src/BLEAdvertisedDevice.cpp
+6 −3 src/BLEAdvertisedDevice.h
+74 −31 src/BLEAdvertising.cpp
+13 −3 src/BLEAdvertising.h
+8 −3 src/BLEBeacon.cpp
+1 −1 src/BLEBeacon.h
+92 −125 src/BLECharacteristic.cpp
+12 −15 src/BLECharacteristic.h
+9 −19 src/BLECharacteristicMap.cpp
+87 −22 src/BLEClient.cpp
+12 −7 src/BLEClient.h
+18 −64 src/BLEDescriptor.cpp
+2 −2 src/BLEDescriptor.h
+18 −23 src/BLEDescriptorMap.cpp
+149 −51 src/BLEDevice.cpp
+32 −7 src/BLEDevice.h
+150 −0 src/BLEEddystoneTLM.cpp
+51 −0 src/BLEEddystoneTLM.h
+148 −0 src/BLEEddystoneURL.cpp
+43 −0 src/BLEEddystoneURL.h
+2 −2 src/BLEExceptions.h
+42 −33 src/BLEHIDDevice.cpp
+9 −9 src/BLEHIDDevice.h
+69 −87 src/BLERemoteCharacteristic.cpp
+12 −13 src/BLERemoteCharacteristic.h
+19 −23 src/BLERemoteDescriptor.cpp
+27 −15 src/BLERemoteService.cpp
+4 −4 src/BLERemoteService.h
+79 −40 src/BLEScan.cpp
+10 −6 src/BLEScan.h
+23 −24 src/BLESecurity.cpp
+5 −4 src/BLESecurity.h
+134 −71 src/BLEServer.cpp
+38 −19 src/BLEServer.h
+22 −39 src/BLEService.cpp
+8 −15 src/BLEService.h
+19 −17 src/BLEServiceMap.cpp
+72 −75 src/BLEUUID.cpp
+3 −3 src/BLEUUID.h
+232 −371 src/BLEUtils.cpp
+3 −3 src/BLEUtils.h
+11 −14 src/BLEValue.cpp
+8 −7 src/BLEValue.h
+16 −28 src/FreeRTOS.cpp
+6 −5 src/FreeRTOS.h
+131 −52 src/GeneralUtils.cpp
+1 −0 src/GeneralUtils.h
+29 −29 src/HIDKeyboardTypes.h
+2 −2 src/HIDTypes.h
11 changes: 11 additions & 0 deletions tools/gen_esp32part.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import sys
import hashlib
import binascii
import errno

MAX_PARTITION_LENGTH = 0xC00 # 3K for partition data (96 entries) leaves 1K in a 4K sector for signature
MD5_PARTITION_BEGIN = b"\xEB\xEB" + b"\xFF" * 14 # The first 2 bytes are like magic numbers for MD5 sum
Expand Down Expand Up @@ -480,6 +481,16 @@ def main():
raise InputError("Partitions defined in '%s' occupy %.1fMB of flash (%d bytes) which does not fit in configured flash size %dMB. Change the flash size in menuconfig under the 'Serial Flasher Config' menu." %
(args.input.name, table_size / 1024.0 / 1024.0, table_size, size_mb))

# Make sure that the output directory is created
output_dir = os.path.abspath(os.path.dirname(args.output))

if not os.path.exists(output_dir):
try:
os.makedirs(output_dir)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise

if input_is_binary:
output = table.to_csv()
with sys.stdout if args.output == '-' else open(args.output, 'w') as f:
Expand Down
Binary file modified tools/sdk/bin/bootloader_dio_80m.bin
Binary file not shown.
Binary file modified tools/sdk/bin/bootloader_qout_40m.bin
Binary file not shown.
6 changes: 6 additions & 0 deletions tools/sdk/include/config/sdkconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
#define CONFIG_SCAN_DUPLICATE_BY_DEVICE_ADDR 1
#define CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER 1
#define CONFIG_MB_SERIAL_TASK_STACK_SIZE 2048
#define CONFIG_MBEDTLS_PSK_MODES 1
#define CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO 1
#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60
#define CONFIG_SPIFFS_USE_MAGIC 1
Expand Down Expand Up @@ -164,9 +165,11 @@
#define CONFIG_BTDM_LPCLK_SEL_MAIN_XTAL 1
#define CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED 1
#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK 1
#define CONFIG_SW_COEXIST_PREFERENCE_WIFI 1
#define CONFIG_DMA_RX_BUF_NUM 10
#define CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED 1
#define CONFIG_MBEDTLS_KEY_EXCHANGE_PSK 1
#define CONFIG_TCP_SYNMAXRTX 6
#define CONFIG_MB_UART_RTS 32
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA 1
Expand Down Expand Up @@ -199,6 +202,7 @@
#define CONFIG_SW_COEXIST_PREFERENCE_VALUE 0
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1
#define CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER 1
#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK 1
#define CONFIG_PPP_SUPPORT 1
#define CONFIG_SPIRAM_SPEED_40M 1
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
Expand Down Expand Up @@ -278,6 +282,7 @@
#define CONFIG_MBEDTLS_HAVE_TIME 1
#define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1
#define CONFIG_TCP_QUEUE_OOSEQ 1
#define CONFIG_FATFS_ALLOC_PREFER_EXTRAM 1
#define CONFIG_GATTS_ENABLE 1
#define CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE 0
#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1
Expand All @@ -287,6 +292,7 @@
#define CONFIG_SUPPORT_TERMIOS 1
#define CONFIG_CLASSIC_BT_ENABLED 1
#define CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK 1
#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK 1
#define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1
#define CONFIG_IDF_TARGET "esp32"
#define CONFIG_WL_SECTOR_SIZE_4096 1
Expand Down
1 change: 1 addition & 0 deletions tools/sdk/include/driver/driver/i2s.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ typedef struct {
int dma_buf_count; /*!< I2S DMA Buffer Count */
int dma_buf_len; /*!< I2S DMA Buffer Length */
bool use_apll; /*!< I2S using APLL as main I2S clock, enable it to get accurate clock */
bool tx_desc_auto_clear; /*!< I2S auto clear tx descriptor if there is underflow condition (helps in avoiding noise in case of data unavailability) */
int fixed_mclk; /*!< I2S using fixed MCLK output. If use_apll = true and fixed_mclk > 0, then the clock output for i2s is fixed and equal to the fixed_mclk value.*/
} i2s_config_t;

Expand Down
27 changes: 27 additions & 0 deletions tools/sdk/include/driver/driver/rmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ typedef enum {
RMT_CARRIER_LEVEL_MAX
} rmt_carrier_level_t;

typedef enum {
RMT_CHANNEL_UNINIT = 0, /*!< RMT channel uninitialized */
RMT_CHANNEL_IDLE = 1, /*!< RMT channel status idle */
RMT_CHANNEL_BUSY = 2, /*!< RMT channel status busy */
} rmt_channel_status_t;

/**
* @brief Data struct of RMT channel status
*/
typedef struct {
rmt_channel_status_t status[RMT_CHANNEL_MAX]; /*!< Store the current status of each channel */
} rmt_channel_status_result_t;

/**
* @brief Data struct of RMT TX configure parameters
*/
Expand Down Expand Up @@ -496,6 +509,7 @@ esp_err_t rmt_set_idle_level(rmt_channel_t channel, bool idle_out_en, rmt_idle_l
* @param channel RMT channel (0-7)
*
* @param status Pointer to accept channel status.
* Please refer to RMT_CHnSTATUS_REG(n=0~7) in `rmt_reg.h` for more details of each field.
*
* @return
* - ESP_ERR_INVALID_ARG Parameter error
Expand Down Expand Up @@ -679,6 +693,19 @@ esp_err_t rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int intr
*/
esp_err_t rmt_driver_uninstall(rmt_channel_t channel);

/**
* @brief Get the current status of eight channels.
*
* @note Do not call this function if it is possible that `rmt_driver_uninstall` will be called at the same time.
*
* @param[out] channel_status store the current status of each channel
*
* @return
* - ESP_ERR_INVALID_ARG Parameter is NULL
* - ESP_OK Success
*/
esp_err_t rmt_get_channel_status(rmt_channel_status_result_t *channel_status);

/**
* @brief RMT send waveform from rmt_item array.
*
Expand Down
7 changes: 5 additions & 2 deletions tools/sdk/include/driver/driver/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ esp_err_t uart_get_collision_flag(uart_port_t uart_num, bool* collision_flag);
* light sleep. This function allows setting the threshold value.
*
* Stop bit and parity bits (if enabled) also contribute to the number of edges.
* For example, letter 'a' with ASCII code 97 is encoded as 010001101 on the wire
* For example, letter 'a' with ASCII code 97 is encoded as 0100001101 on the wire
* (with 8n1 configuration), start and stop bits included. This sequence has 3
* positive edges (transitions from 0 to 1). Therefore, to wake up the system
* when 'a' is sent, set wakeup_threshold=3.
Expand All @@ -813,7 +813,10 @@ esp_err_t uart_get_collision_flag(uart_port_t uart_num, bool* collision_flag);
* correct baud rate all the time, select REF_TICK as UART clock source,
* by setting use_ref_tick field in uart_config_t to true.
*
* @note in ESP32, UART2 does not support light sleep wakeup feature.
* @note in ESP32, the wakeup signal can only be input via IO_MUX (i.e.
* GPIO3 should be configured as function_1 to wake up UART0,
* GPIO9 should be configured as function_5 to wake up UART1), UART2
* does not support light sleep wakeup feature.
*
* @param uart_num UART number
* @param wakeup_threshold number of RX edges for light sleep wakeup, value is 3 .. 0x3ff.
Expand Down
53 changes: 49 additions & 4 deletions tools/sdk/include/esp32/esp_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ typedef enum {
this event, and add the corresponding scan done handler in this event. */
MESH_EVENT_NETWORK_STATE, /**< network state, such as whether current mesh network has a root. */
MESH_EVENT_STOP_RECONNECTION, /**< the root stops reconnecting to the router and non-root devices stop reconnecting to their parents. */
MESH_EVENT_FIND_NETWORK, /**< when the channel field in mesh configuration is set to zero, mesh stack will perform a
full channel scan to find a mesh network that can join, and return the channel value
after finding it. */
MESH_EVENT_ROUTER_SWITCH, /**< if users specify BSSID of the router in mesh configuration, when the root connects to another
router with the same SSID, this event will be posted and the new router information is attached. */
MESH_EVENT_MAX,
} mesh_event_id_t;

Expand Down Expand Up @@ -310,6 +315,14 @@ typedef struct {
mesh_addr_t rc_addr; /**< root address specified by users via API esp_mesh_waive_root() */
} mesh_event_vote_started_t;

/**
* @brief find a mesh network that this device can join
*/
typedef struct {
uint8_t channel; /**< channel number of the new found network */
uint8_t router_bssid[6]; /**< router BSSID */
} mesh_event_find_network_t;

/**
* @brief IP settings from LwIP stack
*/
Expand Down Expand Up @@ -381,6 +394,11 @@ typedef struct {
bool is_rootless; /**< whether current mesh network has a root */
} mesh_event_network_state_t;

/**
* @brief New router information
*/
typedef system_event_sta_connected_t mesh_event_router_switch_t;

/**
* @brief Mesh event information
*/
Expand All @@ -405,6 +423,8 @@ typedef union {
mesh_event_root_fixed_t root_fixed; /**< fixed root */
mesh_event_scan_done_t scan_done; /**< scan done */
mesh_event_network_state_t network_state; /**< network state, such as whether current mesh network has a root. */
mesh_event_find_network_t find_network; /**< network found that can join */
mesh_event_router_switch_t router_switch; /**< new router information */
} mesh_event_info_t;

/**
Expand Down Expand Up @@ -445,10 +465,16 @@ typedef struct {
* @brief Router configuration
*/
typedef struct {
uint8_t ssid[32]; /**< SSID */
uint8_t ssid_len; /**< length of SSID */
uint8_t bssid[6]; /**< BSSID, if router is hidden, this value is mandatory */
uint8_t password[64]; /**< password */
uint8_t ssid[32]; /**< SSID */
uint8_t ssid_len; /**< length of SSID */
uint8_t bssid[6]; /**< BSSID, if this value is specified, users should also specify "allow_router_switch". */
uint8_t password[64]; /**< password */
bool allow_router_switch; /**< if the BSSID is specified and this value is also set, when the router of this specified BSSID
fails to be found after "fail" (mesh_attempts_t) times, the whole network is allowed to switch
to another router with the same SSID. The new router might also be on a different channel.
The default value is false.
There is a risk that if the password is different between the new switched router and the previous
one, the mesh network could be established but the root will never connect to the new switched router. */
} mesh_router_t;

/**
Expand All @@ -464,6 +490,8 @@ typedef struct {
*/
typedef struct {
uint8_t channel; /**< channel, the mesh network on */
bool allow_channel_switch; /**< if this value is set, when "fail" (mesh_attempts_t) times is reached, device will change to
a full channel scan for a network that could join. The default value is false. */
mesh_event_cb_t event_cb; /**< mesh event callback */
mesh_addr_t mesh_id; /**< mesh network identification */
mesh_router_t router; /**< router configuration */
Expand Down Expand Up @@ -1412,6 +1440,23 @@ esp_err_t esp_mesh_disconnect(void);
*/
esp_err_t esp_mesh_connect(void);

/**
* @brief Cause the root device to add Channel Switch Announcement Element (CSA IE) to beacon
* - Set the new channel
* - Set how many beacons with CSA IE will be sent before changing a new channel
* - Enable the channel switch function
*
* @attention This API is only called by the root.
*
* @param[in] new_bssid the new router BSSID if the router changes
* @param[in] csa_newchan the new channel number to which the whole network is moving
* @param[in] csa_count channel switch period(beacon count), unit is based on beacon interval of its softAP, the default value is 15.
*
* @return
* - ESP_OK
*/
esp_err_t esp_mesh_switch_channel(const uint8_t *new_bssid, int csa_newchan, int csa_count);

#ifdef __cplusplus
}
#endif
Expand Down
7 changes: 7 additions & 0 deletions tools/sdk/include/fatfs/ffconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,11 @@
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"

/* Some memory allocation functions are declared here in addition to ff.h, so that
they can be used also by external code when LFN feature is disabled.
*/
void* ff_memalloc (UINT msize);
void* ff_memcalloc (UINT num, UINT size);


/*--- End of configuration options ---*/
4 changes: 2 additions & 2 deletions tools/sdk/include/idf_test/idf_performance.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#define IDF_PERFORMANCE_MAX_SPI_PER_TRANS_POLLING_NO_DMA 15
/* Due to code size & linker layout differences interacting with cache, VFS
microbenchmark currently runs slower with PSRAM enabled. */
#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME 50000
#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM 40000
#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME 20000
#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM 25000
// throughput performance by iperf
#define IDF_PERFORMANCE_MIN_TCP_RX_THROUGHPUT 50
#define IDF_PERFORMANCE_MIN_TCP_TX_THROUGHPUT 40
Expand Down
Loading

0 comments on commit a15b7e9

Please sign in to comment.