-
Notifications
You must be signed in to change notification settings - Fork 1
/
lcd.h
45 lines (35 loc) · 1016 Bytes
/
lcd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* author : Shuichi TAKANO
* since : Sat Feb 24 2024 22:24:23
*/
#pragma once
#include <hardware/i2c.h>
#include <cstdint>
class LCD
{
public:
void init(i2c_inst_t *i2c);
void puts(const char *s);
void locate(int x, int y);
void clear();
void defineChar(int n, const uint8_t *data);
void setContrast(int v);
int getAvailableNonBlockingSize();
void putCharNonBlocking(char ch);
void locateNonBlocking(int x, int y);
bool printNonBlocking(int x, int y, const char *s, int n);
bool defineCharNonBlocking(int n, const uint8_t *data);
void waitForNonBlocking();
void setDisplayOnOff(bool on); // non block 待ちする
static LCD &instance();
protected:
void writeInstruction(uint8_t cmd);
void writeData(uint8_t data);
void writeInstructionNonBlocking(uint8_t cmd);
void writeDataNonBlocking(uint8_t data);
void setAddrForNonBlocking();
private:
i2c_inst_t *i2c_{};
bool needSetAddr_ = true;
bool dispOn_ = false;
};