55 */
66
77#include < unity.h>
8- #include " HardwareSerial.h"
98#include " Wire.h"
109
1110/* Global variables */
1211
1312String last_test = " " ;
1413
15- /* Utility functions */
16-
17- extern int8_t uart_get_RxPin (uint8_t uart_num);
18- extern int8_t uart_get_TxPin (uint8_t uart_num);
19-
2014/* Unity functions */
2115
2216// This function is automatically called by unity before each test is run
@@ -38,30 +32,54 @@ void tearDown(void) {
3832/* Test functions */
3933/* These functions must only init the peripheral on the same pins and update "last_test" */
4034
41- #if SOC_I2C_SUPPORTED
42- void i2c_test (void ) {
43- last_test = " I2C" ;
44- Wire.begin (SOC_RX0, SOC_TX0);
35+ void gpio_test (void ) {
36+ pinMode (SOC_RX0, INPUT);
37+ pinMode (SOC_TX0, INPUT);
38+ last_test = " GPIO" ;
39+ }
40+
41+ #if SOC_SDM_SUPPORTED
42+ void sigmadelta_test (void ) {
43+ if (!sigmaDeltaAttach (SOC_RX0, 312500 )) {
44+ TEST_FAIL_MESSAGE (" SigmaDelta init failed" );
45+ }
46+ if (!sigmaDeltaAttach (SOC_TX0, 312500 )) {
47+ TEST_FAIL_MESSAGE (" SigmaDelta init failed" );
48+ }
49+ last_test = " SigmaDelta" ;
50+ }
51+ #endif
52+
53+ #if SOC_LEDC_SUPPORTED
54+ void ledc_test (void ) {
55+ if (!ledcAttach (SOC_RX0, 5000 , 12 )) {
56+ TEST_FAIL_MESSAGE (" LEDC init failed" );
57+ }
58+ if (!ledcAttach (SOC_TX0, 5000 , 12 )) {
59+ TEST_FAIL_MESSAGE (" LEDC init failed" );
60+ }
61+ last_test = " LEDC" ;
4562}
4663#endif
4764
4865#if SOC_RMT_SUPPORTED
4966void rmt_test (void ) {
50- last_test = " RMT" ;
5167 if (!rmtInit (SOC_RX0, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000 )) {
5268 TEST_FAIL_MESSAGE (" RMT init failed" );
5369 }
5470 if (!rmtInit (SOC_TX0, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000 )) {
5571 TEST_FAIL_MESSAGE (" RMT init failed" );
5672 }
73+ last_test = " RMT" ;
5774}
5875#endif
5976
60- #if SOC_LEDC_SUPPORTED
61- void ledc_test (void ) {
62- last_test = " LEDC" ;
63- ledcAttach (SOC_RX0, 5000 , 12 );
64- ledcAttach (SOC_TX0, 5000 , 12 );
77+ #if SOC_I2C_SUPPORTED
78+ void i2c_test (void ) {
79+ if (!Wire.begin (SOC_RX0, SOC_TX0)) {
80+ TEST_FAIL_MESSAGE (" I2C init failed" );
81+ }
82+ last_test = " I2C" ;
6583}
6684#endif
6785
@@ -73,16 +91,22 @@ void setup() {
7391
7492 UNITY_BEGIN ();
7593
76- #if SOC_I2C_SUPPORTED
77- RUN_TEST (i2c_test);
94+ RUN_TEST (gpio_test);
95+
96+ #if SOC_SDM_SUPPORTED
97+ RUN_TEST (sigmadelta_test);
7898 #endif
7999
80100 #if SOC_LEDC_SUPPORTED
81101 RUN_TEST (ledc_test);
82102 #endif
83103
84104 #if SOC_RMT_SUPPORTED
85- RUN_TEST (rmt_test);
105+ // RUN_TEST(rmt_test);
106+ #endif
107+
108+ #if SOC_I2C_SUPPORTED
109+ RUN_TEST (i2c_test);
86110 #endif
87111
88112 UNITY_END ();
0 commit comments