Skip to content

Commit

Permalink
Add ADC IRQ lookup for STM32H5
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangottstein committed Jan 23, 2025
1 parent e9da4dd commit f0fb89d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions hal_st/stm32fxxx/AnalogToDigitalPinStm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,34 @@ extern "C"

namespace
{
#if !defined (ADC_IRQn)
constexpr std::array irqMap{
#if defined(STM32G4)
constexpr std::array irqMap
{
#if defined(ADC1)
std::make_pair(1, IRQn_Type::ADC1_2_IRQn), // only ADC1 or ADC2 can be configured to use the single interrupt vector
#endif
#if defined(ADC2)
std::make_pair(2, IRQn_Type::ADC1_2_IRQn), // only ADC1 or ADC2 can be configured to use the single interrupt vector
std::make_pair(2, IRQn_Type::ADC1_2_IRQn), // only ADC1 or ADC2 can be configured to use the single interrupt vector
#endif
#else
#if defined(ADC1)
std::make_pair(1, IRQn_Type::ADC1_IRQn),

Check failure on line 37 in hal_st/stm32fxxx/AnalogToDigitalPinStm.cpp

View workflow job for this annotation

GitHub Actions / Embedded Build (RelWithDebInfo, 10.3-2021.10, stm32f429)

'ADC1_IRQn' is not a member of 'IRQn_Type'

Check failure on line 37 in hal_st/stm32fxxx/AnalogToDigitalPinStm.cpp

View workflow job for this annotation

GitHub Actions / Embedded Build (RelWithDebInfo, 10.3-2021.10, stm32f746)

'ADC1_IRQn' is not a member of 'IRQn_Type'
#endif
#if defined(ADC2)
std::make_pair(2, IRQn_Type::ADC2_IRQn),

Check failure on line 40 in hal_st/stm32fxxx/AnalogToDigitalPinStm.cpp

View workflow job for this annotation

GitHub Actions / Embedded Build (RelWithDebInfo, 10.3-2021.10, stm32f429)

'ADC2_IRQn' is not a member of 'IRQn_Type'

Check failure on line 40 in hal_st/stm32fxxx/AnalogToDigitalPinStm.cpp

View workflow job for this annotation

GitHub Actions / Embedded Build (RelWithDebInfo, 10.3-2021.10, stm32f746)

'ADC2_IRQn' is not a member of 'IRQn_Type'
#endif
#endif

#if defined(ADC3)
std::make_pair(3, IRQn_Type::ADC3_IRQn),
std::make_pair(3, IRQn_Type::ADC3_IRQn),

Check failure on line 45 in hal_st/stm32fxxx/AnalogToDigitalPinStm.cpp

View workflow job for this annotation

GitHub Actions / Embedded Build (RelWithDebInfo, 10.3-2021.10, stm32f429)

'ADC3_IRQn' is not a member of 'IRQn_Type'

Check failure on line 45 in hal_st/stm32fxxx/AnalogToDigitalPinStm.cpp

View workflow job for this annotation

GitHub Actions / Embedded Build (RelWithDebInfo, 10.3-2021.10, stm32f746)

'ADC3_IRQn' is not a member of 'IRQn_Type'
#endif

#if defined(ADC4)
std::make_pair(4, IRQn_Type::ADC4_IRQn),
std::make_pair(4, IRQn_Type::ADC4_IRQn),
#endif

#if defined(ADC5)
std::make_pair(5, IRQn_Type::ADC5_IRQn),
std::make_pair(5, IRQn_Type::ADC5_IRQn),
#endif
};

Expand Down Expand Up @@ -152,7 +160,7 @@ namespace hal
#elif defined(STM32WBA)
, interruptHandler(ADC4_IRQn, [this]()
#elif defined(STM32H5)
, interruptHandler(ADC2_IRQn, [this]()
, interruptHandler(LookupIrq(oneBasedIndex), [this]()
#else
, interruptHandler(ADC_IRQn, [this]()
#endif
Expand Down

0 comments on commit f0fb89d

Please sign in to comment.