1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-13 10:29:35 +01:00

[sam] Added serialEvent*() support

This commit is contained in:
Cristian Maglie 2013-03-25 01:29:42 +01:00
parent ee0c76f063
commit 03a7529cc0
2 changed files with 19 additions and 0 deletions

View File

@ -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)

View File

@ -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