mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-15 12:29:26 +01:00
[sam] Added serialEvent*() support
This commit is contained in:
parent
ee0c76f063
commit
03a7529cc0
@ -11,6 +11,7 @@ ARDUINO 1.5.3 BETA
|
|||||||
* sam: Fixed delayMicrosecond() when interrupts are disabled
|
* sam: Fixed delayMicrosecond() when interrupts are disabled
|
||||||
* sam: Upgraded libsam, and added missing modules (CAN, ETH, etc.) (Thibaut Viard)
|
* sam: Upgraded libsam, and added missing modules (CAN, ETH, etc.) (Thibaut Viard)
|
||||||
* sam: Added compatibility for avr/pgmspace.h (Paul Stoffregen)
|
* sam: Added compatibility for avr/pgmspace.h (Paul Stoffregen)
|
||||||
|
* sam: Added serialEvent*() support
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
* sam: Added CAN library (still in early stage of development) (Palliser)
|
* sam: Added CAN library (still in early stage of development) (Palliser)
|
||||||
|
@ -301,6 +301,8 @@ extern const PinDescription g_APinDescription[]=
|
|||||||
RingBuffer rx_buffer1;
|
RingBuffer rx_buffer1;
|
||||||
|
|
||||||
UARTClass Serial(UART, UART_IRQn, ID_UART, &rx_buffer1);
|
UARTClass Serial(UART, UART_IRQn, ID_UART, &rx_buffer1);
|
||||||
|
void serialEvent() __attribute__((weak));
|
||||||
|
void serialEvent() { }
|
||||||
|
|
||||||
// IT handlers
|
// IT handlers
|
||||||
void UART_Handler(void)
|
void UART_Handler(void)
|
||||||
@ -317,8 +319,14 @@ RingBuffer rx_buffer3;
|
|||||||
RingBuffer rx_buffer4;
|
RingBuffer rx_buffer4;
|
||||||
|
|
||||||
USARTClass Serial1(USART0, USART0_IRQn, ID_USART0, &rx_buffer2);
|
USARTClass Serial1(USART0, USART0_IRQn, ID_USART0, &rx_buffer2);
|
||||||
|
void serialEvent1() __attribute__((weak));
|
||||||
|
void serialEvent1() { }
|
||||||
USARTClass Serial2(USART1, USART1_IRQn, ID_USART1, &rx_buffer3);
|
USARTClass Serial2(USART1, USART1_IRQn, ID_USART1, &rx_buffer3);
|
||||||
|
void serialEvent2() __attribute__((weak));
|
||||||
|
void serialEvent2() { }
|
||||||
USARTClass Serial3(USART3, USART3_IRQn, ID_USART3, &rx_buffer4);
|
USARTClass Serial3(USART3, USART3_IRQn, ID_USART3, &rx_buffer4);
|
||||||
|
void serialEvent3() __attribute__((weak));
|
||||||
|
void serialEvent3() { }
|
||||||
|
|
||||||
// IT handlers
|
// IT handlers
|
||||||
void USART0_Handler(void)
|
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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user