boards/arm/stm32l4/nucleo-l452re/src/stm32_adc.c: Appease nxstyle

The following nxstyle error was intentionally left.
(a URL in a comment)

boards/arm/stm32l4/nucleo-l452re/src/stm32_adc.c:79:93: error: Long line found
This commit is contained in:
YAMAMOTO Takashi 2020-12-01 11:04:07 +09:00 committed by Xiang Xiao
parent 39e0b6ee1b
commit 74aac70367

View File

@ -1,4 +1,4 @@
/***************************************************************************** /****************************************************************************
* boards/arm/stm32l4/nucleo-l452re/src/stm32_adc.c * boards/arm/stm32l4/nucleo-l452re/src/stm32_adc.c
* *
* Copyright (C) 2017 Haltian Ltd. All rights reserved. * Copyright (C) 2017 Haltian Ltd. All rights reserved.
@ -63,7 +63,9 @@
/* STM32 chip specific calibration values ***********************************/ /* STM32 chip specific calibration values ***********************************/
/* Voltage used for calibration of internal analog reference voltage (Vrefint) */ /* Voltage used for calibration of internal analog reference voltagei
* (Vrefint)
*/
#if defined(CONFIG_ARCH_CHIP_STM32F7) \ #if defined(CONFIG_ARCH_CHIP_STM32F7) \
|| defined(CONFIG_ARCH_CHIP_STM32F4) \ || defined(CONFIG_ARCH_CHIP_STM32F4) \
@ -146,9 +148,9 @@ static const uint8_t g_chanlist[ADC1_NCHANNELS] =
static const uint32_t g_pinlist[ADC1_NCHANNELS] = static const uint32_t g_pinlist[ADC1_NCHANNELS] =
{ {
0xffffffffU, 0xffffffffu,
0xffffffffU, 0xffffffffu,
0xffffffffU, 0xffffffffu,
GPIO_MEASURE_ADC, GPIO_MEASURE_ADC,
}; };
@ -164,11 +166,16 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] =
* *
****************************************************************************/ ****************************************************************************/
int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *vext) int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat,
uint32_t *vext)
{ {
FAR struct file filestruct; FAR struct file filestruct;
ssize_t nbytes; ssize_t nbytes;
struct adc_msg_s sample[ADC1_NCHANNELS] = { 0 }; struct adc_msg_s sample[ADC1_NCHANNELS] =
{
0
};
int nsamples; int nsamples;
int ret; int ret;
@ -223,7 +230,7 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
for (i = 0; i < nsamples ; i++) for (i = 0; i < nsamples ; i++)
{ {
ainfo("%d: channel: %d value: %d\n", ainfo("%d: channel: %d value: %d\n",
i+1, sample[i].am_channel, sample[i].am_data); i + 1, sample[i].am_channel, sample[i].am_data);
/* Add the raw value to entropy pool. */ /* Add the raw value to entropy pool. */
@ -232,9 +239,12 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
switch (sample[i].am_channel) switch (sample[i].am_channel)
{ {
case ADC1_INTERNAL_VREFINT_CHANNEL: case ADC1_INTERNAL_VREFINT_CHANNEL:
/* Calculate corrected Vrefint with factory calibration value. */ /* Calculate corrected Vrefint with factory calibration
* value.
*/
*vrefint = STM32_VREFINT_MVOLTS * STM32_VREFINT_CAL / sample[i].am_data; *vrefint = STM32_VREFINT_MVOLTS * STM32_VREFINT_CAL /
sample[i].am_data;
ainfo("VREFINT: %d -> %u mV\n", sample[i].am_data, *vrefint); ainfo("VREFINT: %d -> %u mV\n", sample[i].am_data, *vrefint);
break; break;
@ -243,8 +253,9 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve
* so it does not matter much if we use integer type here. * so it does not matter much if we use integer type here.
*/ */
tsense = (110 - 30) * (sample[i].am_data - STM32_TSENSE_TSCAL1) tsense = (110 - 30) *
/ (STM32_TSENSE_TSCAL2 - STM32_TSENSE_TSCAL1) + 30; (sample[i].am_data - STM32_TSENSE_TSCAL1)
/ (STM32_TSENSE_TSCAL2 - STM32_TSENSE_TSCAL1) + 30;
ainfo("TSENSE: %d -> %d °C\n", sample[i].am_data, tsense); ainfo("TSENSE: %d -> %d °C\n", sample[i].am_data, tsense);
UNUSED(tsense); UNUSED(tsense);
break; break;
@ -285,19 +296,22 @@ int stm32l4_adc_setup(void)
if (!initialized) if (!initialized)
{ {
#ifdef CONFIG_STM32L4_ADC1 #ifdef CONFIG_STM32L4_ADC1
int ret, i; int ret;
int i;
/* Configure the pins as analog inputs for the selected channels */ /* Configure the pins as analog inputs for the selected channels */
for (i = 0; i < ADC1_NCHANNELS; i++) for (i = 0; i < ADC1_NCHANNELS; i++)
{ {
if (g_pinlist[i] != 0xffffffffU) if (g_pinlist[i] != 0xffffffffu)
{ {
stm32l4_configgpio(g_pinlist[i]); stm32l4_configgpio(g_pinlist[i]);
} }
} }
/* Call stm32l4_adc_initialize() to get an instance of the ADC interface */ /* Call stm32l4_adc_initialize() to get an instance of the ADC
* interface
*/
g_adc = stm32l4_adc_initialize(1, g_chanlist, ADC1_NCHANNELS); g_adc = stm32l4_adc_initialize(1, g_chanlist, ADC1_NCHANNELS);
if (g_adc == NULL) if (g_adc == NULL)
@ -315,6 +329,7 @@ int stm32l4_adc_setup(void)
return ret; return ret;
} }
#endif #endif
initialized = true; initialized = true;
} }