#pragma once #include #include "../io/io.hpp" namespace spi { enum class ClockDiv { DIV_4 = 0, DIV_16 = 1, DIV_64 = 2, DIV_128 = 3, DIV_2X_2 = 4, DIV_2X_8 = 5, DIV_2X_32 = 6, DIV_2X_64 = 7, }; enum class Mode { MODE_0 = 0, MODE_1 = 1, MODE_2 = 2, MODE_3 = 3, }; enum class Side { MASTER, SLAVE, }; enum class BitOrder { LSB_FIRST, MSB_FIRST, }; template struct HardwareConfig { 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; }; template struct SoftwareConfig { static constexpr auto SCK_PIN = sckPin; static constexpr auto MISO_PIN = misoPin; static constexpr auto MOSI_PIN = mosiPin; static constexpr auto SS_PIN = ssPin; static constexpr auto FREQ = freq; static constexpr auto MODE = mode; static constexpr auto BIT_ORDER = bitOrder; static constexpr auto BITS = bits; static constexpr auto PULLUP = pullup; }; } // namespace spi