2024-09-20 12:20 AM
/**
* @brief STM32 Family
*/
#if !defined (STM32F4)
#define STM32F4
#endif /* STM32F4 */
As we know, STM32F2/F4 and F7 have a different type of DMA implementation than STM32H5, leading to differences in elements in DMA_InitTypeDef and DMA_HandleTypeDef structures.
Is there a macro that will help us distinguish these DMA types, rather than the chip family macro?
2024-09-20 06:45 AM
No, there are not per-peripheral macros for each family and version of peripheral.
2024-09-20 06:57 AM - edited 2024-09-20 07:33 AM
CubeIDE will automatically include a #define for the chip you're using; eg,
So you could use that to create your "family" macro; eg,
#if defined STM32F051x8 || defined STM32F030x8
#define STM32F0
#elif defined STM32L073xx
#define STM32L0
#else
#error "Unknown chip"
#endif
EDIT:
Sorry, I mis-read the question.
But, in a similar style, you could provide your own "DMA Type" macro:
#if defined STM32F2 || defined STM32F4 || defined STM32F7
#define DMA_TYPE_1
#elif defined STM32H5
#define DMA_TYPE_2
#else
#error "Unknown STM32 family."
#endif