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 <Wire.h>
5#include <SegLCDLib.h>
6
12class SegDriver_PCx85 : public SegLCDLib {
13 #define MAX_HW_ADDRESS 0
14 #define MAX_ADDRESS 0
15
16 // Define commands
17 #define CMD_LOAD_POINTER 0x00
18 #define CMD_MODE 0x40
19 #define CMD_DEVICE_SELECT 0x60
20 #define CMD_BLINK 0x70
21 #define CMD_BANK_SELECT 0x78
22 #define CMD_LAST_COMMAND 0x80
23
24 // Common hardware constants for PCF85176 displays
25 protected:
26 static constexpr uint8_t DEFAULT_PCF85176_I2C_ADDRESS = 0x38; // 56 decimal
27 static constexpr uint8_t DEFAULT_SUBADDRESS = 0x00;
28
29 public:
37
47
58
69 SegDriver_PCx85(TwoWire& i2c, uint8_t address, uint8_t subaddress);
70 virtual void init() override;
71
81 void bankSelect(uint8_t input, uint8_t output);
82
90 void clear() override;
91 void on() override;
92 void off() override;
93
94 // TODO: Implement calling commands
95 void command(uint8_t command) override { };
96
105 void flush(uint8_t startAddr, uint8_t length) override;
106 using SegLCDLib::flush; // Inherit base flush() without parameters
107
108 protected:
119 void _setMode(ModeStatus status, ModeDrive drive = MODE_DRIVE_14 , ModeBias bias = MODE_BIAS_13);
120 void _writeRam(uint8_t data, uint8_t address = 0) override;
121 void _writeRam(uint8_t *data, size_t length, uint8_t address = 0) override;
122
123 private:
124 TwoWire& _i2c;
125 uint8_t _address;
126 uint8_t _subaddress;
129
138 void _deviceSelect();
139};
140
145 // TODO: make this somehow better?
146 #define MAX_HW_ADDRESS 39
147 #define MAX_ADDRESS MAX_HW_ADDRESS
148
149 public:
157 SegDriver_PCF85176(TwoWire& i2c, uint8_t address = DEFAULT_PCF85176_I2C_ADDRESS, uint8_t subaddress = DEFAULT_SUBADDRESS) : SegDriver_PCx85(i2c, address, subaddress) {}
158};
159
171 public:
172 using SegDriver_PCF85176::SegDriver_PCF85176; // inherit constructors
173};
174#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:144
SegDriver_PCF85176(TwoWire &i2c, uint8_t address=DEFAULT_PCF85176_I2C_ADDRESS, uint8_t subaddress=DEFAULT_SUBADDRESS)
Constructor for PCF85176 segment driver.
Definition SegDriver_PCx85.h:157
PCF8576 LCD segment driver.
Definition SegDriver_PCx85.h:170
Base class for PCx85 LCD segment display drivers.
Definition SegDriver_PCx85.h:12
ModeStatus
Enable/disable display.
Definition SegDriver_PCx85.h:33
@ MODE_STATUS_BLANK
Display is blanked.
Definition SegDriver_PCx85.h:34
@ MODE_STATUS_ENABLED
Display is enabled.
Definition SegDriver_PCx85.h:35
void command(uint8_t command) override
Send RAW command to controller.
Definition SegDriver_PCx85.h:95
uint8_t _subaddress
Definition SegDriver_PCx85.h:126
void _setMode(ModeStatus status, ModeDrive drive=MODE_DRIVE_14, ModeBias bias=MODE_BIAS_13)
Set the mode of the display.
Definition SegDriver_PCx85.cpp:105
void clear() override
Clear all visible segments on the display.
Definition SegDriver_PCx85.cpp:40
void off() override
Turn the display off.
Definition SegDriver_PCx85.cpp:67
virtual void flush()
Flush all buffered changes to the display.
Definition SegLCDLib.cpp:332
ModeBias _bias
Definition SegDriver_PCx85.h:128
void _deviceSelect()
Select the device for communication.
Definition SegDriver_PCx85.cpp:93
uint8_t _address
Definition SegDriver_PCx85.h:125
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:41
@ BLINK_FREQUENCY_OFF
No blinking.
Definition SegDriver_PCx85.h:42
@ BLINK_FREQUENCY_2
Blink at ~1Hz.
Definition SegDriver_PCx85.h:44
@ BLINK_FREQUENCY_3
Blink at ~0.5Hz.
Definition SegDriver_PCx85.h:45
@ BLINK_FREQUENCY_1
Blink at ~2Hz.
Definition SegDriver_PCx85.h:43
void on() override
Turn the display on.
Definition SegDriver_PCx85.cpp:63
void _writeRam(uint8_t data, uint8_t address=0) override
Low-level method to write a single byte to display RAM.
Definition SegDriver_PCx85.cpp:71
TwoWire & _i2c
Definition SegDriver_PCx85.h:124
static constexpr uint8_t DEFAULT_PCF85176_I2C_ADDRESS
Definition SegDriver_PCx85.h:26
void bankSelect(uint8_t input, uint8_t output)
Select bank for input and output.
Definition SegDriver_PCx85.cpp:14
ModeDrive _drive
Definition SegDriver_PCx85.h:127
BlinkMode
Set blink mode.
Definition SegDriver_PCx85.h:54
@ BLINK_MODE_NORMAL
Normal blink mode.
Definition SegDriver_PCx85.h:55
@ BLINK_MODE_ALTRAM
Alternate RAM blink mode.
Definition SegDriver_PCx85.h:56
void blink(BlinkFrequency blink=BLINK_FREQUENCY_OFF, BlinkMode mode=BLINK_MODE_NORMAL)
Set blink frequency and mode.
Definition SegDriver_PCx85.cpp:27
static constexpr uint8_t DEFAULT_SUBADDRESS
Definition SegDriver_PCx85.h:27
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:332