@@ -43,13 +43,16 @@ int8_t uart1_tx_pin;
43
43
44
44
// This function is automatically called by unity before each test is run
45
45
void setUp (void ) {
46
+ log_v (" Setting up next test" );
46
47
Serial1.setPins (uart1_rx_pin, uart1_tx_pin);
47
48
uart_internal_loopback (1 , SOC_RX0);
48
49
delay (100 );
50
+ log_v (" Running test" );
49
51
}
50
52
51
53
// This function is automatically called by unity after each test is run
52
54
void tearDown (void ) {
55
+ log_v (" Tearing down last test" );
53
56
Serial1.print (last_test);
54
57
Serial1.println (" test: This should not be printed" );
55
58
Serial1.flush ();
@@ -81,10 +84,39 @@ void sigmadelta_test(void) {
81
84
#endif
82
85
83
86
#if SOC_ADC_SUPPORTED
84
- void adc_test (void ) {
87
+ void adc_oneshot_test (void ) {
85
88
analogReadResolution (12 );
86
89
analogRead (A4);
87
- last_test = " ADC" ;
90
+ last_test = " ADC Oneshot" ;
91
+ }
92
+
93
+ volatile bool adc_coversion_done = false ;
94
+ void ARDUINO_ISR_ATTR adcComplete () {
95
+ adc_coversion_done = true ;
96
+ }
97
+
98
+ void adc_continuous_test (void ) {
99
+ uint8_t adc_pins[] = {A4};
100
+ uint8_t adc_pins_count = 1 ;
101
+ adc_continuos_data_t * result = NULL ;
102
+
103
+ analogContinuousSetWidth (12 );
104
+ analogContinuousSetAtten (ADC_11db);
105
+
106
+ analogContinuous (adc_pins, adc_pins_count, 6 , 20000 , &adcComplete);
107
+ analogContinuousStart ();
108
+
109
+ while (adc_coversion_done == false ) {
110
+ delay (1 );
111
+ }
112
+
113
+ if (!analogContinuousRead (&result, 0 )) {
114
+ TEST_FAIL_MESSAGE (" ADC continuous read failed" );
115
+ }
116
+
117
+ analogContinuousStop ();
118
+
119
+ last_test = " ADC Continuous" ;
88
120
}
89
121
#endif
90
122
@@ -225,15 +257,14 @@ void setup() {
225
257
RUN_TEST (spi_test);
226
258
#endif
227
259
228
- uart1_tx_pin = A4;
229
-
230
260
#if SOC_ADC_SUPPORTED
231
- RUN_TEST (adc_test);
261
+ uart1_tx_pin = A4;
262
+ RUN_TEST (adc_oneshot_test);
263
+ RUN_TEST (adc_continuous_test);
232
264
#endif
233
265
234
- uart1_tx_pin = DAC1;
235
-
236
266
#if SOC_DAC_SUPPORTED
267
+ uart1_tx_pin = DAC1;
237
268
RUN_TEST (dac_test);
238
269
#endif
239
270
@@ -243,19 +274,18 @@ void setup() {
243
274
#endif
244
275
#endif
245
276
246
- uart1_tx_pin = T1;
247
-
248
277
#if SOC_TOUCH_SENSOR_SUPPORTED
278
+ uart1_tx_pin = T1;
249
279
RUN_TEST (touch_test);
250
280
#endif
251
281
252
- uart1_tx_pin = UART1_TX_DEFAULT;
253
-
254
282
#if SOC_USB_SERIAL_JTAG_SUPPORTED && (ARDUINO_USB_MODE == 1)
283
+ uart1_tx_pin = UART1_TX_DEFAULT;
255
284
RUN_TEST (jtag_test);
256
285
#endif
257
286
258
287
#if SOC_USB_OTG_SUPPORTED && (ARDUINO_USB_MODE == 0)
288
+ uart1_tx_pin = 19 ;
259
289
RUN_TEST (usb_test);
260
290
#endif
261
291
0 commit comments