Implement sampling ADC and printing over VSP

This commit is contained in:
2020-06-28 16:23:20 +02:00
parent f678273def
commit e6205458c5
2 changed files with 62 additions and 9 deletions

View File

@@ -0,0 +1,21 @@
#pragma once
#include <type_traits>
#include <utility>
namespace util {
template<typename Fn, size_t... Ints>
auto for_constexpr(Fn&& func, std::index_sequence<Ints...>)
{
if constexpr(std::is_void_v<std::invoke_result_t<Fn, std::integral_constant<size_t, 0>>>) {
(func(std::integral_constant<size_t, Ints>{}), ...);
}
else {
if((func(std::integral_constant<size_t, Ints>{}) && ...))
return true;
return false;
}
}
} // namespace util