Skip to content

Commit e6c4b0f

Browse files
committed
support serialEvent()
1 parent 1977aea commit e6c4b0f

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

cores/nRF5/HardwareSerial.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,6 @@ class HardwareSerial : public Stream
8080
};
8181

8282
extern void serialEventRun(void) __attribute__((weak));
83+
extern void serialEvent() __attribute__((weak));
8384

8485
#endif

cores/nRF5/Uart.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
#include "Arduino.h"
2222
#include "wiring_private.h"
2323

24+
25+
void serialEventRun(void)
26+
{
27+
if (serialEvent && Serial.available() ) serialEvent();
28+
}
29+
2430
Uart::Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pinTX)
2531
{
2632
nrfUart = _nrfUart;

cores/nRF5/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ static void loop_task(void* arg)
6161
{
6262
loop();
6363

64+
if (serialEvent && serialEventRun) serialEventRun();
65+
6466
#if CFG_DEBUG >= 2 && DBG_MEM_INFO
6567
static uint32_t meminfo_ms = 0;
6668
if (meminfo_ms + DBG_MEM_INFO_INTERVAL < millis())

0 commit comments

Comments
 (0)