@@ -301,6 +301,8 @@ extern const PinDescription g_APinDescription[]=
301
301
RingBuffer rx_buffer1;
302
302
303
303
UARTClass Serial (UART, UART_IRQn, ID_UART, &rx_buffer1);
304
+ void serialEvent () __attribute__((weak));
305
+ void serialEvent () { }
304
306
305
307
// IT handlers
306
308
void UART_Handler (void )
@@ -317,8 +319,14 @@ RingBuffer rx_buffer3;
317
319
RingBuffer rx_buffer4;
318
320
319
321
USARTClass Serial1 (USART0, USART0_IRQn, ID_USART0, &rx_buffer2);
322
+ void serialEvent1 () __attribute__((weak));
323
+ void serialEvent1 () { }
320
324
USARTClass Serial2 (USART1, USART1_IRQn, ID_USART1, &rx_buffer3);
325
+ void serialEvent2 () __attribute__((weak));
326
+ void serialEvent2 () { }
321
327
USARTClass Serial3 (USART3, USART3_IRQn, ID_USART3, &rx_buffer4);
328
+ void serialEvent3 () __attribute__((weak));
329
+ void serialEvent3 () { }
322
330
323
331
// IT handlers
324
332
void USART0_Handler (void )
@@ -338,6 +346,16 @@ void USART3_Handler(void)
338
346
339
347
// ----------------------------------------------------------------------------
340
348
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
+
341
359
#ifdef __cplusplus
342
360
extern " C" {
343
361
#endif
0 commit comments