From bb78d2291d603647b19600eb3cc02dabce2f8ea5 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Thu, 26 May 2022 14:58:47 +0200 Subject: [PATCH] Make chip select pin configurable --- config.hpp | 5 ++++- hardware.hpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config.hpp b/config.hpp index cdcb07c..c9761d7 100644 --- a/config.hpp +++ b/config.hpp @@ -1,5 +1,7 @@ #pragma once +#include "../io/io.hpp" + namespace spi { enum class ClockDiv { @@ -32,12 +34,13 @@ enum class BitOrder { }; template + BitOrder bitOrder = BitOrder::MSB_FIRST, io::P ssPin = io::P::B2, bool pullup = false> struct Config { static constexpr auto FREQ = freq; static constexpr auto MODE = mode; static constexpr auto SIDE = side; static constexpr auto BIT_ORDER = bitOrder; + static constexpr auto SS_PIN = ssPin; static constexpr auto PULLUP = pullup; }; diff --git a/hardware.hpp b/hardware.hpp index 913569e..8ee6735 100644 --- a/hardware.hpp +++ b/hardware.hpp @@ -52,7 +52,7 @@ class Hardware { static io::Pin sm_sck; static io::Pin sm_miso; static io::Pin sm_mosi; - static io::Pin sm_ss; + static io::Pin sm_ss; static void setClockDiv() {