SegLCDLib
Loading...
Searching...
No Matches
SegDriver_3Wire.h
Go to the documentation of this file.
1#ifndef SEGDRIVER_3WIRE_H
2#define SEGDRIVER_3WIRE_H
3
4#include <SegLCDLib.h>
5#include <SegTransport.h>
6
13class SegDriver_3Wire : public SegLCDLib {
14 // Define operation codes
15 #define OP_CMD 0b100
16 #define OP_READ 0b110
17 #define OP_WRITE 0b101
18 #define OP_RD_MOD_WR 0b101
19
20 // System control commands
21 #define CMD_SYS_DIS 0b00000000
22 #define CMD_SYS_EN 0b00000001
23 #define CMD_LCD_OFF 0b00000010
24 #define CMD_LCD_ON 0b00000011
25 #define CMD_TMR_DIS 0b00000100
26 #define CMD_WDT_DIS 0b00000101
27 #define CMD_TMR_EN 0b00000110
28 #define CMD_WDT_EN 0b00000111
29 #define CMD_CLR_TMR 0b00001100
30 #define CMD_CLR_WDT 0b00001110
31
32 // IRQ control commands
33 #define CMD_IRQ_DIS 0b10000000
34 #define CMD_IRQ_EN 0b10001000
35
36 // Time base and WDT frequency commands
37 #define CMD_F1 0b10100000
38 #define CMD_F2 0b10100001
39 #define CMD_F4 0b10100010
40 #define CMD_F8 0b10100011
41 #define CMD_F16 0b10100100
42 #define CMD_F32 0b10100101
43 #define CMD_F64 0b10100110
44 #define CMD_F128 0b10100111
45
46 // Test/Normal operation commands
47 #define CMD_TEST 0b11100000
48 #define CMD_NORMAL 0b11100011
49
50 public:
57 SegDriver_3Wire(SegTransport3Wire& transport, uint8_t chipselect);
58
62 void init() override;
63
67 void on() override;
68
72 void off() override;
73
79 void command(uint8_t command) override;
80
90 void flush(uint8_t startAddr, uint8_t length) override;
91 using SegLCDLib::flush; // Inherit base flush() without parameters
92
93 protected:
95 uint8_t _cs;
96
98
106 virtual void _writeRam(uint8_t *data, size_t length, uint8_t address);
107};
108
109#endif
Base class for segment LCD display drivers.
Base class for 3-wire serial LCD segment display drivers.
Definition SegDriver_3Wire.h:13
void init() override
Initialize GPIO pins for communication.
Definition SegDriver_3Wire.cpp:6
virtual void flush()
Flush all buffered changes to the display.
Definition SegLCDLib.cpp:322
void off() override
Turn the display off.
Definition SegDriver_3Wire.cpp:17
void on() override
Turn the display on.
Definition SegDriver_3Wire.cpp:12
void command(uint8_t command) override
Send command to the controller.
Definition SegDriver_3Wire.cpp:22
uint8_t _cs
Chip select pin for the display.
Definition SegDriver_3Wire.h:95
SegTransport3Wire & _transport
Definition SegDriver_3Wire.h:94
virtual void _writeRam(uint8_t *data, size_t length, uint8_t address)
Write multiple bytes to RAM starting at specified address.
Definition SegDriver_3Wire.cpp:58
Abstract base class for LCD segment display drivers.
Definition SegLCDLib.h:45
virtual void flush()
Flush all buffered changes to the display.
Definition SegLCDLib.cpp:322
void _writeRam(uint8_t data, uint8_t address=0)
Low-level method to write a single byte to display RAM.
Definition SegLCDLib.cpp:389
Abstract 3-wire serial transport.
Definition SegTransport.h:23