Skip to content

Instantly share code, notes, and snippets.

@ciniml
Last active June 10, 2024 04:15
Show Gist options
  • Save ciniml/bd2bb4dea22a55c067ca6790ad0c3eae to your computer and use it in GitHub Desktop.
Save ciniml/bd2bb4dea22a55c067ca6790ad0c3eae to your computer and use it in GitHub Desktop.
Wio Terminal Grove UART
#include <wiring_private.h>
static Uart Serial3(&sercom3, PIN_WIRE_SCL, PIN_WIRE_SDA, SERCOM_RX_PAD_1, UART_TX_PAD_0);
void setup() {
Serial.begin(115200);
while(!Serial);
Serial3.begin(115200);
pinPeripheral(PIN_WIRE_SCL, PIO_SERCOM_ALT);
pinPeripheral(PIN_WIRE_SDA, PIO_SERCOM_ALT);
}
void loop() {
Serial3.println("test");
delay(1000);
}
void SERCOM3_0_Handler()
{
Serial3.IrqHandler();
}
void SERCOM3_1_Handler()
{
Serial3.IrqHandler();
}
void SERCOM3_2_Handler()
{
Serial3.IrqHandler();
}
void SERCOM3_3_Handler()
{
Serial3.IrqHandler();
}
#include <wiring_private.h>
// GROVE right port
// This disables internal I2C port, which is connected to internal 3-axis accelerometer
static Uart Serial3(&sercom4, D1, D0, SERCOM_RX_PAD_1, UART_TX_PAD_0);
void setup() {
Serial.begin(115200);
while(!Serial);
Serial3.begin(115200);
pinPeripheral(D0, PIO_SERCOM_ALT);
pinPeripheral(D1, PIO_SERCOM_ALT);
}
void loop() {
Serial3.println("test");
delay(1000);
}
void SERCOM4_0_Handler()
{
Serial3.IrqHandler();
}
void SERCOM4_1_Handler()
{
Serial3.IrqHandler();
}
void SERCOM4_2_Handler()
{
Serial3.IrqHandler();
}
void SERCOM4_3_Handler()
{
Serial3.IrqHandler();
}
@mathemaphysics
Copy link

mathemaphysics commented Jun 10, 2024

I am desperately trying to find a way to create _serial and also set the IRQ handlers inside a class.

Something like this:

SERCOM4_0_Handler = &(_serial.IrqHandler);

I should absolutely be able to set a function pointer to pointer if the handler is a function pointer. But this doesn't work.

So now I'm stuck implementing a global event handler just to deal with these IRQs inside a class. It's wildly inefficient.

I just came across your comments here and thought I would ask if anyone knows a way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment