kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'espressif:release/v4.4' into release/v4.4
commit
d6d5c2ca12
|
@ -19,14 +19,6 @@ trim_trailing_whitespace = false
|
|||
indent_style = tab
|
||||
indent_size = 2
|
||||
|
||||
[*/freertos/**]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[{*/freertos/**.S,**/FreeRTOSConfig.h}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.pem]
|
||||
insert_final_newline = false
|
||||
|
||||
|
|
|
@ -67,8 +67,6 @@ variables:
|
|||
|
||||
# target test repo parameters
|
||||
TEST_ENV_CONFIG_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/ci-test-runner-configs.git"
|
||||
CI_AUTO_TEST_SCRIPT_REPO_URL: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/auto_test_script.git"
|
||||
CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v4.1"
|
||||
|
||||
.setup_tools_unless_target_test: &setup_tools_unless_target_test |
|
||||
if [[ -n "$IDF_DONT_USE_MIRRORS" ]]; then
|
||||
|
@ -115,6 +113,8 @@ before_script:
|
|||
- source tools/ci/utils.sh
|
||||
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
|
||||
- export IDF_TOOLS_PATH="${HOME}/.espressif_runner_${CI_RUNNER_ID}_${CI_CONCURRENT_ID}"
|
||||
# Clean up idf-env.json which might not be compatible with one produced by newer ESP-IDF versions
|
||||
- rm -f ${IDF_TOOLS_PATH}/idf-env.json
|
||||
- $IDF_PATH/tools/idf_tools.py install-python-env
|
||||
# On macOS, these tools need to be installed
|
||||
- $IDF_PATH/tools/idf_tools.py --non-interactive install cmake ninja
|
||||
|
|
|
@ -108,6 +108,8 @@ assign_integration_test:
|
|||
extends:
|
||||
- .assign_test_template
|
||||
- .rules:test:integration_test
|
||||
- .before_script_minimal
|
||||
image: ${CI_INTEGRATION_TEST_ENV_IMAGE}
|
||||
needs:
|
||||
- build_ssc_esp32
|
||||
- build_ssc_esp32c3
|
||||
|
@ -120,13 +122,14 @@ assign_integration_test:
|
|||
INTEGRATION_TEST_CASE_PATH: "${CI_PROJECT_DIR}/auto_test_script/TestCaseFiles"
|
||||
ASSIGN_TEST_CASE_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIAssignTestCases.py"
|
||||
PYTHONPATH: ${CI_PROJECT_DIR}/auto_test_script/packages
|
||||
PYTHON_VER: 3.7.7
|
||||
GIT_LFS_SKIP_SMUDGE: 1
|
||||
script:
|
||||
- add_gitlab_ssh_keys
|
||||
# clone test script to assign tests
|
||||
# can not retry if downing git lfs files failed, so using empty_branch first.
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
|
||||
- retry_failed git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script --customized_only
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} auto_test_script
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- ./tools/ci/setup_idfci.sh
|
||||
# assign integration test cases
|
||||
- python ${ASSIGN_TEST_CASE_SCRIPT} -t ${INTEGRATION_TEST_CASE_PATH} -c $CI_TARGET_TEST_CONFIG_FILE -b ${BUILD_DIR} -o $TEST_DIR/test_configs
|
||||
|
||||
|
|
|
@ -781,6 +781,8 @@ component_ut_test_lan8720:
|
|||
extends:
|
||||
- .target_test_job_template
|
||||
- .rules:test:integration_test
|
||||
- .before_script_minimal
|
||||
image: ${CI_INTEGRATION_TEST_ENV_IMAGE}
|
||||
needs: # the assign already needs all the build jobs
|
||||
- assign_integration_test
|
||||
variables:
|
||||
|
@ -791,22 +793,23 @@ component_ut_test_lan8720:
|
|||
KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/tools/ci/integration_test/KnownIssues"
|
||||
CI_RUNNER_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIRunner.py"
|
||||
PREPARE_TEST_BIN_SCRIPT: "${CI_PROJECT_DIR}/tools/ci/integration_test/prepare_test_bins.py"
|
||||
PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages:${PYTHONPATH}"
|
||||
PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages:${CI_PROJECT_DIR}/tools/ci/python_packages:${PYTHONPATH}"
|
||||
INITIAL_CONDITION_RETRY_COUNT: "1"
|
||||
# auto_test_script only supports python 3.7.x
|
||||
PYTHON_VER: 3.7.7
|
||||
GIT_LFS_SKIP_SMUDGE: 1
|
||||
script:
|
||||
- *define_config_file_name
|
||||
# first test if config file exists, if not exist, exit 0
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
- add_gitlab_ssh_keys
|
||||
# clone local test env configs
|
||||
- retry_failed git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
# clone test bench
|
||||
# can not retry if downing git lfs files failed, so using empty_branch first.
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
|
||||
- retry_failed git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script --customized_only
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} auto_test_script
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- ./tools/ci/setup_idfci.sh
|
||||
# Merge known issues
|
||||
- cat ${KNOWN_ISSUE_FILE} >> ${TEST_CASE_FILE_PATH}/KnownIssues
|
||||
# run test
|
||||
- python ${PREPARE_TEST_BIN_SCRIPT} $CONFIG_FILE
|
||||
|
@ -833,16 +836,16 @@ nvs_compatible_test:
|
|||
- *define_config_file_name
|
||||
# first test if config file exists, if not exist, exit 0
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
- add_gitlab_ssh_keys
|
||||
# clone local test env configs
|
||||
- retry_failed git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
# clone test bench
|
||||
# can not retry if downing git lfs files failed, so using empty_branch first.
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
|
||||
- retry_failed git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script --customized_only
|
||||
# prepare nvs bins
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} auto_test_script
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- ./tools/ci/setup_idfci.sh
|
||||
# prepare nvs bins
|
||||
- ./tools/prepare_nvs_bin.sh
|
||||
# run test
|
||||
- python ${PREPARE_TEST_BIN_SCRIPT} $CONFIG_FILE
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d3a4f5bbc58a9bb9f2398862606153c13a3f4e54
|
||||
Subproject commit eac5f0916361e7809af4b65144a8a7f0cc44b9c8
|
|
@ -1 +1 @@
|
|||
Subproject commit 2a91d90e33b3b1104daf1bff898fe5bc3f814811
|
||||
Subproject commit 420ae1726dede6bbd4f3393744a8f3a252330b6a
|
|
@ -1188,8 +1188,7 @@ static bool relay_to_adv(enum bt_mesh_net_if net_if)
|
|||
case BLE_MESH_NET_IF_LOCAL:
|
||||
return true;
|
||||
case BLE_MESH_NET_IF_ADV:
|
||||
return ((bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED) ||
|
||||
(bt_mesh_friend_get() == BLE_MESH_FRIEND_ENABLED));
|
||||
return (bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED);
|
||||
case BLE_MESH_NET_IF_PROXY:
|
||||
return (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED);
|
||||
default:
|
||||
|
@ -1221,9 +1220,9 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||
}
|
||||
|
||||
if (rx->net_if == BLE_MESH_NET_IF_ADV &&
|
||||
!rx->friend_cred &&
|
||||
bt_mesh_relay_get() != BLE_MESH_RELAY_ENABLED &&
|
||||
bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_ENABLED &&
|
||||
bt_mesh_friend_get() != BLE_MESH_FRIEND_ENABLED) {
|
||||
bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1234,7 +1233,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||
* Anything else (like GATT to adv, or locally originated packets)
|
||||
* use the Network Transmit state.
|
||||
*/
|
||||
if (rx->net_if == BLE_MESH_NET_IF_ADV) {
|
||||
if (rx->net_if == BLE_MESH_NET_IF_ADV && !rx->friend_cred) {
|
||||
transmit = bt_mesh_relay_retransmit_get();
|
||||
} else {
|
||||
transmit = bt_mesh_net_transmit_get();
|
||||
|
@ -1304,6 +1303,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||
*/
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
|
||||
(bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED ||
|
||||
rx->friend_cred ||
|
||||
rx->net_if == BLE_MESH_NET_IF_LOCAL)) {
|
||||
if (bt_mesh_proxy_server_relay(&buf->b, rx->ctx.recv_dst) &&
|
||||
BLE_MESH_ADDR_IS_UNICAST(rx->ctx.recv_dst)) {
|
||||
|
@ -1311,7 +1311,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||
}
|
||||
}
|
||||
|
||||
if (relay_to_adv(rx->net_if)) {
|
||||
if (relay_to_adv(rx->net_if) || rx->friend_cred) {
|
||||
#if !defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
|
||||
bt_mesh_adv_send(buf, NULL, NULL);
|
||||
#else
|
||||
|
|
|
@ -768,6 +768,9 @@ typedef uint8_t esp_ble_gap_sync_t;
|
|||
|
||||
typedef uint8_t esp_ble_gap_adv_type_t;
|
||||
|
||||
/// Extend advertising tx power, range: [-127, +126] dBm
|
||||
#define EXT_ADV_TX_PWR_NO_PREFERENCE (127) /*!< host has no preference for tx power */
|
||||
|
||||
/**
|
||||
* @brief ext adv parameters
|
||||
*/
|
||||
|
|
|
@ -1469,7 +1469,7 @@ typedef struct {
|
|||
tBLE_ADDR_TYPE peer_addr_type;
|
||||
BD_ADDR peer_addr;
|
||||
tBTA_BLE_AFP filter_policy;
|
||||
UINT8 tx_power;
|
||||
INT8 tx_power;
|
||||
tBTA_DM_BLE_GAP_PHY primary_phy;
|
||||
UINT8 max_skip;
|
||||
tBTA_DM_BLE_GAP_PHY secondary_phy;
|
||||
|
|
|
@ -423,7 +423,8 @@ static void btc_a2dp_sink_handle_decoder_reset(tBTC_MEDIA_SINK_CFG_UPDATE *p_msg
|
|||
a2dp_sink_local_param.btc_aa_snk_cb.rx_flush = FALSE;
|
||||
APPL_TRACE_EVENT("Reset to sink role");
|
||||
status = OI_CODEC_SBC_DecoderReset(&a2dp_sink_local_param.context, a2dp_sink_local_param.contextData,
|
||||
sizeof(a2dp_sink_local_param.contextData), 2, 2, FALSE, FALSE);
|
||||
sizeof(a2dp_sink_local_param.contextData), a2dp_sink_local_param.btc_aa_snk_cb.channel_count,
|
||||
a2dp_sink_local_param.btc_aa_snk_cb.channel_count, FALSE, FALSE);
|
||||
if (!OI_SUCCESS(status)) {
|
||||
APPL_TRACE_ERROR("OI_CODEC_SBC_DecoderReset failed with error code %d\n", status);
|
||||
}
|
||||
|
|
|
@ -1990,7 +1990,7 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
|
|||
}
|
||||
#if (BLE_PRIVACY_SPT == TRUE )
|
||||
peer_addr_type = bda_type;
|
||||
match = btm_identity_addr_to_random_pseudo (bda, &bda_type, TRUE);
|
||||
match = btm_identity_addr_to_random_pseudo (bda, &bda_type, FALSE);
|
||||
|
||||
/* possiblly receive connection complete with resolvable random on
|
||||
slave role while the device has been paired */
|
||||
|
|
|
@ -4250,10 +4250,11 @@ void btm_ble_read_remote_features_complete(UINT8 *p)
|
|||
btsnd_hcic_rmt_ver_req (p_acl_cb->hci_handle);
|
||||
}
|
||||
else{
|
||||
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
|
||||
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
|
||||
if (p_acl_cb->transport == BT_TRANSPORT_LE) {
|
||||
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) {
|
||||
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
|
||||
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
|
||||
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features) &&
|
||||
(p_acl_cb->data_length_params.tx_len != data_length)) {
|
||||
p_acl_cb->data_len_updating = true;
|
||||
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime);
|
||||
}
|
||||
|
|
|
@ -1214,7 +1214,7 @@ UINT8 btsnd_hcic_ble_set_extend_rand_address(UINT8 adv_handle, BD_ADDR rand_addr
|
|||
UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UINT32 interval_min,
|
||||
UINT32 interval_max, UINT8 channel_map, UINT8 own_addr_type,
|
||||
UINT8 peer_addr_type, BD_ADDR peer_addr,
|
||||
UINT8 adv_filter_policy, UINT8 adv_tx_power,
|
||||
UINT8 adv_filter_policy, INT8 adv_tx_power,
|
||||
UINT8 primary_adv_phy, UINT8 secondary_adv_max_skip,
|
||||
UINT8 secondary_adv_phy,
|
||||
UINT8 adv_sid, UINT8 scan_req_ntf_enable)
|
||||
|
@ -1244,7 +1244,7 @@ UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UIN
|
|||
UINT8_TO_STREAM(pp, peer_addr_type);
|
||||
BDADDR_TO_STREAM (pp, peer_addr);
|
||||
UINT8_TO_STREAM(pp, adv_filter_policy);
|
||||
UINT8_TO_STREAM(pp, adv_tx_power);
|
||||
INT8_TO_STREAM(pp, adv_tx_power);
|
||||
UINT8_TO_STREAM(pp, primary_adv_phy);
|
||||
UINT8_TO_STREAM(pp, secondary_adv_max_skip);
|
||||
UINT8_TO_STREAM(pp, secondary_adv_phy);
|
||||
|
|
|
@ -767,7 +767,7 @@ typedef struct {
|
|||
tBLE_ADDR_TYPE peer_addr_type;
|
||||
BD_ADDR peer_addr;
|
||||
tBTM_BLE_AFP filter_policy;
|
||||
UINT8 tx_power;
|
||||
INT8 tx_power;
|
||||
tBTM_BLE_GAP_PHY primary_phy;
|
||||
UINT8 max_skip;
|
||||
tBTM_BLE_GAP_PHY secondary_phy;
|
||||
|
|
|
@ -962,7 +962,7 @@ UINT8 btsnd_hcic_ble_set_extend_rand_address(UINT8 adv_handle, BD_ADDR rand_addr
|
|||
UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UINT32 interval_min,
|
||||
UINT32 interval_max, UINT8 channel_map, UINT8 own_addr_type,
|
||||
UINT8 peer_addr_type, BD_ADDR peer_addr,
|
||||
UINT8 adv_filter_policy, UINT8 adv_tx_power,
|
||||
UINT8 adv_filter_policy, INT8 adv_tx_power,
|
||||
UINT8 primary_adv_phy, UINT8 secondary_adv_max_skip,
|
||||
UINT8 secondary_adv_phy,
|
||||
UINT8 adv_sid, UINT8 scan_req_ntf_enable);
|
||||
|
|
|
@ -121,8 +121,11 @@ esp_err_t touch_pad_isr_register(intr_handler_t fn, void *arg);
|
|||
* @brief Set touch sensor measurement and sleep time.
|
||||
* Excessive total time will slow down the touch response.
|
||||
* Too small measurement time will not be sampled enough, resulting in inaccurate measurements.
|
||||
*
|
||||
* @note The touch sensor on ESP32 will fix measuring cycles (specified by the second parameter)
|
||||
* and then record the count of charge and discharge cycles during the sensing period as the raw value.
|
||||
* That means the raw value will decrease as the capacity of the touch pad increasing.
|
||||
* @note The greater the duty cycle of the measurement time, the more system power is consumed.
|
||||
*
|
||||
* @param sleep_cycle The touch sensor will sleep after each measurement.
|
||||
* sleep_cycle decide the interval between each measurement.
|
||||
* t_sleep = sleep_cycle / (RTC_SLOW_CLK frequency).
|
||||
|
|
|
@ -39,15 +39,19 @@ esp_err_t touch_pad_sw_start(void);
|
|||
* @brief Set touch sensor times of charge and discharge and sleep time.
|
||||
* Excessive total time will slow down the touch response.
|
||||
* Too small measurement time will not be sampled enough, resulting in inaccurate measurements.
|
||||
*
|
||||
* @note Though this API name is same as ESP32, it has opposite logic of capacity.
|
||||
* The touch sensor on ESP32-S2 will fix the count of charge and discharge cycles (specified by the second parameter)
|
||||
* and then record the count of the clock cycles(which is 8 MHz) during the sensing period as the raw value.
|
||||
* That means the raw value will increase as the capacity of the touch pad increasing.
|
||||
* @note The greater the duty cycle of the measurement time, the more system power is consumed.
|
||||
*
|
||||
* @param sleep_cycle The touch sensor will sleep after each measurement.
|
||||
* sleep_cycle decide the interval between each measurement.
|
||||
* t_sleep = sleep_cycle / (RTC_SLOW_CLK frequency).
|
||||
* The approximate frequency value of RTC_SLOW_CLK can be obtained using rtc_clk_slow_freq_get_hz function.
|
||||
* @param meas_times The times of charge and discharge in each measure process of touch channels.
|
||||
* The timer frequency is 8Mhz. Range: 0 ~ 0xffff.
|
||||
* Recommended typical value: Modify this value to make the measurement time around 1ms.
|
||||
* @param meas_times The times of charge and discharge in each measurement of touch channels. Range: 0 ~ 0xffff.
|
||||
* Recommended typical value: Modify this value to make the measurement time around 1 ms.
|
||||
* The clock frequency is 8 MHz, so the raw value will be about 8000 if the measurement time is 1 ms
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
|
|
|
@ -39,15 +39,19 @@ esp_err_t touch_pad_sw_start(void);
|
|||
* @brief Set touch sensor times of charge and discharge and sleep time.
|
||||
* Excessive total time will slow down the touch response.
|
||||
* Too small measurement time will not be sampled enough, resulting in inaccurate measurements.
|
||||
*
|
||||
* @note Though this API name is same as ESP32, it has opposite logic of capacity.
|
||||
* The touch sensor on ESP32-S3 will fix the count of charge and discharge cycles (specified by the second parameter)
|
||||
* and then record the count of the clock cycles(which is 8 MHz) during the sensing period as the raw value.
|
||||
* That means the raw value will increase as the capacity of the touch pad increasing.
|
||||
* @note The greater the duty cycle of the measurement time, the more system power is consumed.
|
||||
*
|
||||
* @param sleep_cycle The touch sensor will sleep after each measurement.
|
||||
* sleep_cycle decide the interval between each measurement.
|
||||
* t_sleep = sleep_cycle / (RTC_SLOW_CLK frequency).
|
||||
* The approximate frequency value of RTC_SLOW_CLK can be obtained using rtc_clk_slow_freq_get_hz function.
|
||||
* @param meas_times The times of charge and discharge in each measure process of touch channels.
|
||||
* The timer frequency is 8Mhz. Range: 0 ~ 0xffff.
|
||||
* Recommended typical value: Modify this value to make the measurement time around 1ms.
|
||||
* @param meas_times The times of charge and discharge in each measurement of touch channels. Range: 0 ~ 0xffff.
|
||||
* Recommended typical value: Modify this value to make the measurement time around 1 ms.
|
||||
* The clock frequency is 8 MHz, so the raw value will be about 8000 if the measurement time is 1 ms
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
|
|
|
@ -217,6 +217,44 @@ struct spi_bus_lock_dev_t {
|
|||
uint32_t mask; ///< Bitwise OR-ed mask of the REQ, PEND, LOCK bits of this device
|
||||
};
|
||||
|
||||
/**
|
||||
* @note 1
|
||||
* This critical section is only used to fix such condition:
|
||||
*
|
||||
* define: lock_bits = (lock->status & LOCK_MASK) >> LOCK_SHIFT; This `lock_bits` is the Bit 29-20 of the lock->status
|
||||
*
|
||||
* 1. spi_hdl_1:
|
||||
* acquire_end_core():
|
||||
* uint32_t status = lock_status_clear(lock, dev_handle->mask & LOCK_MASK);
|
||||
*
|
||||
* Becuase this is the first `spi_hdl_1`, so after this , lock_bits == 0`b0. status == 0
|
||||
*
|
||||
* 2. spi_hdl_2:
|
||||
* acquire_core:
|
||||
* uint32_t status = lock_status_fetch_set(lock, dev_handle->mask & LOCK_MASK);
|
||||
*
|
||||
* Then here status is 0`b0, but lock_bits == 0`b10. Because this is the `spi_hdl_2`
|
||||
*
|
||||
* 3. spi_hdl_2:
|
||||
* `acquire_core` return true, because status == 0. `spi_bus_lock_acquire_start(spi_hdl_2)` then won't block.
|
||||
*
|
||||
* 4. spi_hdl_2:
|
||||
* spi_device_polling_end(spi_hdl_2).
|
||||
*
|
||||
* 5. spi_hdl_1:
|
||||
* acquire_end_core:
|
||||
* status is 0, so it cleas the lock->acquiring_dev
|
||||
*
|
||||
* 6. spi_hdl_2:
|
||||
* spi_device_polling_end:
|
||||
* assert(handle == get_acquiring_dev(host)); Fail
|
||||
*
|
||||
* @note 2
|
||||
* Only use this critical section in this condition. The critical section scope is limited to the smallest.
|
||||
* As `spi_bus_lock` influences the all the SPIs (including MSPI) a lot!
|
||||
*/
|
||||
portMUX_TYPE s_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
DRAM_ATTR static const char TAG[] = "bus_lock";
|
||||
|
||||
#define LOCK_CHECK(a, str, ret_val, ...) \
|
||||
|
@ -323,7 +361,11 @@ SPI_MASTER_ATTR static inline void req_core(spi_bus_lock_dev_t *dev_handle)
|
|||
SPI_MASTER_ISR_ATTR static inline bool acquire_core(spi_bus_lock_dev_t *dev_handle)
|
||||
{
|
||||
spi_bus_lock_t* lock = dev_handle->parent;
|
||||
|
||||
//For this critical section, search `@note 1` in this file, to know details
|
||||
portENTER_CRITICAL_SAFE(&s_spinlock);
|
||||
uint32_t status = lock_status_fetch_set(lock, dev_handle->mask & LOCK_MASK);
|
||||
portEXIT_CRITICAL_SAFE(&s_spinlock);
|
||||
|
||||
// Check all bits except WEAK_BG
|
||||
if ((status & (BG_MASK | LOCK_MASK)) == 0) {
|
||||
|
@ -401,10 +443,14 @@ schedule_core(spi_bus_lock_t *lock, uint32_t status, spi_bus_lock_dev_t **out_de
|
|||
IRAM_ATTR static inline void acquire_end_core(spi_bus_lock_dev_t *dev_handle)
|
||||
{
|
||||
spi_bus_lock_t* lock = dev_handle->parent;
|
||||
uint32_t status = lock_status_clear(lock, dev_handle->mask & LOCK_MASK);
|
||||
spi_bus_lock_dev_t* desired_dev = NULL;
|
||||
|
||||
//For this critical section, search `@note 1` in this file, to know details
|
||||
portENTER_CRITICAL_SAFE(&s_spinlock);
|
||||
uint32_t status = lock_status_clear(lock, dev_handle->mask & LOCK_MASK);
|
||||
bool invoke_bg = !schedule_core(lock, status, &desired_dev);
|
||||
portEXIT_CRITICAL_SAFE(&s_spinlock);
|
||||
|
||||
if (invoke_bg) {
|
||||
bg_enable(lock);
|
||||
} else if (desired_dev) {
|
||||
|
|
|
@ -1146,6 +1146,9 @@ esp_err_t uart_wait_tx_done(uart_port_t uart_num, TickType_t ticks_to_wait)
|
|||
xSemaphoreGive(p_uart_obj[uart_num]->tx_mux);
|
||||
return ESP_OK;
|
||||
}
|
||||
if (!UART_IS_MODE_SET(uart_num, UART_MODE_RS485_HALF_DUPLEX)) {
|
||||
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), UART_INTR_TX_DONE);
|
||||
}
|
||||
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
|
||||
uart_hal_ena_intr_mask(&(uart_context[uart_num].hal), UART_INTR_TX_DONE);
|
||||
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
|
||||
|
|
|
@ -254,8 +254,11 @@ void esp_mbedtls_conn_delete(esp_tls_t *tls)
|
|||
if (tls != NULL) {
|
||||
esp_mbedtls_cleanup(tls);
|
||||
if (tls->is_tls) {
|
||||
mbedtls_net_free(&tls->server_fd);
|
||||
tls->sockfd = tls->server_fd.fd;
|
||||
if (tls->server_fd.fd != -1) {
|
||||
mbedtls_net_free(&tls->server_fd);
|
||||
/* Socket is already closed by `mbedtls_net_free` and hence also change assignment of its copy to an invalid value */
|
||||
tls->sockfd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,11 +91,23 @@ menu "Hardware Settings"
|
|||
depends on ESP_CONSOLE_USB_SERIAL_JTAG || ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG
|
||||
default y
|
||||
help
|
||||
When the chip goes sleep or software reset, the clock source would change to XTAL
|
||||
and switch off the BBPLL clock for saving power. However, this might make the
|
||||
USB_SERIAL_JTAG down which depends on BBPLL as its unique clock source.
|
||||
Therefore, this is used for keeping bbpll clock always on when USB_SERIAL_JTAG PORT is using.
|
||||
If you want to use USB_SERIAL_JTAG under sw_reset case or sleep-wakeup case, you shoule select
|
||||
this option. But be aware that this might increase the power consumption.
|
||||
When software switches the CPU clock source from BBPLL clock to XTAL, usually the BBPLL will be
|
||||
switched off. This helps to save some power consumption in sleep modes. However this may also happen
|
||||
during the software reset, resulting in the inactive (disconnected from host) of the USB_SERIAL_JTAG
|
||||
device during software reset.
|
||||
|
||||
When USB_SERIAL_JTAG is being used, whether to turn off the clock source during software reset and in
|
||||
sleep modes is determined by RTC_CLOCK_BBPLL_POWER_ON_WITH_USB.
|
||||
|
||||
- When RTC_CLOCK_BBPLL_POWER_ON_WITH_USB is enabled, the clock will be kept, so that the
|
||||
USB_SERIAL_JTAG will keep alive during software reset. The side-effect is the increasing of power
|
||||
consumption during sleep modes, even though USB_SERIAL_JTAG will not work in sleep modes.
|
||||
|
||||
- When RTC_CLOCK_BBPLL_POWER_ON_WITH_USB is disabled, the clock will be turned off. USB_SERIAL_JTAG
|
||||
will be inactive during software reset and in sleep modes. This saves some power consumption in
|
||||
sleep modes.
|
||||
|
||||
When USB_SERIAL_JTAG is not being used, software will always turn off BBPLL regardless of
|
||||
RTC_CLOCK_BBPLL_POWER_ON_WITH_USB is set or not.
|
||||
endmenu
|
||||
endmenu
|
||||
|
|
|
@ -242,7 +242,7 @@ esp_err_t esp_lcd_new_panel_io_i80(esp_lcd_i80_bus_handle_t bus, const esp_lcd_p
|
|||
ESP_GOTO_ON_FALSE(!bus_exclusive, ESP_ERR_INVALID_STATE, err, TAG, "bus has been exclusively owned by device");
|
||||
// check if pixel clock setting is valid
|
||||
uint32_t pclk_prescale = bus->resolution_hz / io_config->pclk_hz;
|
||||
ESP_GOTO_ON_FALSE(pclk_prescale > 0 && pclk_prescale <= LCD_LL_CLOCK_PRESCALE_MAX, ESP_ERR_NOT_SUPPORTED, err, TAG,
|
||||
ESP_GOTO_ON_FALSE(pclk_prescale > 0 && pclk_prescale <= LCD_LL_PCLK_DIV_MAX, ESP_ERR_NOT_SUPPORTED, err, TAG,
|
||||
"prescaler can't satisfy PCLK clock %u", io_config->pclk_hz);
|
||||
i80_device = heap_caps_calloc(1, sizeof(lcd_panel_io_i80_t) + io_config->trans_queue_depth * sizeof(lcd_i80_trans_descriptor_t), LCD_I80_MEM_ALLOC_CAPS);
|
||||
ESP_GOTO_ON_FALSE(i80_device, ESP_ERR_NO_MEM, err, TAG, "no mem for i80 panel io");
|
||||
|
@ -466,7 +466,8 @@ static esp_err_t lcd_i80_select_periph_clock(esp_lcd_i80_bus_handle_t bus, lcd_c
|
|||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
// force to use integer division, as fractional division might lead to clock jitter
|
||||
lcd_ll_set_group_clock_src(bus->hal.dev, clk_src, LCD_PERIPH_CLOCK_PRE_SCALE, 0, 0);
|
||||
lcd_ll_select_clk_src(bus->hal.dev, clk_src);
|
||||
lcd_ll_set_group_clock_coeff(bus->hal.dev, LCD_PERIPH_CLOCK_PRE_SCALE, 0, 0);
|
||||
switch (clk_src) {
|
||||
case LCD_CLK_SRC_PLL160M:
|
||||
bus->resolution_hz = 160000000 / LCD_PERIPH_CLOCK_PRE_SCALE;
|
||||
|
|
|
@ -59,7 +59,7 @@ static esp_err_t rgb_panel_mirror(esp_lcd_panel_t *panel, bool mirror_x, bool mi
|
|||
static esp_err_t rgb_panel_swap_xy(esp_lcd_panel_t *panel, bool swap_axes);
|
||||
static esp_err_t rgb_panel_set_gap(esp_lcd_panel_t *panel, int x_gap, int y_gap);
|
||||
static esp_err_t rgb_panel_disp_off(esp_lcd_panel_t *panel, bool off);
|
||||
static esp_err_t lcd_rgb_panel_select_periph_clock(esp_rgb_panel_t *panel, lcd_clock_source_t clk_src);
|
||||
static esp_err_t lcd_rgb_panel_select_clock_src(esp_rgb_panel_t *panel, lcd_clock_source_t clk_src);
|
||||
static esp_err_t lcd_rgb_panel_create_trans_link(esp_rgb_panel_t *panel);
|
||||
static esp_err_t lcd_rgb_panel_configure_gpio(esp_rgb_panel_t *panel, const esp_lcd_rgb_panel_config_t *panel_config);
|
||||
static void lcd_rgb_panel_start_transmission(esp_rgb_panel_t *rgb_panel);
|
||||
|
@ -79,13 +79,14 @@ struct esp_rgb_panel_t {
|
|||
uint8_t *fb; // Frame buffer
|
||||
size_t fb_size; // Size of frame buffer
|
||||
int data_gpio_nums[SOC_LCD_RGB_DATA_WIDTH]; // GPIOs used for data lines, we keep these GPIOs for action like "invert_color"
|
||||
size_t resolution_hz; // Peripheral clock resolution
|
||||
uint32_t src_clk_hz; // Peripheral source clock resolution
|
||||
esp_lcd_rgb_timing_t timings; // RGB timing parameters (e.g. pclk, sync pulse, porch width)
|
||||
gdma_channel_handle_t dma_chan; // DMA channel handle
|
||||
esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; // Callback, invoked after frame trans done
|
||||
void *user_ctx; // Reserved user's data of callback functions
|
||||
int x_gap; // Extra gap in x coordinate, it's used when calculate the flush window
|
||||
int y_gap; // Extra gap in y coordinate, it's used when calculate the flush window
|
||||
int lcd_clk_flags; // LCD clock calculation flags
|
||||
struct {
|
||||
unsigned int disp_en_level: 1; // The level which can turn on the screen by `disp_gpio_num`
|
||||
unsigned int stream_mode: 1; // If set, the LCD transfers data continuously, otherwise, it stops refreshing the LCD when transaction done
|
||||
|
@ -154,9 +155,16 @@ esp_err_t esp_lcd_new_rgb_panel(const esp_lcd_rgb_panel_config_t *rgb_panel_conf
|
|||
rgb_panel->flags.fb_in_psram = alloc_from_psram;
|
||||
// initialize HAL layer, so we can call LL APIs later
|
||||
lcd_hal_init(&rgb_panel->hal, panel_id);
|
||||
// set peripheral clock resolution
|
||||
ret = lcd_rgb_panel_select_periph_clock(rgb_panel, rgb_panel_config->clk_src);
|
||||
ESP_GOTO_ON_ERROR(ret, err, TAG, "select periph clock failed");
|
||||
// enable clock gating
|
||||
lcd_ll_enable_clock(rgb_panel->hal.dev, true);
|
||||
// set clock source
|
||||
ret = lcd_rgb_panel_select_clock_src(rgb_panel, rgb_panel_config->clk_src);
|
||||
ESP_GOTO_ON_ERROR(ret, err, TAG, "set source clock failed");
|
||||
// set minimal PCLK divider
|
||||
// A limitation in the hardware, if the LCD_PCLK == LCD_CLK, then the PCLK polarity can't be adjustable
|
||||
if (!(rgb_panel_config->timings.flags.pclk_active_neg || rgb_panel_config->timings.flags.pclk_idle_high)) {
|
||||
rgb_panel->lcd_clk_flags |= LCD_HAL_PCLK_FLAG_ALLOW_EQUAL_SYSCLK;
|
||||
}
|
||||
// install interrupt service, (LCD peripheral shares the interrupt source with Camera by different mask)
|
||||
int isr_flags = LCD_RGB_INTR_ALLOC_FLAGS | ESP_INTR_FLAG_SHARED;
|
||||
ret = esp_intr_alloc_intrstatus(lcd_periph_signals.panels[panel_id].irq_id, isr_flags,
|
||||
|
@ -227,6 +235,7 @@ static esp_err_t rgb_panel_del(esp_lcd_panel_t *panel)
|
|||
gdma_disconnect(rgb_panel->dma_chan);
|
||||
gdma_del_channel(rgb_panel->dma_chan);
|
||||
esp_intr_free(rgb_panel->intr);
|
||||
lcd_ll_enable_clock(rgb_panel->hal.dev, false);
|
||||
periph_module_disable(lcd_periph_signals.panels[panel_id].module);
|
||||
lcd_com_remove_device(LCD_COM_DEVICE_TYPE_RGB, rgb_panel->panel_id);
|
||||
free(rgb_panel->fb);
|
||||
|
@ -251,14 +260,8 @@ static esp_err_t rgb_panel_init(esp_lcd_panel_t *panel)
|
|||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
esp_rgb_panel_t *rgb_panel = __containerof(panel, esp_rgb_panel_t, base);
|
||||
// configure clock
|
||||
lcd_ll_enable_clock(rgb_panel->hal.dev, true);
|
||||
// set PCLK frequency
|
||||
uint32_t pclk_prescale = rgb_panel->resolution_hz / rgb_panel->timings.pclk_hz;
|
||||
ESP_GOTO_ON_FALSE(pclk_prescale <= LCD_LL_CLOCK_PRESCALE_MAX, ESP_ERR_NOT_SUPPORTED, err, TAG,
|
||||
"prescaler can't satisfy PCLK clock %uHz", rgb_panel->timings.pclk_hz);
|
||||
lcd_ll_set_pixel_clock_prescale(rgb_panel->hal.dev, pclk_prescale);
|
||||
rgb_panel->timings.pclk_hz = rgb_panel->resolution_hz / pclk_prescale;
|
||||
// set pixel clock frequency
|
||||
rgb_panel->timings.pclk_hz = lcd_hal_cal_pclk_freq(&rgb_panel->hal, rgb_panel->src_clk_hz, rgb_panel->timings.pclk_hz, rgb_panel->lcd_clk_flags);
|
||||
// pixel clock phase and polarity
|
||||
lcd_ll_set_clock_idle_level(rgb_panel->hal.dev, rgb_panel->timings.flags.pclk_idle_high);
|
||||
lcd_ll_set_pixel_clock_edge(rgb_panel->hal.dev, rgb_panel->timings.flags.pclk_active_neg);
|
||||
|
@ -294,7 +297,6 @@ static esp_err_t rgb_panel_init(esp_lcd_panel_t *panel)
|
|||
lcd_rgb_panel_start_transmission(rgb_panel);
|
||||
}
|
||||
ESP_LOGD(TAG, "rgb panel(%d) start, pclk=%uHz", rgb_panel->panel_id, rgb_panel->timings.pclk_hz);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -316,19 +318,21 @@ static esp_err_t rgb_panel_draw_bitmap(esp_lcd_panel_t *panel, int x_start, int
|
|||
// convert the frame buffer to 3D array
|
||||
int bytes_per_pixel = rgb_panel->data_width / 8;
|
||||
int pixels_per_line = rgb_panel->timings.h_res;
|
||||
uint32_t bytes_per_line = bytes_per_pixel * pixels_per_line;
|
||||
const uint8_t *from = (const uint8_t *)color_data;
|
||||
uint8_t (*to)[pixels_per_line][bytes_per_pixel] = (uint8_t (*)[pixels_per_line][bytes_per_pixel])rgb_panel->fb;
|
||||
// manipulate the frame buffer
|
||||
for (int j = y_start; j < y_end; j++) {
|
||||
for (int i = x_start; i < x_end; i++) {
|
||||
for (int k = 0; k < bytes_per_pixel; k++) {
|
||||
to[j][i][k] = *from++;
|
||||
}
|
||||
}
|
||||
uint32_t copy_bytes_per_line = (x_end - x_start) * bytes_per_pixel;
|
||||
uint8_t *to = rgb_panel->fb + (y_start * pixels_per_line + x_start) * bytes_per_pixel;
|
||||
for (int y = y_start; y < y_end; y++) {
|
||||
memcpy(to, from, copy_bytes_per_line);
|
||||
to += bytes_per_line;
|
||||
from += copy_bytes_per_line;
|
||||
}
|
||||
|
||||
if (rgb_panel->flags.fb_in_psram) {
|
||||
// CPU writes data to PSRAM through DCache, data in PSRAM might not get updated, so write back
|
||||
Cache_WriteBack_Addr((uint32_t)&to[y_start][0][0], (y_end - y_start) * rgb_panel->timings.h_res * bytes_per_pixel);
|
||||
uint32_t bytes_to_flush = (y_end - y_start) * bytes_per_line;
|
||||
Cache_WriteBack_Addr((uint32_t)(rgb_panel->fb + y_start * bytes_per_line), bytes_to_flush);
|
||||
}
|
||||
|
||||
// restart the new transmission
|
||||
|
@ -437,14 +441,26 @@ static esp_err_t lcd_rgb_panel_configure_gpio(esp_rgb_panel_t *panel, const esp_
|
|||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t lcd_rgb_panel_select_periph_clock(esp_rgb_panel_t *panel, lcd_clock_source_t clk_src)
|
||||
static esp_err_t lcd_rgb_panel_select_clock_src(esp_rgb_panel_t *panel, lcd_clock_source_t clk_src)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
// force to use integer division, as fractional division might lead to clock jitter
|
||||
lcd_ll_set_group_clock_src(panel->hal.dev, clk_src, LCD_PERIPH_CLOCK_PRE_SCALE, 0, 0);
|
||||
switch (clk_src) {
|
||||
case LCD_CLK_SRC_PLL240M:
|
||||
panel->src_clk_hz = 240000000;
|
||||
break;
|
||||
case LCD_CLK_SRC_PLL160M:
|
||||
panel->resolution_hz = 160000000 / LCD_PERIPH_CLOCK_PRE_SCALE;
|
||||
panel->src_clk_hz = 160000000;
|
||||
break;
|
||||
case LCD_CLK_SRC_XTAL:
|
||||
panel->src_clk_hz = rtc_clk_xtal_freq_get() * 1000000;
|
||||
break;
|
||||
default:
|
||||
ESP_RETURN_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, TAG, "unsupported clock source: %d", clk_src);
|
||||
break;
|
||||
}
|
||||
lcd_ll_select_clk_src(panel->hal.dev, clk_src);
|
||||
|
||||
if (clk_src == LCD_CLK_SRC_PLL240M || clk_src == LCD_CLK_SRC_PLL160M) {
|
||||
#if CONFIG_PM_ENABLE
|
||||
ret = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "rgb_panel", &panel->pm_lock);
|
||||
ESP_RETURN_ON_ERROR(ret, TAG, "create ESP_PM_APB_FREQ_MAX lock failed");
|
||||
|
@ -452,13 +468,6 @@ static esp_err_t lcd_rgb_panel_select_periph_clock(esp_rgb_panel_t *panel, lcd_c
|
|||
esp_pm_lock_acquire(panel->pm_lock);
|
||||
ESP_LOGD(TAG, "installed ESP_PM_APB_FREQ_MAX lock and hold the lock during the whole panel lifecycle");
|
||||
#endif
|
||||
break;
|
||||
case LCD_CLK_SRC_XTAL:
|
||||
panel->resolution_hz = rtc_clk_xtal_freq_get() * 1000000 / LCD_PERIPH_CLOCK_PRE_SCALE;
|
||||
break;
|
||||
default:
|
||||
ESP_RETURN_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, TAG, "unsupported clock source: %d", clk_src);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -600,18 +600,19 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
|
|||
* @attention 1. It is discouraged to call this API since this doesn't validate the per-country rules,
|
||||
* it's up to the user to fill in all fields according to local regulations.
|
||||
* Please use esp_wifi_set_country_code instead.
|
||||
* @attention 2. The default country is CHINA {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO}
|
||||
* @attention 3. When the country policy is WIFI_COUNTRY_POLICY_AUTO, the country info of the AP to which
|
||||
* the station is connected is used. E.g. if the configured country info is {.cc="USA", .schan=1, .nchan=11}
|
||||
* @attention 2. The default country is CHINA {.cc="CN", .schan=1, .nchan=13, .policy=WIFI_COUNTRY_POLICY_AUTO}.
|
||||
* @attention 3. The third octect of country code string is one of the following: ' ', 'O', 'I', 'X', otherwise it is considered as ' '.
|
||||
* @attention 4. When the country policy is WIFI_COUNTRY_POLICY_AUTO, the country info of the AP to which
|
||||
* the station is connected is used. E.g. if the configured country info is {.cc="US", .schan=1, .nchan=11}
|
||||
* and the country info of the AP to which the station is connected is {.cc="JP", .schan=1, .nchan=14}
|
||||
* then the country info that will be used is {.cc="JP", .schan=1, .nchan=14}. If the station disconnected
|
||||
* from the AP the country info is set back to the country info of the station automatically,
|
||||
* {.cc="US", .schan=1, .nchan=11} in the example.
|
||||
* @attention 4. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, then the configured country info is used always.
|
||||
* @attention 5. When the country info is changed because of configuration or because the station connects to a different
|
||||
* @attention 5. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, then the configured country info is used always.
|
||||
* @attention 6. When the country info is changed because of configuration or because the station connects to a different
|
||||
* external AP, the country IE in probe response/beacon of the soft-AP is also changed.
|
||||
* @attention 6. The country configuration is stored into flash.
|
||||
* @attention 7. When this API is called, the PHY init data will switch to the PHY init data type corresponding to the
|
||||
* @attention 7. The country configuration is stored into flash.
|
||||
* @attention 8. When this API is called, the PHY init data will switch to the PHY init data type corresponding to the
|
||||
* country info.
|
||||
*
|
||||
* @param country the configured country info
|
||||
|
@ -909,7 +910,7 @@ esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);
|
|||
* @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_STARTED: WiFi is not started by esp_wifi_start
|
||||
* - 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);
|
||||
|
@ -922,7 +923,7 @@ esp_err_t esp_wifi_set_max_tx_power(int8_t 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_STARTED: WiFi is not started by esp_wifi_start
|
||||
* - ESP_ERR_WIFI_ARG: invalid argument
|
||||
*/
|
||||
esp_err_t esp_wifi_get_max_tx_power(int8_t *power);
|
||||
|
@ -1018,7 +1019,7 @@ esp_err_t esp_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx);
|
|||
* 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 or promiscuous mode is not enabled
|
||||
* - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start or promiscuous mode is not enabled
|
||||
* - ESP_ERR_INVALID_ARG: invalid argument
|
||||
*/
|
||||
esp_err_t esp_wifi_set_csi_config(const wifi_csi_config_t *config);
|
||||
|
@ -1031,7 +1032,7 @@ esp_err_t esp_wifi_set_csi_config(const wifi_csi_config_t *config);
|
|||
* 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 or promiscuous mode is not enabled
|
||||
* - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start or promiscuous mode is not enabled
|
||||
* - ESP_ERR_INVALID_ARG: invalid argument
|
||||
*/
|
||||
esp_err_t esp_wifi_set_csi(bool en);
|
||||
|
@ -1244,6 +1245,7 @@ esp_err_t esp_wifi_set_connectionless_wake_interval(uint16_t interval);
|
|||
*
|
||||
* @attention 7. When country code "01" (world safe mode) is set, SoftAP mode won't contain country IE.
|
||||
* @attention 8. The default country is "CN" and ieee80211d_enabled is TRUE.
|
||||
* @attention 9. The third octect of country code string is one of the following: ' ', 'O', 'I', 'X', otherwise it is considered as ' '.
|
||||
*
|
||||
* @param country the configured country ISO code
|
||||
* @param ieee80211d_enabled 802.11d is enabled or not
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a7d80f7e4e4b5f65809b2eef14159e9b4e153941
|
||||
Subproject commit 04ccb7f7d1c6bf3f4d9227934c165f56ba188877
|
|
@ -273,3 +273,109 @@ TEST_CASE("Calling esp_wifi_deinit() without stop", "[wifi_init]")
|
|||
sema = NULL;
|
||||
test_utils_task_delete(th);
|
||||
}
|
||||
|
||||
static void wifi_country_code_task(void* arg)
|
||||
{
|
||||
SemaphoreHandle_t *sema = (SemaphoreHandle_t *) arg;
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
|
||||
ESP_LOGI(TAG, EMPH_STR("nvs_flash_erase"));
|
||||
nvs_flash_erase();
|
||||
ESP_LOGI(TAG, EMPH_STR("nvs_flash_init"));
|
||||
esp_err_t r = nvs_flash_init();
|
||||
if (r == ESP_ERR_NVS_NO_FREE_PAGES || r == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_LOGI(TAG, EMPH_STR("no free pages or NFS version mismatch, erase.."));
|
||||
TEST_ESP_OK(nvs_flash_erase());
|
||||
r = nvs_flash_init();
|
||||
}
|
||||
TEST_ESP_OK(r);
|
||||
//init tcpip stack
|
||||
test_case_uses_tcpip();
|
||||
ESP_LOGI(TAG, EMPH_STR("event_init"));
|
||||
TEST_ESP_OK(event_init());
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_init"));
|
||||
TEST_ESP_OK(esp_wifi_init(&cfg));
|
||||
|
||||
wifi_country_t country;
|
||||
wifi_country_t country_01 = {.cc="01", .schan=1, .nchan=11, .policy=WIFI_COUNTRY_POLICY_MANUAL};
|
||||
wifi_country_t country_CN = {.cc="CN", .schan=1, .nchan=13, .policy=WIFI_COUNTRY_POLICY_MANUAL};
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_get_country"));
|
||||
TEST_ESP_OK(esp_wifi_get_country(&country));
|
||||
TEST_ASSERT(country.cc[0] == country_CN.cc[0] && country.cc[1] == country_CN.cc[1]);
|
||||
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_country"));
|
||||
TEST_ESP_OK(esp_wifi_set_country(&country_01));
|
||||
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_get_country"));
|
||||
TEST_ESP_OK(esp_wifi_get_country(&country));
|
||||
TEST_ASSERT(country.cc[0] == country_01.cc[0] && country.cc[1] == country_01.cc[1]);
|
||||
|
||||
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit"));
|
||||
TEST_ESP_OK(esp_wifi_deinit());
|
||||
ESP_LOGI(TAG, EMPH_STR("event_deinit"));
|
||||
TEST_ESP_OK(event_deinit());
|
||||
ESP_LOGI(TAG, EMPH_STR("nvs_flash_deinit..."));
|
||||
nvs_flash_deinit();
|
||||
|
||||
ESP_LOGI(TAG, EMPH_STR("nvs_flash_erase"));
|
||||
nvs_flash_erase();
|
||||
ESP_LOGI(TAG, EMPH_STR("nvs_flash_init"));
|
||||
r = nvs_flash_init();
|
||||
if (r == ESP_ERR_NVS_NO_FREE_PAGES || r == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_LOGI(TAG, EMPH_STR("no free pages or NFS version mismatch, erase.."));
|
||||
TEST_ESP_OK(nvs_flash_erase());
|
||||
r = nvs_flash_init();
|
||||
}
|
||||
TEST_ESP_OK(r);
|
||||
//init tcpip stack
|
||||
test_case_uses_tcpip();
|
||||
ESP_LOGI(TAG, EMPH_STR("event_init"));
|
||||
TEST_ESP_OK(event_init());
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_init"));
|
||||
TEST_ESP_OK(esp_wifi_init(&cfg));
|
||||
|
||||
char country_code_string[3];
|
||||
char country_code_string_01[3] = "01";
|
||||
char country_code_string_CN[3] = "CN";
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_get_country_code"));
|
||||
TEST_ESP_OK(esp_wifi_get_country_code(&country_code_string[0]));
|
||||
TEST_ASSERT(country_code_string[0] == country_code_string_CN[0] && country_code_string[1] == country_code_string_CN[1]);
|
||||
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_country_code"));
|
||||
TEST_ESP_OK(esp_wifi_set_country_code(&country_code_string_01[0], false));
|
||||
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_get_country_code"));
|
||||
TEST_ESP_OK(esp_wifi_get_country_code(&country_code_string[0]));
|
||||
TEST_ASSERT(country_code_string[0] == country_code_string_01[0] && country_code_string[1] == country_code_string_01[1]);
|
||||
|
||||
|
||||
ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit"));
|
||||
TEST_ESP_OK(esp_wifi_deinit());
|
||||
ESP_LOGI(TAG, EMPH_STR("event_deinit"));
|
||||
TEST_ESP_OK(event_deinit());
|
||||
ESP_LOGI(TAG, EMPH_STR("nvs_flash_deinit..."));
|
||||
nvs_flash_deinit();
|
||||
|
||||
ESP_LOGI(TAG, "test passed...");
|
||||
xSemaphoreGive(*sema);
|
||||
vTaskSuspend(NULL);
|
||||
}
|
||||
|
||||
TEST_CASE("wifi set country code", "[wifi_init]")
|
||||
{
|
||||
TaskHandle_t th = NULL;
|
||||
SemaphoreHandle_t sema = xSemaphoreCreateBinary();
|
||||
TEST_ASSERT_NOT_NULL(sema);
|
||||
printf("Creating tasks\n");
|
||||
#ifndef CONFIG_FREERTOS_UNICORE
|
||||
xTaskCreatePinnedToCore(wifi_country_code_task, "wifi_country_code_task", 2048*2, &sema, 3, &th, 0);
|
||||
#else
|
||||
xTaskCreate(wifi_country_code_task, "wifi_country_code_task", 2048*2, &sema, 3, &th);
|
||||
#endif
|
||||
TEST_ASSERT_NOT_NULL(th);
|
||||
xSemaphoreTake(sema, portMAX_DELAY);
|
||||
vSemaphoreDelete(sema);
|
||||
sema = NULL;
|
||||
test_utils_task_delete(th);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e53efcf84ceb6fac315ccb1348d6950ac33af309
|
||||
Subproject commit 7d10144efdb14eb339a9e7ab59694f03d70e0eb9
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h> /* For NULL declaration */
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "hal/misc.h"
|
||||
|
@ -23,25 +24,27 @@ extern "C" {
|
|||
#define LCD_LL_EVENT_VSYNC_END (1 << 0)
|
||||
#define LCD_LL_EVENT_TRANS_DONE (1 << 1)
|
||||
|
||||
// Maximum coefficient of clock prescaler
|
||||
#define LCD_LL_CLOCK_PRESCALE_MAX (64)
|
||||
#define LCD_LL_CLK_FRAC_DIV_N_MAX 256 // LCD_CLK = LCD_CLK_S / (N + b/a), the N register is 8 bit-width
|
||||
#define LCD_LL_CLK_FRAC_DIV_AB_MAX 64 // LCD_CLK = LCD_CLK_S / (N + b/a), the a/b register is 6 bit-width
|
||||
#define LCD_LL_PCLK_DIV_MAX 64 // LCD_PCLK = LCD_CLK / MO, the MO register is 6 bit-width
|
||||
|
||||
#define LCD_LL_COLOR_RANGE_TO_REG(range) (uint8_t[]){0,1}[(range)]
|
||||
#define LCD_LL_CONV_STD_TO_REG(std) (uint8_t[]){0,1}[(std)]
|
||||
#define LCD_LL_YUV_SAMPLE_TO_REG(sample) (uint8_t[]){0,1,2}[(sample)]
|
||||
|
||||
static inline void lcd_ll_enable_clock(lcd_cam_dev_t *dev, bool en)
|
||||
{
|
||||
dev->lcd_clock.clk_en = en;
|
||||
}
|
||||
|
||||
static inline void lcd_ll_set_group_clock_src(lcd_cam_dev_t *dev, lcd_clock_source_t src, int div_num, int div_a, int div_b)
|
||||
/**
|
||||
* @brief Select clock source for LCD peripheral
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param src Clock source
|
||||
*/
|
||||
static inline void lcd_ll_select_clk_src(lcd_cam_dev_t *dev, lcd_clock_source_t src)
|
||||
{
|
||||
// lcd_clk = module_clock_src / (div_num + div_b / div_a)
|
||||
HAL_ASSERT(div_num >= 2 && div_num <= 256);
|
||||
// dic_num == 0 means 256 divider in hardware
|
||||
if (div_num >= 256) {
|
||||
div_num = 0;
|
||||
}
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(dev->lcd_clock, lcd_clkm_div_num, div_num);
|
||||
dev->lcd_clock.lcd_clkm_div_a = div_a;
|
||||
dev->lcd_clock.lcd_clkm_div_b = div_b;
|
||||
switch (src) {
|
||||
case LCD_CLK_SRC_PLL160M:
|
||||
dev->lcd_clock.lcd_clk_sel = 3;
|
||||
|
@ -53,13 +56,41 @@ static inline void lcd_ll_set_group_clock_src(lcd_cam_dev_t *dev, lcd_clock_sour
|
|||
dev->lcd_clock.lcd_clk_sel = 1;
|
||||
break;
|
||||
default:
|
||||
// disble LCD clock source
|
||||
// disable LCD clock source
|
||||
dev->lcd_clock.lcd_clk_sel = 0;
|
||||
HAL_ASSERT(false && "unsupported clock source");
|
||||
HAL_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set clock coefficient of LCD peripheral
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param div_num Integer part of the divider
|
||||
* @param div_a denominator of the divider
|
||||
* @param div_b numerator of the divider
|
||||
*/
|
||||
static inline void lcd_ll_set_group_clock_coeff(lcd_cam_dev_t *dev, int div_num, int div_a, int div_b)
|
||||
{
|
||||
// lcd_clk = module_clock_src / (div_num + div_b / div_a)
|
||||
HAL_ASSERT(div_num >= 2 && div_num <= LCD_LL_CLK_FRAC_DIV_N_MAX);
|
||||
// dic_num == 0 means LCD_LL_CLK_FRAC_DIV_N_MAX divider in hardware
|
||||
if (div_num >= LCD_LL_CLK_FRAC_DIV_N_MAX) {
|
||||
div_num = 0;
|
||||
}
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(dev->lcd_clock, lcd_clkm_div_num, div_num);
|
||||
dev->lcd_clock.lcd_clkm_div_a = div_a;
|
||||
dev->lcd_clock.lcd_clkm_div_b = div_b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the PCLK clock level state when there's no transaction undergoing
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param level 1 is high level, 0 is low level
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_clock_idle_level(lcd_cam_dev_t *dev, bool level)
|
||||
{
|
||||
|
@ -75,6 +106,7 @@ static inline void lcd_ll_set_pixel_clock_edge(lcd_cam_dev_t *dev, bool active_o
|
|||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_pixel_clock_prescale(lcd_cam_dev_t *dev, uint32_t prescale)
|
||||
{
|
||||
HAL_ASSERT(prescale <= LCD_LL_PCLK_DIV_MAX);
|
||||
// Formula: pixel_clk = lcd_clk / (1 + clkcnt_n)
|
||||
// clkcnt_n can't be zero
|
||||
uint32_t scale = 1;
|
||||
|
@ -92,6 +124,92 @@ static inline void lcd_ll_enable_rgb_yuv_convert(lcd_cam_dev_t *dev, bool en)
|
|||
dev->lcd_rgb_yuv.lcd_conv_bypass = en;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set convert data line width
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param width data line width (8 or 16)
|
||||
*/
|
||||
static inline void lcd_ll_set_convert_data_width(lcd_cam_dev_t *dev, uint32_t width)
|
||||
{
|
||||
HAL_ASSERT(width == 8 || width == 16);
|
||||
dev->lcd_rgb_yuv.lcd_conv_mode_8bits_on = (width == 8) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the color range of input data
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param range Color range
|
||||
*/
|
||||
static inline void lcd_ll_set_input_color_range(lcd_cam_dev_t *dev, lcd_color_range_t range)
|
||||
{
|
||||
dev->lcd_rgb_yuv.lcd_conv_data_in_mode = LCD_LL_COLOR_RANGE_TO_REG(range);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the color range of output data
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param range Color range
|
||||
*/
|
||||
static inline void lcd_ll_set_output_color_range(lcd_cam_dev_t *dev, lcd_color_range_t range)
|
||||
{
|
||||
dev->lcd_rgb_yuv.lcd_conv_data_out_mode = LCD_LL_COLOR_RANGE_TO_REG(range);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set YUV conversion standard
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param std YUV conversion standard
|
||||
*/
|
||||
static inline void lcd_ll_set_yuv_convert_std(lcd_cam_dev_t *dev, lcd_yuv_conv_std_t std)
|
||||
{
|
||||
dev->lcd_rgb_yuv.lcd_conv_protocol_mode = LCD_LL_CONV_STD_TO_REG(std);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the converter mode: RGB565 to YUV
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param yuv_sample YUV sample mode
|
||||
*/
|
||||
static inline void lcd_ll_set_convert_mode_rgb_to_yuv(lcd_cam_dev_t *dev, lcd_yuv_sample_t yuv_sample)
|
||||
{
|
||||
dev->lcd_rgb_yuv.lcd_conv_trans_mode = 1;
|
||||
dev->lcd_rgb_yuv.lcd_conv_yuv_mode = LCD_LL_YUV_SAMPLE_TO_REG(yuv_sample);
|
||||
dev->lcd_rgb_yuv.lcd_conv_yuv2yuv_mode = 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the converter mode: YUV to RGB565
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param yuv_sample YUV sample mode
|
||||
*/
|
||||
static inline void lcd_ll_set_convert_mode_yuv_to_rgb(lcd_cam_dev_t *dev, lcd_yuv_sample_t yuv_sample)
|
||||
{
|
||||
dev->lcd_rgb_yuv.lcd_conv_trans_mode = 0;
|
||||
dev->lcd_rgb_yuv.lcd_conv_yuv_mode = LCD_LL_YUV_SAMPLE_TO_REG(yuv_sample);
|
||||
dev->lcd_rgb_yuv.lcd_conv_yuv2yuv_mode = 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the converter mode: YUV to YUV
|
||||
*
|
||||
* @param dev LCD register base address
|
||||
* @param src_sample Source YUV sample mode
|
||||
* @param dst_sample Destination YUV sample mode
|
||||
*/
|
||||
static inline void lcd_ll_set_convert_mode_yuv_to_yuv(lcd_cam_dev_t *dev, lcd_yuv_sample_t src_sample, lcd_yuv_sample_t dst_sample)
|
||||
{
|
||||
HAL_ASSERT(src_sample != dst_sample);
|
||||
dev->lcd_rgb_yuv.lcd_conv_trans_mode = 1;
|
||||
dev->lcd_rgb_yuv.lcd_conv_yuv_mode = LCD_LL_YUV_SAMPLE_TO_REG(src_sample);
|
||||
dev->lcd_rgb_yuv.lcd_conv_yuv2yuv_mode = LCD_LL_YUV_SAMPLE_TO_REG(dst_sample);
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_phase_cycles(lcd_cam_dev_t *dev, uint32_t cmd_cycles, uint32_t dummy_cycles, uint32_t data_cycles)
|
||||
{
|
||||
|
|
|
@ -1,23 +1,52 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief LCD peripheral SOC layer handle
|
||||
*/
|
||||
typedef struct lcd_cam_dev_t *lcd_soc_handle_t;
|
||||
|
||||
/**
|
||||
* @brief LCD HAL layer context
|
||||
*/
|
||||
typedef struct {
|
||||
lcd_soc_handle_t dev;
|
||||
lcd_soc_handle_t dev; // SOC layer handle
|
||||
} lcd_hal_context_t;
|
||||
|
||||
/**
|
||||
* @brief LCD HAL layer initialization
|
||||
*
|
||||
* @param hal LCD HAL layer context
|
||||
* @param id LCD peripheral ID
|
||||
*/
|
||||
void lcd_hal_init(lcd_hal_context_t *hal, int id);
|
||||
|
||||
#define LCD_HAL_PCLK_FLAG_ALLOW_EQUAL_SYSCLK (1 << 0)
|
||||
|
||||
/**
|
||||
* @brief LCD PCLK clock calculation
|
||||
* @note Currently this function is only used by RGB LCD driver, I80 driver still uses a fixed clock division
|
||||
*
|
||||
* @param hal LCD HAL layer context
|
||||
* @param src_freq_hz LCD source clock frequency in Hz
|
||||
* @param expect_pclk_freq_hz Expected LCD PCLK frequency in Hz
|
||||
* @param lcd_clk_flags Extra flags to control LCD PCLK clock calculation, supported flags are prefixed with LCD_HAL_PCLK_FLAG_
|
||||
* @return Actual LCD PCLK frequency in Hz
|
||||
*/
|
||||
uint32_t lcd_hal_cal_pclk_freq(lcd_hal_context_t *hal, uint32_t src_freq_hz, uint32_t expect_pclk_freq_hz, int lcd_clk_flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,39 @@ typedef enum {
|
|||
LCD_CLK_SRC_XTAL, /*!< Select XTAL as the source clock */
|
||||
} lcd_clock_source_t;
|
||||
|
||||
/**
|
||||
* @brief LCD color space
|
||||
*/
|
||||
typedef enum {
|
||||
LCD_COLOR_SPACE_RGB, /*!< Color space: RGB */
|
||||
LCD_COLOR_SPACE_YUV, /*!< Color space: YUV */
|
||||
} lcd_color_space_t;
|
||||
|
||||
/**
|
||||
* @brief LCD color range
|
||||
*/
|
||||
typedef enum {
|
||||
LCD_COLOR_RANGE_LIMIT, /*!< Limited color range */
|
||||
LCD_COLOR_RANGE_FULL, /*!< Full color range */
|
||||
} lcd_color_range_t;
|
||||
|
||||
/**
|
||||
* @brief YUV sampling method
|
||||
*/
|
||||
typedef enum {
|
||||
LCD_YUV_SAMPLE_422, /*!< YUV 4:2:2 sampling */
|
||||
LCD_YUV_SAMPLE_420, /*!< YUV 4:2:0 sampling */
|
||||
LCD_YUV_SAMPLE_411, /*!< YUV 4:1:1 sampling */
|
||||
} lcd_yuv_sample_t;
|
||||
|
||||
/**
|
||||
* @brief The standard used for conversion between RGB and YUV
|
||||
*/
|
||||
typedef enum {
|
||||
LCD_YUV_CONV_STD_BT601, /*!< YUV<->RGB conversion standard: BT.601 */
|
||||
LCD_YUV_CONV_STD_BT709, /*!< YUV<->RGB conversion standard: BT.709 */
|
||||
} lcd_yuv_conv_std_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,69 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "hal/lcd_hal.h"
|
||||
#include "hal/lcd_ll.h"
|
||||
#include "hal/log.h"
|
||||
|
||||
void lcd_hal_init(lcd_hal_context_t *hal, int id)
|
||||
{
|
||||
hal->dev = LCD_LL_GET_HW(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief helper function, calculate the Greatest Common Divisor
|
||||
* @note gcd(a, b) = gcd(b, a % b)
|
||||
* @param a bigger value
|
||||
* @param b smaller value
|
||||
* @return result of gcd(a, b)
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline uint32_t _gcd(uint32_t a, uint32_t b)
|
||||
{
|
||||
uint32_t c = a % b;
|
||||
while (c != 0) {
|
||||
a = b;
|
||||
b = c;
|
||||
c = a % b;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
uint32_t lcd_hal_cal_pclk_freq(lcd_hal_context_t *hal, uint32_t src_freq_hz, uint32_t expect_pclk_freq_hz, int lcd_clk_flags)
|
||||
{
|
||||
// lcd_clk = module_clock_src / (n + b / a)
|
||||
// pixel_clk = lcd_clk / mo
|
||||
uint32_t mo = src_freq_hz / expect_pclk_freq_hz / LCD_LL_CLK_FRAC_DIV_N_MAX + 1;
|
||||
if (mo == 1 && !(lcd_clk_flags & LCD_HAL_PCLK_FLAG_ALLOW_EQUAL_SYSCLK)) {
|
||||
mo = 2;
|
||||
}
|
||||
uint32_t n = src_freq_hz / expect_pclk_freq_hz / mo;
|
||||
uint32_t a = 0;
|
||||
uint32_t b = 0;
|
||||
// delta_hz / expect_pclk_freq_hz <==> b / a
|
||||
uint32_t delta_hz = src_freq_hz / mo - expect_pclk_freq_hz * n;
|
||||
// fractional divider
|
||||
if (delta_hz) {
|
||||
uint32_t gcd = _gcd(expect_pclk_freq_hz, delta_hz);
|
||||
a = expect_pclk_freq_hz / gcd;
|
||||
b = delta_hz / gcd;
|
||||
// normalize div_a and div_b
|
||||
uint32_t d = a / LCD_LL_CLK_FRAC_DIV_AB_MAX + 1;
|
||||
a /= d;
|
||||
b /= d;
|
||||
}
|
||||
|
||||
HAL_EARLY_LOGD("lcd_hal", "n=%d,a=%d,b=%d,mo=%d", n, a, b, mo);
|
||||
|
||||
lcd_ll_set_group_clock_coeff(hal->dev, n, a, b);
|
||||
lcd_ll_set_pixel_clock_prescale(hal->dev, mo);
|
||||
|
||||
if (delta_hz) {
|
||||
return ((uint64_t)src_freq_hz * a) / (n * a + b) / mo;
|
||||
} else {
|
||||
return src_freq_hz / n / mo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,8 @@ entries:
|
|||
cpu_hal (noflash)
|
||||
soc_hal (noflash)
|
||||
wdt_hal_iram (noflash)
|
||||
if IDF_TARGET_ESP32C3 = n && IDF_TARGET_ESP32H2 = n:
|
||||
if TWAI_ISR_IN_IRAM = y:
|
||||
twai_hal_iram (noflash)
|
||||
else:
|
||||
twai_hal_iram (default)
|
||||
if TWAI_ISR_IN_IRAM = y:
|
||||
twai_hal_iram (noflash)
|
||||
if IDF_TARGET_ESP32 = n:
|
||||
spi_flash_hal_gpspi (noflash)
|
||||
systimer_hal (noflash)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 27eb4726067465c5c67d4ecdca5ddccd26f02580
|
||||
Subproject commit 60983d1dd54196b1e3f399c6f928d77256ec742a
|
|
@ -52,7 +52,7 @@ typedef struct protocomm_ble_config {
|
|||
/**
|
||||
* BLE device name being broadcast at the time of provisioning
|
||||
*/
|
||||
char device_name[MAX_BLE_DEVNAME_LEN];
|
||||
char device_name[MAX_BLE_DEVNAME_LEN + 1];
|
||||
|
||||
/**
|
||||
* 128 bit UUID of the provisioning service
|
||||
|
|
|
@ -226,6 +226,7 @@
|
|||
#define SOC_SPI_DMA_CHAN_NUM 2
|
||||
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 3
|
||||
#define SOC_SPI_MAX_CS_NUM 3
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
#define SOC_SPI_MAX_PRE_DIVIDER 8192
|
||||
|
|
|
@ -212,6 +212,7 @@
|
|||
/*-------------------------- SPI CAPS ----------------------------------------*/
|
||||
#define SOC_SPI_PERIPH_NUM 2
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 6
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/spi_periph.h"
|
||||
#include "stddef.h"
|
||||
|
@ -54,7 +46,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
|||
.spiq_in = FSPIQ_IN_IDX,
|
||||
.spiwp_in = FSPIWP_IN_IDX,
|
||||
.spihd_in = FSPIHD_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = SPI2_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = SPI2_IOMUX_PIN_NUM_MOSI,
|
||||
|
|
|
@ -197,6 +197,7 @@
|
|||
/*-------------------------- SPI CAPS ----------------------------------------*/
|
||||
#define SOC_SPI_PERIPH_NUM 2
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 6
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/spi_periph.h"
|
||||
#include "stddef.h"
|
||||
|
@ -54,7 +46,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
|||
.spiq_in = FSPIQ_IN_IDX,
|
||||
.spiwp_in = FSPIWP_IN_IDX,
|
||||
.spihd_in = FSPIHD_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = SPI2_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = SPI2_IOMUX_PIN_NUM_MOSI,
|
||||
|
|
|
@ -203,9 +203,10 @@
|
|||
#define SOC_SIGMADELTA_CHANNEL_NUM (8) // 8 channels
|
||||
|
||||
/*-------------------------- SPI CAPS ----------------------------------------*/
|
||||
#define SOC_SPI_PERIPH_NUM 3
|
||||
#define SOC_SPI_DMA_CHAN_NUM 3
|
||||
#define SOC_SPI_PERIPH_NUM 3
|
||||
#define SOC_SPI_DMA_CHAN_NUM 3
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) (((i)==0)? 2: (((i)==1)? 6: 3))
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 72
|
||||
#define SOC_SPI_MAX_PRE_DIVIDER 8192
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/spi_periph.h"
|
||||
#include "stddef.h"
|
||||
|
@ -62,7 +54,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
|||
.spid5_in = FSPIIO5_IN_IDX,
|
||||
.spid6_in = FSPIIO6_IN_IDX,
|
||||
.spid7_in = FSPIIO7_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = FSPI_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = FSPI_IOMUX_PIN_NUM_MOSI,
|
||||
|
|
|
@ -181,6 +181,7 @@
|
|||
#define SOC_LCD_RGB_PANELS (1) /*!< Support one RGB LCD panel */
|
||||
#define SOC_LCD_I80_BUS_WIDTH (16) /*!< Intel 8080 bus width */
|
||||
#define SOC_LCD_RGB_DATA_WIDTH (16) /*!< Number of LCD data lines */
|
||||
#define SOC_LCD_SUPPORT_RGB_YUV_CONV (1) /*!< Support color format conversion between RGB and YUV */
|
||||
|
||||
/*-------------------------- RTC CAPS --------------------------------------*/
|
||||
#define SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH (128)
|
||||
|
@ -208,6 +209,7 @@
|
|||
#define SOC_SPI_PERIPH_NUM 3
|
||||
#define SOC_SPI_DMA_CHAN_NUM 3
|
||||
#define SOC_SPI_PERIPH_CS_NUM(i) 3
|
||||
#define SOC_SPI_MAX_CS_NUM 6
|
||||
#define SOC_SPI_MAXIMUM_BUFFER_SIZE 64
|
||||
#define SOC_SPI_SUPPORT_DDRCLK 1
|
||||
#define SOC_SPI_SLAVE_SUPPORT_SEG_TRANS 1
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/spi_periph.h"
|
||||
#include "stddef.h"
|
||||
|
@ -62,7 +54,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
|||
.spid5_in = FSPIIO5_IN_IDX,
|
||||
.spid6_in = FSPIIO6_IN_IDX,
|
||||
.spid7_in = FSPIIO7_IN_IDX,
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
|
||||
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX, FSPICS3_OUT_IDX, FSPICS4_OUT_IDX, FSPICS5_OUT_IDX},
|
||||
.spics_in = FSPICS0_IN_IDX,
|
||||
.spiclk_iomux_pin = SPI2_IOMUX_PIN_NUM_CLK,
|
||||
.spid_iomux_pin = SPI2_IOMUX_PIN_NUM_MOSI,
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef struct {
|
|||
const uint8_t spid6_in;
|
||||
const uint8_t spid7_in;
|
||||
#endif // SOC_SPI_SUPPORT_OCT
|
||||
const uint8_t spics_out[3]; // /CS GPIO output mux signals
|
||||
const uint8_t spics_out[SOC_SPI_MAX_CS_NUM]; // /CS GPIO output mux signals
|
||||
const uint8_t spics_in;
|
||||
const uint8_t spidqs_out;
|
||||
const uint8_t spicd_out;
|
||||
|
|
|
@ -95,7 +95,7 @@ typedef void(*tusb_cdcacm_callback_t)(int itf, cdcacm_event_t *event);
|
|||
typedef struct {
|
||||
tinyusb_usbdev_t usb_dev; /*!< Usb device to set up */
|
||||
tinyusb_cdcacm_itf_t cdc_port; /*!< CDC port */
|
||||
size_t rx_unread_buf_sz; /*!< Amount of data that can be passed to the AMC at once */
|
||||
size_t rx_unread_buf_sz; /*!< Amount of data that can be passed to the ACM at once */
|
||||
tusb_cdcacm_callback_t callback_rx; /*!< Pointer to the function with the `tusb_cdcacm_callback_t` type that will be handled as a callback */
|
||||
tusb_cdcacm_callback_t callback_rx_wanted_char; /*!< Pointer to the function with the `tusb_cdcacm_callback_t` type that will be handled as a callback */
|
||||
tusb_cdcacm_callback_t callback_line_state_changed; /*!< Pointer to the function with the `tusb_cdcacm_callback_t` type that will be handled as a callback */
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef struct {
|
|||
tinyusb_usbdev_t usb_dev; /*!< USB device to set up */
|
||||
tusb_class_code_t cdc_class; /*!< CDC device class : Communications or Data device */
|
||||
union {
|
||||
cdc_comm_sublcass_type_t comm_subclass; /*!< Communications device subclasses: AMC, ECM, etc. */
|
||||
cdc_comm_sublcass_type_t comm_subclass; /*!< Communications device subclasses: ACM, ECM, etc. */
|
||||
cdc_data_sublcass_type_t data_subclass; /*!< Data device has only one subclass.*/
|
||||
} cdc_subclass; /*!< CDC device subclass according to Class Definitions for Communications Devices the CDC v.1.20 */
|
||||
} tinyusb_config_cdc_t; /*!< Main configuration structure of a CDC device */
|
||||
|
@ -50,7 +50,7 @@ typedef struct {
|
|||
tinyusb_usbdev_t usb_dev; /*!< USB device used for the instance */
|
||||
tusb_class_code_t type;
|
||||
union {
|
||||
cdc_comm_sublcass_type_t comm_subclass; /*!< Communications device subclasses: AMC, ECM, etc. */
|
||||
cdc_comm_sublcass_type_t comm_subclass; /*!< Communications device subclasses: ACM, ECM, etc. */
|
||||
cdc_data_sublcass_type_t data_subclass; /*!< Data device has only one subclass.*/
|
||||
} cdc_subclass; /*!< CDC device subclass according to Class Definitions for Communications Devices the CDC v.1.20 */
|
||||
void *subclass_obj; /*!< Dynamically allocated subclass specific object */
|
||||
|
|
|
@ -36,7 +36,7 @@ typedef struct {
|
|||
tusb_cdcacm_callback_t callback_rx_wanted_char;
|
||||
tusb_cdcacm_callback_t callback_line_state_changed;
|
||||
tusb_cdcacm_callback_t callback_line_coding_changed;
|
||||
} esp_tusb_cdcacm_t; /*!< CDC_AMC object */
|
||||
} esp_tusb_cdcacm_t; /*!< CDC_ACM object */
|
||||
|
||||
static const char *TAG = "tusb_cdc_acm";
|
||||
|
||||
|
|
|
@ -57,4 +57,16 @@ There are several limitations to the USB console feature. These may or may not b
|
|||
|
||||
3. The behaviour between an actual USB-to-serial bridge chip and the USB Serial/JTAG Controller is slightly different if the ESP-IDF application does not listen for incoming bytes. An USB-to-serial bridge chip will just send the bytes to a (not listening) chip, while the USB Serial/JTAG Controller will block until the application reads the bytes. This can lead to a non-responsive looking terminal program.
|
||||
|
||||
4. If the application enters light-sleep (including automatic light-sleep) or software reset, etc. The USB CDC device will still work on the system. But be aware that this might increase the power consumption, if you don't need USB CDC in sleep and want to keep low power consumption, please disable the menuconfig ``CONFIG_RTC_CLOCK_BBPLL_POWER_ON_WITH_USB``. Moreover, the power consumption will only increase when your USB CDC port is really in use (like data transaction), therefore, if your USB CDC just connects with power bank or battery, rather than something like computer, you don't need to care about the increasing power consumption mentioned above.
|
||||
4. The USB CDC device won't work in sleep modes as normal due to the lack of APB clock in sleep modes. This includes deep-sleep, light-sleep (automataic light-sleep as well).
|
||||
|
||||
5. The power consumption in sleep modes will be higher if the USB CDC device is in use.
|
||||
|
||||
This is because we want to keep the USB CDC device alive during software reset by default.
|
||||
|
||||
However there is an issue that this might also increase the power consumption in sleep modes. This is because the software keeps a clock source on during the reset to keep the USB CDC device alive. As a side-effect, the clock is also kept on during sleep modes. There is one exception: the clock will only be kept on when your USB CDC port is really in use (like data transaction), therefore, if your USB CDC is connected to power bank or battery, etc., instead of a valid USB host (for example, a PC), the power consumption will not increase.
|
||||
|
||||
If you still want to keep low power consumption in sleep modes:
|
||||
|
||||
1. If you are not using the USB CDC port, you don't need to do anything. Software will detect if the CDC device is connected to a valid host before going to sleep, and keep the clocks only when the host is connected. Otherwise the clocks will be turned off as normal.
|
||||
|
||||
2. If you are using the USB CDC port, please disable the menuconfig option ``CONFIG_RTC_CLOCK_BBPLL_POWER_ON_WITH_USB``. The clock will be switched off as normal during software reset and in sleep modes. In these cases, the USB CDC device may be unplugged from the host.
|
||||
|
|
|
@ -1301,98 +1301,111 @@ When to Use LR
|
|||
|
||||
The general conditions for using LR are:
|
||||
|
||||
- Both the AP and station are devices.
|
||||
- Both the AP and station are Espressif devices.
|
||||
- Long distance Wi-Fi connection and data transmission is required.
|
||||
- Data throughput requirements are very small, such as remote device control, etc.
|
||||
|
||||
Wi-Fi Country Code
|
||||
+++++++++++++++++++++++++
|
||||
|
||||
Call :cpp:func:`esp_wifi_set_country()` to set the country info.
|
||||
The table below describes the fields in detail, please consult local 2.4 GHz RF operating regulations before configuring these fields.
|
||||
Call :cpp:func:`esp_wifi_set_country()` to set the country info. The table below describes the fields in detail. Please consult local 2.4 GHz RF operating regulations before configuring these fields.
|
||||
|
||||
+------------------+-----------------------------------------------------------------------------------+
|
||||
| Field | Description |
|
||||
+==================+===================================================================================+
|
||||
| cc[3] | Country code string, this attributes identify the country or noncountry entity |
|
||||
| | in which the station/AP is operating. If it's a country, the first two |
|
||||
| | octets of this string is the two character country info as described in document |
|
||||
| | ISO/IEC3166-1. The third octect is one of the following: |
|
||||
| | |
|
||||
| | - an ASCII space character, if the regulations under which the station/AP is |
|
||||
| | operating encompass all environments for the current frequency band in the |
|
||||
| | country. |
|
||||
| | - an ASCII 'O' character if the regulations under which the station/AP is |
|
||||
| | operating are for an outdoor environment only. |
|
||||
| | - an ASCII 'I' character if the regulations under which the station/AP is |
|
||||
| | operating are for an indoor environment only. |
|
||||
| | - an ASCII 'X' character if the station/AP is operating under a noncountry |
|
||||
| | entity. The first two octets of the noncountry entity is two ASCII 'XX' |
|
||||
| | characters. |
|
||||
| | - the binary representation of the Operating Class table number currently in use.|
|
||||
| | Refer to Annex E, IEEE Std 802.11-2012. |
|
||||
| | |
|
||||
+------------------+-----------------------------------------------------------------------------------+
|
||||
| schan | Start channel, it's the minimum channel number of the regulations under which the |
|
||||
| | station/AP can operate. |
|
||||
| | |
|
||||
+------------------+-----------------------------------------------------------------------------------+
|
||||
| nchan | Total number of channels as per the regulations, e.g. if the schan=1, nchan=13, |
|
||||
| | it means the station/AP can send data from channel 1 to 13. |
|
||||
| | |
|
||||
+------------------+-----------------------------------------------------------------------------------+
|
||||
| policy | Country policy, this field control which country info will be used if the |
|
||||
| | configured country info is conflict with the connected AP's. More description |
|
||||
| | about policy is provided in following section. |
|
||||
| | |
|
||||
+------------------+-----------------------------------------------------------------------------------+
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 15 55
|
||||
|
||||
The default country info is {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO}, if the Wi-Fi Mode is station/AP coexist mode, they share the same configured country info. Sometimes, the country info of AP, to which the station is connected, is different from the country info of configured. For example, the configured station has country info {.cc="JP", .schan=1, .nchan=14, policy=WIFI_COUNTRY_POLICY_AUTO}, but the connected AP has country info {.cc="CN", .schan=1, .nchan=13}, then country info of connected AP's is used.
|
||||
Following table depicts which country info is used in different Wi-Fi Mode and different country policy, also describe the impact to active scan.
|
||||
* - Field
|
||||
- Description
|
||||
* - cc[3]
|
||||
- Country code string. This attribute identifies the country or noncountry entity in which the station/AP is operating. If it is a country, the first two octets of this string is the two-character country info as described in the document ISO/IEC3166-1. The third octect is one of the following:
|
||||
|
||||
- an ASCII space character, which means the regulations under which the station/AP is operating encompass all environments for the current frequency band in the country.
|
||||
- an ASCII ‘O’ character, which means the regulations under which the station/AP is operating are for an outdoor environment only.
|
||||
- an ASCII ‘I’ character, which means the regulations under which the station/AP is operating are for an indoor environment only.
|
||||
- an ASCII ‘X’ character, which means the station/AP is operating under a noncountry entity. The first two octets of the noncountry entity is two ASCII ‘XX’ characters.
|
||||
- the binary representation of the Operating Class table number currently in use. Refer to Annex E of IEEE Std 802.11-2020.
|
||||
|
||||
* - schan
|
||||
- Start channel. It is the minimum channel number of the regulations under which the station/AP can operate.
|
||||
* - nchan
|
||||
- Total number of channels as per the regulations. For example, if the schan=1, nchan=13, then the station/AP can send data from channel 1 to 13.
|
||||
* - policy
|
||||
- Country policy. This field controls which country info will be used if the configured country info is in conflict with the connected AP’s. For more details on related policies, see the following section.
|
||||
|
||||
|
||||
The default country info is::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "CN",
|
||||
.schan = 1,
|
||||
.nchan = 13,
|
||||
.policy = WIFI_COUNTRY_POLICY_AUTO,
|
||||
};
|
||||
|
||||
If the Wi-Fi Mode is station/AP coexist mode, they share the same configured country info. Sometimes, the country info of AP, to which the station is connected, is different from the country info of configured. For example, the configured station has country info::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "JP",
|
||||
.schan = 1,
|
||||
.nchan = 14,
|
||||
.policy = WIFI_COUNTRY_POLICY_AUTO,
|
||||
};
|
||||
|
||||
but the connected AP has country info::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "CN",
|
||||
.schan = 1,
|
||||
.nchan = 13,
|
||||
};
|
||||
|
||||
then country info of connected AP's is used.
|
||||
|
||||
The following table depicts which country info is used in different Wi-Fi modes and different country policies, and it also describes the impact on active scan.
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 15 15 35
|
||||
|
||||
* - Wi-Fi Mode
|
||||
- Policy
|
||||
- Description
|
||||
* - Station
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- If the connected AP has country IE in its beacon, the country info equals to the country info in beacon. Otherwise, use the default country info.
|
||||
|
||||
For scan:
|
||||
|
||||
Use active scan from 1 to 11 and use passive scan from 12 to 14.
|
||||
|
||||
Always keep in mind that if an AP with hidden SSID and station is set to a passive scan channel, the passive scan will not find it. In other words, if the application hopes to find the AP with hidden SSID in every channel, the policy of country info should be configured to WIFI_COUNTRY_POLICY_MANUAL.
|
||||
|
||||
* - Station
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- Always use the configured country info.
|
||||
|
||||
For scan:
|
||||
|
||||
Use active scan from schan to schan+nchan-1.
|
||||
|
||||
* - AP
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- Always use the configured country info.
|
||||
|
||||
* - AP
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- Always use the configured country info.
|
||||
|
||||
* - Station/AP-coexistence
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- Station: Same as station mode with policy WIFI_COUNTRY_POLICY_AUTO.
|
||||
AP: If the station does not connect to any external AP, the AP uses the configured country info. If the station connects to an external AP, the AP has the same country info as the station.
|
||||
|
||||
* - Station/AP-coexistence
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- Station: Same as station mode with policy WIFI_COUNTRY_POLICY_MANUAL.
|
||||
AP: Same as AP mode with policy WIFI_COUNTRY_POLICY_MANUAL.
|
||||
|
||||
+-----------+----------------------------+----------------------------------------------------------------+
|
||||
| WiFi Mode | Policy | Description |
|
||||
+===========+============================+================================================================+
|
||||
| Station | WIFI_COUNTRY_POLICY_AUTO | If the connected AP has country IE in its beacon, the country |
|
||||
| | | info equals to the country info in beacon, otherwise, use |
|
||||
| | | default country info. |
|
||||
| | | |
|
||||
| | | For scan: |
|
||||
| | | |
|
||||
| | | -If schan+nchan-1 >11 : |
|
||||
| | | Use active scan from schan to 11 and use passive scan |
|
||||
| | | from 12 to schan+nchan-1. |
|
||||
| | | |
|
||||
| | | -If schan+nchan-1 <= 11 : |
|
||||
| | | Use active scan from schan to schan+nchan-1. |
|
||||
| | | |
|
||||
| | | Always keep in mind that if an AP with hidden SSID |
|
||||
| | | is set to a passive scan channel, the passive scan will not |
|
||||
| | | find it. In other words, if the application hopes to find the |
|
||||
| | | AP with hidden SSID in every channel, the policy of |
|
||||
| | | country info should be configured to |
|
||||
| | | WIFI_COUNTRY_POLICY_MANUAL. |
|
||||
| | | |
|
||||
+-----------+----------------------------+----------------------------------------------------------------+
|
||||
| Station | WIFI_COUNTRY_POLICY_MANUAL | Always use the configured country info. |
|
||||
| | | |
|
||||
| | | For scan, scans channel "schan" to "schan+nchan-1" with active |
|
||||
| | | scan. |
|
||||
| | | |
|
||||
+-----------+----------------------------+----------------------------------------------------------------+
|
||||
| AP | WIFI_COUNTRY_POLICY_AUTO | Always use the configured country info. |
|
||||
| | | |
|
||||
+-----------+----------------------------+----------------------------------------------------------------+
|
||||
| AP | WIFI_COUNTRY_POLICY_MANUAL | Always use the configured country info. |
|
||||
| | | |
|
||||
+-----------+----------------------------+----------------------------------------------------------------+
|
||||
|Station/AP-| WIFI_COUNTRY_POLICY_AUTO | If the station doesn't connects to any AP, the AP use the |
|
||||
| | | configured country info. |
|
||||
|coexistence| | If the station connects to an AP, the AP has the same |
|
||||
| | | country info as the station. |
|
||||
| | | |
|
||||
| | | Same as station mode with policy WIFI_COUNTRY_POLICY_AUTO. |
|
||||
+-----------+----------------------------+----------------------------------------------------------------+
|
||||
|
||||
Home Channel
|
||||
*************************
|
||||
|
|
|
@ -1189,74 +1189,111 @@ LR 吞吐量
|
|||
|
||||
通常使用 LR 的场景包括:
|
||||
|
||||
- AP 和 station 都是设备。
|
||||
- AP 和 station 都是乐鑫设备。
|
||||
- 需要长距离 Wi-Fi 连接和数据传输。
|
||||
- 数据吞吐量要求非常小,例如远程设备控制等。
|
||||
|
||||
Wi-Fi 国家/地区代码
|
||||
+++++++++++++++++++++++++
|
||||
|
||||
调用 :cpp:func:`esp_wifi_set_country()`,设置国家/地区信息。下表详细介绍了各个字段,请在配置这些字段之前参考当地的 2.4GHz RF 操作规定。
|
||||
调用 :cpp:func:`esp_wifi_set_country()`,设置国家/地区信息。下表详细介绍了各个字段,请在配置这些字段之前参考当地的 2.4 GHz RF 操作规定。
|
||||
|
||||
+--------+----------------------------------------------------------------------------------------------------------------+
|
||||
| 字段 | 描述 |
|
||||
+--------+----------------------------------------------------------------------------------------------------------------+
|
||||
| cc[3] | 国家/地区代码字符串,此属性标识 station/AP |
|
||||
| | 位于的国家/地区或非国家/地区实体。如果是一个国家/地区,该字符串的前两个八位字节是 |
|
||||
| | ISO/IEC3166-1 中规定的国家/地区两位字母代码。第三个八位字节应是下述之一: |
|
||||
| | |
|
||||
| | -ASCII 码空格字符,代表 station/AP 所处国家/地区的规定允许当前频段所需的所有环境。 |
|
||||
| | |
|
||||
| | -ASCII 码 'O' 字符,代表 station/AP 所处国家/地区的规定仅允许室外环境。 |
|
||||
| | |
|
||||
| | -ASCII 码 'I' 字符,代表 station/AP 所处国家/地区的规定仅允许室内环境。 |
|
||||
| | |
|
||||
| | -ASCII 码 'X' 字符,代表 station/AP 位于非国家/地区实体。非国家实体的前两个八位字节是两个ASCII 码 'XX' 字符。 |
|
||||
| | |
|
||||
| | -当前使用的操作类表编号的二进制形式。见 IEEE Std 802.11-2012 附件 E。 |
|
||||
+--------+----------------------------------------------------------------------------------------------------------------+
|
||||
| schan | 起始信道,station/AP 所处国家/地区规定的最小信道数。 |
|
||||
+--------+----------------------------------------------------------------------------------------------------------------+
|
||||
| nchan | 规定的总信道数,比如,如果 schan=1,nchan=13,那么 station/AP 可以从信道 1 至 13 发送数据。 |
|
||||
+--------+----------------------------------------------------------------------------------------------------------------+
|
||||
| policy | 国家/地区政策,当配置的国家/地区信息与所连 AP |
|
||||
| | 的国家/地区信息冲突时,该字段决定使用哪一信息。更多政策相关信息,可参见下文。 |
|
||||
+--------+----------------------------------------------------------------------------------------------------------------+
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 15 55
|
||||
|
||||
默认国家/地区信息为 {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO},如果 Wi-Fi 模式为 AP-STA 共存模式,则它们配置的国家/地区信息相同。有时,station 所连 AP 的国家/地区信息与配置的不同。例如,配置的 station 国家/地区信息为 {.cc="JP", .schan=1, .nchan=14, policy=WIFI_COUNTRY_POLICY_AUTO},但所连 AP 的国家/地区信息为 {.cc="CN", .schan=1, .nchan=13},此时,使用 AP 的国家/地区信息。
|
||||
下表描述了在不同 Wi-Fi 模式和不同国家/地区政策下使用的国家/地区信息,并描述了对主动扫描的影响。
|
||||
* - 字段
|
||||
- 描述
|
||||
* - cc[3]
|
||||
- 国家/地区代码字符串,此属性标识 station/AP 位于的国家/地区或非国家/地区实体。如果是一个国家/地区,该字符串的前两个八位字节是 ISO/IEC3166-1 中规定的国家/地区两位字母代码。第三个八位字节应是下述之一:
|
||||
|
||||
- ASCII 码空格字符,代表 station/AP 所处国家/地区的规定允许当前频段所需的所有环境。
|
||||
- ASCII 码 ‘O’ 字符,代表 station/AP 所处国家/地区的规定仅允许室外环境。
|
||||
- ASCII 码 ‘I’ 字符,代表 station/AP 所处国家/地区的规定仅允许室内环境。
|
||||
- ASCII 码 ‘X’ 字符,代表 station/AP 位于非国家/地区实体。非国家实体的前两个八位字节是两个 ASCII 码 ‘XX’ 字符。
|
||||
- 当前使用的操作类表编号的二进制形式。见 IEEE Std 802.11-2020 附件 E。
|
||||
|
||||
* - schan
|
||||
- 起始信道,station/AP 所处国家/地区规定的最小信道值。
|
||||
* - nchan
|
||||
- 规定的总信道数,比如,如果 schan=1,nchan=13,那么 station/AP 可以从信道 1 至 13 发送数据。
|
||||
* - policy
|
||||
- 国家/地区策略,当配置的国家/地区信息与所连 AP 的国家/地区信息冲突时,该字段决定使用哪一信息。更多策略相关信息,可参见下文。
|
||||
|
||||
|
||||
默认国家/地区信息为::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "CN",
|
||||
.schan = 1,
|
||||
.nchan = 13,
|
||||
.policy = WIFI_COUNTRY_POLICY_AUTO,
|
||||
};
|
||||
|
||||
如果 Wi-Fi 模式为 station/AP 共存模式,则它们配置的国家/地区信息相同。有时,station 所连 AP 的国家/地区信息与配置的不同。例如,配置的 station 国家/地区信息为::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "JP",
|
||||
.schan = 1,
|
||||
.nchan = 14,
|
||||
.policy = WIFI_COUNTRY_POLICY_AUTO,
|
||||
};
|
||||
|
||||
但所连 AP 的国家/地区信息为::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "CN",
|
||||
.schan = 1,
|
||||
.nchan = 13,
|
||||
};
|
||||
|
||||
此时,使用所连 AP 的国家/地区信息。
|
||||
|
||||
下表描述了在不同 Wi-Fi 模式和不同国家/地区策略下使用的国家/地区信息,并描述了对主动扫描的影响。
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 15 15 35
|
||||
|
||||
* - Wi-Fi 模式
|
||||
- 策略
|
||||
- 描述
|
||||
* - station 模式
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- 如果所连 AP 的 beacon 中有国家/地区的 IE,使用的国家/地区信息为 beacon 中的信息,否则,使用默认信息。
|
||||
|
||||
扫描时:
|
||||
|
||||
主动扫描信道 1 至信道 11,被动扫描信道 12 至 信道 14。
|
||||
|
||||
请记住,如果带有隐藏 SSID 的 AP 和 station 被设置在被动扫描信道上,被动扫描将无法找到该 AP。也就是说,如果应用程序希望在每个信道中找到带有隐藏 SSID 的 AP,国家/地区信息应该配置为 WIFI_COUNTRY_POLICY_MANUAL。
|
||||
|
||||
* - station 模式
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- 总是使用配置的国家/地区信息。
|
||||
|
||||
扫描时:
|
||||
|
||||
主动扫描信道 schan 至信道 schan+nchan-1。
|
||||
|
||||
* - AP 模式
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- 总是使用配置的国家/地区信息。
|
||||
|
||||
* - AP 模式
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- 总是使用配置的国家/地区信息。
|
||||
|
||||
* - station/AP 共存模式
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- 该 station 与 station 模式、WIFI_COUNTRY_POLICY_AUTO 策略下使用的国家/地区信息相同。
|
||||
如果 station 不连接任何外部 AP,AP 使用配置的国家/地区信息。如果 station 连接一个外部 AP,该 AP 的国家/地区信息与该 station 相同。
|
||||
|
||||
* - station/AP 共存模式
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- 该 station 与 station 模式、WIFI_COUNTRY_POLICY_MANUAL 策略下使用的国家/地区信息相同。
|
||||
该 AP 与 AP 模式、WIFI_COUNTRY_POLICY_MANUAL 策略下使用的国家/地区信息相同。
|
||||
|
||||
+---------------------+----------------------------+------------------------------------------------------------------------------+
|
||||
| Wi-Fi 模式 | 政策 | 描述 |
|
||||
+---------------------+----------------------------+------------------------------------------------------------------------------+
|
||||
| Station 模式 | WIFI_COUNTRY_POLICY_AUTO | 如果所连 AP 的 beacon 中有国家/地区的 IE,使用的国家/地区信息为 beacon |
|
||||
| | | 中的信息,否则,使用默认信息。 |
|
||||
| | | |
|
||||
| | | 扫描时: |
|
||||
| | | |
|
||||
| | | -如果 schan+nchan-1>11, |
|
||||
| | | 主动扫描起始信道至信道 11,被动扫描信道 12 至 信道 |
|
||||
| | | schan+nchan-1。 |
|
||||
| | | |
|
||||
| | | -如果 schan+nchan-1<=11, |
|
||||
| | | 主动扫描起始信道至信道 schan+nchan-1。 |
|
||||
| | | |
|
||||
| | | 请记住,如果 AP 带有隐藏 SSID |
|
||||
| | | 且被设置为被动扫描信道,被动扫描将无法找到该 |
|
||||
| | | AP。也就是说,如果应用程序希望在每个信道中找到带有隐藏 |
|
||||
| | | SSID 的 AP,国家/地区信息应该配置为 |
|
||||
| | | WIFI_COUNTRY_POLICY_MANUAL。 |
|
||||
+---------------------+----------------------------+------------------------------------------------------------------------------+
|
||||
| Station 模式 | WIFI_COUNTRY_POLICY_MANUAL | 总是使用配置的国家/地区信息。 扫描时,主动扫描起始信道至信道 schan+nchan-1。 |
|
||||
+---------------------+----------------------------+------------------------------------------------------------------------------+
|
||||
| AP 模式 | WIFI_COUNTRY_POLICY_AUTO | 总是使用配置的国家/地区信息。 |
|
||||
+---------------------+----------------------------+------------------------------------------------------------------------------+
|
||||
| AP 模式 | WIFI_COUNTRY_POLICY_MANUAL | 总是使用配置的国家/地区信息。 |
|
||||
+---------------------+----------------------------+------------------------------------------------------------------------------+
|
||||
| Station/AP 共存模式 | WIFI_COUNTRY_POLICY_AUTO | 如果 station 不连接任何 AP,AP 使用配置的国家/地区信息。如果 station |
|
||||
| | | 连接一个 AP,该 AP 的国家/地区信息与该 station 相同。与 |
|
||||
| | | Station 模式、WIFI_COUNTRY_POLICY_AUTO 政策下使用的国家/地区信息相同。 |
|
||||
+---------------------+----------------------------+------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
主信道
|
||||
|
|
|
@ -57,6 +57,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_2M = {
|
|||
.sid = 0,
|
||||
.scan_req_notif = false,
|
||||
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
|
||||
.tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE,
|
||||
};
|
||||
|
||||
struct gatts_profile_inst {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* This demo showcases BLE GATT server. It can send adv data, be connected by client.
|
||||
|
@ -66,6 +67,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_1M = {
|
|||
.sid = 0,
|
||||
.scan_req_notif = false,
|
||||
.own_addr_type = BLE_ADDR_TYPE_RANDOM,
|
||||
.tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE,
|
||||
};
|
||||
|
||||
esp_ble_gap_ext_adv_params_t ext_adv_params_2M = {
|
||||
|
@ -80,6 +82,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_2M = {
|
|||
.sid = 1,
|
||||
.scan_req_notif = false,
|
||||
.own_addr_type = BLE_ADDR_TYPE_RANDOM,
|
||||
.tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE,
|
||||
};
|
||||
|
||||
esp_ble_gap_ext_adv_params_t legacy_adv_params = {
|
||||
|
@ -94,6 +97,7 @@ esp_ble_gap_ext_adv_params_t legacy_adv_params = {
|
|||
.sid = 2,
|
||||
.scan_req_notif = false,
|
||||
.own_addr_type = BLE_ADDR_TYPE_RANDOM,
|
||||
.tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE,
|
||||
};
|
||||
|
||||
esp_ble_gap_ext_adv_params_t ext_adv_params_coded = {
|
||||
|
@ -108,6 +112,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_coded = {
|
|||
.sid = 3,
|
||||
.scan_req_notif = false,
|
||||
.own_addr_type = BLE_ADDR_TYPE_RANDOM,
|
||||
.tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE,
|
||||
};
|
||||
|
||||
static uint8_t raw_adv_data_1m[] = {
|
||||
|
|
|
@ -67,6 +67,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_2M = {
|
|||
.sid = 0,
|
||||
.scan_req_notif = false,
|
||||
.own_addr_type = BLE_ADDR_TYPE_RANDOM,
|
||||
.tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE,
|
||||
};
|
||||
|
||||
static esp_ble_gap_periodic_adv_params_t periodic_adv_params = {
|
||||
|
|
|
@ -273,6 +273,7 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
|
|||
/* for now only SBC stream is supported */
|
||||
if (a2d->audio_cfg.mcc.type == ESP_A2D_MCT_SBC) {
|
||||
int sample_rate = 16000;
|
||||
int ch_count = 2;
|
||||
char oct0 = a2d->audio_cfg.mcc.cie.sbc[0];
|
||||
if (oct0 & (0x01 << 6)) {
|
||||
sample_rate = 32000;
|
||||
|
@ -281,7 +282,11 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
|
|||
} else if (oct0 & (0x01 << 4)) {
|
||||
sample_rate = 48000;
|
||||
}
|
||||
i2s_set_clk(0, sample_rate, 16, 2);
|
||||
if (oct0 & (0x01 << 3)) {
|
||||
ch_count = 1;
|
||||
}
|
||||
|
||||
i2s_set_clk(0, sample_rate, 16, ch_count);
|
||||
|
||||
ESP_LOGI(BT_AV_TAG, "Configure audio player: %x-%x-%x-%x",
|
||||
a2d->audio_cfg.mcc.cie.sbc[0],
|
||||
|
|
|
@ -69,8 +69,8 @@ void example_i2s_init(void)
|
|||
.communication_format = I2S_COMM_FORMAT_STAND_MSB,
|
||||
.channel_format = EXAMPLE_I2S_FORMAT,
|
||||
.intr_alloc_flags = 0,
|
||||
.dma_buf_count = 2,
|
||||
.dma_buf_len = 1024,
|
||||
.dma_buf_count = 6,
|
||||
.dma_buf_len = 256,
|
||||
.use_apll = 1,
|
||||
};
|
||||
//install and start i2s driver
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_adc_dac_example.csv"
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
|
@ -411,8 +411,8 @@ void job_fifo(essl_handle_t handle)
|
|||
const int wait_ms = 50;
|
||||
int length = packet_len[i];
|
||||
ret = essl_send_packet(handle, send_buffer + pointer, length, wait_ms);
|
||||
if (ret == ESP_ERR_TIMEOUT) {
|
||||
ESP_LOGD(TAG, "several packets are expected to timeout.");
|
||||
if (ret == ESP_ERR_TIMEOUT || ret == ESP_ERR_NOT_FOUND) {
|
||||
ESP_LOGD(TAG, "slave not ready to receive packet %d", i); // And there are several packets expected to timeout.
|
||||
} else {
|
||||
ESP_ERROR_CHECK(ret);
|
||||
ESP_LOGI(TAG, "send packet length: %d", length);
|
||||
|
|
|
@ -10,7 +10,22 @@ import re
|
|||
import subprocess
|
||||
|
||||
IDF_GIT_DESCRIBE_PATTERN = re.compile(r'^v(\d)\.(\d)')
|
||||
RETRY_COUNT = 3
|
||||
|
||||
|
||||
def _idf_version_from_cmake():
|
||||
version_path = os.path.join(os.environ['IDF_PATH'], 'tools/cmake/version.cmake')
|
||||
regex = re.compile(r'^\s*set\s*\(\s*IDF_VERSION_([A-Z]{5})\s+(\d+)')
|
||||
try:
|
||||
ver = {}
|
||||
with open(version_path) as f:
|
||||
for line in f:
|
||||
m = regex.match(line)
|
||||
if m:
|
||||
ver[m.group(1)] = m.group(2)
|
||||
return (int(ver['MAJOR']), int(ver['MINOR']))
|
||||
except (KeyError, OSError):
|
||||
print('WARNING: Cannot find ESP-IDF version in version.cmake')
|
||||
return (0, 0)
|
||||
|
||||
|
||||
def get_customized_project_revision(proj_name):
|
||||
|
@ -44,20 +59,12 @@ def target_branch_candidates(proj_name):
|
|||
candidates.insert(0, customized_candidate)
|
||||
|
||||
# branch name read from IDF
|
||||
try:
|
||||
git_describe = subprocess.check_output(['git', 'describe', 'HEAD'])
|
||||
match = IDF_GIT_DESCRIBE_PATTERN.search(git_describe.decode())
|
||||
if match:
|
||||
major_revision = match.group(1)
|
||||
minor_revision = match.group(2)
|
||||
# release branch
|
||||
candidates.append('release/v{}.{}'.format(major_revision, minor_revision))
|
||||
# branch to match all major branches, like v3.x or v3
|
||||
candidates.append('release/v{}.x'.format(major_revision))
|
||||
candidates.append('release/v{}'.format(major_revision))
|
||||
except subprocess.CalledProcessError:
|
||||
# this should not happen as IDF should have describe message
|
||||
pass
|
||||
major_revision, minor_revision = _idf_version_from_cmake()
|
||||
# release branch
|
||||
candidates.append('release/v{}.{}'.format(major_revision, minor_revision))
|
||||
# branch to match all major branches, like v3.x or v3
|
||||
candidates.append('release/v{}.x'.format(major_revision))
|
||||
candidates.append('release/v{}'.format(major_revision))
|
||||
|
||||
return [c for c in candidates if c] # filter out null value
|
||||
|
||||
|
@ -100,16 +107,10 @@ if __name__ == '__main__':
|
|||
continue
|
||||
|
||||
if ref_to_use:
|
||||
for _ in range(RETRY_COUNT):
|
||||
# Add retry for projects with git-lfs
|
||||
try:
|
||||
subprocess.check_call(['git', 'checkout', '-f', ref_to_use], stdout=subprocess.PIPE) # not print the stdout
|
||||
print('CI using ref {} for project {}'.format(ref_to_use, args.project))
|
||||
break
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
else:
|
||||
print('Failed to use ref {} for project {}'.format(ref_to_use, args.project))
|
||||
exit(1)
|
||||
try:
|
||||
subprocess.check_call(['git', 'checkout', '-f', ref_to_use], stdout=subprocess.PIPE) # not print the stdout
|
||||
print('CI using ref {} for project {}'.format(ref_to_use, args.project))
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
else:
|
||||
print('using default branch')
|
||||
|
|
|
@ -1077,7 +1077,10 @@ def get_idf_env(): # type: () -> Any
|
|||
try:
|
||||
idf_env_file_path = os.path.join(global_idf_tools_path, IDF_ENV_FILE) # type: ignore
|
||||
with open(idf_env_file_path, 'r') as idf_env_file:
|
||||
return json.load(idf_env_file)
|
||||
idf_env_json = json.load(idf_env_file)
|
||||
if 'sha' not in idf_env_json['idfInstalled']:
|
||||
idf_env_json['idfInstalled']['sha'] = {'targets': []}
|
||||
return idf_env_json
|
||||
except (IOError, OSError):
|
||||
if not os.path.exists(idf_env_file_path):
|
||||
warn('File {} was not found. '.format(idf_env_file_path))
|
||||
|
@ -1087,17 +1090,14 @@ def get_idf_env(): # type: () -> Any
|
|||
os.rename(idf_env_file_path, os.path.join(os.path.dirname(idf_env_file_path), (filename + '_failed' + ending)))
|
||||
|
||||
info('Creating {}' .format(idf_env_file_path))
|
||||
return {'idfSelectedId': 'sha', 'idfInstalled': {'sha': {'targets': {}}}}
|
||||
return {'idfInstalled': {'sha': {'targets': []}}}
|
||||
|
||||
|
||||
def export_targets_to_idf_env_json(targets): # type: (list[str]) -> None
|
||||
idf_env_json = get_idf_env()
|
||||
targets = list(set(targets + get_user_defined_targets()))
|
||||
|
||||
for env in idf_env_json['idfInstalled']:
|
||||
if env == idf_env_json['idfSelectedId']:
|
||||
idf_env_json['idfInstalled'][env]['targets'] = targets
|
||||
break
|
||||
idf_env_json['idfInstalled']['sha']['targets'] = targets
|
||||
|
||||
try:
|
||||
if global_idf_tools_path: # mypy fix for Optional[str] in the next call
|
||||
|
@ -1132,16 +1132,13 @@ def get_user_defined_targets(): # type: () -> list[str]
|
|||
try:
|
||||
with open(os.path.join(global_idf_tools_path, IDF_ENV_FILE), 'r') as idf_env_file: # type: ignore
|
||||
idf_env_json = json.load(idf_env_file)
|
||||
if 'sha' not in idf_env_json['idfInstalled']:
|
||||
idf_env_json['idfInstalled']['sha'] = {'targets': []}
|
||||
except OSError:
|
||||
# warn('File {} was not found. Installing tools for all esp targets.'.format(os.path.join(global_idf_tools_path, IDF_ENV_FILE))) # type: ignore
|
||||
return []
|
||||
|
||||
targets = []
|
||||
for env in idf_env_json['idfInstalled']:
|
||||
if env == idf_env_json['idfSelectedId']:
|
||||
targets = idf_env_json['idfInstalled'][env]['targets']
|
||||
break
|
||||
return targets
|
||||
return idf_env_json['idfInstalled']['sha']['targets'] # type: ignore
|
||||
|
||||
|
||||
def get_all_targets_from_tools_json(): # type: () -> list[str]
|
||||
|
|
Ładowanie…
Reference in New Issue