displaylib_1bit_PICO 2.0.0
1-bit colour graphic display library, Rpi PICO RP2040 library
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
erm19264.hpp
Go to the documentation of this file.
1
7#pragma once
8
9// ** INCLUDES **
10#include "display_graphics.hpp"
11#include "hardware/spi.h"
12#include "pico/stdlib.h"
13
14// class
16{
17
18public:
19 ERM19264(int16_t width, int16_t height);
20 ~ERM19264(){};
21 // Rotate LCD commands
22 enum LCD_rotate_cmd_e : uint8_t {
23 ROTATION_FLIP_THREE = 0x00,
24 ROTATION_FLIP_ONE = 0x02,
25 ROTATION_NORMAL = 0x04,
26 ROTATION_FLIP_TWO = 0x06
27 };
28
29 virtual void drawPixel(int16_t x, int16_t y, uint8_t colour) override;
30
32 DisplayRet::Ret_Codes_e LCDSetBufferPtr(uint8_t width, uint8_t height, std::span<uint8_t> buffer);
34 void LCDBuffer(int16_t x, int16_t y, uint8_t w, uint8_t h, std::span<uint8_t> data);
35 void LCDBitmap(int16_t x, int16_t y, uint8_t w, uint8_t h, std::span<const uint8_t> data);
36
37 void LCDSPISetup(spi_inst_t *spi, uint32_t spiBaudRate, int8_t cd, int8_t rst, int8_t cs, int8_t sclk, int8_t din);
38 void LCDinit(uint8_t VbiasPot = UC1609_DEFAULT_GN_PM, uint8_t AddressSet = UC1609_ADDRESS_SET);
39 void LCDEnable(uint8_t on);
40 void LCDFillScreen(uint8_t pixel, uint8_t mircodelay);
41 void LCDFillPage(uint8_t pixels);
42 void LCDsetRotateCmd(LCD_rotate_cmd_e rotatevalue);
43 void LCDInvertDisplay(uint8_t on);
44 void LCDAllpixelsOn(uint8_t bits);
45 void LCDGotoXY(uint8_t column , uint8_t page);
46 void LCDscroll(uint8_t bits);
47 void LCDReset(void);
48 void LCDPowerDown(void);
49 void LCDSPIoff(void);
50
51private:
52 void SendData(uint8_t data);
53 void SendCommand(uint8_t command, uint8_t value);
54
55 // GPIO & SPI
56 int8_t _display_CS;
57 int8_t _display_CD;
58 int8_t _display_RST;
60 int8_t _display_DIN;
61 spi_inst_t *_spiInterface;
63 // Screen related
64 int16_t _LCD_WIDTH = 192;
65 int16_t _LCD_HEIGHT = 64;
66 int8_t _LCD_PAGE_NUM = (_LCD_HEIGHT / 8);
67 std::span<uint8_t> _LCDbuffer;
68 uint8_t _VbiasPOT;
69 uint8_t _AddressCtrl;
71 // UC1609 registers
72 static constexpr uint8_t UC1609_SYSTEM_RESET = 0xE2;
73 static constexpr uint8_t UC1609_POWER_CONTROL = 0x28;
74 static constexpr uint8_t UC1609_PC_SET = 0x06;
75 static constexpr uint8_t UC1609_ADDRESS_CONTROL = 0x88;
76 static constexpr uint8_t UC1609_ADDRESS_SET = 0x02;
77 static constexpr uint8_t UC1609_SET_PAGEADD = 0xB0;
78 static constexpr uint8_t UC1609_SET_COLADD_LSB = 0x00;
79 static constexpr uint8_t UC1609_SET_COLADD_MSB = 0x10;
80 static constexpr uint8_t UC1609_TEMP_COMP_REG = 0x27;
81 static constexpr uint8_t UC1609_TEMP_COMP_SET = 0x00;
82 static constexpr uint8_t UC1609_FRAMERATE_REG = 0xA0;
83 static constexpr uint8_t UC1609_FRAMERATE_SET = 0x01;
84 static constexpr uint8_t UC1609_BIAS_RATIO = 0xE8;
85 static constexpr uint8_t UC1609_BIAS_RATIO_SET = 0x03;
86 static constexpr uint8_t UC1609_GN_PM = 0x81;
87 static constexpr uint8_t UC1609_DEFAULT_GN_PM = 0x49;
88 static constexpr uint8_t UC1609_LCD_CONTROL = 0xC0;
89 static constexpr uint8_t UC1609_DISPLAY_ON = 0xAE;
90 static constexpr uint8_t UC1609_ALL_PIXEL_ON = 0xA4;
91 static constexpr uint8_t UC1609_INVERSE_DISPLAY = 0xA6;
92 static constexpr uint8_t UC1609_SCROLL = 0x40;
94 // Delays
95 static constexpr uint8_t UC1609_RESET_DELAY = 3;
96 static constexpr uint8_t UC1609_RESET_DELAY2 = 0;
97 static constexpr uint8_t UC1609_INIT_DELAY = 100;
98 static constexpr uint8_t UC1609_INIT_DELAY2 = 3;
99};
Definition erm19264.hpp:16
int8_t _display_SCLK
Definition erm19264.hpp:59
void LCDSPISetup(spi_inst_t *spi, uint32_t spiBaudRate, int8_t cd, int8_t rst, int8_t cs, int8_t sclk, int8_t din)
initialise LCD pinmodes and SPI setup
Definition erm19264.cpp:31
static constexpr uint8_t UC1609_ADDRESS_CONTROL
Definition erm19264.hpp:75
int8_t _display_RST
Definition erm19264.hpp:58
void LCDBitmap(int16_t x, int16_t y, uint8_t w, uint8_t h, std::span< const uint8_t > data)
Draw a bitmap in direct to screen to the screen.
Definition erm19264.cpp:265
static constexpr uint8_t UC1609_BIAS_RATIO
Definition erm19264.hpp:84
std::span< uint8_t > _LCDbuffer
Definition erm19264.hpp:67
DisplayRet::Ret_Codes_e LCDSetBufferPtr(uint8_t width, uint8_t height, std::span< uint8_t > buffer)
sets the buffer pointer to the users screen data buffer
Definition erm19264.cpp:443
static constexpr uint8_t UC1609_RESET_DELAY2
Definition erm19264.hpp:96
static constexpr uint8_t UC1609_ALL_PIXEL_ON
Definition erm19264.hpp:90
DisplayRet::Ret_Codes_e LCDupdate(void)
updates the LCD i.e. writes the shared buffer to the active screen pointed to by ActiveBuffer
Definition erm19264.cpp:312
int16_t _LCD_WIDTH
Definition erm19264.hpp:64
void LCDSPIoff(void)
End SPI operations.
Definition erm19264.cpp:140
static constexpr uint8_t UC1609_SET_PAGEADD
Definition erm19264.hpp:77
int8_t _display_DIN
Definition erm19264.hpp:60
static constexpr uint8_t UC1609_PC_SET
Definition erm19264.hpp:74
uint8_t _VbiasPOT
Definition erm19264.hpp:68
spi_inst_t * _spiInterface
Definition erm19264.hpp:61
static constexpr uint8_t UC1609_DISPLAY_ON
Definition erm19264.hpp:89
void LCDPowerDown(void)
Powerdown procedure for LCD see datasheet P40.
Definition erm19264.cpp:128
void LCDBuffer(int16_t x, int16_t y, uint8_t w, uint8_t h, std::span< uint8_t > data)
Draw an array to the screen.
Definition erm19264.cpp:355
int8_t _LCD_PAGE_NUM
Definition erm19264.hpp:66
int8_t _display_CS
Definition erm19264.hpp:56
int8_t _display_CD
Definition erm19264.hpp:57
void LCDEnable(uint8_t on)
Turns On Display.
Definition erm19264.cpp:148
void LCDscroll(uint8_t bits)
Scroll the displayed image up by SL rows.
Definition erm19264.cpp:162
static constexpr uint8_t UC1609_LCD_CONTROL
Definition erm19264.hpp:88
void LCDinit(uint8_t VbiasPot=UC1609_DEFAULT_GN_PM, uint8_t AddressSet=UC1609_ADDRESS_SET)
begin Method initialise LCD
Definition erm19264.cpp:71
void SendData(uint8_t data)
Send data byte with SPI to UC1609.
Definition erm19264.cpp:301
static constexpr uint8_t UC1609_BIAS_RATIO_SET
Definition erm19264.hpp:85
static constexpr uint8_t UC1609_GN_PM
Definition erm19264.hpp:86
static constexpr uint8_t UC1609_SCROLL
Definition erm19264.hpp:92
static constexpr uint8_t UC1609_DEFAULT_GN_PM
Definition erm19264.hpp:87
void LCDFillPage(uint8_t pixels)
Fill the chosen page at cursor with a datapattern.
Definition erm19264.cpp:245
void LCDsetRotateCmd(LCD_rotate_cmd_e rotatevalue)
Rotates the display using LCD built-in rotate commands.
Definition erm19264.cpp:177
static constexpr uint8_t UC1609_SET_COLADD_MSB
Definition erm19264.hpp:79
void SendCommand(uint8_t command, uint8_t value)
Sends a command to the display.
Definition erm19264.cpp:106
static constexpr uint8_t UC1609_ADDRESS_SET
Definition erm19264.hpp:76
static constexpr uint8_t UC1609_POWER_CONTROL
Definition erm19264.hpp:73
static constexpr uint8_t UC1609_INIT_DELAY2
Definition erm19264.hpp:98
void LCDReset(void)
Resets LCD in a four wire setup called at start and should also be called in a controlled power down ...
Definition erm19264.cpp:117
void LCDInvertDisplay(uint8_t on)
invert the display
Definition erm19264.cpp:205
static constexpr uint8_t UC1609_TEMP_COMP_SET
Definition erm19264.hpp:81
void LCDAllpixelsOn(uint8_t bits)
turns on all Pixels
Definition erm19264.cpp:217
static constexpr uint8_t UC1609_SET_COLADD_LSB
Definition erm19264.hpp:78
static constexpr uint8_t UC1609_TEMP_COMP_REG
Definition erm19264.hpp:80
static constexpr uint8_t UC1609_FRAMERATE_SET
Definition erm19264.hpp:83
static constexpr uint8_t UC1609_SYSTEM_RESET
Definition erm19264.hpp:72
static constexpr uint8_t UC1609_INIT_DELAY
Definition erm19264.hpp:97
int16_t _LCD_HEIGHT
Definition erm19264.hpp:65
virtual void drawPixel(int16_t x, int16_t y, uint8_t colour) override
Draws a Pixel to the screen , overrides the graphics library.
Definition erm19264.cpp:395
uint8_t _AddressCtrl
Definition erm19264.hpp:69
static constexpr uint8_t UC1609_FRAMERATE_REG
Definition erm19264.hpp:82
static constexpr uint8_t UC1609_RESET_DELAY
Definition erm19264.hpp:95
void LCDGotoXY(uint8_t column, uint8_t page)
Goes to X Y position.
Definition erm19264.cpp:464
DisplayRet::Ret_Codes_e LCDclearBuffer(void)
clears the buffer of the active screen pointed to by ActiveBuffer
Definition erm19264.cpp:334
void LCDFillScreen(uint8_t pixel, uint8_t mircodelay)
Fill the screen NOT the buffer with a datapattern.
Definition erm19264.cpp:229
static constexpr uint8_t UC1609_INVERSE_DISPLAY
Definition erm19264.hpp:91
Graphics class to hold graphic related functions.
Definition display_graphics.hpp:22
int16_t height(void) const
Gets the height of the display (per current _rotation)
Definition display_graphics.cpp:677
int16_t width(void) const
Gets the width of the display (per current _rotation)
Definition display_graphics.cpp:668
header file for the graphics based functions, 1-bit color displays.
Ret_Codes_e
Definition display_data.hpp:32