Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add STM32Cube HAL getter to SPI, Wire and HardwareSerial #1674

Merged
merged 1 commit into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cores/arduino/HardwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions libraries/SPI/src/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
6 changes: 6 additions & 0 deletions libraries/Wire/src/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};


Expand Down