@@ -301,6 +301,8 @@ extern const PinDescription g_APinDescription[]=
301301RingBuffer rx_buffer1;
302302
303303UARTClass Serial (UART, UART_IRQn, ID_UART, &rx_buffer1);
304+ void serialEvent () __attribute__((weak));
305+ void serialEvent () { }
304306
305307// IT handlers
306308void UART_Handler (void )
@@ -317,8 +319,14 @@ RingBuffer rx_buffer3;
317319RingBuffer rx_buffer4;
318320
319321USARTClass Serial1 (USART0, USART0_IRQn, ID_USART0, &rx_buffer2);
322+ void serialEvent1 () __attribute__((weak));
323+ void serialEvent1 () { }
320324USARTClass Serial2 (USART1, USART1_IRQn, ID_USART1, &rx_buffer3);
325+ void serialEvent2 () __attribute__((weak));
326+ void serialEvent2 () { }
321327USARTClass Serial3 (USART3, USART3_IRQn, ID_USART3, &rx_buffer4);
328+ void serialEvent3 () __attribute__((weak));
329+ void serialEvent3 () { }
322330
323331// IT handlers
324332void USART0_Handler (void )
@@ -338,6 +346,16 @@ void USART3_Handler(void)
338346
339347// ----------------------------------------------------------------------------
340348
349+ void serialEventRun (void )
350+ {
351+ if (Serial.available ()) serialEvent ();
352+ if (Serial1.available ()) serialEvent1 ();
353+ if (Serial2.available ()) serialEvent2 ();
354+ if (Serial3.available ()) serialEvent3 ();
355+ }
356+
357+ // ----------------------------------------------------------------------------
358+
341359#ifdef __cplusplus
342360extern " C" {
343361#endif
0 commit comments