diff --git a/adc.hpp b/adc.hpp index 23598c6..e181563 100644 --- a/adc.hpp +++ b/adc.hpp @@ -13,6 +13,8 @@ struct Config { template class Adc { public: + static_assert(detail::supports_adc_v, "Pin does not support ADC"); + void read() {} private: diff --git a/hardware.hpp b/hardware.hpp index 5cba31d..0b67e2a 100644 --- a/hardware.hpp +++ b/hardware.hpp @@ -2,7 +2,7 @@ #include -#include +#include "../io/io.hpp" namespace adc { @@ -70,6 +70,14 @@ enum class ControlFlagsDigInDis { DIGITAL_INPUT_DISABLE_5 = ADC5D, }; +template +struct supports_adc { + static constexpr auto value = (io::detail::getBus(pin) == io::Bus::C) ? true : false; +}; + +template +constexpr auto supports_adc_v = supports_adc::value; + #pragma pop_macro("_MMIO_BYTE") #else