File tree 1 file changed +6
-7
lines changed
libraries/ESP32/examples/Serial/Interrupt 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
- HardwareSerial hwSerial (0 );
2
- HardwareSerial hwSerial2 (2 );
1
+ // Serial, Serial1 and Serial2 are all of the type HardwareSerial.
3
2
4
3
static void IRAM_ATTR onSerialRX (uint8_t c, void * user_arg){
5
- hwSerial .print (c);
4
+ Serial .print (c);
6
5
7
6
// Cast the user_arg containing a void* to the Serial device, to HardwareSerial* to be used
8
7
HardwareSerial* serial = (HardwareSerial*)user_arg;
@@ -11,12 +10,12 @@ static void IRAM_ATTR onSerialRX(uint8_t c, void* user_arg){
11
10
12
11
void setup ()
13
12
{
14
- hwSerial .begin (115200 );
15
- hwSerial2 .begin (115200 );
13
+ Serial .begin (115200 );
14
+ Serial2 .begin (115200 );
16
15
17
16
// The user_arg is expected to be a void pointer (void*),
18
- // so take the reference of hwSerial2 , and cast the HardwareSerial* to a void*
19
- hwSerial2 .setRxInterrupt (onSerialRX, (void *)&hwSerial2 );
17
+ // so take the reference of Serial2 , and cast the HardwareSerial* to a void*
18
+ Serial2 .setRxInterrupt (onSerialRX, (void *)&Serial2 );
20
19
}
21
20
22
21
void loop ()
You can’t perform that action at this time.
0 commit comments