mirror of https://github.com/ARMmbed/mbed-os.git
commit
fa090ff05c
|
@ -124,9 +124,11 @@ void UART_test()
|
||||||
{
|
{
|
||||||
utest_printf("UART TX Pin 0x%x RX Pin 0x%x\n", TX_pin, RX_pin);
|
utest_printf("UART TX Pin 0x%x RX Pin 0x%x\n", TX_pin, RX_pin);
|
||||||
|
|
||||||
|
// 1. check if Arduino_uno pins are not already used by the console
|
||||||
TEST_SKIP_UNLESS_MESSAGE(TX_pin != CONSOLE_TX, "ARDUINO_UNO_UART pin shared with CONSOLE_TX");
|
TEST_SKIP_UNLESS_MESSAGE(TX_pin != CONSOLE_TX, "ARDUINO_UNO_UART pin shared with CONSOLE_TX");
|
||||||
TEST_SKIP_UNLESS_MESSAGE(RX_pin != CONSOLE_RX, "ARDUINO_UNO_UART pin shared with CONSOLE_RX");
|
TEST_SKIP_UNLESS_MESSAGE(RX_pin != CONSOLE_RX, "ARDUINO_UNO_UART pin shared with CONSOLE_RX");
|
||||||
|
|
||||||
|
// 2. check if Arduino_uno pins are part of pinmap table
|
||||||
{
|
{
|
||||||
const PinMap *maps = serial_tx_pinmap();
|
const PinMap *maps = serial_tx_pinmap();
|
||||||
while (maps->pin != (PinName)NC) { // check each pin from PinMap table till NC pin
|
while (maps->pin != (PinName)NC) { // check each pin from PinMap table till NC pin
|
||||||
|
@ -151,8 +153,14 @@ void UART_test()
|
||||||
TEST_ASSERT_NOT_EQUAL(NC, maps->pin);
|
TEST_ASSERT_NOT_EQUAL(NC, maps->pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3. check if Arduino_uno pins are not using the same UART instance as console
|
||||||
|
int console_uart = pinmap_peripheral(CONSOLE_TX, serial_tx_pinmap());
|
||||||
|
TEST_ASSERT_NOT_EQUAL(console_uart, pinmap_peripheral(TX_pin, serial_tx_pinmap()));
|
||||||
|
|
||||||
|
// 4. check if UART pins can be initialized
|
||||||
BufferedSerial TEST(TX_pin, RX_pin);
|
BufferedSerial TEST(TX_pin, RX_pin);
|
||||||
// Basic API call
|
|
||||||
|
// 5. check a basic API call
|
||||||
TEST.set_baud(115200);
|
TEST.set_baud(115200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ Requirements specified in docs/design-documents/hal/0004-pin-names-general-guide
|
||||||
|
|
||||||
#ifndef LED1
|
#ifndef LED1
|
||||||
#error [NOT_SUPPORTED] Target is not following mbed-os pin names standard // Test is set as Skipped
|
#error [NOT_SUPPORTED] Target is not following mbed-os pin names standard // Test is set as Skipped
|
||||||
// #error [NOT_SUPPORTED] Target is not following mbed-os pin names standard // Test is set as Error
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
@ -82,6 +81,9 @@ Case cases[] = {
|
||||||
#ifdef BUTTON2
|
#ifdef BUTTON2
|
||||||
Case("BUTTON2", BUTTON_test<2, BUTTON2>),
|
Case("BUTTON2", BUTTON_test<2, BUTTON2>),
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BUTTON3
|
||||||
|
Case("BUTTON3", BUTTON_test<3, BUTTON3>),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
|
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
|
||||||
|
|
Loading…
Reference in New Issue