diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index de5b6a94f9..a6bad527d8 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -174,6 +174,13 @@ class HardwareSerial : public Stream { // Interrupt handlers static void _rx_complete_irq(serial_t *obj); static int _tx_complete_irq(serial_t *obj); + + // Could be used to mix Arduino API and STM32Cube HAL API (ex: DMA). Use at your own risk. + UART_HandleTypeDef *getHandle(void) + { + return &(_serial.handle); + } + private: bool _rx_enabled; uint8_t _config; diff --git a/libraries/SPI/src/SPI.h b/libraries/SPI/src/SPI.h index bd6677c55e..72f6d59fda 100644 --- a/libraries/SPI/src/SPI.h +++ b/libraries/SPI/src/SPI.h @@ -227,6 +227,12 @@ class SPIClass { void attachInterrupt(void); void detachInterrupt(void); + // Could be used to mix Arduino API and STM32Cube HAL API (ex: DMA). Use at your own risk. + SPI_HandleTypeDef *getHandle(void) + { + return &(_spi.handle); + } + private: /* Contains various spiSettings for the same spi instance. Each spi spiSettings is associated to a CS pin. */ diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index cd1dfe925d..52b934d259 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -130,6 +130,12 @@ class TwoWire : public Stream { return write((uint8_t)n); } using Print::write; + + // Could be used to mix Arduino API and STM32Cube HAL API (ex: DMA). Use at your own risk. + I2C_HandleTypeDef *getHandle(void) + { + return &(_i2c.handle); + } };