Documentation ¶
Overview ¶
Package uc8151 implements a driver for e-ink displays controlled by UC8151
Inspired by https://github.com/pimoroni/pimoroni-pico/blob/main/drivers/uc8151/uc8151.cpp Additional inspiration from https://github.com/antirez/uc8151_micropython Datasheet: https://www.buydisplay.com/download/ic/UC8151C.pdf
Index ¶
- Constants
- type Config
- type Device
- func (d *Device) ClearBuffer()
- func (d *Device) ClearDisplay()
- func (d *Device) Configure(cfg Config)
- func (d *Device) Display() error
- func (d *Device) DisplayRect(x int16, y int16, width int16, height int16) error
- func (d *Device) DrawBitmap(x, y int16, bitmap pixel.Image[pixel.Monochrome]) error
- func (d *Device) FillRectangle(x, y, width, height int16, c color.RGBA) error
- func (d *Device) Invert(invert bool)
- func (d *Device) IsBusy() bool
- func (d *Device) PowerOff()
- func (d *Device) PowerOn()
- func (d *Device) Reset()
- func (d *Device) Rotation() drivers.Rotation
- func (d *Device) SendCommand(command uint8)
- func (d *Device) SendData(data ...uint8)
- func (d *Device) SetBlocking(blocking bool)
- func (d *Device) SetLUT(speed Speed, flickerFree bool) error
- func (d *Device) SetPixel(x int16, y int16, c color.RGBA)
- func (d *Device) SetRotation(rotation drivers.Rotation) error
- func (d *Device) SetScroll(line int16)
- func (d *Device) SetSpeed(speed Speed)
- func (d *Device) Size() (w, h int16)
- func (d *Device) Sleep(sleepEnabled bool) error
- func (d *Device) WaitUntilIdle()
- type LUTSet
- type LUTType
- type Speed
Constants ¶
const ( // Display resolution EPD_WIDTH = 128 EPD_HEIGHT = 296 PSR = 0x00 PWR = 0x01 POF = 0x02 PFS = 0x03 PON = 0x04 PMES = 0x05 BTST = 0x06 DSLP = 0x07 DTM1 = 0x10 DSP = 0x11 DRF = 0x12 DTM2 = 0x13 LUT_VCOM = 0x20 LUT_WW = 0x21 LUT_BW = 0x22 LUT_WB = 0x23 LUT_BB = 0x24 PLL = 0x30 TSC = 0x40 TSE = 0x41 TSR = 0x43 TSW = 0x42 CDI = 0x50 LPD = 0x51 TCON = 0x60 TRES = 0x61 REV = 0x70 FLG = 0x71 AMV = 0x80 VV = 0x81 VDCS = 0x82 PTL = 0x90 PTIN = 0x91 PTOU = 0x92 PGM = 0xa0 APG = 0xa1 ROTP = 0xa2 CCSET = 0xe0 PWS = 0xe3 TSSET = 0xe5 RES_96x230 = 0b00000000 RES_96x252 = 0b01000000 RES_128x296 = 0b10000000 RES_160x296 = 0b11000000 LUT_OTP = 0b00000000 LUT_REG = 0b00100000 FORMAT_BWR = 0b00000000 FORMAT_BW = 0b00010000 SCAN_DOWN = 0b00000000 SCAN_UP = 0b00001000 SHIFT_LEFT = 0b00000000 SHIFT_RIGHT = 0b00000100 BOOSTER_OFF = 0b00000000 BOOSTER_ON = 0b00000010 RESET_SOFT = 0b00000000 RESET_NONE = 0b00000001 VDS_EXTERNAL = 0b00000000 VDS_INTERNAL = 0b00000010 VDG_EXTERNAL = 0b00000000 VDG_INTERNAL = 0b00000001 VCOM_VD = 0b00000000 VCOM_VG = 0b00000100 VGHL_16V = 0b00000000 VGHL_15V = 0b00000001 VGHL_14V = 0b00000010 VGHL_13V = 0b00000011 START_10MS = 0b00000000 START_20MS = 0b01000000 START_30MS = 0b10000000 START_40MS = 0b11000000 STRENGTH_1 = 0b00000000 STRENGTH_2 = 0b00001000 STRENGTH_3 = 0b00010000 STRENGTH_4 = 0b00011000 STRENGTH_5 = 0b00100000 STRENGTH_6 = 0b00101000 STRENGTH_7 = 0b00110000 STRENGTH_8 = 0b00111000 OFF_0_27US = 0b00000000 OFF_0_34US = 0b00000001 OFF_0_40US = 0b00000010 OFF_0_54US = 0b00000011 OFF_0_80US = 0b00000100 OFF_1_54US = 0b00000101 OFF_3_34US = 0b00000110 OFF_6_58US = 0b00000111 FRAMES_1 = 0b00000000 FRAMES_2 = 0b00010000 FRAMES_3 = 0b00100000 FRAMES_4 = 0b00110000 TEMP_INTERNAL = 0b00000000 TEMP_EXTERNAL = 0b10000000 OFFSET_0 = 0b00000000 OFFSET_1 = 0b00000001 OFFSET_2 = 0b00000010 OFFSET_3 = 0b00000011 OFFSET_4 = 0b00000100 OFFSET_5 = 0b00000101 OFFSET_6 = 0b00000110 OFFSET_7 = 0b00000111 OFFSET_MIN_8 = 0b00001000 OFFSET_MIN_7 = 0b00001001 OFFSET_MIN_6 = 0b00001010 OFFSET_MIN_5 = 0b00001011 OFFSET_MIN_4 = 0b00001100 OFFSET_MIN_3 = 0b00001101 OFFSET_MIN_2 = 0b00001110 OFFSET_MIN_1 = 0b00001111 HZ_29 = 0b00111111 HZ_33 = 0b00111110 HZ_40 = 0b00111101 HZ_50 = 0b00111100 HZ_67 = 0b00111011 HZ_100 = 0b00111010 HZ_200 = 0b00111001 // deprecated constants, just here for backward compatibility. NO_ROTATION = drivers.Rotation0 ROTATION_90 = drivers.Rotation90 ROTATION_180 = drivers.Rotation180 ROTATION_270 = drivers.Rotation270 DEFAULT Speed = 0 SLOW Speed = 1 MEDIUM Speed = 2 FAST Speed = 3 FASTER Speed = 4 TURBO Speed = 5 )
Registers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Width int16 Height int16 Rotation drivers.Rotation // Rotation is clock-wise Speed Speed // Value from DEFAULT, SLOW, MEDIUM, FAST, FASTER, TURBO Blocking bool // block on calls to display or return immediately FlickerFree bool // if we should avoid flickering UpdateAfter int // if we are using flicker-free mode, how often we should update the screen }
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) ClearBuffer ¶
func (d *Device) ClearBuffer()
ClearBuffer sets the buffer to 0xFF (white)
func (*Device) DisplayRect ¶
DisplayRect sends only an area of the buffer to the screen. The rectangle points need to be a multiple of 8 in the screen. They might not work as expected if the screen is rotated.
func (*Device) DrawBitmap ¶ added in v0.28.0
DrawBitmap copies the bitmap to the screen at the given coordinates.
func (*Device) FillRectangle ¶ added in v0.29.0
FillRectangle fills a rectangle at a given coordinates with a color
func (*Device) SendCommand ¶
SendCommand sends a command to the display
func (*Device) SetBlocking ¶
SetBlocking changes the blocking flag of the device
func (*Device) SetLUT ¶
SetLUT sets the look up tables for full or partial updates based on the speed and flicker-free mode. Based on code from https://github.com/antirez/uc8151_micropython
func (*Device) SetPixel ¶
SetPixel modifies the internal buffer in a single pixel. The display have 2 colors: black and white We use RGBA(0, 0, 0) as white (transparent) Anything else as black
func (*Device) SetRotation ¶
SetRotation changes the rotation (clock-wise) of the device
func (*Device) SetScroll ¶ added in v0.29.0
SetScroll sets the vertical scrolling for the display, which is a NOP for this display.
func (*Device) SetSpeed ¶
SetSpeed changes the refresh speed of the device (the display needs to re-configure)
func (*Device) WaitUntilIdle ¶
func (d *Device) WaitUntilIdle()
WaitUntilIdle waits until the display is ready