diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_dfsdm.c b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_dfsdm.c index f6be8c6c547..7819952d12c 100644 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_dfsdm.c +++ b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_dfsdm.c @@ -69,6 +69,33 @@ int stm32_dfsdm_setup(void) { int ret; struct adc_dev_s *adc; +#ifdef CONFIG_STM32L4_DFSDM1_FLT0 + const uint8_t chanlist0[1] = + { + 0 + }; +#endif + +#ifdef CONFIG_STM32L4_DFSDM1_FLT1 + const uint8_t chanlist1[2] = + { + 0, 1 + }; +#endif + +#ifdef CONFIG_STM32L4_DFSDM1_FLT2 + const uint8_t chanlist2[8] = + { + 0, 1, 2, 3, 4, 5, 6, 7 + }; +#endif + +#ifdef CONFIG_STM32L4_DFSDM1_FLT3 + const uint8_t chanlist3[4] = + { + 6, 5, 4, 3 + }; +#endif ainfo("Initializing DFSDM\n"); @@ -78,7 +105,7 @@ int stm32_dfsdm_setup(void) */ #ifdef CONFIG_STM32L4_DFSDM1_FLT0 - adc = stm32l4_dfsdm_initialize(0, (const uint8_t[1]){0}, 1); + adc = stm32l4_dfsdm_initialize(0, chanlist0, 1); if (adc == NULL) { aerr("Failed to get DFSDM FLT0 interface\n"); @@ -92,8 +119,9 @@ int stm32_dfsdm_setup(void) return ret; } #endif + #ifdef CONFIG_STM32L4_DFSDM1_FLT1 - adc = stm32l4_dfsdm_initialize(1, (const uint8_t[2]){0,1}, 2); + adc = stm32l4_dfsdm_initialize(1, chanlist1, 2); if (adc == NULL) { aerr("Failed to get DFSDM FLT1 interface\n"); @@ -107,8 +135,9 @@ int stm32_dfsdm_setup(void) return ret; } #endif + #ifdef CONFIG_STM32L4_DFSDM1_FLT2 - adc = stm32l4_dfsdm_initialize(2, (const uint8_t[8]){0,1,2,3,4,5,6,7}, 8); + adc = stm32l4_dfsdm_initialize(2, chanlist2, 8); if (adc == NULL) { aerr("Failed to get DFSDM FLT2 interface\n"); @@ -122,8 +151,9 @@ int stm32_dfsdm_setup(void) return ret; } #endif + #ifdef CONFIG_STM32L4_DFSDM1_FLT3 - adc = stm32l4_dfsdm_initialize(3, (const uint8_t[4]){6,5,4,3}, 4); + adc = stm32l4_dfsdm_initialize(3, chanlist3, 4); if (adc == NULL) { aerr("Failed to get DFSDM FLT3 interface\n");