pcd8544

package
v0.0.0-...-2e22e3b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package pcd8544 implements a driver for the PCD8544 48x84 pixels matrix LCD, used in Nokia's 5110 and 3310 phones.

Datasheet: http://eia.udg.edu/~forest/PCD8544_1.pdf

Index

Constants

View Source
const (
	POWERDOWN           = 0x04
	ENTRYMODE           = 0x02
	EXTENDEDINSTRUCTION = 0x01
	FUNCTIONSET         = 0x20

	DISPLAYCONTROL  = 0x08
	DISPLAYBLANK    = 0x0
	DISPLAYNORMAL   = 0x04
	DISPLAYALLON    = 0x01
	DISPLAYINVERTED = 0x05

	SETYADDR = 0x40
	SETXADDR = 0x80
	SETTEMP  = 0x04
	SETBIAS  = 0x10
	SETVOP   = 0x80
)

Registers

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Width  int16
	Height int16
}

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device wraps an SPI connection.

func New

func New(bus drivers.SPI, dcPin, rstPin, scePin machine.Pin) *Device

New creates a new PCD8544 connection. The SPI bus must already be configured.

func (*Device) ClearBuffer

func (d *Device) ClearBuffer()

ClearBuffer clears the image buffer

func (*Device) ClearDisplay

func (d *Device) ClearDisplay()

ClearDisplay clears the image buffer and clear the display

func (*Device) Configure

func (d *Device) Configure(cfg Config)

Configure initializes the display with default configuration

func (*Device) Display

func (d *Device) Display() error

Display sends the whole buffer to the screen

func (*Device) GetPixel

func (d *Device) GetPixel(x int16, y int16) bool

GetPixel returns if the specified pixel is on (true) or off (false)

func (*Device) SendCommand

func (d *Device) SendCommand(command uint8)

SendCommand sends a command to the display

func (*Device) SendData

func (d *Device) SendData(data uint8)

SendData sends a data byte to the display

func (*Device) SetBuffer

func (d *Device) SetBuffer(buffer []byte) error

SetBuffer changes the whole buffer at once

func (*Device) SetPixel

func (d *Device) SetPixel(x int16, y int16, c color.RGBA)

SetPixel enables or disables a pixel in the buffer color.RGBA{0, 0, 0, 255} is consider transparent, anything else with enable a pixel on the screen

func (*Device) Size

func (d *Device) Size() (w, h int16)

Size returns the current size of the display.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL