SegLCDLib
Loading...
Searching...
No Matches
SegDriver_PCx85.h
Go to the documentation of this file.
1#ifndef SEGDRIVER_PCx85_H
2#define SEGDRIVER_PCx85_H
3
4#include <SegLCDLib.h>
5#include <SegTransport.h>
6
12class SegDriver_PCx85 : public SegLCDLib {
13 // Define commands
14 #define CMD_LOAD_POINTER 0x00
15 #define CMD_MODE 0x40
16 #define CMD_DEVICE_SELECT 0x60
17 #define CMD_BLINK 0x70
18 #define CMD_BANK_SELECT 0x78
19 #define CMD_LAST_COMMAND 0x80
20
21 // Common hardware constants for PCF85176 displays
22 protected:
23 static constexpr uint8_t DEFAULT_PCF85176_I2C_ADDRESS = 0x38; // 56 decimal
24 static constexpr uint8_t DEFAULT_SUBADDRESS = 0x00;
25 static constexpr uint8_t MAX_ADDRESS = 39;
26
27 public:
35
45
56
67 SegDriver_PCx85(SegTransportI2C& transport, uint8_t address, uint8_t subaddress);
68 virtual void init() override;
69
79 void bankSelect(uint8_t input, uint8_t output);
80
88 void on() override;
89 void off() override;
90
91 // TODO: Implement calling commands
92 void command(uint8_t) override { };
93
102 void flush(uint8_t startAddr, uint8_t length) override;
103 using SegLCDLib::flush; // Inherit base flush() without parameters
104
105 protected:
116 void _setMode(ModeStatus status, ModeDrive drive = MODE_DRIVE_14 , ModeBias bias = MODE_BIAS_13);
118 void _writeRam(uint8_t *data, size_t length, uint8_t address = 0) override;
119
120 private:
122 uint8_t _address;
123 uint8_t _subaddress;
126
135 void _deviceSelect();
136};
137
142 public:
150 SegDriver_PCF85176(SegTransportI2C& transport, uint8_t address = DEFAULT_PCF85176_I2C_ADDRESS, uint8_t subaddress = DEFAULT_SUBADDRESS) : SegDriver_PCx85(transport, address, subaddress) {}
151};
152
164 public:
165 using SegDriver_PCF85176::SegDriver_PCF85176; // inherit constructors
166};
167#endif
Base class for segment LCD display drivers.
ModeBias
Bias mode used by LCD controller.
Definition SegLCDLib.h:25
@ MODE_BIAS_13
1/3 bias
Definition SegLCDLib.h:26
ModeDrive
Drive mode used by LCD controller.
Definition SegLCDLib.h:15
@ MODE_DRIVE_14
1/4 multiplexing
Definition SegLCDLib.h:19
Implementation of the PCF85176 controllers.
Definition SegDriver_PCx85.h:141
SegDriver_PCF85176(SegTransportI2C &transport, uint8_t address=DEFAULT_PCF85176_I2C_ADDRESS, uint8_t subaddress=DEFAULT_SUBADDRESS)
Constructor for PCF85176 segment driver.
Definition SegDriver_PCx85.h:150
PCF8576 LCD segment driver.
Definition SegDriver_PCx85.h:163
Base class for PCx85 LCD segment display drivers.
Definition SegDriver_PCx85.h:12
ModeStatus
Enable/disable display.
Definition SegDriver_PCx85.h:31
@ MODE_STATUS_BLANK
Display is blanked.
Definition SegDriver_PCx85.h:32
@ MODE_STATUS_ENABLED
Display is enabled.
Definition SegDriver_PCx85.h:33
static constexpr uint8_t MAX_ADDRESS
Last valid start HW nibble address for byte write on a single PCx85 device.
Definition SegDriver_PCx85.h:25
void _writeRam(uint8_t *data, size_t length, uint8_t address=0) override
Low-level method to write a data buffer to display RAM.
Definition SegDriver_PCx85.cpp:45
uint8_t _subaddress
Definition SegDriver_PCx85.h:123
void _setMode(ModeStatus status, ModeDrive drive=MODE_DRIVE_14, ModeBias bias=MODE_BIAS_13)
Set the mode of the display.
Definition SegDriver_PCx85.cpp:73
void command(uint8_t) override
Send RAW command to controller.
Definition SegDriver_PCx85.h:92
void off() override
Turn the display off.
Definition SegDriver_PCx85.cpp:41
virtual void flush()
Flush all buffered changes to the display.
Definition SegLCDLib.cpp:337
ModeBias _bias
Definition SegDriver_PCx85.h:125
void _deviceSelect()
Select the device for communication.
Definition SegDriver_PCx85.cpp:63
uint8_t _address
Definition SegDriver_PCx85.h:122
virtual void init() override
Logical display sections that can be targeted by higher-level rendering logic.
Definition SegDriver_PCx85.cpp:10
BlinkFrequency
Set blink frequency.
Definition SegDriver_PCx85.h:39
@ BLINK_FREQUENCY_OFF
No blinking.
Definition SegDriver_PCx85.h:40
@ BLINK_FREQUENCY_2
Blink at ~1Hz.
Definition SegDriver_PCx85.h:42
@ BLINK_FREQUENCY_3
Blink at ~0.5Hz.
Definition SegDriver_PCx85.h:43
@ BLINK_FREQUENCY_1
Blink at ~2Hz.
Definition SegDriver_PCx85.h:41
void on() override
Turn the display on.
Definition SegDriver_PCx85.cpp:37
SegTransportI2C & _transport
Definition SegDriver_PCx85.h:121
static constexpr uint8_t DEFAULT_PCF85176_I2C_ADDRESS
Definition SegDriver_PCx85.h:23
void bankSelect(uint8_t input, uint8_t output)
Select bank for input and output.
Definition SegDriver_PCx85.cpp:15
ModeDrive _drive
Definition SegDriver_PCx85.h:124
BlinkMode
Set blink mode.
Definition SegDriver_PCx85.h:52
@ BLINK_MODE_NORMAL
Normal blink mode.
Definition SegDriver_PCx85.h:53
@ BLINK_MODE_ALTRAM
Alternate RAM blink mode.
Definition SegDriver_PCx85.h:54
void blink(BlinkFrequency blink=BLINK_FREQUENCY_OFF, BlinkMode mode=BLINK_MODE_NORMAL)
Set blink frequency and mode.
Definition SegDriver_PCx85.cpp:26
static constexpr uint8_t DEFAULT_SUBADDRESS
Definition SegDriver_PCx85.h:24
Abstract base class for LCD segment display drivers.
Definition SegLCDLib.h:36
virtual void flush()
Flush all buffered changes to the display.
Definition SegLCDLib.cpp:337
void _writeRam(uint8_t data, uint8_t address=0)
Low-level method to write a single byte to display RAM.
Definition SegLCDLib.cpp:404
Abstract I2C transport.
Definition SegTransport.h:65