Add initial esp32-P4 support (#208)

This commit is contained in:
chegewara authored and GitHub committed 2024-10-31 19:06:57 -06:00
1 parent 8ca58f5a89
commit ed2c59d5de
6 files changed
+76 -1

No files matched your search

+4
View File
@@ -56,7 +56,9 @@ void NimBLEAdvertising::reset() {
m_advData.name = (uint8_t *)name;
m_advData.name_len = strlen(name);
m_advData.name_is_complete = 1;
#ifndef CONFIG_IDF_TARGET_ESP32P4
m_advData.tx_pwr_lvl = NimBLEDevice::getPower();
#endif
m_advData.flags = (BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP);
#if !defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
@@ -1018,7 +1020,9 @@ void NimBLEAdvertisementData::addTxPower() {
char cdata[3];
cdata[0] = BLE_HS_ADV_TX_PWR_LVL_LEN + 1;
cdata[1] = BLE_HS_ADV_TYPE_TX_PWR_LVL;
#ifndef CONFIG_IDF_TARGET_ESP32P4
cdata[2] = NimBLEDevice::getPower();
#endif
addData(cdata, 3);
} // addTxPower
+4 -1
View File
@@ -20,7 +20,9 @@
#ifdef ESP_PLATFORM
# include "esp_err.h"
#ifndef CONFIG_IDF_TARGET_ESP32P4
# include "esp_bt.h"
#endif
# include "nvs_flash.h"
# if defined(CONFIG_NIMBLE_CPP_IDF)
# if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE)
@@ -360,6 +362,7 @@ NimBLEClient* NimBLEDevice::getDisconnectedClient() {
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#ifdef ESP_PLATFORM
#ifndef CONFIG_IDF_TARGET_ESP32P4
/**
* @brief Set the transmission power.
* @param [in] powerLevel The power level to set, can be one of:
@@ -438,7 +441,7 @@ int NimBLEDevice::getPower(esp_ble_power_type_t powerType) {
return BLE_HS_ADV_TX_PWR_LVL_AUTO;
}
} // getPower
#endif
#else
void NimBLEDevice::setPower(int dbm) {
+4
View File
@@ -42,8 +42,10 @@ class NimBLEClient;
#include "NimBLEAddress.h"
#ifdef ESP_PLATFORM
#ifndef CONFIG_IDF_TARGET_ESP32P4
# include "esp_bt.h"
#endif
#endif
#include <string>
#include <array>
@@ -116,8 +118,10 @@ public:
#endif
#ifdef ESP_PLATFORM
#ifndef CONFIG_IDF_TARGET_ESP32P4
static void setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT);
static int getPower(esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT);
#endif
static void setOwnAddrType(uint8_t own_addr_type, bool useNRPA=false);
static void setScanDuplicateCacheSize(uint16_t cacheSize);
static void setScanFilterMode(uint8_t type);