Question
Does HAL have constants for the total number of ADC channels?
Folks,
Does HAL have constants for the total number of ADC channels?
I want to iterate through all channels and make sure that all of them are disabled. Here's the code I have in mind.
ADC_ChannelConfTypeDef sConfig = {0};
sConfig.Rank = ADC_RANK_NONE; // disable all channels
const uint8_t nChannels = 19; // Does HAL already have a constant for the number of ADC channels?
for (uint32_t iChannel = 0; iChannel < nChannels; ++iChannel)
{
sConfig.Channel = iChannel;
if (HAL_ADC_ConfigChannel(hadc, &sConfig) != HAL_OK) Error_Handler();
}
I'm declaring my own constant nChannels = 19 . The number 19 came from the STM32G4 family reference manual. I wonder if HAL already has a constant for that.
Best regards,
- Nick
