Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[sam] Added serialEvent*() support

  • Loading branch information...
commit 03a7529cc00b7ede1adb1e1dcbb29a555ea31c8a 1 parent ee0c76f
Cristian Maglie cmaglie authored
1  build/shared/revisions.txt
View
@@ -11,6 +11,7 @@ ARDUINO 1.5.3 BETA
* sam: Fixed delayMicrosecond() when interrupts are disabled
* sam: Upgraded libsam, and added missing modules (CAN, ETH, etc.) (Thibaut Viard)
* sam: Added compatibility for avr/pgmspace.h (Paul Stoffregen)
+* sam: Added serialEvent*() support
[libraries]
* sam: Added CAN library (still in early stage of development) (Palliser)
18 hardware/arduino/sam/variants/arduino_due_x/variant.cpp
View
@@ -301,6 +301,8 @@ extern const PinDescription g_APinDescription[]=
RingBuffer rx_buffer1;
UARTClass Serial(UART, UART_IRQn, ID_UART, &rx_buffer1);
+void serialEvent() __attribute__((weak));
+void serialEvent() { }
// IT handlers
void UART_Handler(void)
@@ -317,8 +319,14 @@ RingBuffer rx_buffer3;
RingBuffer rx_buffer4;
USARTClass Serial1(USART0, USART0_IRQn, ID_USART0, &rx_buffer2);
+void serialEvent1() __attribute__((weak));
+void serialEvent1() { }
USARTClass Serial2(USART1, USART1_IRQn, ID_USART1, &rx_buffer3);
+void serialEvent2() __attribute__((weak));
+void serialEvent2() { }
USARTClass Serial3(USART3, USART3_IRQn, ID_USART3, &rx_buffer4);
+void serialEvent3() __attribute__((weak));
+void serialEvent3() { }
// IT handlers
void USART0_Handler(void)
@@ -338,6 +346,16 @@ void USART3_Handler(void)
// ----------------------------------------------------------------------------
+void serialEventRun(void)
+{
+ if (Serial.available()) serialEvent();
+ if (Serial1.available()) serialEvent1();
+ if (Serial2.available()) serialEvent2();
+ if (Serial3.available()) serialEvent3();
+}
+
+// ----------------------------------------------------------------------------
+
#ifdef __cplusplus
extern "C" {
#endif

1 comment on commit 03a7529

gslender

What about SerialUSB?

Please sign in to comment.
Something went wrong with that request. Please try again.