Minor improvement of lcd driver

This commit is contained in:
muzkr committed 2025-11-19 21:17:49 +08:00
1 parent 32bbaae56a
commit 78409793b6
1 file changed
+12 -11
+12 -11
View File
@@ -201,59 +201,60 @@ void ST7565_FillScreen(uint8_t value)
{
CS_Assert();
for (unsigned i = 0; i < 8; i++) {
// TODO: This is wrong
DrawLine(0, i, NULL, value);
}
CS_Release();
}
// Software reset
const uint8_t ST7565_CMD_SOFTWARE_RESET = 0xE2;
#define ST7565_CMD_SOFTWARE_RESET 0xE2
// Bias Select
// 1 0 1 0 0 0 1 BS
// Select bias setting 0=1/9; 1=1/7 (at 1/65 duty)
const uint8_t ST7565_CMD_BIAS_SELECT = 0xA2;
#define ST7565_CMD_BIAS_SELECT 0xA2
// COM Direction
// 1 1 0 0 MY - - -
// Set output direction of COM
// MY=1, reverse direction
// MY=0, normal direction
const uint8_t ST7565_CMD_COM_DIRECTION = 0xC0;
#define ST7565_CMD_COM_DIRECTION 0xC0
// SEG Direction
// 1 0 1 0 0 0 0 MX
// Set scan direction of SEG
// MX=1, reverse direction
// MX=0, normal direction
const uint8_t ST7565_CMD_SEG_DIRECTION = 0xA0;
#define ST7565_CMD_SEG_DIRECTION 0xA0
// Inverse Display
// 1 0 1 0 0 1 1 INV
// INV =1, inverse display
// INV =0, normal display
const uint8_t ST7565_CMD_INVERSE_DISPLAY = 0xA6;
#define ST7565_CMD_INVERSE_DISPLAY 0xA6
// All Pixel ON
// 1 0 1 0 0 1 0 AP
// AP=1, set all pixel ON
// AP=0, normal display
const uint8_t ST7565_CMD_ALL_PIXEL_ON = 0xA4;
#define ST7565_CMD_ALL_PIXEL_ON 0xA4
// Regulation Ratio
// 0 0 1 0 0 RR2 RR1 RR0
// This instruction controls the regulation ratio of the built-in regulator
const uint8_t ST7565_CMD_REGULATION_RATIO = 0x20;
#define ST7565_CMD_REGULATION_RATIO 0x20
// Double command!! Set electronic volume (EV) level
// Send next: 0 0 EV5 EV4 EV3 EV2 EV1 EV0 contrast 0-63
const uint8_t ST7565_CMD_SET_EV = 0x81;
#define ST7565_CMD_SET_EV 0x81
// Control built-in power circuit ON/OFF - 0 0 1 0 1 VB VR VF
// VB: Built-in Booster
// VR: Built-in Regulator
// VF: Built-in Follower
const uint8_t ST7565_CMD_POWER_CIRCUIT = 0x28;
#define ST7565_CMD_POWER_CIRCUIT 0x28
// Set display start line 0-63
// 0 0 0 1 S5 S4 S3 S2 S1 S0
const uint8_t ST7565_CMD_SET_START_LINE = 0x40;
#define ST7565_CMD_SET_START_LINE 0x40
// Display ON/OFF
// 0 0 1 0 1 0 1 1 1 D
// D=1, display ON
// D=0, display OFF
const uint8_t ST7565_CMD_DISPLAY_ON_OFF = 0xAE;
#define ST7565_CMD_DISPLAY_ON_OFF 0xAE
uint8_t cmds[] = {
ST7565_CMD_BIAS_SELECT | 0, // Select bias setting: 1/9