Skip to content

Commit 89308d3

Browse files
committed
Update SerialLoop example
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 09fd192 commit 89308d3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Diff for: examples/NonReg/SerialLoop/SerialLoop.ino

+9-7
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@
1414

1515
/*
1616
* 1 - Connect Rx/Tx of the desired Serial
17-
* 2 - Define SERIAL_PORT_TESTED by setting Serial number to use 1,2,...
18-
* ! Ensure Serial feature is enabled thanks 'Serial interface menu'!
17+
* 2 - Define UART_TEST_INSTANCE
18+
* ! Ensure Serial feature is enabled thanks 'U(S)ART support menu'!
1919
* 3 - Optionnal: comment unwanted speed in serialSpeed array.
2020
*/
21-
#if defined(SERIAL_UART_INSTANCE) && (SERIAL_UART_INSTANCE == 2)
22-
#define SERIAL_PORT_TESTED Serial1
23-
HardwareSerial Serial1(USART1);
21+
#define SERIAL_PORT_TESTED SerialTest
22+
#if defined(SERIAL_UART_INSTANCE) && (SERIAL_UART_INSTANCE != 1)
23+
#define UART_TEST_INSTANCE USART1
24+
#elif defined(USART2_BASE)
25+
#define UART_TEST_INSTANCE USART2
2426
#else
25-
#define SERIAL_PORT_TESTED Serial2
26-
HardwareSerial Serial2(USART2);
27+
#define UART_TEST_INSTANCE LPUART1
2728
#endif
2829
// or
2930
//HardwareSerial Serialx(rxpin, txpin)
31+
HardwareSerial SERIAL_PORT_TESTED(UART_TEST_INSTANCE);
3032

3133
#define DECL_CONFIG(x) {#x, x}
3234

0 commit comments

Comments
 (0)