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"
|
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>
|
2020-02-21 16:49:22 +01:00
|
|
|
class Spi {
|
2020-02-21 16:47:47 +01:00
|
|
|
public:
|
2020-02-21 17:26:14 +01:00
|
|
|
static void init()
|
2020-02-21 17:01:56 +01:00
|
|
|
{
|
2020-02-21 17:26:14 +01:00
|
|
|
Driver::init();
|
2020-02-21 16:47:47 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 17:01:56 +01:00
|
|
|
static uint8_t transfer(uint8_t ui8Data)
|
|
|
|
{
|
2020-02-21 17:29:45 +01:00
|
|
|
return Driver::transfer(ui8Data);
|
2020-02-21 16:47:47 +01:00
|
|
|
}
|
2020-02-21 17:01:56 +01:00
|
|
|
|
|
|
|
static void select(bool bSelect)
|
|
|
|
{
|
2020-02-21 17:29:45 +01:00
|
|
|
Driver::select(bSelect);
|
2020-02-21 16:47:47 +01:00
|
|
|
}
|
2020-02-21 17:26:14 +01:00
|
|
|
|
|
|
|
private:
|
2020-02-21 17:01:56 +01:00
|
|
|
};
|
2020-02-21 16:49:22 +01:00
|
|
|
|
|
|
|
} // namespace spi
|