nucleo-g431kb: modify COMP example

COMP example was changed to use DAC3CH2 signal on COMP INM input.
This commit is contained in:
Daniel P. Carvalho 2021-07-29 17:55:46 -03:00 committed by Mateusz Szafoni
parent 2593089f84
commit 91264ba704
2 changed files with 30 additions and 0 deletions

View File

@ -16,7 +16,10 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_COMP=y
CONFIG_DAC=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_DAC=y
CONFIG_EXAMPLES_DAC_DEVPATH="/dev/dac5"
CONFIG_INTELHEX_BINARY=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
@ -32,7 +35,11 @@ CONFIG_START_MONTH=6
CONFIG_START_YEAR=2021
CONFIG_STM32_COMP2=y
CONFIG_STM32_COMP2_HYST=3
CONFIG_STM32_COMP2_INM=4
CONFIG_STM32_COMP2_OUT=y
CONFIG_STM32_DAC3=y
CONFIG_STM32_DAC3CH2=y
CONFIG_STM32_DAC3CH2_MODE=3
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_FORCEPOWER=y
CONFIG_STM32_JTAG_FULL_ENABLE=y

View File

@ -42,6 +42,10 @@
static struct dac_dev_s *g_dac1;
#endif
#ifdef CONFIG_STM32_DAC3CH2
static struct dac_dev_s *g_dac5;
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -80,6 +84,25 @@ int stm32_dac_setup(void)
return ret;
}
#endif
#ifdef CONFIG_STM32_DAC3CH2
g_dac5 = stm32_dacinitialize(5);
if (g_dac5 == NULL)
{
aerr("ERROR: Failed to get DAC interface\n");
return -ENODEV;
}
/* Register the DAC driver at "/dev/dac5" */
ret = dac_register("/dev/dac5", g_dac5);
if (ret < 0)
{
aerr("ERROR: dac_register() failed: %d\n", ret);
return ret;
}
#endif
UNUSED(ret);