diff --git a/tests/periman/periman.ino b/tests/periman/periman.ino index 2b391a26738..3ec040817b8 100644 --- a/tests/periman/periman.ino +++ b/tests/periman/periman.ino @@ -5,18 +5,12 @@ */ #include -#include "HardwareSerial.h" #include "Wire.h" /* Global variables */ String last_test = ""; -/* Utility functions */ - -extern int8_t uart_get_RxPin(uint8_t uart_num); -extern int8_t uart_get_TxPin(uint8_t uart_num); - /* Unity functions */ // This function is automatically called by unity before each test is run @@ -38,30 +32,54 @@ void tearDown(void) { /* Test functions */ /* These functions must only init the peripheral on the same pins and update "last_test" */ -#if SOC_I2C_SUPPORTED -void i2c_test(void) { - last_test = "I2C"; - Wire.begin(SOC_RX0, SOC_TX0); +void gpio_test(void) { + pinMode(SOC_RX0, INPUT); + pinMode(SOC_TX0, INPUT); + last_test = "GPIO"; +} + +#if SOC_SDM_SUPPORTED +void sigmadelta_test(void) { + if (!sigmaDeltaAttach(SOC_RX0, 312500)) { + TEST_FAIL_MESSAGE("SigmaDelta init failed"); + } + if (!sigmaDeltaAttach(SOC_TX0, 312500)) { + TEST_FAIL_MESSAGE("SigmaDelta init failed"); + } + last_test = "SigmaDelta"; +} +#endif + +#if SOC_LEDC_SUPPORTED +void ledc_test(void) { + if (!ledcAttach(SOC_RX0, 5000, 12)) { + TEST_FAIL_MESSAGE("LEDC init failed"); + } + if (!ledcAttach(SOC_TX0, 5000, 12)) { + TEST_FAIL_MESSAGE("LEDC init failed"); + } + last_test = "LEDC"; } #endif #if SOC_RMT_SUPPORTED void rmt_test(void) { - last_test = "RMT"; if (!rmtInit(SOC_RX0, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000)) { TEST_FAIL_MESSAGE("RMT init failed"); } if (!rmtInit(SOC_TX0, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000)) { TEST_FAIL_MESSAGE("RMT init failed"); } + last_test = "RMT"; } #endif -#if SOC_LEDC_SUPPORTED -void ledc_test(void) { - last_test = "LEDC"; - ledcAttach(SOC_RX0, 5000, 12); - ledcAttach(SOC_TX0, 5000, 12); +#if SOC_I2C_SUPPORTED +void i2c_test(void) { + if (!Wire.begin(SOC_RX0, SOC_TX0)) { + TEST_FAIL_MESSAGE("I2C init failed"); + } + last_test = "I2C"; } #endif @@ -73,8 +91,10 @@ void setup() { UNITY_BEGIN(); - #if SOC_I2C_SUPPORTED - RUN_TEST(i2c_test); + RUN_TEST(gpio_test); + + #if SOC_SDM_SUPPORTED + RUN_TEST(sigmadelta_test); #endif #if SOC_LEDC_SUPPORTED @@ -82,7 +102,11 @@ void setup() { #endif #if SOC_RMT_SUPPORTED - RUN_TEST(rmt_test); + //RUN_TEST(rmt_test); + #endif + + #if SOC_I2C_SUPPORTED + RUN_TEST(i2c_test); #endif UNITY_END();