From 70aabc07f64a33b04e3e9ee00627f5c120b1f9ef Mon Sep 17 00:00:00 2001 From: BlackMark Date: Fri, 21 Feb 2020 17:35:23 +0100 Subject: [PATCH] Added constexpr and checking of supported chip --- hardware.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hardware.hpp b/hardware.hpp index 4defd34..913569e 100644 --- a/hardware.hpp +++ b/hardware.hpp @@ -4,6 +4,8 @@ namespace spi { +#if defined(__AVR_ATmega328P__) + template class Hardware { public: @@ -101,7 +103,7 @@ class Hardware { static void setBitOrder() { - if (Cfg::BIT_ORDER == BitOrder::LSB_FIRST) { + if constexpr (Cfg::BIT_ORDER == BitOrder::LSB_FIRST) { SPCR |= (1 << DORD); } else { SPCR &= ~(1 << DORD); @@ -126,4 +128,8 @@ class Hardware { } }; +#else +#error "This chip is not supported" +#endif + } // namespace spi