Skip to content

Commit 86d0471

Browse files
committed
Pin_names arduino_uno test: Add a check for UART instance
1 parent 587eb41 commit 86d0471

File tree

1 file changed

+9
-1
lines changed
  • hal/tests/TESTS/pin_names/arduino_uno

1 file changed

+9
-1
lines changed

hal/tests/TESTS/pin_names/arduino_uno/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ void UART_test()
124124
{
125125
utest_printf("UART TX Pin 0x%x RX Pin 0x%x\n", TX_pin, RX_pin);
126126

127+
// 1. check if Arduino_uno pins are not already used by the console
127128
TEST_SKIP_UNLESS_MESSAGE(TX_pin != CONSOLE_TX, "ARDUINO_UNO_UART pin shared with CONSOLE_TX");
128129
TEST_SKIP_UNLESS_MESSAGE(RX_pin != CONSOLE_RX, "ARDUINO_UNO_UART pin shared with CONSOLE_RX");
129130

131+
// 2. check if Arduino_uno pins are part of pinmap table
130132
{
131133
const PinMap *maps = serial_tx_pinmap();
132134
while (maps->pin != (PinName)NC) { // check each pin from PinMap table till NC pin
@@ -151,8 +153,14 @@ void UART_test()
151153
TEST_ASSERT_NOT_EQUAL(NC, maps->pin);
152154
}
153155

156+
// 3. check if Arduino_uno pins are not using the same UART instance as console
157+
int console_uart = pinmap_peripheral(CONSOLE_TX, serial_tx_pinmap());
158+
TEST_ASSERT_NOT_EQUAL(console_uart, pinmap_peripheral(TX_pin, serial_tx_pinmap()));
159+
160+
// 4. check if UART pins can be initialized
154161
BufferedSerial TEST(TX_pin, RX_pin);
155-
// Basic API call
162+
163+
// 5. check a basic API call
156164
TEST.set_baud(115200);
157165
}
158166

0 commit comments

Comments
 (0)