"""Inky Lookup Tables.
These lookup tables comprise of two sets of values.
The first set of values, formatted as binary, describe the voltages applied during the six update phases:
Phase 0 Phase 1 Phase 2 Phase 3 Phase 4 Phase 5 Phase 6
A B C D
0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00000000, 0b00000000, LUT0 - Black
0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b00000000, 0b00000000, LUT1 - White
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, NOT USED BY HARDWARE
0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b00000000, 0b00000000, LUT3 - Yellow or Red
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, LUT4 - VCOM
There are seven possible phases, arranged horizontally, and only the phases with duration/repeat information
(see below) are used during the update cycle.
Each phase has four steps: A, B, C and D. Each step is represented by two binary bits and these bits can
have one of four possible values representing the voltages to be applied. The default values follow:
0b00: VSS or Ground
0b01: VSH1 or 15V
0b10: VSL or -15V
0b11: VSH2 or 5.4V
During each phase the Black, White and Yellow (or Red) stages are applied in turn, creating a voltage
differential across each display pixel. This is what moves the physical ink particles in their suspension.
The second set of values, formatted as hex, describe the duration of each step in a phase, and the number
of times that phase should be repeated:
Duration Repeat
A B C D
0x10, 0x04, 0x04, 0x04, 0x04, <-- Timings for Phase 0
0x10, 0x04, 0x04, 0x04, 0x04, <-- Timings for Phase 1
0x04, 0x08, 0x08, 0x10, 0x10, etc
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
The duration and repeat parameters allow you to take a single sequence of A, B, C and D voltage values and
transform them into a waveform that - effectively - wiggles the ink particles into the desired position.
In all of our LUT definitions we use the first and second phases to flash/pulse and clear the display to
mitigate image retention. The flashing effect is actually the ink particles being moved from the bottom to
the top of the display repeatedly in an attempt to reset them back into a sensible resting position.
"""
self._luts = {
'black': [
0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00000000, 0b00000000,
0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b00000000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b00000000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0x10, 0x04, 0x04, 0x04, 0x04,
0x10, 0x04, 0x04, 0x04, 0x04,
0x04, 0x08, 0x08, 0x10, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
],
'red': [
0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00000000, 0b00000000,
0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b00000000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b00000000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0x40, 0x0C, 0x20, 0x0C, 0x06,
0x10, 0x08, 0x04, 0x04, 0x06,
0x04, 0x08, 0x08, 0x10, 0x10,
0x02, 0x02, 0x02, 0x40, 0x20,
0x02, 0x02, 0x02, 0x02, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
],
'red_ht': [
0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00010000, 0b00010000,
0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b10000000, 0b10000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b01001000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0x43, 0x0A, 0x1F, 0x0A, 0x04,
0x10, 0x08, 0x04, 0x04, 0x06,
0x04, 0x08, 0x08, 0x10, 0x0B,
0x01, 0x02, 0x01, 0x10, 0x30,
0x06, 0x06, 0x06, 0x02, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
],
'yellow': [
0b11111010, 0b10010100, 0b10001100, 0b11000000, 0b11010000, 0b00000000, 0b00000000,
0b11111010, 0b10010100, 0b00101100, 0b10000000, 0b11100000, 0b00000000, 0b00000000,
0b11111010, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0b11111010, 0b10010100, 0b11111000, 0b10000000, 0b01010000, 0b00000000, 0b11001100,
0b10111111, 0b01011000, 0b11111100, 0b10000000, 0b11010000, 0b00000000, 0b00010001,
0x40, 0x10, 0x40, 0x10, 0x08,
0x08, 0x10, 0x04, 0x04, 0x10,
0x08, 0x08, 0x03, 0x08, 0x20,
0x08, 0x04, 0x00, 0x00, 0x10,
0x10, 0x08, 0x08, 0x00, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
]
}
##从github上抓的波表,https://github.com/pimoroni/inky/blob/master/library/inky/inky.py
另一份波表,黑白双色
const unsigned char EPD_2IN13_V2_lut_full_update[]= { 0x80,0x60,0x40,0x00,0x00,0x00,0x00, //LUT0: BB: VS 0 ~7 0x10,0x60,0x20,0x00,0x00,0x00,0x00, //LUT1: BW: VS 0 ~7 0x80,0x60,0x40,0x00,0x00,0x00,0x00, //LUT2: WB: VS 0 ~7 0x10,0x60,0x20,0x00,0x00,0x00,0x00, //LUT3: WW: VS 0 ~7 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT4: VCOM: VS 0 ~7 0x03,0x03,0x00,0x00,0x02, // TP0 A~D RP0 0x09,0x09,0x00,0x00,0x02, // TP1 A~D RP1 0x03,0x03,0x00,0x00,0x02, // TP2 A~D RP2 0x00,0x00,0x00,0x00,0x00, // TP3 A~D RP3 0x00,0x00,0x00,0x00,0x00, // TP4 A~D RP4 0x00,0x00,0x00,0x00,0x00, // TP5 A~D RP5 0x00,0x00,0x00,0x00,0x00, // TP6 A~D RP6 0x15,0x41,0xA8,0x32,0x30,0x0A, };
补一张datasheet图
发现每一份波表初始化都不一样,,,
目前只能实现黑白双色刷新,而不能实现三色刷新orz
数据手册、democode、reference https://www.buydisplay.com/chinese/2-13-inch-color-e-paper-display-module-manufacturers-104x212-ssd1675a
https://www.zephray.me/post/stm32_epd_calendar