ISF15ACP4 Driver 1.0.0
API reference
Loading...
Searching...
No Matches
isf15acp4_ssd1331.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <cstddef>
9#include <cstdint>
10
11#include "isf15acp4_types.hpp"
12
14
16enum class Command : uint8_t {
17 SetColumnAddress = 0x15,
18 SetRowAddress = 0x75,
19 SetContrastA = 0x81,
20 SetContrastB = 0x82,
21 SetContrastC = 0x83,
22 SecondPrechargeA = 0x8A,
23 SecondPrechargeB = 0x8B,
24 SecondPrechargeC = 0x8C,
25 MasterCurrent = 0x87,
26 RemapColorDepth = 0xA0,
28 SetDisplayOffset = 0xA2,
29 NormalDisplay = 0xA4,
30 AllPixelsOnMax = 0xA5,
31 AllPixelsOnMin = 0xA6,
32 InverseDisplay = 0xA7,
33 SetMultiplexRatio = 0xA8,
34 DimModeSetting = 0xAB,
35 MasterConfig = 0xAD,
36 DisplayOff = 0xAE,
37 DisplayOn = 0xAF,
38 PowerSave = 0xB0,
39 PhasePeriod = 0xB1,
40 DisplayClockDiv = 0xB3,
41 LinearGrayScale = 0xB9,
42 PrechargeLevel = 0xBB,
43 Vcomh = 0xBE,
44 DrawLine = 0x21,
45 DimWindow = 0x24,
46 ClearWindow = 0x25,
47 DrawRectangle = 0x22,
48 Copy = 0x23,
49 FillEnable = 0x26,
50 ScrollSetup = 0x27,
51 DeactivateScroll = 0x2E,
52 ActivateScroll = 0x2F,
53 NopBd = 0xBD,
54 NopBc = 0xBC,
55 NopE3 = 0xE3
56};
57
59struct InitStep {
60 uint8_t command;
61 uint8_t data[10];
62 uint8_t data_len;
63};
64
66inline constexpr uint32_t kResetPulseMinUs = 3;
67
73inline constexpr uint32_t kResetRecoveryUs = 10;
74
76inline constexpr uint32_t kMaxSpiClockHz = 6'600'000;
77
82inline const InitStep* GetInitTableIsf15acp4(std::size_t& count) noexcept {
83 static constexpr InitStep kTable[] = {
84 {0x81, {0x1C}, 1},
85 {0x82, {0x2E}, 1},
86 {0x83, {0x2C}, 1},
87 {0x8A, {0x4F}, 1},
88 {0x8B, {0x74}, 1},
89 {0x8C, {0x88}, 1},
90 {0x87, {0x0F}, 1},
91 {0xA0, {0x68}, 1},
92 {0xA1, {0x00}, 1},
93 {0xA2, {0x00}, 1},
94 {0xA4, {}, 0},
95 {0xA8, {0x3F}, 1},
96 {0xAB, {0x00, 0x0E, 0x17, 0x16, 0x12}, 5},
97 {0xAD, {0x8E}, 1},
98 {0xB0, {0x0B}, 1},
99 {0xB1, {0x17}, 1},
100 {0xB3, {0xF0}, 1},
101 {0xB9, {}, 0},
102 {0xBB, {0x1D}, 1},
103 {0xBE, {0x20}, 1},
104 {0xAF, {}, 0},
105 };
106 count = sizeof(kTable) / sizeof(kTable[0]);
107 return kTable;
108}
109
113inline const InitStep* GetInitTableIsc15anp4(std::size_t& count) noexcept {
114 static constexpr InitStep kTable[] = {
115 {0x81, {0x15}, 1}, {0x82, {0x1A}, 1}, {0x83, {0x17}, 1}, {0x87, {0x0F}, 1},
116 {0xA0, {0x70}, 1}, {0xA1, {0x00}, 1}, {0xA2, {0x10}, 1}, {0xA4, {}, 0},
117 {0xA8, {0x2F}, 1}, {0xAB, {0x00, 0x12, 0x0C, 0x14, 0x12}, 5}, {0xAD, {0x8E}, 1},
118 {0xB0, {0x0B}, 1}, {0xB1, {0x44}, 1}, {0xB3, {0xA0}, 1}, {0xB9, {}, 0},
119 {0xBB, {0x12}, 1}, {0xBE, {0x3E}, 1}, {0xAF, {}, 0},
120 };
121 count = sizeof(kTable) / sizeof(kTable[0]);
122 return kTable;
123}
124
128inline const InitStep* GetInitTableIsc01p(std::size_t& count) noexcept {
129 static constexpr InitStep kTable[] = {
130 {0x81, {0x0E}, 1}, {0x82, {0x13}, 1}, {0x83, {0x12}, 1}, {0x87, {0x0F}, 1},
131 {0xA0, {0x70}, 1}, {0xA1, {0x00}, 1}, {0xA2, {0x1C}, 1}, {0xA4, {}, 0},
132 {0xA8, {0x23}, 1}, {0xAB, {0x00, 0x07, 0x0A, 0x09, 0x12}, 5}, {0xAD, {0x8E}, 1},
133 {0xB0, {0x0B}, 1}, {0xB1, {0x44}, 1}, {0xB3, {0x30}, 1}, {0xB9, {}, 0},
134 {0xBB, {0x12}, 1}, {0xBE, {0x3C}, 1}, {0xAF, {}, 0},
135 };
136 count = sizeof(kTable) / sizeof(kTable[0]);
137 return kTable;
138}
139
151inline constexpr uint16_t ToPanelPixel(Color565 color) noexcept {
152 return static_cast<uint16_t>(((color & 0x001Fu) << 11) | (color & 0x07E0u) | ((color >> 11) & 0x001Fu));
153}
154
158inline const InitStep* GetInitTable(ProductVariant variant, std::size_t& count) noexcept {
159 switch (variant) {
161 return GetInitTableIsf15acp4(count);
163 return GetInitTableIsc15anp4(count);
165 return GetInitTableIsc01p(count);
166 }
167 return GetInitTableIsf15acp4(count);
168}
169
170} // namespace isf15acp4::ssd1331
Shared types, constants, and color utilities for NKK SmartDisplay OLED drivers.
Definition isf15acp4_ssd1331.hpp:13
const InitStep * GetInitTableIsc01p(std::size_t &count) noexcept
Initialization table for ISC01P (52x36 display).
Definition isf15acp4_ssd1331.hpp:128
constexpr uint16_t ToPanelPixel(Color565 color) noexcept
Convert an RGB565 colour to the 16-bit pixel word the NKK panels expect in display RAM.
Definition isf15acp4_ssd1331.hpp:151
constexpr uint32_t kResetRecoveryUs
Wait after releasing RES# before the first command.
Definition isf15acp4_ssd1331.hpp:73
constexpr uint32_t kMaxSpiClockHz
Maximum SPI clock per datasheet (6.6 MHz).
Definition isf15acp4_ssd1331.hpp:76
const InitStep * GetInitTableIsc15anp4(std::size_t &count) noexcept
Initialization table for ISC15ANP4 (64x48 pushbutton).
Definition isf15acp4_ssd1331.hpp:113
const InitStep * GetInitTable(ProductVariant variant, std::size_t &count) noexcept
Resolve initialization table for a product variant.
Definition isf15acp4_ssd1331.hpp:158
const InitStep * GetInitTableIsf15acp4(std::size_t &count) noexcept
Factory initialization table for ISF15ACP4 (96x64 frameless).
Definition isf15acp4_ssd1331.hpp:82
Command
SSD1331 command opcodes used by NKK application notes.
Definition isf15acp4_ssd1331.hpp:16
constexpr uint32_t kResetPulseMinUs
Minimum RES# low pulse width (SSD1331 rev 1.2 Table 18; NKK power ON sequence).
Definition isf15acp4_ssd1331.hpp:66
ProductVariant
Supported NKK SmartDisplay OLED product variants.
Definition isf15acp4_types.hpp:19
@ Isc15anp4
Standard OLED pushbutton, 64x48 (ISC15ANP4)
@ Isc01p
OLED display module, 52x36 (ISC01P)
@ Isf15acp4
Frameless OLED pushbutton, 96x64 (ISF15ACP4)
uint16_t Color565
16-bit RGB565 color value (R5G6B5).
Definition isf15acp4_types.hpp:50
One initialization command with optional trailing data bytes.
Definition isf15acp4_ssd1331.hpp:59
uint8_t data_len
Definition isf15acp4_ssd1331.hpp:62
uint8_t data[10]
Definition isf15acp4_ssd1331.hpp:61
uint8_t command
Definition isf15acp4_ssd1331.hpp:60