Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
luisan00 committed Jul 15, 2022
1 parent e2502c0 commit 9de4ea0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/periph_adc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <string.h>
#include <errno.h>
#include "periph/adc.h"
#include "ztimer.h"
#include "embUnit.h"

#define RES ADC_RES_10BIT
Expand All @@ -37,8 +38,10 @@ void test_adc_init(void) {
err = 1;
} else {
printf("\nSuccessfully initialized ADC_LINE(%u)\n", i);
printf("Channel %u of %u\n", i + 1, ADC_NUMOF);
err = 0;
}
ztimer_sleep(ZTIMER_MSEC, DELAY_MS);
}

TEST_ASSERT_EQUAL_INT(0, err);
Expand All @@ -49,7 +52,7 @@ void test_adc_read(void) {
int sample;
for (int lap = 0; lap < LAPS; lap++) {

printf("\nRound %d of %d\n", lap+1, LAPS);
printf("\nRound %d of %d\n", lap + 1, LAPS);

for (unsigned i = 0; i < ADC_NUMOF; i++) {
sample = adc_sample(ADC_LINE(i), RES);
Expand All @@ -61,14 +64,18 @@ void test_adc_read(void) {
err = 0;
}
}

ztimer_sleep(ZTIMER_MSEC, DELAY_MS);
}

TEST_ASSERT_EQUAL_INT(0, err);
}

Test *test_periph_adc(void) {
EMB_UNIT_TESTFIXTURES(fixtures){new_TestFixture(test_adc_init), new_TestFixture(test_adc_read)};

EMB_UNIT_TESTFIXTURES(fixtures){
new_TestFixture(test_adc_init), // init. ADC lines available
new_TestFixture(test_adc_read), // read value for each line
};

EMB_UNIT_TESTCALLER(test_periph_adc, NULL, NULL, fixtures);

Expand Down

0 comments on commit 9de4ea0

Please sign in to comment.