5
5
*/
6
6
7
7
#include < unity.h>
8
- #include " HardwareSerial.h"
9
8
#include " Wire.h"
10
9
11
10
/* Global variables */
12
11
13
12
String last_test = " " ;
14
13
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
-
20
14
/* Unity functions */
21
15
22
16
// This function is automatically called by unity before each test is run
@@ -38,30 +32,54 @@ void tearDown(void) {
38
32
/* Test functions */
39
33
/* These functions must only init the peripheral on the same pins and update "last_test" */
40
34
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" ;
45
62
}
46
63
#endif
47
64
48
65
#if SOC_RMT_SUPPORTED
49
66
void rmt_test (void ) {
50
- last_test = " RMT" ;
51
67
if (!rmtInit (SOC_RX0, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000 )) {
52
68
TEST_FAIL_MESSAGE (" RMT init failed" );
53
69
}
54
70
if (!rmtInit (SOC_TX0, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000 )) {
55
71
TEST_FAIL_MESSAGE (" RMT init failed" );
56
72
}
73
+ last_test = " RMT" ;
57
74
}
58
75
#endif
59
76
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" ;
65
83
}
66
84
#endif
67
85
@@ -73,16 +91,22 @@ void setup() {
73
91
74
92
UNITY_BEGIN ();
75
93
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);
78
98
#endif
79
99
80
100
#if SOC_LEDC_SUPPORTED
81
101
RUN_TEST (ledc_test);
82
102
#endif
83
103
84
104
#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);
86
110
#endif
87
111
88
112
UNITY_END ();
0 commit comments