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.
This commit is contained in:
parent
75c1e43334
commit
28c133a503
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user