tftdci

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type I2C added in v0.1.2

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

I2C is an implementation of the display/tft.DCI interface that uses an I2C peripheral to communicate with the I2C displays.

Limitations

Current implementation is written with the SSD1306 OLED controller in mind and the pix/driver/fbdrv driver. It doesn't support ReadBytes, WriteWords, WriteWordN. The Cmd and the Write* methods are sending the provided commands/data bytes using a single I2C transaction: I2C Start, SSD1306 control byte, command/data bytes, I2C Stop (the Co bit in the Control Byte is cleared).

func NewI2C added in v0.1.2

func NewI2C(m *i2c.Master, addr i2cbus.Addr) *I2C

NewI2C returns new I2C based implementation of tftdrv.DCI. User must provide a configured I2C master driver and the slave address.

func (*I2C) Cmd added in v0.1.2

func (dci *I2C) Cmd(p []byte, dataMode int)

func (*I2C) Driver added in v0.1.2

func (dci *I2C) Driver() *i2c.Master

func (*I2C) End added in v0.1.2

func (dci *I2C) End()

func (*I2C) Err added in v0.1.2

func (dci *I2C) Err(clear bool) error

func (*I2C) ReadBytes added in v0.1.2

func (dci *I2C) ReadBytes(p []byte)

func (*I2C) WriteByteN added in v0.1.2

func (dci *I2C) WriteByteN(b byte, n int)

func (*I2C) WriteBytes added in v0.1.2

func (dci *I2C) WriteBytes(p []uint8)

func (*I2C) WriteString added in v0.1.2

func (dci *I2C) WriteString(s string)

type SPI

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

An SPI is an implementation of the tftdrv.DCI interface that uses an SPI peripheral to communicate with the display using the 4-line Serial Protocol.

func NewSPI

func NewSPI(drv *spi.Master, csn, dc iomux.Pin, mode spi.Config, rcHz, wcHz int) *SPI

NewSPI returns new SPI based implementation of tftdrv.DCI.

func (*SPI) Cmd

func (dci *SPI) Cmd(p []byte, _ int)

func (*SPI) Driver

func (dci *SPI) Driver() *spi.Master

func (*SPI) End

func (dci *SPI) End()

End ends the SPI transaction. It sets CSn pin high, disables the SPI peripheral and unlocks the driver. Other usesrs of the same master driver can then take controll of the SPI bus locking the driver before use.

func (*SPI) Err

func (dci *SPI) Err(clear bool) error

func (*SPI) ReadBytes

func (dci *SPI) ReadBytes(p []byte)

func (*SPI) WriteByteN

func (dci *SPI) WriteByteN(b byte, n int)

func (*SPI) WriteBytes

func (dci *SPI) WriteBytes(p []uint8)

func (*SPI) WriteString

func (dci *SPI) WriteString(s string)

func (*SPI) WriteWordN

func (dci *SPI) WriteWordN(w uint16, n int)

func (*SPI) WriteWords

func (dci *SPI) WriteWords(p []uint16)

Jump to

Keyboard shortcuts

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