diff --git a/cores/esp32/USB.cpp b/cores/esp32/USB.cpp index 60dcf3dc943..247f6887aa9 100644 --- a/cores/esp32/USB.cpp +++ b/cores/esp32/USB.cpp @@ -11,8 +11,10 @@ // 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. + #include "USB.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_ENABLED #include "pins_arduino.h" @@ -357,3 +359,4 @@ const char * ESPUSB::webUSBURL(void){ ESPUSB USB; #endif /* CONFIG_TINYUSB_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/USB.h b/cores/esp32/USB.h index 250cda13b2d..762ad172b7f 100644 --- a/cores/esp32/USB.h +++ b/cores/esp32/USB.h @@ -14,9 +14,11 @@ #pragma once #include "soc/soc_caps.h" - #if SOC_USB_OTG_SUPPORTED +#include "sdkconfig.h" +#if CONFIG_TINYUSB_ENABLED + #include "esp_event.h" #include "USBCDC.h" @@ -116,4 +118,6 @@ class ESPUSB { extern ESPUSB USB; + +#endif /* CONFIG_TINYUSB_ENABLED */ #endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/USBCDC.cpp b/cores/esp32/USBCDC.cpp index b17572db9d1..df5462884c4 100644 --- a/cores/esp32/USBCDC.cpp +++ b/cores/esp32/USBCDC.cpp @@ -11,10 +11,14 @@ // 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. + +#include "USBCDC.h" + +#if SOC_USB_OTG_SUPPORTED #include "USB.h" #if CONFIG_TINYUSB_CDC_ENABLED -#include "USBCDC.h" + #include "esp32-hal-tinyusb.h" #include "rom/ets_sys.h" @@ -456,3 +460,4 @@ USBCDC Serial(0); #endif #endif /* CONFIG_TINYUSB_CDC_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/USBCDC.h b/cores/esp32/USBCDC.h index baccb22e844..4012b2b369a 100644 --- a/cores/esp32/USBCDC.h +++ b/cores/esp32/USBCDC.h @@ -13,6 +13,9 @@ // limitations under the License. #pragma once +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "sdkconfig.h" #if CONFIG_TINYUSB_CDC_ENABLED @@ -143,3 +146,4 @@ extern USBCDC Serial; #endif #endif /* CONFIG_TINYUSB_CDC_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/USBMSC.cpp b/cores/esp32/USBMSC.cpp index 479d68e5802..8b615d94c70 100644 --- a/cores/esp32/USBMSC.cpp +++ b/cores/esp32/USBMSC.cpp @@ -11,8 +11,10 @@ // 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. + #include "USBMSC.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_MSC_ENABLED #include "esp32-hal-tinyusb.h" @@ -258,3 +260,4 @@ void USBMSC::mediaPresent(bool media_present){ } #endif /* CONFIG_TINYUSB_MSC_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/USBMSC.h b/cores/esp32/USBMSC.h index 287a57ceb31..b21a95543f6 100644 --- a/cores/esp32/USBMSC.h +++ b/cores/esp32/USBMSC.h @@ -13,6 +13,10 @@ // limitations under the License. #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include #include #include "sdkconfig.h" @@ -49,3 +53,4 @@ class USBMSC }; #endif /* CONFIG_TINYUSB_MSC_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-bt.c b/cores/esp32/esp32-hal-bt.c index 7b6a54e1ad4..d2084bda3f3 100644 --- a/cores/esp32/esp32-hal-bt.c +++ b/cores/esp32/esp32-hal-bt.c @@ -14,6 +14,7 @@ #include "esp32-hal-bt.h" +#if SOC_BT_SUPPORTED #ifdef CONFIG_BT_ENABLED // user may want to change it to free resources @@ -97,5 +98,6 @@ bool btStop() return false; } -#endif // CONFIG_BT_ENABLED +#endif /* CONFIG_BT_ENABLED */ +#endif /* SOC_BT_SUPPORTED */ \ No newline at end of file diff --git a/cores/esp32/esp32-hal-bt.h b/cores/esp32/esp32-hal-bt.h index 56222da3182..9758e8ab1fc 100644 --- a/cores/esp32/esp32-hal-bt.h +++ b/cores/esp32/esp32-hal-bt.h @@ -15,6 +15,9 @@ #ifndef _ESP32_ESP32_HAL_BT_H_ #define _ESP32_ESP32_HAL_BT_H_ +#include "soc/soc_caps.h" +#if SOC_BT_SUPPORTED + #include "esp32-hal.h" #ifdef __cplusplus @@ -29,4 +32,6 @@ bool btStop(); } #endif +#endif /* SOC_BT_SUPPORTED */ + #endif /* _ESP32_ESP32_HAL_BT_H_ */ diff --git a/cores/esp32/esp32-hal-i2c-slave.c b/cores/esp32/esp32-hal-i2c-slave.c index d4bff885cac..595a8002d90 100644 --- a/cores/esp32/esp32-hal-i2c-slave.c +++ b/cores/esp32/esp32-hal-i2c-slave.c @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "soc/soc_caps.h" + +#if SOC_I2C_SUPPORT_SLAVE #include #include #include @@ -874,3 +877,5 @@ static bool i2cSlaveDetachBus(void * bus_i2c_num){ } return true; } + +#endif /* SOC_I2C_SUPPORT_SLAVE */ diff --git a/cores/esp32/esp32-hal-i2c-slave.h b/cores/esp32/esp32-hal-i2c-slave.h index ceed8b10da1..bc6893003c1 100644 --- a/cores/esp32/esp32-hal-i2c-slave.h +++ b/cores/esp32/esp32-hal-i2c-slave.h @@ -14,6 +14,9 @@ #pragma once +#include "soc/soc_caps.h" +#if SOC_I2C_SUPPORT_SLAVE + #ifdef __cplusplus extern "C" { #endif @@ -33,3 +36,5 @@ size_t i2cSlaveWrite(uint8_t num, const uint8_t *buf, uint32_t len, uint32_t tim #ifdef __cplusplus } #endif + +#endif /* SOC_I2C_SUPPORT_SLAVE */ diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index cd1ac0cdadd..84959dbc9a3 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -13,6 +13,8 @@ // limitations under the License. #include "esp32-hal-i2c.h" + +#if SOC_I2C_SUPPORTED #include "esp32-hal.h" #if !CONFIG_DISABLE_HAL_LOCKS #include "freertos/FreeRTOS.h" @@ -390,3 +392,5 @@ esp_err_t i2cGetClock(uint8_t i2c_num, uint32_t * frequency){ *frequency = bus[i2c_num].frequency; return ESP_OK; } + +#endif /* SOC_I2C_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-i2c.h b/cores/esp32/esp32-hal-i2c.h index 3fa889fbefb..2fa1e24a0a5 100644 --- a/cores/esp32/esp32-hal-i2c.h +++ b/cores/esp32/esp32-hal-i2c.h @@ -17,6 +17,9 @@ #ifndef _ESP32_HAL_I2C_H_ #define _ESP32_HAL_I2C_H_ +#include "soc/soc_caps.h" +#if SOC_I2C_SUPPORTED + #ifdef __cplusplus extern "C" { #endif @@ -38,4 +41,5 @@ bool i2cIsInit(uint8_t i2c_num); } #endif +#endif /* SOC_I2C_SUPPORTED */ #endif /* _ESP32_HAL_I2C_H_ */ diff --git a/cores/esp32/esp32-hal-ledc.c b/cores/esp32/esp32-hal-ledc.c index fe98740856c..cddaf7b05ec 100644 --- a/cores/esp32/esp32-hal-ledc.c +++ b/cores/esp32/esp32-hal-ledc.c @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "esp32-hal.h" #include "soc/soc_caps.h" + +#if SOC_LEDC_SUPPORTED +#include "esp32-hal.h" +#include "esp32-hal-ledc.h" #include "driver/ledc.h" #include "esp32-hal-periman.h" @@ -382,3 +385,5 @@ void analogWriteResolution(uint8_t pin, uint8_t resolution) { } analog_resolution = resolution; } + +#endif /* SOC_LEDC_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-ledc.h b/cores/esp32/esp32-hal-ledc.h index e379183b590..ca172844247 100644 --- a/cores/esp32/esp32-hal-ledc.h +++ b/cores/esp32/esp32-hal-ledc.h @@ -15,6 +15,9 @@ #ifndef _ESP32_HAL_LEDC_H_ #define _ESP32_HAL_LEDC_H_ +#include "soc/soc_caps.h" +#if SOC_LEDC_SUPPORTED + #ifdef __cplusplus extern "C" { #endif @@ -59,4 +62,5 @@ bool ledcFadeWithInterruptArg(uint8_t pin, uint32_t start_duty, uint32_t target_ } #endif +#endif /* SOC_LEDC_SUPPORTED */ #endif /* _ESP32_HAL_LEDC_H_ */ diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index f7ff9612ba9..c81ae38b4e1 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -38,23 +38,26 @@ #include "esp_system.h" #ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ + #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 #include "esp32/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32S2 #include "esp32s2/rom/rtc.h" -#include "driver/temperature_sensor.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/rtc.h" -#include "driver/temperature_sensor.h" #elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/rtc.h" -#include "driver/temperature_sensor.h" #elif CONFIG_IDF_TARGET_ESP32C6 #include "esp32c6/rom/rtc.h" -#include "driver/temperature_sensor.h" + #else #error Target CONFIG_IDF_TARGET is not supported #endif + +#if SOC_TEMP_SENSOR_SUPPORTED +#include "driver/temperature_sensor.h" +#endif + #else // ESP32 Before IDF 4.0 #include "rom/rtc.h" #endif @@ -68,7 +71,7 @@ float temperatureRead() { return (temprature_sens_read() - 32) / 1.8; } -#else +#elif SOC_TEMP_SENSOR_SUPPORTED static temperature_sensor_handle_t temp_sensor = NULL; static bool temperatureReadInit() diff --git a/cores/esp32/esp32-hal-rmt.c b/cores/esp32/esp32-hal-rmt.c index 6f6c6445f1a..9230928aee0 100644 --- a/cores/esp32/esp32-hal-rmt.c +++ b/cores/esp32/esp32-hal-rmt.c @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "soc/soc_caps.h" + +#if SOC_RMT_SUPPORTED #include "esp32-hal.h" #include "driver/gpio.h" #include "driver/rmt_tx.h" @@ -568,3 +571,5 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ _rmtDetachBus((void *)bus); return false; } + +#endif /* SOC_RMT_SUPPORTED */ \ No newline at end of file diff --git a/cores/esp32/esp32-hal-rmt.h b/cores/esp32/esp32-hal-rmt.h index a968d471377..a8cb22d3a60 100644 --- a/cores/esp32/esp32-hal-rmt.h +++ b/cores/esp32/esp32-hal-rmt.h @@ -15,6 +15,9 @@ #ifndef MAIN_ESP32_HAL_RMT_H_ #define MAIN_ESP32_HAL_RMT_H_ +#include "soc/soc_caps.h" +#if SOC_RMT_SUPPORTED + #ifdef __cplusplus extern "C" { #endif @@ -214,4 +217,5 @@ bool rmtDeinit(int pin); } #endif -#endif /* MAIN_ESP32_HAL_RMT_H_ */ \ No newline at end of file +#endif /* SOC_RMT_SUPPORTED */ +#endif /* MAIN_ESP32_HAL_RMT_H_ */ diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 839398bf31c..da2ca542d09 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -13,6 +13,8 @@ // limitations under the License. #include "esp32-hal-spi.h" + +#if SOC_GPSPI_SUPPORTED #include "esp32-hal.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -1577,3 +1579,5 @@ uint32_t spiFrequencyToClockDiv(uint32_t freq) } return bestReg.value; } + +#endif /* SOC_GPSPI_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-spi.h b/cores/esp32/esp32-hal-spi.h index f763fd194ce..654ed6b8bdf 100644 --- a/cores/esp32/esp32-hal-spi.h +++ b/cores/esp32/esp32-hal-spi.h @@ -15,6 +15,9 @@ #ifndef MAIN_ESP32_HAL_SPI_H_ #define MAIN_ESP32_HAL_SPI_H_ +#include "soc/soc_caps.h" +#if SOC_GPSPI_SUPPORTED + #ifdef __cplusplus extern "C" { #endif @@ -146,4 +149,5 @@ uint32_t spiClockDivToFrequency(uint32_t freq); } #endif +#endif /* SOC_GPSPI_SUPPORTED */ #endif /* MAIN_ESP32_HAL_SPI_H_ */ diff --git a/cores/esp32/esp32-hal-timer.c b/cores/esp32/esp32-hal-timer.c index 13c88d58058..b8ab8548d76 100644 --- a/cores/esp32/esp32-hal-timer.c +++ b/cores/esp32/esp32-hal-timer.c @@ -13,8 +13,9 @@ // limitations under the License. #include "esp32-hal-timer.h" + +#if SOC_GPTIMER_SUPPORTED #include "driver/gptimer.h" -#include "soc/soc_caps.h" #if defined __has_include && __has_include ("clk_tree.h") #include "clk_tree.h" #else @@ -212,3 +213,5 @@ double timerReadSeconds(hw_timer_t * timer){ uint32_t frequency = timerGetFrequency(timer); return (double)timer_val / frequency; } + +#endif /* SOC_GPTIMER_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-timer.h b/cores/esp32/esp32-hal-timer.h index 61de2ea813c..9b71e1801f7 100644 --- a/cores/esp32/esp32-hal-timer.h +++ b/cores/esp32/esp32-hal-timer.h @@ -19,6 +19,9 @@ #pragma once +#include "soc/soc_caps.h" +#if SOC_GPTIMER_SUPPORTED + #include "esp32-hal.h" #include "driver/gptimer_types.h" @@ -53,3 +56,5 @@ void timerAlarm(hw_timer_t * timer, uint64_t alarm_value, bool autoreload, uint6 #ifdef __cplusplus } #endif + +#endif /* SOC_GPTIMER_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-tinyusb.c b/cores/esp32/esp32-hal-tinyusb.c index 4df6b1d26fa..eaf9674fa0a 100644 --- a/cores/esp32/esp32-hal-tinyusb.c +++ b/cores/esp32/esp32-hal-tinyusb.c @@ -1,4 +1,6 @@ +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED #include "sdkconfig.h" #if CONFIG_TINYUSB_ENABLED #include @@ -794,3 +796,4 @@ uint8_t tinyusb_get_free_out_endpoint(void){ } #endif /* CONFIG_TINYUSB_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-tinyusb.h b/cores/esp32/esp32-hal-tinyusb.h index 84e156e874d..a9213fd4b9d 100644 --- a/cores/esp32/esp32-hal-tinyusb.h +++ b/cores/esp32/esp32-hal-tinyusb.h @@ -13,6 +13,9 @@ // limitations under the License. #pragma once +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "esp32-hal.h" #if CONFIG_TINYUSB_ENABLED @@ -104,3 +107,4 @@ uint8_t tinyusb_get_free_out_endpoint(void); #endif #endif /* CONFIG_TINYUSB_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-touch.c b/cores/esp32/esp32-hal-touch.c index 86ddab63eaa..9c49ecee119 100644 --- a/cores/esp32/esp32-hal-touch.c +++ b/cores/esp32/esp32-hal-touch.c @@ -11,10 +11,9 @@ // 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. - #include "soc/soc_caps.h" -#if SOC_TOUCH_SENSOR_NUM > 0 +#if SOC_TOUCH_SENSOR_SUPPORTED #include "driver/touch_sensor.h" #include "esp32-hal-touch.h" #include "esp32-hal-periman.h" @@ -336,4 +335,4 @@ extern void touchAttachInterruptArg(uint8_t, voidArgFuncPtr, void *, touch_value extern void touchDetachInterrupt(uint8_t) __attribute__ ((weak, alias("__touchDettachInterrupt"))); extern void touchSetCycles(uint16_t, uint16_t) __attribute__ ((weak, alias("__touchSetCycles"))); -#endif // #if SOC_TOUCH_SENSOR_NUM > 0 +#endif /* SOC_TOUCH_SENSOR_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-touch.h b/cores/esp32/esp32-hal-touch.h index 235b8f86d63..780b5abf3bb 100644 --- a/cores/esp32/esp32-hal-touch.h +++ b/cores/esp32/esp32-hal-touch.h @@ -20,15 +20,15 @@ #ifndef MAIN_ESP32_HAL_TOUCH_H_ #define MAIN_ESP32_HAL_TOUCH_H_ +#include "soc/soc_caps.h" +#if SOC_TOUCH_SENSOR_SUPPORTED + #ifdef __cplusplus extern "C" { #endif -#include "soc/soc_caps.h" #include "esp32-hal.h" -#if SOC_TOUCH_SENSOR_NUM > 0 - #if !defined(SOC_TOUCH_VERSION_1) && !defined(SOC_TOUCH_VERSION_2) #error Touch IDF driver Not supported! #endif @@ -94,9 +94,9 @@ bool touchInterruptGetLastStatus(uint8_t pin); **/ void touchSleepWakeUpEnable(uint8_t pin, touch_value_t threshold); -#endif // SOC_TOUCH_SENSOR_NUM > 0 - #ifdef __cplusplus } #endif + +#endif /* SOC_TOUCH_SENSOR_SUPPORTED */ #endif /* MAIN_ESP32_HAL_TOUCH_H_ */ diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 51c645b1890..e23db130dd8 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -13,6 +13,8 @@ // limitations under the License. #include "esp32-hal-uart.h" + +#if SOC_UART_SUPPORTED #include "esp32-hal.h" #include "esp32-hal-periman.h" @@ -899,3 +901,5 @@ int uart_send_msg_with_break(uint8_t uartNum, uint8_t *msg, size_t msgSize) // 12 bits long BREAK for 8N1 return uart_write_bytes_with_break(uartNum, (const void *)msg, msgSize, 12); } + +#endif /* SOC_UART_SUPPORTED */ \ No newline at end of file diff --git a/cores/esp32/esp32-hal-uart.h b/cores/esp32/esp32-hal-uart.h index 1e4185050e8..a1531d6042d 100644 --- a/cores/esp32/esp32-hal-uart.h +++ b/cores/esp32/esp32-hal-uart.h @@ -15,6 +15,9 @@ #ifndef MAIN_ESP32_HAL_UART_H_ #define MAIN_ESP32_HAL_UART_H_ +#include "soc/soc_caps.h" +#if SOC_UART_SUPPORTED + #ifdef __cplusplus extern "C" { #endif @@ -164,4 +167,5 @@ int uart_send_msg_with_break(uint8_t uartNum, uint8_t *msg, size_t msgSize); } #endif +#endif /* SOC_UART_SUPPORTED */ #endif /* MAIN_ESP32_HAL_UART_H_ */ diff --git a/libraries/BLE/examples/BLE5_extended_scan/BLE5_extended_scan.ino b/libraries/BLE/examples/BLE5_extended_scan/BLE5_extended_scan.ino index d3606e691d5..069cdab4ebb 100644 --- a/libraries/BLE/examples/BLE5_extended_scan/BLE5_extended_scan.ino +++ b/libraries/BLE/examples/BLE5_extended_scan/BLE5_extended_scan.ino @@ -7,7 +7,7 @@ author: chegewara */ -#ifndef CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#ifndef SOC_BLE_50_SUPPORTED #warning "Not compatible hardware" #else #include @@ -46,4 +46,4 @@ void loop() { // put your main code here, to run repeatedly: delay(2000); } -#endif // CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#endif // SOC_BLE_50_SUPPORTED diff --git a/libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino b/libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino index b6430eb932b..b28e4e36661 100644 --- a/libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino +++ b/libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino @@ -7,7 +7,7 @@ author: chegewara */ -#ifndef CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#ifndef SOC_BLE_50_SUPPORTED #warning "Not compatible hardware" #else #include @@ -105,4 +105,4 @@ void loop() delay(2000); } -#endif // CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#endif // SOC_BLE_50_SUPPORTED diff --git a/libraries/BLE/src/BLE2902.cpp b/libraries/BLE/src/BLE2902.cpp index 880e73e2f79..6faa5d8d688 100644 --- a/libraries/BLE/src/BLE2902.cpp +++ b/libraries/BLE/src/BLE2902.cpp @@ -9,6 +9,9 @@ * See also: * https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.client_characteristic_configuration.xml */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -62,3 +65,4 @@ void BLE2902::setNotifications(bool flag) { } // setNotifications #endif +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLE2902.h b/libraries/BLE/src/BLE2902.h index b50ed750f72..6218ed3ca8e 100644 --- a/libraries/BLE/src/BLE2902.h +++ b/libraries/BLE/src/BLE2902.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLE2902_H_ #define COMPONENTS_CPP_UTILS_BLE2902_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -31,4 +34,5 @@ class BLE2902: public BLEDescriptor { }; // BLE2902 #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLE2902_H_ */ diff --git a/libraries/BLE/src/BLE2904.cpp b/libraries/BLE/src/BLE2904.cpp index 23ad3e73d8e..56710212cb1 100644 --- a/libraries/BLE/src/BLE2904.cpp +++ b/libraries/BLE/src/BLE2904.cpp @@ -9,6 +9,9 @@ * See also: * https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -72,3 +75,4 @@ void BLE2904::setUnit(uint16_t unit) { } // setUnit #endif +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLE2904.h b/libraries/BLE/src/BLE2904.h index 4d6075255ab..c1b9e392528 100644 --- a/libraries/BLE/src/BLE2904.h +++ b/libraries/BLE/src/BLE2904.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLE2904_H_ #define COMPONENTS_CPP_UTILS_BLE2904_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -71,4 +74,5 @@ class BLE2904: public BLEDescriptor { }; // BLE2904 #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLE2904_H_ */ diff --git a/libraries/BLE/src/BLEAddress.cpp b/libraries/BLE/src/BLEAddress.cpp index f9abae1803b..13f6501bf72 100644 --- a/libraries/BLE/src/BLEAddress.cpp +++ b/libraries/BLE/src/BLEAddress.cpp @@ -4,6 +4,9 @@ * Created on: Jul 2, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -114,4 +117,6 @@ std::string BLEAddress::toString() { free(res); return ret; } // toString + #endif +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEAddress.h b/libraries/BLE/src/BLEAddress.h index e8fa326a226..83f01879270 100644 --- a/libraries/BLE/src/BLEAddress.h +++ b/libraries/BLE/src/BLEAddress.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEADDRESS_H_ #define COMPONENTS_CPP_UTILS_BLEADDRESS_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include // ESP32 BLE @@ -37,4 +40,5 @@ class BLEAddress { }; #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEADDRESS_H_ */ diff --git a/libraries/BLE/src/BLEAdvertisedDevice.cpp b/libraries/BLE/src/BLEAdvertisedDevice.cpp index f266877e7bb..03e15ce16b8 100644 --- a/libraries/BLE/src/BLEAdvertisedDevice.cpp +++ b/libraries/BLE/src/BLEAdvertisedDevice.cpp @@ -11,6 +11,8 @@ * Created on: Jul 3, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -591,4 +593,4 @@ size_t BLEAdvertisedDevice::getPayloadLength() { } #endif /* CONFIG_BLUEDROID_ENABLED */ - +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEAdvertisedDevice.h b/libraries/BLE/src/BLEAdvertisedDevice.h index b785838cb76..5d05c26343b 100644 --- a/libraries/BLE/src/BLEAdvertisedDevice.h +++ b/libraries/BLE/src/BLEAdvertisedDevice.h @@ -7,6 +7,8 @@ #ifndef COMPONENTS_CPP_UTILS_BLEADVERTISEDDEVICE_H_ #define COMPONENTS_CPP_UTILS_BLEADVERTISEDDEVICE_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -125,7 +127,7 @@ class BLEAdvertisedDeviceCallbacks { virtual void onResult(BLEAdvertisedDevice advertisedDevice) = 0; }; -#ifdef CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#ifdef SOC_BLE_50_SUPPORTED class BLEExtAdvertisingCallbacks { public: virtual ~BLEExtAdvertisingCallbacks() {} @@ -137,8 +139,9 @@ class BLEExtAdvertisingCallbacks { */ virtual void onResult(esp_ble_gap_ext_adv_reprot_t report) = 0; }; -#endif // CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#endif // SOC_BLE_50_SUPPORTED #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEADVERTISEDDEVICE_H_ */ diff --git a/libraries/BLE/src/BLEAdvertising.cpp b/libraries/BLE/src/BLEAdvertising.cpp index 3dcd99b77c3..30ff7644999 100644 --- a/libraries/BLE/src/BLEAdvertising.cpp +++ b/libraries/BLE/src/BLEAdvertising.cpp @@ -16,6 +16,9 @@ * set in the data will be advertised. * */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include "BLEAdvertising.h" @@ -528,7 +531,7 @@ void BLEAdvertising::handleGAPEvent( } } -#ifdef CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#ifdef SOC_BLE_50_SUPPORTED /** * @brief Creator @@ -763,7 +766,7 @@ void BLEMultiAdvertising::setDuration(uint8_t instance, int duration, int max_ev ext_adv[instance] = { instance, duration, max_events }; } -#endif // CONFIG_BT_BLE_50_FEATURES_SUPPORTED - +#endif // SOC_BLE_50_SUPPORTED #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEAdvertising.h b/libraries/BLE/src/BLEAdvertising.h index ec1d00334e9..4236c25e3c1 100644 --- a/libraries/BLE/src/BLEAdvertising.h +++ b/libraries/BLE/src/BLEAdvertising.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEADVERTISING_H_ #define COMPONENTS_CPP_UTILS_BLEADVERTISING_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -79,7 +82,7 @@ class BLEAdvertising { }; -#ifdef CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#ifdef SOC_BLE_50_SUPPORTED class BLEMultiAdvertising { @@ -107,7 +110,8 @@ class BLEMultiAdvertising bool startPeriodicAdvertising(uint8_t instance); }; -#endif // CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#endif // SOC_BLE_50_SUPPORTED #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEADVERTISING_H_ */ diff --git a/libraries/BLE/src/BLEBeacon.cpp b/libraries/BLE/src/BLEBeacon.cpp index 177926d9ea8..512300a5223 100644 --- a/libraries/BLE/src/BLEBeacon.cpp +++ b/libraries/BLE/src/BLEBeacon.cpp @@ -4,6 +4,9 @@ * Created on: Jan 4, 2018 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -81,3 +84,4 @@ void BLEBeacon::setSignalPower(int8_t signalPower) { #endif +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEBeacon.h b/libraries/BLE/src/BLEBeacon.h index 277bd670776..27c811e8d1e 100644 --- a/libraries/BLE/src/BLEBeacon.h +++ b/libraries/BLE/src/BLEBeacon.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEBEACON_H_ #define COMPONENTS_CPP_UTILS_BLEBEACON_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "BLEUUID.h" /** * @brief Representation of a beacon. @@ -40,4 +43,5 @@ class BLEBeacon { void setSignalPower(int8_t signalPower); }; // BLEBeacon +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEBEACON_H_ */ diff --git a/libraries/BLE/src/BLECharacteristic.cpp b/libraries/BLE/src/BLECharacteristic.cpp index 228c38969f4..62c478582e6 100644 --- a/libraries/BLE/src/BLECharacteristic.cpp +++ b/libraries/BLE/src/BLECharacteristic.cpp @@ -4,6 +4,9 @@ * Created on: Jun 22, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -799,3 +802,4 @@ void BLECharacteristicCallbacks::onStatus(BLECharacteristic* pCharacteristic, St #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLECharacteristic.h b/libraries/BLE/src/BLECharacteristic.h index 9e7c0317faf..2a87d8f0aa7 100644 --- a/libraries/BLE/src/BLECharacteristic.h +++ b/libraries/BLE/src/BLECharacteristic.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLECHARACTERISTIC_H_ #define COMPONENTS_CPP_UTILS_BLECHARACTERISTIC_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -185,5 +188,7 @@ class BLECharacteristicCallbacks { */ virtual void onStatus(BLECharacteristic* pCharacteristic, Status s, uint32_t code); }; + #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLECHARACTERISTIC_H_ */ diff --git a/libraries/BLE/src/BLECharacteristicMap.cpp b/libraries/BLE/src/BLECharacteristicMap.cpp index 06aeb5bb88e..2348c290481 100644 --- a/libraries/BLE/src/BLECharacteristicMap.cpp +++ b/libraries/BLE/src/BLECharacteristicMap.cpp @@ -4,6 +4,9 @@ * Created on: Jun 22, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -132,3 +135,4 @@ std::string BLECharacteristicMap::toString() { #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEClient.cpp b/libraries/BLE/src/BLEClient.cpp index 6f099c40335..7ccfdb05d3f 100644 --- a/libraries/BLE/src/BLEClient.cpp +++ b/libraries/BLE/src/BLEClient.cpp @@ -4,6 +4,9 @@ * Created on: Mar 22, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -593,5 +596,5 @@ std::string BLEClient::toString() { return res; } // toString - -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEClient.h b/libraries/BLE/src/BLEClient.h index 2550274c9f0..a87d0277223 100644 --- a/libraries/BLE/src/BLEClient.h +++ b/libraries/BLE/src/BLEClient.h @@ -8,6 +8,9 @@ #ifndef MAIN_BLEDEVICE_H_ #define MAIN_BLEDEVICE_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -100,5 +103,6 @@ class BLEClientCallbacks { virtual void onDisconnect(BLEClient *pClient) = 0; }; -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* MAIN_BLEDEVICE_H_ */ diff --git a/libraries/BLE/src/BLEDescriptor.cpp b/libraries/BLE/src/BLEDescriptor.cpp index f9bd0626d4e..652d82f01a3 100644 --- a/libraries/BLE/src/BLEDescriptor.cpp +++ b/libraries/BLE/src/BLEDescriptor.cpp @@ -4,6 +4,9 @@ * Created on: Jun 22, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -289,3 +292,4 @@ void BLEDescriptorCallbacks::onWrite(BLEDescriptor* pDescriptor) { #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEDescriptor.h b/libraries/BLE/src/BLEDescriptor.h index cc501e85a2f..bf4cfb91361 100644 --- a/libraries/BLE/src/BLEDescriptor.h +++ b/libraries/BLE/src/BLEDescriptor.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEDESCRIPTOR_H_ #define COMPONENTS_CPP_UTILS_BLEDESCRIPTOR_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -73,5 +76,7 @@ class BLEDescriptorCallbacks { virtual void onRead(BLEDescriptor* pDescriptor); virtual void onWrite(BLEDescriptor* pDescriptor); }; + #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEDESCRIPTOR_H_ */ diff --git a/libraries/BLE/src/BLEDescriptorMap.cpp b/libraries/BLE/src/BLEDescriptorMap.cpp index 49aeea2162b..10cca4dc48f 100644 --- a/libraries/BLE/src/BLEDescriptorMap.cpp +++ b/libraries/BLE/src/BLEDescriptorMap.cpp @@ -4,6 +4,9 @@ * Created on: Jun 22, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -145,4 +148,6 @@ BLEDescriptor* BLEDescriptorMap::getNext() { m_iterator++; return pRet; } // getNext + #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEDevice.cpp b/libraries/BLE/src/BLEDevice.cpp index 473f3ef032e..87d6603b588 100644 --- a/libraries/BLE/src/BLEDevice.cpp +++ b/libraries/BLE/src/BLEDevice.cpp @@ -4,6 +4,9 @@ * Created on: Mar 16, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -674,4 +677,5 @@ void BLEDevice::setCustomGattsHandler(gatts_event_handler handler) { m_customGattsHandler = handler; } -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEDevice.h b/libraries/BLE/src/BLEDevice.h index 9b9cdf03d15..b938072079b 100644 --- a/libraries/BLE/src/BLEDevice.h +++ b/libraries/BLE/src/BLEDevice.h @@ -7,6 +7,9 @@ #ifndef MAIN_BLEDevice_H_ #define MAIN_BLEDevice_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include // ESP32 BLE @@ -97,5 +100,6 @@ class BLEDevice { }; // class BLE -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* MAIN_BLEDevice_H_ */ diff --git a/libraries/BLE/src/BLEEddystoneTLM.cpp b/libraries/BLE/src/BLEEddystoneTLM.cpp index dc453686a63..8492fc1f867 100644 --- a/libraries/BLE/src/BLEEddystoneTLM.cpp +++ b/libraries/BLE/src/BLEEddystoneTLM.cpp @@ -9,6 +9,9 @@ * Fixes based on EddystoneTLM frame specification https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md * */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -161,3 +164,4 @@ void BLEEddystoneTLM::setTime(uint32_t tmil) { } // setTime #endif +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEEddystoneTLM.h b/libraries/BLE/src/BLEEddystoneTLM.h index 72dec318072..0bb28f88916 100644 --- a/libraries/BLE/src/BLEEddystoneTLM.h +++ b/libraries/BLE/src/BLEEddystoneTLM.h @@ -7,6 +7,9 @@ #ifndef _BLEEddystoneTLM_H_ #define _BLEEddystoneTLM_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "BLEUUID.h" #define EDDYSTONE_TLM_FRAME_TYPE 0x20 @@ -53,4 +56,5 @@ class BLEEddystoneTLM { }; // BLEEddystoneTLM +#endif /* SOC_BLE_SUPPORTED */ #endif /* _BLEEddystoneTLM_H_ */ diff --git a/libraries/BLE/src/BLEEddystoneURL.cpp b/libraries/BLE/src/BLEEddystoneURL.cpp index 1c23e52bf44..a68966d2ef8 100644 --- a/libraries/BLE/src/BLEEddystoneURL.cpp +++ b/libraries/BLE/src/BLEEddystoneURL.cpp @@ -4,6 +4,9 @@ * Created on: Mar 12, 2018 * Author: pcbreflux */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -146,3 +149,4 @@ void BLEEddystoneURL::setURL(std::string url) { #endif +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEEddystoneURL.h b/libraries/BLE/src/BLEEddystoneURL.h index adb1335e6bb..a1e3d7f9045 100644 --- a/libraries/BLE/src/BLEEddystoneURL.h +++ b/libraries/BLE/src/BLEEddystoneURL.h @@ -7,6 +7,9 @@ #ifndef _BLEEddystoneURL_H_ #define _BLEEddystoneURL_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "BLEUUID.h" #define EDDYSTONE_URL_FRAME_TYPE 0x10 @@ -40,4 +43,5 @@ class BLEEddystoneURL { }; // BLEEddystoneURL +#endif /* SOC_BLE_SUPPORTED */ #endif /* _BLEEddystoneURL_H_ */ diff --git a/libraries/BLE/src/BLEExceptions.h b/libraries/BLE/src/BLEExceptions.h index ea9db8550bc..1fa10046789 100644 --- a/libraries/BLE/src/BLEExceptions.h +++ b/libraries/BLE/src/BLEExceptions.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEEXCEPTIONS_H_ #define COMPONENTS_CPP_UTILS_BLEEXCEPTIONS_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if CONFIG_CXX_EXCEPTIONS != 1 @@ -28,4 +31,5 @@ class BLEUuidNotFoundException : public std::exception { } }; +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEEXCEPTIONS_H_ */ diff --git a/libraries/BLE/src/BLEHIDDevice.cpp b/libraries/BLE/src/BLEHIDDevice.cpp index 5dc6504dac0..0aff716d08e 100644 --- a/libraries/BLE/src/BLEHIDDevice.cpp +++ b/libraries/BLE/src/BLEHIDDevice.cpp @@ -4,6 +4,9 @@ * Created on: Jan 03, 2018 * Author: chegewara */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -243,5 +246,5 @@ BLEService* BLEHIDDevice::batteryService() { return m_batteryService; } -#endif // CONFIG_BLUEDROID_ENABLED - +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEHIDDevice.h b/libraries/BLE/src/BLEHIDDevice.h index 9770145f7e7..ecab1f52ed0 100644 --- a/libraries/BLE/src/BLEHIDDevice.h +++ b/libraries/BLE/src/BLEHIDDevice.h @@ -8,6 +8,9 @@ #ifndef _BLEHIDDEVICE_H_ #define _BLEHIDDEVICE_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -72,5 +75,7 @@ class BLEHIDDevice { BLECharacteristic* m_protocolModeCharacteristic; //0x2a4e BLECharacteristic* m_batteryLevelCharacteristic; //0x2a19 }; -#endif // CONFIG_BLUEDROID_ENABLED + +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* _BLEHIDDEVICE_H_ */ diff --git a/libraries/BLE/src/BLERemoteCharacteristic.cpp b/libraries/BLE/src/BLERemoteCharacteristic.cpp index 825ca33c73b..996fc8d741a 100644 --- a/libraries/BLE/src/BLERemoteCharacteristic.cpp +++ b/libraries/BLE/src/BLERemoteCharacteristic.cpp @@ -7,6 +7,9 @@ #include "BLERemoteCharacteristic.h" +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -621,3 +624,4 @@ void BLERemoteCharacteristic::setAuth(esp_gatt_auth_req_t auth) { } #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLERemoteCharacteristic.h b/libraries/BLE/src/BLERemoteCharacteristic.h index e51c4f257a4..e9f6b97fab7 100644 --- a/libraries/BLE/src/BLERemoteCharacteristic.h +++ b/libraries/BLE/src/BLERemoteCharacteristic.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEREMOTECHARACTERISTIC_H_ #define COMPONENTS_CPP_UTILS_BLEREMOTECHARACTERISTIC_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -83,5 +86,7 @@ class BLERemoteCharacteristic { // We maintain a map of descriptors owned by this characteristic keyed by a string representation of the UUID. std::map m_descriptorMap; }; // BLERemoteCharacteristic + #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEREMOTECHARACTERISTIC_H_ */ diff --git a/libraries/BLE/src/BLERemoteDescriptor.cpp b/libraries/BLE/src/BLERemoteDescriptor.cpp index f99cdb8c8f3..dba4de29980 100644 --- a/libraries/BLE/src/BLERemoteDescriptor.cpp +++ b/libraries/BLE/src/BLERemoteDescriptor.cpp @@ -4,6 +4,9 @@ * Created on: Jul 8, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -219,3 +222,4 @@ void BLERemoteDescriptor::setAuth(esp_gatt_auth_req_t auth) { } #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLERemoteDescriptor.h b/libraries/BLE/src/BLERemoteDescriptor.h index af370e43bf4..1276b93ad04 100644 --- a/libraries/BLE/src/BLERemoteDescriptor.h +++ b/libraries/BLE/src/BLERemoteDescriptor.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_ #define COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -54,5 +57,7 @@ class BLERemoteDescriptor { }; + #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_ */ diff --git a/libraries/BLE/src/BLERemoteService.cpp b/libraries/BLE/src/BLERemoteService.cpp index b008bfb0dc0..41344108be8 100644 --- a/libraries/BLE/src/BLERemoteService.cpp +++ b/libraries/BLE/src/BLERemoteService.cpp @@ -4,6 +4,9 @@ * Created on: Jul 8, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -361,3 +364,4 @@ std::string BLERemoteService::toString() { #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLERemoteService.h b/libraries/BLE/src/BLERemoteService.h index 64aff5a168b..d9034ef6053 100644 --- a/libraries/BLE/src/BLERemoteService.h +++ b/libraries/BLE/src/BLERemoteService.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEREMOTESERVICE_H_ #define COMPONENTS_CPP_UTILS_BLEREMOTESERVICE_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -82,4 +85,5 @@ class BLERemoteService { }; // BLERemoteService #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEREMOTESERVICE_H_ */ diff --git a/libraries/BLE/src/BLEScan.cpp b/libraries/BLE/src/BLEScan.cpp index e17eb2b0f12..02286cfda70 100644 --- a/libraries/BLE/src/BLEScan.cpp +++ b/libraries/BLE/src/BLEScan.cpp @@ -7,10 +7,12 @@ * Update: April, 2021 * add BLE5 support */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) - #include #include @@ -146,7 +148,7 @@ void BLEScan::handleGAPEvent( break; } // ESP_GAP_BLE_SCAN_RESULT_EVT -#ifdef CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#ifdef SOC_BLE_50_SUPPORTED case ESP_GAP_BLE_EXT_ADV_REPORT_EVT: { if (param->ext_adv_report.params.event_type & ESP_BLE_GAP_SET_EXT_ADV_PROP_LEGACY) { log_v("legacy adv, adv type 0x%x data len %d", param->ext_adv_report.params.event_type, param->ext_adv_report.params.adv_data_len); @@ -237,7 +239,7 @@ void BLEScan::handleGAPEvent( } break; -#endif // CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#endif // SOC_BLE_50_SUPPORTED default: { break; @@ -273,7 +275,7 @@ void BLEScan::setAdvertisedDeviceCallbacks(BLEAdvertisedDeviceCallbacks* pAdvert m_shouldParse = shouldParse; } // setAdvertisedDeviceCallbacks -#ifdef CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#ifdef SOC_BLE_50_SUPPORTED void BLEScan::setExtendedScanCallback(BLEExtAdvertisingCallbacks* cb) { @@ -355,7 +357,7 @@ void BLEScan::setPeriodicScanCallback(BLEPeriodicScanCallbacks* cb) m_pPeriodicScanCb = cb; } -#endif // CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#endif // SOC_BLE_50_SUPPORTED /** * @brief Set the interval to scan. * @param [in] The interval in msecs. @@ -510,3 +512,4 @@ void BLEScan::clearResults() { } #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEScan.h b/libraries/BLE/src/BLEScan.h index 3aca9e7d084..606d41e6541 100644 --- a/libraries/BLE/src/BLEScan.h +++ b/libraries/BLE/src/BLEScan.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLESCAN_H_ #define COMPONENTS_CPP_UTILS_BLESCAN_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -74,7 +77,7 @@ class BLEScan { BLEScanResults getResults(); void clearResults(); -#ifdef CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#ifdef SOC_BLE_50_SUPPORTED void setExtendedScanCallback(BLEExtAdvertisingCallbacks* cb); void setPeriodicScanCallback(BLEPeriodicScanCallbacks* cb); @@ -85,7 +88,7 @@ class BLEScan { private: BLEExtAdvertisingCallbacks* m_pExtendedScanCb = nullptr; BLEPeriodicScanCallbacks* m_pPeriodicScanCb = nullptr; -#endif // CONFIG_BT_BLE_50_FEATURES_SUPPORTED +#endif // SOC_BLE_50_SUPPORTED private: BLEScan(); // One doesn't create a new instance instead one asks the BLEDevice for the singleton. @@ -119,4 +122,5 @@ class BLEPeriodicScanCallbacks { }; #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLESCAN_H_ */ diff --git a/libraries/BLE/src/BLESecurity.cpp b/libraries/BLE/src/BLESecurity.cpp index b04acfdaf8a..8437ee721e4 100644 --- a/libraries/BLE/src/BLESecurity.cpp +++ b/libraries/BLE/src/BLESecurity.cpp @@ -5,6 +5,9 @@ * Author: chegewara */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "BLESecurity.h" #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -112,4 +115,6 @@ char* BLESecurity::esp_key_type_to_str(esp_ble_key_type_t key_type) { } return key_str; } // esp_key_type_to_str -#endif // CONFIG_BLUEDROID_ENABLED + +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLESecurity.h b/libraries/BLE/src/BLESecurity.h index 144f4bbdf2b..06c7dcd30dc 100644 --- a/libraries/BLE/src/BLESecurity.h +++ b/libraries/BLE/src/BLESecurity.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLESECURITY_H_ #define COMPONENTS_CPP_UTILS_BLESECURITY_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -69,5 +72,6 @@ class BLESecurityCallbacks { virtual bool onConfirmPIN(uint32_t pin) = 0; }; // BLESecurityCallbacks -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif // COMPONENTS_CPP_UTILS_BLESECURITY_H_ diff --git a/libraries/BLE/src/BLEServer.cpp b/libraries/BLE/src/BLEServer.cpp index f9f7d4515c8..2fe3b64d0c3 100644 --- a/libraries/BLE/src/BLEServer.cpp +++ b/libraries/BLE/src/BLEServer.cpp @@ -4,6 +4,8 @@ * Created on: Apr 16, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -439,4 +441,5 @@ void BLEServer::disconnect(uint16_t connId) { esp_ble_gatts_close(m_gatts_if, connId); } -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEServer.h b/libraries/BLE/src/BLEServer.h index 804e14579ac..0e31ff5ac4a 100644 --- a/libraries/BLE/src/BLEServer.h +++ b/libraries/BLE/src/BLEServer.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLESERVER_H_ #define COMPONENTS_CPP_UTILS_BLESERVER_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -149,4 +152,5 @@ class BLEServerCallbacks { #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLESERVER_H_ */ diff --git a/libraries/BLE/src/BLEService.cpp b/libraries/BLE/src/BLEService.cpp index ea815825883..c40a5059c9e 100644 --- a/libraries/BLE/src/BLEService.cpp +++ b/libraries/BLE/src/BLEService.cpp @@ -7,6 +7,9 @@ // A service is identified by a UUID. A service is also the container for one or more characteristics. +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -410,4 +413,5 @@ BLEServer* BLEService::getServer() { return m_pServer; } // getServer -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEService.h b/libraries/BLE/src/BLEService.h index c801a2f5322..4c479343c9a 100644 --- a/libraries/BLE/src/BLEService.h +++ b/libraries/BLE/src/BLEService.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLESERVICE_H_ #define COMPONENTS_CPP_UTILS_BLESERVICE_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) @@ -93,5 +96,6 @@ class BLEService { }; // BLEService -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLESERVICE_H_ */ diff --git a/libraries/BLE/src/BLEServiceMap.cpp b/libraries/BLE/src/BLEServiceMap.cpp index ec6fab259ce..c70b567fe2c 100644 --- a/libraries/BLE/src/BLEServiceMap.cpp +++ b/libraries/BLE/src/BLEServiceMap.cpp @@ -4,6 +4,9 @@ * Created on: Jun 22, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -135,3 +138,4 @@ int BLEServiceMap::getRegisteredServiceCount(){ } #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEUUID.cpp b/libraries/BLE/src/BLEUUID.cpp index 3cbb34a5271..d91a5eae094 100644 --- a/libraries/BLE/src/BLEUUID.cpp +++ b/libraries/BLE/src/BLEUUID.cpp @@ -4,6 +4,9 @@ * Created on: Jun 21, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -384,3 +387,4 @@ std::string BLEUUID::toString() { } // toString #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEUUID.h b/libraries/BLE/src/BLEUUID.h index 07617b9dcb4..ba05c3f2a4e 100644 --- a/libraries/BLE/src/BLEUUID.h +++ b/libraries/BLE/src/BLEUUID.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEUUID_H_ #define COMPONENTS_CPP_UTILS_BLEUUID_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #include #if CONFIG_BLUEDROID_ENABLED @@ -35,5 +38,7 @@ class BLEUUID { esp_bt_uuid_t m_uuid; // The underlying UUID structure that this class wraps. bool m_valueSet = false; // Is there a value set for this instance. }; // BLEUUID + #endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEUUID_H_ */ diff --git a/libraries/BLE/src/BLEUtils.cpp b/libraries/BLE/src/BLEUtils.cpp index be9cc55f8b7..be3accf93fb 100644 --- a/libraries/BLE/src/BLEUtils.cpp +++ b/libraries/BLE/src/BLEUtils.cpp @@ -4,6 +4,9 @@ * Created on: Mar 25, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include "BLEAddress.h" @@ -2037,4 +2040,5 @@ const char* BLEUtils::searchEventTypeToString(esp_gap_search_evt_t searchEvt) { } } // searchEventTypeToString -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEUtils.h b/libraries/BLE/src/BLEUtils.h index 580075df7cc..a141fbfe903 100644 --- a/libraries/BLE/src/BLEUtils.h +++ b/libraries/BLE/src/BLEUtils.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEUTILS_H_ #define COMPONENTS_CPP_UTILS_BLEUTILS_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include // ESP32 BLE @@ -59,5 +62,6 @@ class BLEUtils { static const char* searchEventTypeToString(esp_gap_search_evt_t searchEvt); }; -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEUTILS_H_ */ diff --git a/libraries/BLE/src/BLEValue.cpp b/libraries/BLE/src/BLEValue.cpp index a42c92d123e..8554753fe4b 100644 --- a/libraries/BLE/src/BLEValue.cpp +++ b/libraries/BLE/src/BLEValue.cpp @@ -4,6 +4,9 @@ * Created on: Jul 17, 2017 * Author: kolban */ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include "BLEValue.h" @@ -127,4 +130,5 @@ void BLEValue::setValue(uint8_t* pData, size_t length) { } // setValue -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ diff --git a/libraries/BLE/src/BLEValue.h b/libraries/BLE/src/BLEValue.h index 31734e489cc..745899e8b32 100644 --- a/libraries/BLE/src/BLEValue.h +++ b/libraries/BLE/src/BLEValue.h @@ -7,6 +7,9 @@ #ifndef COMPONENTS_CPP_UTILS_BLEVALUE_H_ #define COMPONENTS_CPP_UTILS_BLEVALUE_H_ +#include "soc/soc_caps.h" +#if SOC_BLE_SUPPORTED + #include "sdkconfig.h" #if defined(CONFIG_BLUEDROID_ENABLED) #include @@ -35,5 +38,6 @@ class BLEValue { std::string m_value; }; -#endif // CONFIG_BLUEDROID_ENABLED +#endif /* CONFIG_BLUEDROID_ENABLED */ +#endif /* SOC_BLE_SUPPORTED */ #endif /* COMPONENTS_CPP_UTILS_BLEVALUE_H_ */ diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index d206e6cc212..6e2c024fdd6 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -20,6 +20,8 @@ */ #include "SPI.h" +#if SOC_GPSPI_SUPPORTED + #include "esp32-hal-log.h" #if !CONFIG_DISABLE_HAL_LOCKS @@ -360,3 +362,4 @@ SPIClass SPI(VSPI); SPIClass SPI(FSPI); #endif +#endif /* SOC_GPSPI_SUPPORTED */ diff --git a/libraries/SPI/src/SPI.h b/libraries/SPI/src/SPI.h index 7f07e5beb0d..70cc28a0d27 100644 --- a/libraries/SPI/src/SPI.h +++ b/libraries/SPI/src/SPI.h @@ -21,6 +21,9 @@ #ifndef _SPI_H_INCLUDED #define _SPI_H_INCLUDED +#include "soc/soc_caps.h" +#if SOC_GPSPI_SUPPORTED + #include #include "pins_arduino.h" #include "esp32-hal-spi.h" @@ -94,4 +97,5 @@ class SPIClass extern SPIClass SPI; -#endif +#endif /* SOC_GPSPI_SUPPORTED */ +#endif /* _SPI_H_INCLUDED */ diff --git a/libraries/USB/src/USBHID.cpp b/libraries/USB/src/USBHID.cpp index 521e0803970..ee673d174c1 100644 --- a/libraries/USB/src/USBHID.cpp +++ b/libraries/USB/src/USBHID.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "USBHID.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_HID_ENABLED @@ -384,3 +385,4 @@ void USBHID::onEvent(arduino_usb_hid_event_t event, esp_event_handler_t callback } #endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHID.h b/libraries/USB/src/USBHID.h index e7eaae10fab..22e3b8c8988 100644 --- a/libraries/USB/src/USBHID.h +++ b/libraries/USB/src/USBHID.h @@ -13,6 +13,10 @@ // limitations under the License. #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include #include #include "sdkconfig.h" @@ -77,3 +81,4 @@ class USBHID }; #endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDConsumerControl.cpp b/libraries/USB/src/USBHIDConsumerControl.cpp index b1863dee3f3..69530e24be2 100644 --- a/libraries/USB/src/USBHIDConsumerControl.cpp +++ b/libraries/USB/src/USBHIDConsumerControl.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "USBHID.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_HID_ENABLED @@ -55,3 +56,4 @@ size_t USBHIDConsumerControl::release(){ #endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDConsumerControl.h b/libraries/USB/src/USBHIDConsumerControl.h index 9c60ff69e6f..54377d287e5 100644 --- a/libraries/USB/src/USBHIDConsumerControl.h +++ b/libraries/USB/src/USBHIDConsumerControl.h @@ -13,6 +13,10 @@ // limitations under the License. #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "USBHID.h" #if CONFIG_TINYUSB_HID_ENABLED @@ -82,4 +86,5 @@ class USBHIDConsumerControl: public USBHIDDevice { uint16_t _onGetDescriptor(uint8_t* buffer); }; -#endif +#endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDGamepad.cpp b/libraries/USB/src/USBHIDGamepad.cpp index 9ddf67f4a99..0377065cd4e 100644 --- a/libraries/USB/src/USBHIDGamepad.cpp +++ b/libraries/USB/src/USBHIDGamepad.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "USBHID.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_HID_ENABLED @@ -117,5 +118,5 @@ bool USBHIDGamepad::send(int8_t x, int8_t y, int8_t z, int8_t rz, int8_t rx, int return write(); } - #endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDGamepad.h b/libraries/USB/src/USBHIDGamepad.h index 72b096db005..c86865d781d 100644 --- a/libraries/USB/src/USBHIDGamepad.h +++ b/libraries/USB/src/USBHIDGamepad.h @@ -13,6 +13,10 @@ // limitations under the License. #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "USBHID.h" #if CONFIG_TINYUSB_HID_ENABLED @@ -84,4 +88,5 @@ class USBHIDGamepad: public USBHIDDevice { uint16_t _onGetDescriptor(uint8_t* buffer); }; -#endif +#endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDKeyboard.cpp b/libraries/USB/src/USBHIDKeyboard.cpp index 8de377d29c2..7cfa239174b 100644 --- a/libraries/USB/src/USBHIDKeyboard.cpp +++ b/libraries/USB/src/USBHIDKeyboard.cpp @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "USBHID.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_HID_ENABLED @@ -347,3 +348,4 @@ size_t USBHIDKeyboard::write(const uint8_t *buffer, size_t size) { } #endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDKeyboard.h b/libraries/USB/src/USBHIDKeyboard.h index 41b6db9d8fc..7e0201688c8 100644 --- a/libraries/USB/src/USBHIDKeyboard.h +++ b/libraries/USB/src/USBHIDKeyboard.h @@ -20,6 +20,10 @@ */ #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "Print.h" #include "USBHID.h" #if CONFIG_TINYUSB_HID_ENABLED @@ -137,4 +141,5 @@ class USBHIDKeyboard: public USBHIDDevice, public Print void _onOutput(uint8_t report_id, const uint8_t* buffer, uint16_t len); }; -#endif +#endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDMouse.cpp b/libraries/USB/src/USBHIDMouse.cpp index 30b802a4607..e71d26570fb 100644 --- a/libraries/USB/src/USBHIDMouse.cpp +++ b/libraries/USB/src/USBHIDMouse.cpp @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "USBHID.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_HID_ENABLED @@ -88,5 +89,5 @@ bool USBHIDMouse::isPressed(uint8_t b){ return false; } - #endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDMouse.h b/libraries/USB/src/USBHIDMouse.h index 17adf17b471..f69e371c798 100644 --- a/libraries/USB/src/USBHIDMouse.h +++ b/libraries/USB/src/USBHIDMouse.h @@ -20,6 +20,10 @@ */ #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "USBHID.h" #if CONFIG_TINYUSB_HID_ENABLED @@ -51,4 +55,5 @@ class USBHIDMouse: public USBHIDDevice { uint16_t _onGetDescriptor(uint8_t* buffer); }; -#endif +#endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDSystemControl.cpp b/libraries/USB/src/USBHIDSystemControl.cpp index 93ef897fd69..086d9bd627c 100644 --- a/libraries/USB/src/USBHIDSystemControl.cpp +++ b/libraries/USB/src/USBHIDSystemControl.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "USBHID.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_HID_ENABLED @@ -57,3 +58,4 @@ size_t USBHIDSystemControl::release(){ } #endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDSystemControl.h b/libraries/USB/src/USBHIDSystemControl.h index 05ba573f2b4..84ef40ff1c6 100644 --- a/libraries/USB/src/USBHIDSystemControl.h +++ b/libraries/USB/src/USBHIDSystemControl.h @@ -13,6 +13,10 @@ // limitations under the License. #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "USBHID.h" #if CONFIG_TINYUSB_HID_ENABLED @@ -36,4 +40,5 @@ class USBHIDSystemControl: public USBHIDDevice { uint16_t _onGetDescriptor(uint8_t* buffer); }; -#endif +#endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDVendor.cpp b/libraries/USB/src/USBHIDVendor.cpp index aa5b9f0ac7d..342c47f96db 100644 --- a/libraries/USB/src/USBHIDVendor.cpp +++ b/libraries/USB/src/USBHIDVendor.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "USBHID.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_HID_ENABLED @@ -234,3 +235,4 @@ void USBHIDVendor::flush(void){} #endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBHIDVendor.h b/libraries/USB/src/USBHIDVendor.h index fe11c0b5e11..714d3ab9b15 100644 --- a/libraries/USB/src/USBHIDVendor.h +++ b/libraries/USB/src/USBHIDVendor.h @@ -13,6 +13,10 @@ // limitations under the License. #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "Stream.h" #include "USBHID.h" #if CONFIG_TINYUSB_HID_ENABLED @@ -64,4 +68,5 @@ class USBHIDVendor: public USBHIDDevice, public Stream { void _onOutput(uint8_t report_id, const uint8_t* buffer, uint16_t len); }; -#endif +#endif /* CONFIG_TINYUSB_HID_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBVendor.cpp b/libraries/USB/src/USBVendor.cpp index 8882e32c0c5..dabc5a0766d 100644 --- a/libraries/USB/src/USBVendor.cpp +++ b/libraries/USB/src/USBVendor.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "USBVendor.h" +#if SOC_USB_OTG_SUPPORTED #if CONFIG_TINYUSB_VENDOR_ENABLED @@ -214,3 +215,4 @@ size_t USBVendor::read(uint8_t *buffer, size_t size){ void USBVendor::flush(void){} #endif /* CONFIG_TINYUSB_VENDOR_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/USB/src/USBVendor.h b/libraries/USB/src/USBVendor.h index 2016a76a790..6be0c7a5888 100644 --- a/libraries/USB/src/USBVendor.h +++ b/libraries/USB/src/USBVendor.h @@ -13,6 +13,10 @@ // limitations under the License. #pragma once + +#include "soc/soc_caps.h" +#if SOC_USB_OTG_SUPPORTED + #include "Stream.h" #include "sdkconfig.h" @@ -92,3 +96,4 @@ class USBVendor: public Stream { }; #endif /* CONFIG_TINYUSB_VENDOR_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index ae05e2752a0..2568e3c9413 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -22,6 +22,8 @@ Modified Nov 2017 by Chuck Todd (ctodd@cableone.net) - ESP32 ISR Support Modified Nov 2021 by Hristo Gochkov to support ESP-IDF API */ +#include "soc/soc_caps.h" +#if SOC_I2C_SUPPORTED extern "C" { #include @@ -224,6 +226,7 @@ size_t TwoWire::setBufferSize(size_t bSize) return bSize; } +#if SOC_I2C_SUPPORT_SLAVE // Slave Begin bool TwoWire::begin(uint8_t addr, int sdaPin, int sclPin, uint32_t frequency) { @@ -273,6 +276,7 @@ bool TwoWire::begin(uint8_t addr, int sdaPin, int sclPin, uint32_t frequency) #endif return started; } +#endif /* SOC_I2C_SUPPORT_SLAVE */ // Master Begin bool TwoWire::begin(int sdaPin, int sclPin, uint32_t frequency) @@ -642,6 +646,8 @@ uint8_t TwoWire::endTransmission(void) return endTransmission(true); } +#if SOC_I2C_SUPPORT_SLAVE + size_t TwoWire::slaveWrite(const uint8_t * buffer, size_t len) { return i2cSlaveWrite(num, buffer, len, _timeOutMillis); @@ -693,6 +699,9 @@ void TwoWire::onRequest( void (*function)(void) ) user_onRequest = function; } +#endif /* SOC_I2C_SUPPORT_SLAVE */ TwoWire Wire = TwoWire(0); TwoWire Wire1 = TwoWire(1); + +#endif /* SOC_I2C_SUPPORTED */ diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index 339b0e2866f..a4cdb117443 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -26,6 +26,9 @@ #ifndef TwoWire_h #define TwoWire_h +#include "soc/soc_caps.h" +#if SOC_I2C_SUPPORTED + #include #if !CONFIG_DISABLE_HAL_LOCKS #include "freertos/FreeRTOS.h" @@ -69,10 +72,12 @@ class TwoWire: public Stream #endif private: bool is_slave; +#if SOC_I2C_SUPPORT_SLAVE void (*user_onRequest)(void); void (*user_onReceive)(int); static void onRequestService(uint8_t, void *); static void onReceiveService(uint8_t, uint8_t*, size_t, bool, void *); +#endif /* SOC_I2C_SUPPORT_SLAVE */ bool initPins(int sdaPin, int sclPin); bool allocateWireBuffer(void); void freeWireBuffer(void); @@ -153,13 +158,15 @@ class TwoWire: public Stream { return write((uint8_t)n); } - +#if SOC_I2C_SUPPORT_SLAVE void onReceive( void (*)(int) ); void onRequest( void (*)(void) ); size_t slaveWrite(const uint8_t *, size_t); +#endif /* SOC_I2C_SUPPORT_SLAVE */ }; extern TwoWire Wire; extern TwoWire Wire1; -#endif +#endif /* SOC_I2C_SUPPORTED */ +#endif /* TwoWire_h */