Skip to content

Commit be20fcb

Browse files
authored
feat(ci): fixing and adapting perimanager teste
1 parent 520ea66 commit be20fcb

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

tests/validation/periman/periman.ino

+42-23
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* Peripheral Manager test
2-
*
3-
* This test is using Serial to check if the peripheral manager is able to
4-
* attach and detach peripherals correctly on shared pins.
5-
* Make sure that the peripheral names contain only letters, numbers and underscores.
6-
*
7-
* This test skips the following peripherals:
8-
* - USB: USB is not able to be detached
9-
* - SDMMC: SDMMC requires a card to be mounted before the pins are attached
10-
* - ETH: ETH requires a ethernet port to be connected before the pins are attached
11-
*/
2+
3+
This test is using Serial to check if the peripheral manager is able to
4+
attach and detach peripherals correctly on shared pins.
5+
Make sure that the peripheral names contain only letters, numbers and underscores.
6+
7+
This test skips the following peripherals:
8+
- USB: USB is not able to be detached
9+
- SDMMC: SDMMC requires a card to be mounted before the pins are attached
10+
- ETH: ETH requires a ethernet port to be connected before the pins are attached
11+
*/
1212

1313
#if SOC_I2S_SUPPORTED
1414
#include "ESP_I2S.h"
@@ -62,7 +62,7 @@ void onReceive_cb(void) {
6262

6363
// This function is called by before each test is run
6464
void setup_test(String test_name, int8_t rx_pin = UART1_RX_DEFAULT, int8_t tx_pin = UART1_TX_DEFAULT) {
65-
log_v("Setting up %s test", test_name.c_str());
65+
log_i("Setting up %s test", test_name.c_str());
6666

6767
current_test = test_name;
6868
uart1_rx_pin = rx_pin;
@@ -74,12 +74,12 @@ void setup_test(String test_name, int8_t rx_pin = UART1_RX_DEFAULT, int8_t tx_pi
7474
Serial1.setPins(uart1_rx_pin, uart1_tx_pin);
7575
uart_internal_loopback(1, true);
7676
delay(100);
77-
log_v("Running %s test", test_name.c_str());
77+
log_i("Running %s test", test_name.c_str());
7878
}
7979

8080
// This function is called after each test is run
8181
void teardown_test(void) {
82-
log_v("Tearing down %s test", current_test.c_str());
82+
log_i("Tearing down %s test", current_test.c_str());
8383
if (test_executed) {
8484
pinMode(uart1_rx_pin, INPUT_PULLUP);
8585
pinMode(uart1_tx_pin, OUTPUT);
@@ -96,13 +96,15 @@ void teardown_test(void) {
9696
Serial1.println(" test: This should be printed");
9797
Serial1.flush();
9898

99-
log_v("Finished %s test", current_test.c_str());
99+
log_i("Finished %s test", current_test.c_str());
100+
Serial.println("=========================================================================================");
101+
delay(2000);
100102
}
101103

102104
/* Test functions */
103105
/* These functions must call "setup_test" and "teardown_test" and set "test_executed" to true
104-
* if the test is executed
105-
*/
106+
if the test is executed
107+
*/
106108

107109
void gpio_test(void) {
108110
setup_test("GPIO");
@@ -130,7 +132,7 @@ void sigmadelta_test(void) {
130132

131133
void adc_oneshot_test(void) {
132134
#if !SOC_ADC_SUPPORTED
133-
setup_test("ADC_Oneshot");
135+
setup_test("ADC_Oneshot - NO ADC Support");
134136
#else
135137
setup_test("ADC_Oneshot", ADC1_DEFAULT, ADC2_DEFAULT);
136138
test_executed = true;
@@ -151,8 +153,8 @@ void ARDUINO_ISR_ATTR adcComplete() {
151153
#endif
152154

153155
void adc_continuous_test(void) {
154-
#if !SOC_ADC_SUPPORTED
155-
setup_test("ADC_Continuous");
156+
#if !SOC_ADC_SUPPORTED || CONFIG_IDF_TARGET_ESP32P4
157+
setup_test("ADC_Continuous - NO ADC Support");
156158
#else
157159
setup_test("ADC_Continuous", ADC1_DEFAULT, ADC2_DEFAULT);
158160
test_executed = true;
@@ -166,8 +168,10 @@ void adc_continuous_test(void) {
166168
analogContinuous(adc_pins, adc_pins_count, 6, 20000, &adcComplete);
167169
analogContinuousStart();
168170

171+
Serial.println();
169172
while (adc_coversion_done == false) {
170-
delay(1);
173+
Serial.print(".");
174+
delay(500);
171175
}
172176

173177
if (!analogContinuousRead(&result, 0)) {
@@ -226,12 +230,13 @@ void i2s_test(void) {
226230
I2SClass i2s;
227231

228232
i2s.setPins(uart1_rx_pin, uart1_tx_pin, -1);
233+
229234
i2s.setTimeout(1000);
230235
if (!i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO)) {
231-
Serial.println("I2S init failed");
232236
}
233237
#endif
234238
teardown_test();
239+
delay(500); Serial.println("Exting I2S driver..."); delay(500);
235240
}
236241

237242
void i2c_test(void) {
@@ -282,17 +287,31 @@ void setup() {
282287
Serial1.onReceive(onReceive_cb);
283288
uart_internal_loopback(1, true);
284289

290+
Serial.println("starting gpio_test()");
285291
gpio_test();
292+
Serial.println("starting sigmadelta_test()");
286293
sigmadelta_test();
294+
Serial.println("starting ledc_test()");
287295
ledc_test();
296+
Serial.println("starting rmt_test()");
288297
rmt_test();
289-
i2s_test();
290-
i2c_test();
298+
Serial.println("\t ==>starting i2s_test()");
299+
i2s_test(); // apos esta linha temos um [E][esp32-hal-periman.c:122] perimanSetPinBus(): Invalid pin: 255
300+
Serial.println("\t ==>Back to setup()");
301+
Serial.println("\t ==>starting spi_test()");
291302
spi_test();
303+
Serial.println("\t ==>starting i2c_test()");
304+
i2c_test();
305+
Serial.println("\t ==>ended i2c_test()");
306+
Serial.println("starting adc_oneshot_test()");
292307
adc_oneshot_test();
308+
Serial.println("starting adc_continuous_test()");
293309
adc_continuous_test();
310+
Serial.println("starting dac_test()");
294311
dac_test();
312+
Serial.println("starting touch_test()");
295313
touch_test();
314+
Serial.println("starting gpio_test()");
296315

297316
// Print to Serial1 to avoid buffering issues
298317
Serial1.println("Peripheral Manager test done");

0 commit comments

Comments
 (0)