From 824dbce941064a6d9fd160646a9991130a5315c8 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 21 Apr 2021 06:14:47 -0700 Subject: [PATCH] drivers:ADC Use inttypes --- src/drivers/adc/board_adc/ADC.cpp | 10 +++++----- src/drivers/adc/board_adc/ADC.hpp | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/drivers/adc/board_adc/ADC.cpp b/src/drivers/adc/board_adc/ADC.cpp index 7552dd8a20..cccd64ff96 100644 --- a/src/drivers/adc/board_adc/ADC.cpp +++ b/src/drivers/adc/board_adc/ADC.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012-2020 PX4 Development Team. All rights reserved. + * Copyright (C) 2012-2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,7 +55,7 @@ ADC::ADC(uint32_t base_address, uint32_t channels) : } if (_channel_count > PX4_MAX_ADC_CHANNELS) { - PX4_ERR("PX4_MAX_ADC_CHANNELS is too small (%d, %d)", (unsigned)PX4_MAX_ADC_CHANNELS, _channel_count); + PX4_ERR("PX4_MAX_ADC_CHANNELS is too small (%u, %u)", PX4_MAX_ADC_CHANNELS, _channel_count); } _samples = new px4_adc_msg_t[_channel_count]; @@ -307,14 +307,14 @@ int ADC::test() px4_usleep(20000); // sleep 20ms and wait for adc report if (adc_sub_test.update(&adc)) { - PX4_INFO_RAW("DeviceID: %d\n", adc.device_id); - PX4_INFO_RAW("Resolution: %d\n", adc.resolution); + PX4_INFO_RAW("DeviceID: %" PRId32 "\n", adc.device_id); + PX4_INFO_RAW("Resolution: %" PRId32 "\n", adc.resolution); PX4_INFO_RAW("Voltage Reference: %f\n", (double)adc.v_ref); for (unsigned l = 0; l < 20; ++l) { for (unsigned i = 0; i < PX4_MAX_ADC_CHANNELS; ++i) { if (adc.channel_id[i] >= 0) { - PX4_INFO_RAW("% 2d:% 6d", adc.channel_id[i], adc.raw_data[i]); + PX4_INFO_RAW("% 2" PRId16 " :% 6" PRId32, adc.channel_id[i], adc.raw_data[i]); } } diff --git a/src/drivers/adc/board_adc/ADC.hpp b/src/drivers/adc/board_adc/ADC.hpp index b53fe3d47e..ab78fe3329 100644 --- a/src/drivers/adc/board_adc/ADC.hpp +++ b/src/drivers/adc/board_adc/ADC.hpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012-2020 PX4 Development Team. All rights reserved. + * Copyright (C) 2012-2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,6 +37,7 @@ * Driver for an ADC. * */ +#include #include #include