Skip to content

Commit

Permalink
Add compatibility with Giga
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed Mar 10, 2023
1 parent b40f618 commit f852716
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ sentence=Enables Bluetooth® Low Energy connectivity on the Arduino MKR WiFi 101
paragraph=This library supports creating a Bluetooth® Low Energy peripheral & central mode.
category=Communication
url=https://www.arduino.cc/en/Reference/ArduinoBLE
architectures=samd,megaavr,mbed,apollo3,mbed_nano,mbed_portenta,mbed_nicla,esp32
architectures=samd,megaavr,mbed,apollo3,mbed_nano,mbed_portenta,mbed_nicla,esp32,mbed_giga
includes=ArduinoBLE.h
8 changes: 6 additions & 2 deletions src/local/BLELocalDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#ifndef BT_REG_ON
#define BT_REG_ON PF_14
#endif
#elif defined(ARDUINO_GIGA)
#ifndef BT_REG_ON
#define BT_REG_ON PA_10
#endif
#endif

BLELocalDevice::BLELocalDevice()
Expand Down Expand Up @@ -65,7 +69,7 @@ int BLELocalDevice::begin()
delay(100);
digitalWrite(NINA_RESETN, HIGH);
delay(750);
#elif defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#elif defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA)
// BT_REG_ON -> HIGH
pinMode(BT_REG_ON, OUTPUT);
digitalWrite(BT_REG_ON, HIGH);
Expand Down Expand Up @@ -195,7 +199,7 @@ void BLELocalDevice::end()
#elif defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_NANO_RP2040_CONNECT)
// disable the NINA
digitalWrite(NINA_RESETN, LOW);
#elif defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#elif defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA)
digitalWrite(BT_REG_ON, LOW);
#endif
}
Expand Down
8 changes: 4 additions & 4 deletions src/utility/HCICordioTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <driver/CordioHCITransportDriver.h>
#include <driver/CordioHCIDriver.h>

#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA)
#include "ble/BLE.h"
#include <events/mbed_events.h>
#endif
Expand Down Expand Up @@ -181,7 +181,7 @@ HCICordioTransportClass::~HCICordioTransportClass()
{
}

#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA)
events::EventQueue eventQueue(10 * EVENTS_EVENT_SIZE);
void scheduleMbedBleEvents(BLE::OnEventsToProcessCallbackContext *context) {
eventQueue.call(mbed::Callback<void()>(&context->ble, &BLE::processEvents));
Expand All @@ -201,7 +201,7 @@ int HCICordioTransportClass::begin()
init_wsf(bufPoolDesc);
#endif

#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA)
BLE &ble = BLE::Instance();
ble.onEventsToProcess(scheduleMbedBleEvents);

Expand Down Expand Up @@ -235,7 +235,7 @@ void HCICordioTransportClass::end()
bleLoopThread = NULL;
}

#if !defined(ARDUINO_PORTENTA_H7_M4) && !defined(ARDUINO_PORTENTA_H7_M7) && !defined(ARDUINO_NICLA_VISION)
#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA)
CordioHCIHook::getDriver().terminate();
#endif

Expand Down

0 comments on commit f852716

Please sign in to comment.