Skip to content

Commit

Permalink
changing paradigm for BLE local device
Browse files Browse the repository at this point in the history
Since in the next version for BLE we are delivering HCI commands through
spi we don't need to restart the nina device for ble to run, thus
removing those commands from this library
  • Loading branch information
andreagilardoni committed Jan 15, 2025
1 parent 8a7a2a1 commit 4fa765b
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 deletions src/local/BLELocalDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,7 @@ BLELocalDevice::~BLELocalDevice()

int BLELocalDevice::begin()
{
#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_NANO_RP2040_CONNECT)
// reset the NINA in BLE mode
pinMode(SPIWIFI_SS, OUTPUT);
pinMode(NINA_RESETN, OUTPUT);

digitalWrite(SPIWIFI_SS, LOW);
#endif

#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_AVR_UNO_WIFI_REV2)
digitalWrite(NINA_RESETN, HIGH);
delay(100);
digitalWrite(NINA_RESETN, LOW);
delay(750);
#elif defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_NANO_RP2040_CONNECT)
// inverted reset
digitalWrite(NINA_RESETN, LOW);
delay(100);
digitalWrite(NINA_RESETN, HIGH);
delay(750);
#elif defined(PORTENTA_H7_PINS) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)
#if defined(PORTENTA_H7_PINS) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)
// BT_REG_ON -> HIGH
pinMode(BT_REG_ON, OUTPUT);
digitalWrite(BT_REG_ON, LOW);
Expand Down Expand Up @@ -216,15 +197,9 @@ void BLELocalDevice::end()

HCI.end();

#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_AVR_UNO_WIFI_REV2)
// disable the NINA
digitalWrite(NINA_RESETN, HIGH);
#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) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)
#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)
digitalWrite(BT_REG_ON, LOW);
#endif
#endif
_advertisingData.clear();
_scanResponseData.clear();
}
Expand Down

0 comments on commit 4fa765b

Please sign in to comment.