examples/pwm/pwm_main.c: Fix printf format warnings

This commit is contained in:
YAMAMOTO Takashi 2020-11-10 07:36:38 +09:00 committed by Xiang Xiao
parent b04e19ffc7
commit 862a9fcbda

View File

@ -49,6 +49,7 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
#include <nuttx/timers/pwm.h> #include <nuttx/timers/pwm.h>
@ -185,7 +186,7 @@ static void pwm_help(FAR struct pwm_state_s *pwm)
"Default: %s Current: %s\n", "Default: %s Current: %s\n",
CONFIG_EXAMPLES_PWM_DEVPATH, pwm->devpath ? pwm->devpath : "NONE"); CONFIG_EXAMPLES_PWM_DEVPATH, pwm->devpath ? pwm->devpath : "NONE");
printf(" [-f frequency] selects the pulse frequency. " printf(" [-f frequency] selects the pulse frequency. "
"Default: %d Hz Current: %u Hz\n", "Default: %d Hz Current: %" PRIu32 " Hz\n",
CONFIG_EXAMPLES_PWM_FREQUENCY, pwm->freq); CONFIG_EXAMPLES_PWM_FREQUENCY, pwm->freq);
#ifdef CONFIG_PWM_MULTICHAN #ifdef CONFIG_PWM_MULTICHAN
printf(" [[-c channel1] [[-c channel2] ...]] " printf(" [[-c channel1] [[-c channel2] ...]] "
@ -487,7 +488,7 @@ int main(int argc, FAR char *argv[])
info.frequency = g_pwmstate.freq; info.frequency = g_pwmstate.freq;
#ifdef CONFIG_PWM_MULTICHAN #ifdef CONFIG_PWM_MULTICHAN
printf("pwm_main: starting output with frequency: %u", printf("pwm_main: starting output with frequency: %" PRIu32,
info.frequency); info.frequency);
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++) for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
@ -495,7 +496,7 @@ int main(int argc, FAR char *argv[])
info.channels[i].channel = g_pwmstate.channels[i]; info.channels[i].channel = g_pwmstate.channels[i];
info.channels[i].duty = ((uint32_t)g_pwmstate.duties[i] info.channels[i].duty = ((uint32_t)g_pwmstate.duties[i]
<< 16) / 100; << 16) / 100;
printf(" channel: %d duty: %08x", printf(" channel: %d duty: %08" PRIx32,
info.channels[i].channel, info.channels[i].duty); info.channels[i].channel, info.channels[i].duty);
} }