From 664b209e7aa2281273edf967979c6f61095e5b3d Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 17 Mar 2023 13:02:20 +0100 Subject: [PATCH 1/2] cpu/efm32: pwm_init errors are zeros --- cpu/efm32/periph/pwm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/efm32/periph/pwm.c b/cpu/efm32/periph/pwm.c index f8c2f2432e26..ea940a3b5a5b 100644 --- a/cpu/efm32/periph/pwm.c +++ b/cpu/efm32/periph/pwm.c @@ -33,7 +33,7 @@ uint32_t pwm_init(pwm_t dev, pwm_mode_t mode, uint32_t freq, uint16_t res) { /* check if device is valid */ if (dev >= PWM_NUMOF) { - return -1; + return 0; } /* enable clocks */ @@ -46,7 +46,7 @@ uint32_t pwm_init(pwm_t dev, pwm_mode_t mode, uint32_t freq, uint16_t res) freq_timer); if (prescaler > timerPrescale1024) { - return -2; + return 0; } /* reset and initialize peripheral */ From 6c8d1ebc9805fb8b8cf9f0845ce975282b4d3b69 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 17 Mar 2023 13:09:57 +0100 Subject: [PATCH 2/2] tests/periph_pwm: wording fix, s/initiate/initialize/ --- tests/periph_pwm/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/periph_pwm/main.c b/tests/periph_pwm/main.c index a615eaba0268..092e136da0c1 100644 --- a/tests/periph_pwm/main.c +++ b/tests/periph_pwm/main.c @@ -42,7 +42,7 @@ #define OSC_STEPS (256U) #define PWR_SLEEP (1U) -static uint32_t initiated; +static uint32_t initialized; static unsigned _get_dev(const char *dev_str) { @@ -94,11 +94,11 @@ static int _init(int argc, char** argv) (uint16_t)atoi(argv[4])); if (pwm_freq != 0) { printf("The pwm frequency is set to %" PRIu32 "\n", pwm_freq); - initiated |= (1 << dev); + initialized |= (1 << dev); return 0; } - puts("Error: device is not initiated"); + puts("Error: device is not initialized"); return 1; } @@ -117,8 +117,8 @@ static int _set(int argc, char**argv) return 1; } - if ((initiated & (1 << dev)) == 0) { - puts("Error: pwm is not initiated.\n"); + if ((initialized & (1 << dev)) == 0) { + puts("Error: pwm is not initialized.\n"); puts("Execute init function first.\n"); return 1; } @@ -245,7 +245,7 @@ static const shell_command_t shell_commands[] = { int main(void) { puts("PWM peripheral driver test\n"); - initiated = 0; + initialized = 0; char line_buf[SHELL_DEFAULT_BUFSIZE]; shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);