8000 Set ESP-IDF to 3.2 (#2662) · projectgus/arduino-esp32@7b5cd47 · GitHub
[go: up one dir, main page]

8000 Skip to content

Commit 7b5cd47

Browse files
authored
Set ESP-IDF to 3.2 (espressif#2662)
* Set IDF to v3.2 * Remove BLE submodule * Add BLE lib source * Update Camera example to support OV3660
1 parent 1412606 commit 7b5cd47

File tree

247 files changed

+15354
-5225
lines changed
  • BLE_notify
  • BLE_scan
  • BLE_server_multiconnect
  • BLE_server
  • BLE_uart
  • BLE_write
  • src
  • ESP32/examples/Camera/CameraWebServer
  • tools
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    247 files changed

    +15354
    -5225
    lines changed

    .gitmodules

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,3 @@
    1-
    [submodule "libraries/BLE"]
    2-
    path = libraries/BLE
    3-
    url = https://github.com/nkolban/ESP32_BLE_Arduino.git
    41
    [submodule "libraries/AzureIoT"]
    52
    path = libraries/AzureIoT
    63
    url = https://github.com/VSChina/ESP32_AzureIoT_Arduino

    boards.txt

    Lines changed: 27 additions & 25 deletions
    Original file line numberDiff line numberDiff line change
    @@ -9,31 +9,7 @@ menu.PSRAM=PSRAM
    99
    menu.Revision=Board Revision
    1010

    1111
    ##############################################################
    12-
    13-
    esp32cam.name=AI Thinker ESP32-CAM
    14-
    15-
    esp32cam.upload.tool=esptool_py
    16-
    esp32cam.upload.maximum_size=3145728
    17-
    esp32cam.upload.maximum_data_size=327680
    18-
    esp32cam.upload.wait_for_upload_port=true
    19-
    esp32cam.upload.speed=460800
    20-
    21-
    esp32cam.serial.disableDTR=true
    22-
    esp32cam.serial.disableRTS=true
    23-
    24-
    esp32cam.build.mcu=esp32
    25-
    esp32cam.build.core=esp32
    26-
    esp32cam.build.variant=esp32
    27-
    esp32cam.build.board=ESP32_DEV
    28-
    esp32cam.build.f_cpu=240000000L
    29-
    esp32cam.build.flash_size=4MB
    30-
    esp32cam.build.flash_freq=80m
    31-
    esp32cam.build.flash_mode=dio
    32-
    esp32cam.build.boot=qio
    33-
    esp32cam.build.partitions=huge_app
    34-
    esp32cam.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
    35-
    esp32cam.build.code_debug=0
    36-
    12+
    ### DO NOT PUT BOARDS ABOVE THE OFFICIAL ESPRESSIF BOARDS! ###
    3713
    ##############################################################
    3814

    3915
    esp32.name=ESP32 Dev Module
    @@ -3449,4 +3425,30 @@ frogboard.menu.DebugLevel.verbose.build.code_debug=5
    34493425

    34503426
    ##############################################################
    34513427

    3428+
    esp32cam.name=AI Thinker ESP32-CAM
    3429+
    3430+
    esp32cam.upload.tool=esptool_py
    3431+
    esp32cam.upload.maximum_size=3145728
    3432+
    esp32cam.upload.maximum_data_size=327680
    3433+
    esp32cam.upload.wait_for_upload_port=true
    3434+
    esp32cam.upload.speed=460800
    3435+
    3436+
    esp32cam.serial.disableDTR=true
    3437+
    esp32cam.serial.disableRTS=true
    3438+
    3439+
    esp32cam.build.mcu=esp32
    3440+
    esp32cam.build.core=esp32
    3441+
    esp32cam.build.variant=esp32
    3442+
    esp32cam.build.board=ESP32_DEV
    3443+
    esp32cam.build.f_cpu=240000000L
    3444+
    esp32cam.build.flash_size=4MB
    3445+
    esp32cam.build.flash_freq=80m
    3446+
    esp32cam.build.flash_mode=dio
    3447+
    esp32cam.build.boot=qio
    3448+
    esp32cam.build.partitions=huge_app
    3449+
    esp32cam.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
    3450+
    esp32cam.build.code_debug=0
    3451+
    3452+
    ##############################################################
    3453+
    34523454

    libraries/BLE

    Lines changed: 0 additions & 1 deletion
    This file was deleted.

    libraries/BLE/README.md

    Lines changed: 15 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,15 @@
    1+
    # ESP32 BLE for Arduino
    2+
    The Arduino IDE provides an excellent library package manager where versions of libraries can be downloaded and installed. This Github project provides the repository for the ESP32 BLE support for Arduino.
    3+
    4+
    The actual source of the project which is being maintained can be found here:
    5+
    6+
    https://github.com/nkolban/esp32-snippets
    7+
    8+
    Issues and questions should be raised here:
    9+
    10+
    https://github.com/nkolban/esp32-snippets/issues
    11+
    12+
    13+
    Documentation for using the library can be found here:
    14+
    15+
    https://github.com/nkolban/esp32-snippets/tree/master/Documentation
    Lines changed: 160 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,160 @@
    1+
    /**
    2+
    * A BLE client example that is rich in capabilities.
    3+
    * There is a lot new capabilities implemented.
    4+
    * author unknown
    5+
    * updated by chegewara
    6+
    */
    7+
    8+
    #include "BLEDevice.h"
    9+
    //#include "BLEScan.h"
    10+
    11+
    // The remote service we wish to connect to.
    12+
    static BLEUUID serviceUUID("4fafc201-1fb5-459e-8fcc-c5c9c331914b");
    13+
    // The characteristic of the remote service we are interested in.
    14+
    static BLEUUID charUUID("beb5483e-36e1-4688-b7f5-ea07361b26a8");
    15+
    16+
    static boolean doConnect = false;
    17+
    static boolean connected = false;
    18+
    static boolean doScan = false;
    19+
    static BLERemoteCharacteristic* pRemoteCharacteristic;
    20+
    static BLEAdvertisedDevice* myDevice;
    21+
    22+
    static void notifyCallback(
    23+
    BLERemoteCharacteristic* pBLERemoteCharacteristic,
    24+
    uint8_t* pData,
    25+
    size_t length,
    26+
    bool isNotify) {
    27+
    Serial.print("Notify callback for characteristic ");
    28+
    Serial.print(pBLERemoteCharacteristic->getUUID().toString().c_str());
    29+
    Serial.print(" of data length ");
    30+
    Serial.println(length);
    31+
    Serial.print("data: ");
    32+
    Serial.println((char*)pData);
    33+
    }
    34+
    35+
    class MyClientCallback : public BLEClientCallbacks {
    36+
    void on 10000 Connect(BLEClient* pclient) {
    37+
    }
    38+
    39+
    void onDisconnect(BLEClient* pclient) {
    40+
    connected = false;
    41+
    Serial.println("onDisconnect");
    42+
    }
    43+
    };
    44+
    45+
    bool connectToServer() {
    46+
    Serial.print("Forming a connection to ");
    47+
    Serial.println(myDevice->getAddress().toString().c_str());
    48+
    49+
    BLEClient* pClient = BLEDevice::createClient();
    50+
    Serial.println(" - Created client");
    51+
    52+
    pClient->setClientCallbacks(new MyClientCallback());
    53+
    54+
    // Connect to the remove BLE Server.
    55+
    pClient->connect(myDevice); // if you pass BLEAdvertisedDevice instead of address, it will be recognized type of peer device address (public or private)
    56+
    Serial.println(" - Connected to server");
    57+
    58+
    // Obtain a reference to the service we are after in the remote BLE server.
    59+
    BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
    60+
    if (pRemoteService == nullptr) {
    61+
    Serial.print("Failed to find our service UUID: ");
    62+
    Serial.println(serviceUUID.toString().c_str());
    63+
    pClient->disconnect();
    64+
    return false;
    65+
    }
    66+
    Serial.println(" - Found our service");
    67+
    68+
    69+
    // Obtain a reference to the characteristic in the service of the remote BLE server.
    70+
    pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
    71+
    if (pRemoteCharacteristic == nullptr) {
    72+
    Serial.print("Failed to find our characteristic UUID: ");
    73+
    Serial.println(charUUID.toString().c_str());
    74+
    pClient->disconnect();
    75+
    return false;
    76+
    }
    77+
    Serial.println(" - Found our characteristic");
    78+
    79+
    // Read the value of the characteristic.
    80+
    if(pRemoteCharacteristic->canRead()) {
    81+
    std::string value = pRemoteCharacteristic->readValue();
    82+
    Serial.print("The characteristic value was: ");
    83+
    Serial.println(value.c_str());
    84+
    }
    85+
    86+
    if(pRemoteCharacteristic->canNotify())
    87+
    pRemoteCharacteristic->registerForNotify(notifyCallback);
    88+
    89+
    connected = true;
    90+
    }
    91+
    /**
    92+
    * Scan for BLE servers and find the first one that advertises the service we are looking for.
    93+
    */
    94+
    class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
    95+
    /**
    96+
    * Called for each advertising BLE server.
    97+
    */
    98+
    void onResult(BLEAdvertisedDevice advertisedDevice) {
    99+
    Serial.print("BLE Advertised Device found: ");
    100+
    Serial.println(advertisedDevice.toString().c_str());
    101+
    102+
    // We have found a device, let us now see if it contains the service we are looking for.
    103+
    if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(serviceUUID)) {
    104+
    105+
    BLEDevice::getScan()->stop();
    106+
    myDevice = new BLEAdvertisedDevice(advertisedDevice);
    107+
    doConnect = true;
    108+
    doScan = true;
    109+
    110+
    } // Found our server
    111+
    } // onResult
    112+
    }; // MyAdvertisedDeviceCallbacks
    113+
    114+
    115+
    void setup() {
    116+
    Serial.begin(115200);
    117+
    Serial.println("Starting Arduino BLE Client application...");
    118+
    BLEDevice::init("");
    119+
    120+
    // Retrieve a Scanner and set the callback we want to use to be informed when we
    121+
    // have detected a new device. Specify that we want active scanning and start the
    122+
    // scan to run for 5 seconds.
    123+
    BLEScan* pBLEScan = BLEDevice::getScan();
    124+
    pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
    125+
    pBLEScan->setInterval(1349);
    126+
    pBLEScan->setWindow(449);
    127+
    pBLEScan->setActiveScan(true);
    128+
    pBLEScan->start(5, false);
    129+
    } // End of setup.
    130+
    131+
    132+
    // This is the Arduino main loop function.
    133+
    void loop() {
    134+
    135+
    // If the flag "doConnect" is true then we have scanned for and found the desired
    136+
    // BLE Server with which we wish to connect. Now we connect to it. Once we are
    137+
    // connected we set the connected flag to be true.
    138+
    if (doConnect == true) {
    139+
    if (connectToServer()) {
    140+
    Serial.println("We are now connected to the BLE Server.");
    141+
    } else {
    142+
    Serial.println("We have failed to connect to the server; there is nothin more we will do.");
    143+
    }
    144+
    doConnect = false;
    145+
    }
    146+
    147+
    // If we are connected to a peer BLE Server, update the characteristic each time we are reached
    148+
    // with the current time since boot.
    149+
    if (connected) {
    150+
    String newValue = "Time since boot: " + String(millis()/1000);
    151+
    Serial.println("Setting new characteristic value to \"" + newValue + "\"");
    152+
    153+
    // Set the characteristic's value to be the array of bytes that is actually a string.
    154+
    pRemoteCharacteristic->writeValue(newValue.c_str(), newValue.length());
    155+
    }else if(doScan){
    156+
    BLEDevice::getScan()->start(0); // this is just eample to start scan after disconnect, most likely there is better way to do it in arduino
    157+
    }
    158+
    159+
    delay(1000); // Delay a second between loops.
    160+
    } // End of loop
    Lines changed: 103 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,103 @@
    1+
    /*
    2+
    Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp
    3+
    Ported to Arduino ESP32 by pcbreflux
    4+
    */
    5+
    6+
    7+
    /*
    8+
    Create a BLE server that will send periodic iBeacon frames.
    9+
    The design of creating the BLE server is:
    10+
    1. Create a BLE Server
    11+
    2. Create advertising data
    12+
    3. Start advertising.
    13+
    4. wait
    14+
    5. Stop advertising.
    15+
    6. deep sleep
    16+
    17+
    */
    18+
    #include "sys/time.h"
    19+
    20+
    #include "BLEDevice.h"
    21+
    #include "BLEUtils.h"
    22+
    #include "BLEBeacon.h"
    23+
    #include "esp_sleep.h"
    24+
    25+
    #define GPIO_DEEP_SLEEP_DURATION 10 // sleep x seconds and then wake up
    26+
    RTC_DATA_ATTR static time_t last; // remember last boot in RTC Memory
    27+
    RTC_DATA_ATTR static uint32_t bootcount; // remember number of boots in RTC Memory
    28+
    29+
    #ifdef __cplusplus
    30+
    extern "C" {
    31+
    #endif
    32+
    33+
    uint8_t temprature_sens_read();
    34+
    //uint8_t g_phyFuns;
    35+
    36+
    #ifdef __cplusplus
    37+
    }
    38+
    #endif
    39+
    40+
    // See the following for generating UUIDs:
    41+
    // https://www.uuidgenerator.net/
    42+
    BLEAdvertising *pAdvertising;
    43+
    struct timeval now;
    44+
    45+
    #define BEACON_UUID "8ec76ea3-6668-48da-9866-75be8bc86f4d" // UUID 1 128-Bit (may use linux tool uuidgen or random numbers via https://www.uuidgenerator.net/)
    46+
    47+
    void setBeacon() {
    48+
    49+
    BLEBeacon oBeacon = BLEBeacon();
    50+
    oBeacon.setManufacturerId(0x4C00); // fake Apple 0x004C LSB (ENDIAN_CHANGE_U16!)
    51+
    oBeacon.setProximityUUID(BLEUUID(BEACON_UUID));
    52+
    oBeacon.setMajor((bootcount & 0xFFFF0000) >> 16);
    53+
    oBeacon.setMinor(bootcount&0xFFFF);
    54+
    BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
    55+
    BLEAdvertisementData oScanResponseData = BLEAdvertisementData();
    56+
    57+
    oAdvertisementData.setFlags(0x04); // BR_EDR_NOT_SUPPORTED 0x04
    58+
    59+
    std::string strServiceData = "";
    60+
    61+
    strServiceData += (char)26; // Len
    62+
    strServiceData += (char)0xFF; // Type
    63+
    strServiceData += oBeacon.getData();
    64+
    oAdvertisementData.addData(strServiceData);
    65+
    66+
    pAdvertising->setAdvertisementData(oAdvertisementData);
    67+
    pAdvertising->setScanResponseData(oScanResponseData);
    68+
    69+
    }
    70+
    71+
    void setup() {
    72+
    73+
    74+
    Serial.begin(115200);
    75+
    gettimeofday(&now, NULL);
    76+
    77+
    Serial.printf("start ESP32 %d\n",bootcount++);
    78+
    79+
    Serial.printf("deep sleep (%lds since last reset, %lds since last boot)\n",now.tv_sec,now.tv_sec-last);
    80+
    81+
    last = now.tv_sec;
    82+
    83+
    // Create the BLE Device
    84+
    BLEDevice::init("");
    85+
    86+
    // Create the BLE Server
    87+
    // BLEServer *pServer = BLEDevice::createServer(); // <-- no longer required to instantiate BLEServer, less flash and ram usage
    88+
    89+
    pAdvertising = BLEDevice::getAdvertising();
    90+
    91+
    setBeacon();
    92+
    // Start advertising
    93+
    pAdvertising->start();
    94+
    Serial.println("Advertizing started...");
    95+
    delay(100);
    96+
    pAdvertising->stop();
    97+
    Serial.printf("enter deep sleep\n");
    98+
    esp_deep_sleep(1000000LL * GPIO_DEEP_SLEEP_DURATION);
    99+
    Serial.printf("in deep sleep\n");
    100+
    }
    101+
    102+
    void loop() {
    103+
    }

    0 commit comments

    Comments
     (0)
    0