Use enum to represent commands
This commit is contained in:
parent
9a4193ee75
commit
d1419b2d23
34
eink.hpp
34
eink.hpp
@ -12,21 +12,21 @@ namespace eink {
|
||||
|
||||
template <uint16_t Width, uint16_t Height, typename Spi, io::P RstPin, io::P DcPin, io::P BusyPin>
|
||||
class Eink {
|
||||
struct Cmd {
|
||||
static constexpr auto SW_RESET = uint8_t{0x12};
|
||||
static constexpr auto DRIVER_OUTPUT_CONTROL = uint8_t{0x01};
|
||||
static constexpr auto DATA_ENTRY_MODE = uint8_t{0x11};
|
||||
static constexpr auto SET_RAM_X_ADDR_POSITIONS = uint8_t{0x44};
|
||||
static constexpr auto SET_RAM_Y_ADDR_POSITIONS = uint8_t{0x45};
|
||||
static constexpr auto BORDER_WAVEFORM_CONTROL = uint8_t{0x3C};
|
||||
static constexpr auto READ_TEMPERATURE_SENSOR = uint8_t{0x18};
|
||||
static constexpr auto SET_RAM_X_ADDR = uint8_t{0x4E};
|
||||
static constexpr auto SET_RAM_Y_ADDR = uint8_t{0x4F};
|
||||
static constexpr auto WRITE_RAM_BLACK = uint8_t{0x24};
|
||||
static constexpr auto WRITE_RAM_RED = uint8_t{0x26};
|
||||
static constexpr auto DISPLAY_UPDATE_CONTROL_2 = uint8_t{0x22};
|
||||
static constexpr auto UPDATE_DISPLAY = uint8_t{0x20};
|
||||
static constexpr auto DEEP_SLEEP_MODE = uint8_t{0x10};
|
||||
enum class Cmd : uint8_t {
|
||||
DRIVER_OUTPUT_CONTROL = 0x01,
|
||||
DEEP_SLEEP_MODE = 0x10,
|
||||
DATA_ENTRY_MODE = 0x11,
|
||||
SW_RESET = 0x12,
|
||||
READ_TEMPERATURE_SENSOR = 0x18,
|
||||
UPDATE_DISPLAY = 0x20,
|
||||
DISPLAY_UPDATE_CONTROL_2 = 0x22,
|
||||
WRITE_RAM_BLACK = 0x24,
|
||||
WRITE_RAM_RED = 0x26,
|
||||
BORDER_WAVEFORM_CONTROL = 0x3C,
|
||||
SET_RAM_X_ADDR_POSITIONS = 0x44,
|
||||
SET_RAM_Y_ADDR_POSITIONS = 0x45,
|
||||
SET_RAM_X_ADDR = 0x4E,
|
||||
SET_RAM_Y_ADDR = 0x4F,
|
||||
};
|
||||
|
||||
static io::Pin<RstPin> m_rst;
|
||||
@ -106,10 +106,10 @@ class Eink {
|
||||
waitUntilIdle();
|
||||
}
|
||||
|
||||
static void sendCommand(const uint8_t command)
|
||||
static void sendCommand(const Cmd command)
|
||||
{
|
||||
m_dc = false;
|
||||
spiTransfer(command);
|
||||
spiTransfer(static_cast<uint8_t>(command));
|
||||
}
|
||||
|
||||
static void sendData(const uint8_t data)
|
||||
|
Loading…
Reference in New Issue
Block a user