Skip to content

Commit

Permalink
ESP32-C6: an option to build with NimBLE driver
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Mar 1, 2024
1 parent bcba878 commit d58ff02
Show file tree
Hide file tree
Showing 7 changed files with 463 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
ARDUINO_CLI_VERSION: 0.34.2
ARDUINO_BLE_VERSION: 1.3.6
ENERGIA_IDE_VERSION: 1.8.10E23
NIM_BLE_VERSION: 1.4.1
BOARD: ${{ matrix.board }}

# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down Expand Up @@ -214,6 +215,10 @@ jobs:
arduino --pref "custom_UploadSpeed=esp32c6_921600" --save-prefs ;
cd $HOME/.arduino15/packages/esp32/hardware/esp32/3.0.0-alpha3 ;
sed -i "s\echo '-DARDUINO_CORE_BUILD'\echo -DARDUINO_CORE_BUILD\g" platform.txt ;
wget https://github.com/h2zero/NimBLE-Arduino/archive/refs/tags/${NIM_BLE_VERSION}.tar.gz ;
tar xzf ${NIM_BLE_VERSION}.tar.gz ;
rm ${NIM_BLE_VERSION}.tar.gz ;
mv NimBLE-Arduino-${NIM_BLE_VERSION} $HOME/Arduino/libraries/ ;
cd $GITHUB_WORKSPACE ;
fi
if [[ "$BOARD" =~ "STM32:stm32:" ]]; then
Expand Down
5 changes: 5 additions & 0 deletions software/firmware/source/SoftRF/src/driver/Bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ enum
#endif

#if defined(ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2)
#include "../system/SoC.h"
#if defined(USE_NIMBLE)
#include "../platform/bluetooth/NimBLE.h"
#else
#include "../platform/bluetooth/Bluedroid.h"
#endif /* USE_NIMBLE */
#elif defined(ARDUINO_ARCH_NRF52)
#include "../platform/bluetooth/Bluefruit.h"
#elif defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_RASPBERRY_PI_PICO_W)
Expand Down
10 changes: 6 additions & 4 deletions software/firmware/source/SoftRF/src/platform/ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4082,8 +4082,9 @@ void handleMainEvent(AceButton* button, uint8_t eventType,
switch (eventType) {
#if defined(USE_SA8X8)
case AceButton::kEventPressed:
if (button == &button_ptt &&
Voice_Frequency > 0 &&
if (button == &button_ptt &&
hw_info.rf == RF_IC_SA8X8 &&
Voice_Frequency > 0 &&
(settings->power_save & POWER_SAVE_NORECEIVE)) {
bool playback = false;
#if !defined(EXCLUDE_VOICE_MESSAGE)
Expand Down Expand Up @@ -4135,8 +4136,9 @@ void handleMainEvent(AceButton* button, uint8_t eventType,
}
#endif /* USE_OLED */
#if defined(USE_SA8X8)
if (button == &button_ptt &&
Voice_Frequency > 0 &&
if (button == &button_ptt &&
hw_info.rf == RF_IC_SA8X8 &&
Voice_Frequency > 0 &&
(settings->power_save & POWER_SAVE_NORECEIVE)) {
controller.receive();
sa868_Tx_LED_state(false);
Expand Down
2 changes: 2 additions & 0 deletions software/firmware/source/SoftRF/src/platform/ESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,12 @@ extern const USB_Device_List_t supported_USB_devices[];
#define EXCLUDE_WATCHOUT_MODE
#undef USE_NMEALIB
#undef ENABLE_PROL
//#define USE_NIMBLE
#endif /* C6 */
#endif /* CONFIG_IDF_TARGET_ESP32SX | C3 | C6 */
#else
//#define ENABLE_BT_VOICE
//#define USE_NIMBLE
#endif /* NOT CONFIG_IDF_TARGET_ESP32 */

#define POWER_SAVING_WIFI_TIMEOUT 600000UL /* 10 minutes */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#if defined(ESP32)
#include "sdkconfig.h"

#if defined(CONFIG_BLUEDROID_ENABLED)
#include "../../system/SoC.h"

#if defined(CONFIG_BLUEDROID_ENABLED) && !defined(USE_NIMBLE)
/*
* BLE code is based on Neil Kolban example for IDF:
* https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp
Expand All @@ -34,7 +35,6 @@

#include "esp_gap_bt_api.h"

#include "../../system/SoC.h"
#include "../../driver/EEPROM.h"
#include "../../driver/Bluetooth.h"
#include "../../driver/WiFi.h"
Expand Down
Loading

0 comments on commit d58ff02

Please sign in to comment.