Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasssvaz committed Dec 4, 2023
1 parent c8db2cb commit d119085
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/periman/periman.ino
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ void onReceive_cb(void) {
// This function is automatically called by unity before each test is run
void setUp(void) {
log_v("Setting up next test");
Serial1.setPins(uart1_rx_pin, uart1_tx_pin);
Serial1.end();
Serial1.begin(115200, SERIAL_8N1, uart1_rx_pin, uart1_tx_pin);
uart_internal_loopback(1, uart1_rx_pin);
delay(100);
log_v("Running test");
Expand All @@ -65,7 +66,7 @@ void tearDown(void) {
Serial1.println(" test: This should not be printed");
Serial1.flush();

Serial1.setPins(uart1_rx_pin, uart1_tx_pin);
Serial1.begin(115200, SERIAL_8N1, uart1_rx_pin, uart1_tx_pin);
uart_internal_loopback(1, uart1_rx_pin);
delay(100);
test_executed = false;
Expand All @@ -90,10 +91,10 @@ void sigmadelta_test(void) {
last_test = "SigmaDelta";
#if SOC_SDM_SUPPORTED
test_executed = true;
if (!sigmaDeltaAttach(uart1_tx_pin, 312500)) {
if (!sigmaDeltaAttach(uart1_rx_pin, 312500)) {
TEST_FAIL_MESSAGE("SigmaDelta init failed");
}
if (!sigmaDeltaAttach(uart1_rx_pin, 312500)) {
if (!sigmaDeltaAttach(uart1_tx_pin, 312500)) {
TEST_FAIL_MESSAGE("SigmaDelta init failed");
}
#endif
Expand All @@ -104,6 +105,8 @@ void adc_oneshot_test(void) {
#if SOC_ADC_SUPPORTED
test_executed = true;
analogReadResolution(12);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
analogRead(A3);
analogRead(A4);
#endif
Expand Down Expand Up @@ -155,10 +158,10 @@ void ledc_test(void) {
last_test = "LEDC";
#if SOC_LEDC_SUPPORTED
test_executed = true;
if (!ledcAttach(uart1_tx_pin, 5000, 12)) {
if (!ledcAttach(uart1_rx_pin, 5000, 12)) {
TEST_FAIL_MESSAGE("LEDC init failed");
}
if (!ledcAttach(uart1_rx_pin, 5000, 12)) {
if (!ledcAttach(uart1_tx_pin, 5000, 12)) {
TEST_FAIL_MESSAGE("LEDC init failed");
}
#endif
Expand Down Expand Up @@ -230,8 +233,7 @@ void setup() {
Serial.begin(115200);
while(!Serial) { delay(10); }

Serial1.setPins(UART1_RX_DEFAULT, UART1_TX_DEFAULT);
Serial1.begin(115200);
Serial1.begin(115200, SERIAL_8N1, uart1_rx_pin, uart1_tx_pin);
while(!Serial1) { delay(10); }
Serial1.onReceive(onReceive_cb);
uart_internal_loopback(1, uart1_rx_pin);
Expand Down

0 comments on commit d119085

Please sign in to comment.