spi/spi.hpp

32 lines
459 B
C++
Raw Permalink Normal View History

2020-02-21 16:48:31 +01:00
#pragma once
2020-02-21 16:47:47 +01:00
2020-02-21 17:10:49 +01:00
#include "config.hpp"
#include "hardware.hpp"
2022-05-28 15:43:42 +02:00
#include "software.hpp"
2020-02-21 16:49:22 +01:00
2020-02-21 17:10:49 +01:00
#include "../io/io.hpp"
2020-02-21 16:47:47 +01:00
2020-02-21 16:49:22 +01:00
namespace spi {
2020-02-21 17:10:49 +01:00
template <class Driver>
struct Spi {
using word_t = typename Driver::word_t;
static inline void init()
{
2020-02-21 17:26:14 +01:00
Driver::init();
2020-02-21 16:47:47 +01:00
}
static inline word_t transfer(const word_t data)
{
return Driver::transfer(data);
2020-02-21 16:47:47 +01:00
}
static inline void select(const bool selectState)
{
Driver::select(selectState);
2020-02-21 16:47:47 +01:00
}
};
2020-02-21 16:49:22 +01:00
} // namespace spi