Skip to content

Commit fa090ff

Browse files
authored
Merge pull request #14704 from jeromecoutant/PR_TEST_PIN
Pin name tests update
2 parents a8fd7b3 + 4abefe5 commit fa090ff

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
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

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Requirements specified in docs/design-documents/hal/0004-pin-names-general-guide
2626

2727
#ifndef LED1
2828
#error [NOT_SUPPORTED] Target is not following mbed-os pin names standard // Test is set as Skipped
29-
// #error [NOT_SUPPORTED] Target is not following mbed-os pin names standard // Test is set as Error
3029
#else
3130

3231
using namespace utest::v1;
@@ -82,6 +81,9 @@ Case cases[] = {
8281
#ifdef BUTTON2
8382
Case("BUTTON2", BUTTON_test<2, BUTTON2>),
8483
#endif
84+
#ifdef BUTTON3
85+
Case("BUTTON3", BUTTON_test<3, BUTTON3>),
86+
#endif
8587
};
8688

8789
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

0 commit comments

Comments
 (0)