From 28c133a50376ad0b505d406e5ec7484fea3cfdd1 Mon Sep 17 00:00:00 2001 From: Norman Rasmussen Date: Tue, 28 Dec 2021 12:24:17 -0800 Subject: [PATCH] Adjust channel and duty bounds to allow testing sentinel values commit 7354ab187ed701ae041b45a0a6603878ab9b165d and commit 1e2f06718103e7028809012a69b7ac932e9ae537 added code to skip all remaining channels when the channel number is -1. This adds support for testing that using the example app. The BL602 driver's first channel is channel 0, so this also allows the example app to select the first channel. --- examples/pwm/pwm_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/pwm/pwm_main.c b/examples/pwm/pwm_main.c index a095484e5..a8a207d86 100644 --- a/examples/pwm/pwm_main.c +++ b/examples/pwm/pwm_main.c @@ -330,7 +330,7 @@ static void parse_args(FAR struct pwm_state_s *pwm, int argc, #ifdef CONFIG_PWM_MULTICHAN case 'c': nargs = arg_decimal(&argv[index], &value); - if (value < 1 || value > CONFIG_PWM_NCHANNELS) + if (value < -1 || value > CONFIG_PWM_NCHANNELS) { printf("Channel out of range: %ld\n", value); exit(1); @@ -346,14 +346,14 @@ static void parse_args(FAR struct pwm_state_s *pwm, int argc, CONFIG_PWM_NCHANNELS - 1); } - pwm->channels[nchannels - 1] = (uint8_t)value; + pwm->channels[nchannels - 1] = (int8_t)value; index += nargs; break; #endif case 'd': nargs = arg_decimal(&argv[index], &value); - if (value < 1 || value > 99) + if (value < 0 || value > 100) { printf("Duty out of range: %ld\n", value); exit(1);