BOOT_FLASH attached to a pin?

I was helping someone figure out how to reimplement ResetToBootloader in Arduino and this works (requires additional #include "utility/gpio.h")

#include "DaisyDuino.h"
#include "utility/gpio.h"

void resetToBootloader() {
  // Initialize Boot Pin
  dsy_gpio_pin bootpin = {DSY_GPIOG, 3};
  dsy_gpio pin;
  pin.mode = DSY_GPIO_MODE_OUTPUT_PP;
  pin.pin = bootpin;
  dsy_gpio_init(&pin);
  dsy_gpio_write(&pin, 1);
  delay(10);
  HAL_NVIC_SystemReset();
}

I was hoping to figure out how to do this with typical Arduino functions, i.e. pinMode and digitalWrite but I can’t figure out the pin identifier in Arduino-world. PG3 is not recognized by the compiler and PG_3 is recognized but does not work.

Regardless adding the dsy_gpio version as a function exposed by DaisyDuino on the DaisyHardware class should be possible, might whip up a Pull Request for that.

3 Likes