mirror of
https://github.com/apache/nuttx.git
synced 2026-08-14 17:03:29 +00:00
Fix compile error from last ADC change
This commit is contained in:
parent
0843af5367
commit
5b46df9c49
1 changed files with 15 additions and 0 deletions
|
|
@ -1217,6 +1217,9 @@ static void adc_enable(FAR struct stm32_dev_s *priv, bool enable)
|
|||
|
||||
avdbg("enable: %d\n", (enable ? 1 : 0));
|
||||
|
||||
/* Not all STM32 parts prove the SR ADONS bit */
|
||||
|
||||
#ifdef ADC_SR_ADONS
|
||||
regval = adc_getreg(priv, STM32_ADC_SR_OFFSET);
|
||||
|
||||
if (!(regval & ADC_SR_ADONS) && enable)
|
||||
|
|
@ -1230,6 +1233,18 @@ static void adc_enable(FAR struct stm32_dev_s *priv, bool enable)
|
|||
regval &= ~ADC_CR2_ADON;
|
||||
}
|
||||
|
||||
#else
|
||||
regval = adc_getreg(priv, STM32_ADC_CR2_OFFSET);
|
||||
if (enable)
|
||||
{
|
||||
regval |= ADC_CR2_ADON;
|
||||
}
|
||||
else
|
||||
{
|
||||
regval &= ~ADC_CR2_ADON;
|
||||
}
|
||||
#endif
|
||||
|
||||
adc_putreg(priv, STM32_ADC_CR2_OFFSET, regval);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue