eve

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: BSD-3-Clause Imports: 4 Imported by: 4

Documentation

Overview

Package eve provides a driver to FTDI/BRTCHIP Embedded Video Engine display controller.

Index

Constants

View Source
const (
	ALPHA_FUNC         = 0x09000000 // Arg: func<<8 | ref
	BEGIN              = 0x1F000000 // Arg: prim
	BITMAP_HANDLE      = 0x05000000 // Arg: handle
	BITMAP_LAYOUT      = 0x07000000 // Arg: linestride<<9 | height
	BITMAP_LAYOUT_H    = 0x28000000 // Arg: linestride<<2 | height (EVE2)
	BITMAP_SIZE        = 0x08000000 // Arg: opt<<18 | width<<9 | height
	BITMAP_SIZE_H      = 0x29000000 // Arg: width<<2 | height (EVE2)
	BITMAP_SOURCE      = 0x01000000 // Arg: addr
	BITMAP_TRANSFORM_A = 0x15000000 // Arg: a
	BITMAP_TRANSFORM_B = 0x16000000 // Arg: b
	BITMAP_TRANSFORM_C = 0x17000000 // Arg: c
	BITMAP_TRANSFORM_D = 0x18000000 // Arg: d
	BITMAP_TRANSFORM_E = 0x19000000 // Arg: e
	BITMAP_TRANSFORM_F = 0x1A000000 // Arg: f
	BLEND_FUNC         = 0x0B000000 // Arg: src<<3 | dst
	CALL               = 0x1D000000 // Arg: dest
	CELL               = 0x06000000 // Arg: cell
	CLEAR              = 0x26000000 // Arg: cst
	CLEAR_COLOR_A      = 0x0F000000 // Arg: alpha
	CLEAR_COLOR_RGB    = 0x02000000 // Arg: red<<16 | blue<<8 | green
	CLEAR_STENCIL      = 0x11000000 // Arg: s
	CLEAR_TAG          = 0x12000000 // Arg: t
	COLOR_A            = 0x10000000 // Arg: alpha
	COLOR_MASK         = 0x20000000 // Arg: rgba
	COLOR_RGB          = 0x04000000 // Arg: red<<16 | blue<<8 | green
	DISPLAY            = 0x00000000
	END                = 0x21000000
	JUMP               = 0x1E000000 // Arg: dest
	LINE_WIDTH         = 0x0E000000 // Arg: width
	MACRO              = 0x25000000 // Arg: m
	NOP                = 0x2D000000
	PALETTE_SOURCE     = 0x2A000000 // Arg: addr (EVE2)
	POINT_SIZE         = 0x0D000000 // Arg: size
	RESTORE_CONTEXT    = 0x23000000
	RETURN             = 0x24000000
	SAVE_CONTEXT       = 0x22000000
	SCISSOR_SIZE       = 0x1C000000 // Arg: width<<12 | height
	SCISSOR_XY         = 0x1B000000 // Arg: x<<11 | y
	STENCIL_FUNC       = 0x0A000000 // Arg: func<<16 | ref<<8 | mask
	STENCIL_MASK       = 0x13000000 // Arg: mask
	STENCIL_OP         = 0x0C000000 // Arg: sfail<<3 | spass
	TAG                = 0x03000000 // Arg: t
	TAG_MASK           = 0x14000000 // Arg: mask
	VERTEX2F           = 0x40000000 // Arg: x<<15 | y
	VERTEX2II          = 0x80000000 // Arg: x<<21 | y<<12 | handle<<7 | cell
	VERTEX_FORMAT      = 0x27000000 // Arg: frac (EVE2)
	VERTEX_TRANSLATE_X = 0x2B000000 // Arg: x (EVE2)
	VERTEX_TRANSLATE_Y = 0x2C000000 // Arg: y (EVE2)
)

Display list commands.

View Source
const (
	NEVER    = 0
	LESS     = 1
	LEQUAL   = 2
	GREATER  = 3
	GEQUAL   = 4
	EQUAL    = 5
	NOTEQUAL = 6
	ALWAYS   = 7
)

Alpha/stencil function (ALPHA_FUNC, STENCIL_FUNC).

View Source
const (
	BITMAPS      = 1
	POINTS       = 2
	LINES        = 3
	LINE_STRIP   = 4
	EDGE_STRIP_R = 5
	EDGE_STRIP_L = 6
	EDGE_STRIP_A = 7
	EDGE_STRIP_B = 8
	RECTS        = 9
)

Graphics primitive (BEGIN).

View Source
const (
	ARGB1555     = 0
	L1           = 1
	L4           = 2
	L8           = 3
	RGB332       = 4
	ARGB2        = 5
	ARGB4        = 6
	RGB565       = 7
	PALETTED     = 8 // EVE1
	TEXT8X8      = 9
	TEXTVGA      = 10
	BARGRAPH     = 11
	PALETTED565  = 14 // EVE2
	PALETTED4444 = 15 // EVE2
	PALETTED8    = 16 // EVE2
	L2           = 17 // EVE2
	ARGB8        = 32 // EVE2 (CMD_SNAPSHOT2)
)

Bitmap formats (BITMAP_LAYOUT).

View Source
const (
	NEAREST  = 0
	BILINEAR = 1 << 2
	BORDER   = 0
	REPEATX  = 1 << 1
	REPEATY  = 1 << 0
)

Bitmap options (BITMAP_SIZE).

View Source
const (
	ZERO                = 0
	ONE                 = 1
	SRC_ALPHA           = 2
	DST_ALPHA           = 3
	ONE_MINUS_SRC_ALPHA = 4
	ONE_MINUS_DST_ALPHA = 5
)

Blending options (BLEND_FUNC).

View Source
const (
	T   = 1 << 0
	S   = 1 << 1
	C   = 1 << 2
	CS  = C | S
	ST  = S | T
	CT  = C | T
	CST = C | S | T
)

Clearing options: cst (CLEAR).

View Source
const (
	A    = 1 << 0
	B    = 1 << 1
	G    = 1 << 2
	R    = 1 << 3
	RG   = R | G
	GB   = G | B
	RB   = R | B
	RGB  = R | G | B
	BA   = B | A
	GA   = G | A
	RA   = R | A
	RGA  = RG | A
	GBA  = GB | A
	RBA  = RB | A
	RGBA = RGB | A
)

Color mask: rgba (COLOR_MASK).

View Source
const (
	//ZERO  = 0 // Alredy defined in blending options.
	KEEP    = 1
	REPLACE = 2
	INCR    = 3
	DECR    = 4
	INVERT  = 5
)

Stencil test actions: sfail, spass.

View Source
const (
	CMD_DLSTART      = 0xFFFFFF00
	CMD_SWAP         = 0xFFFFFF01
	CMD_COLDSTART    = 0xFFFFFF32
	CMD_INTERRUPT    = 0xFFFFFF02
	CMD_APPEND       = 0xFFFFFF1E // Arg: addr, num
	CMD_REGREAD      = 0xFFFFFF19 // Arg: addr
	CMD_MEMWRITE     = 0xFFFFFF1A // Arg: addr, num, ...
	CMD_INFLATE      = 0xFFFFFF22 // Arg: addr, ...
	CMD_LOADIMAGE    = 0xFFFFFF24 // Arg: addr, options, ...
	CMD_MEDIAFIFO    = 0xFFFFFF39 // Arg: addr, size (EVE2)
	CMD_PLAYVIDEO    = 0xFFFFFF3A // Arg: options, ... (EVE2)
	CMD_VIDEOSTART   = 0xFFFFFF40 // (EVE2)
	CMD_VIDEOFRAME   = 0xFFFFFF41 // Arg: dst, ptr (EVE2)
	CMD_MEMCRC       = 0xFFFFFF18 // Arg: addr, num
	CMD_MEMZERO      = 0xFFFFFF1C // Arg: addr, num
	CMD_MEMSET       = 0xFFFFFF1B // Arg: addr, val, num
	CMD_MEMCPY       = 0xFFFFFF1D // Arg: dst, src, num
	CMD_BUTTON       = 0xFFFFFF0D // Arg: x, y, w, h, font, options, ..., 0
	CMD_CLOCK        = 0xFFFFFF14 // Arg: x, y, r, options, h, m, s, ms
	CMD_FGCOLOR      = 0xFFFFFF0A // Arg: rgb
	CMD_BGCOLOR      = 0xFFFFFF09 // Arg: rgb
	CMD_GRADCOLOR    = 0xFFFFFF34 // Arg: rgb
	CMD_GAUGE        = 0xFFFFFF13 // Arg: x, y, r, optns, major, minor, val, max
	CMD_GRADIENT     = 0xFFFFFF0B // Arg: x0, y0, rgb0, x1, y1, rgb1
	CMD_KEYS         = 0xFFFFFF0E // Arg: x, y, w, h, font, options, ..., 0
	CMD_PROGRESS     = 0xFFFFFF0F // Arg: x, y, w, h, options, val, max
	CMD_SCROLLBAR    = 0xFFFFFF11 // Arg: x, y, w, h, options, val, size, max
	CMD_SLIDER       = 0xFFFFFF10 // Arg: x, y, w, h, options, val, max
	CMD_DIAL         = 0xFFFFFF2d // Arg: x, y, r, options, val
	CMD_TOGGLE       = 0xFFFFFF12 // Arg: x, y, w, font, options, state, ..., 0
	CMD_TEXT         = 0xFFFFFF0C // Arg: x, y, font, options, ..., 0
	CMD_SETBASE      = 0xFFFFFF38 // Arg: base (EVE2)
	CMD_NUMBER       = 0xFFFFFF2E // Arg: x, y int, font, options, n
	CMD_LOADIDENTITY = 0xFFFFFF26
	CMD_SETMATRIX    = 0xFFFFFF2A
	CMD_GETMATRIX    = 0xFFFFFF33
	CMD_GETPTR       = 0xFFFFFF23
	CMD_GETPROPS     = 0xFFFFFF25
	CMD_SCALE        = 0xFFFFFF28 // Arg: sx, sy
	CMD_ROTATE       = 0xFFFFFF29 // Arg: a
	CMD_TRANSLATE    = 0xFFFFFF27 // Arg: tx, ty
	CMD_CALIBRATE    = 0xFFFFFF15
	CMD_SETROTATE    = 0xFFFFFF36 // Arg: r (EVE2)
	CMD_SPINNER      = 0xFFFFFF16 // Arg: x, y, style, scale
	CMD_SCREENSAVER  = 0xFFFFFF2F
	CMD_SKETCH       = 0xFFFFFF30 // Arg: x, y, w, h, addr, format
	CMD_STOP         = 0xFFFFFF17
	CMD_SETFONT      = 0xFFFFFF2B // Arg: font, addr
	CMD_SETFONT2     = 0xFFFFFF3B // Arg: font, addr, firstchar (EVE2)
	CMD_SETSCRATCH   = 0xFFFFFF3C // Arg: handle (EVE2)
	CMD_ROMFONT      = 0xFFFFFF3F // Arg: font, romslot (EVE2)
	CMD_TRACK        = 0xFFFFFF2C // Arg: x, y, w, h, tag
	CMD_SNAPSHOT     = 0xFFFFFF1F // Arg: addr
	CMD_SNAPSHOT2    = 0xFFFFFF37 // Arg: format, addr, x, y, w, h (EVE2)
	CMD_SETBITMAP    = 0xFFFFFF43 // Arg: addr, format, w, h (EVE2)
	CMD_CSKETCH      = 0xFFFFFF35 // Arg: x, y, w, h, addr, format, freq (FT801)
)

Graphics Engine Commands.

View Source
const (
	OPT_RGB565     = 0
	OPT_MONO       = 1 << 0
	OPT_NODL       = 1 << 1
	OPT_NOTEAR     = 1 << 2 // EVE2
	OPT_FULLSCREEN = 1 << 3 // EVE2
	OPT_MEDIAFIFO  = 1 << 4 // EVE2
	OPT_SOUND      = 1 << 5 // EVE2
)

Image/video options (CMD_LOAD_IMAGE, CMD_PLAYVIDEO).

View Source
const (
	OPT_FLAT    = 1 << 8
	OPT_SIGNED  = 1 << 8
	OPT_CENTERX = 1 << 9
	OPT_CENTERY = 1 << 10
	OPT_RIGHTX  = 1 << 11
	OPT_CENTER  = OPT_CENTERX | OPT_CENTERY
)

Widget options.

View Source
const (
	OPT_NOBACK    = 1 << 12
	OPT_NOTICKS   = 1 << 13
	OPT_NOPOINTER = 1 << 14
	OPT_NOHM      = 1 << 14
	OPT_NOSECS    = 1 << 15
	OPT_NOHANDS   = OPT_NOHM | OPT_NOSECS
)

Clock, gauge options.

View Source
const (
	DECR_WRAP            = 7
	INCR_WRAP            = 6
	LINEAR_SAMPLES       = 0
	PLAYCOLOR            = 0x00a0a080
	REPEAT               = 1
	TOUCHMODE_CONTINUOUS = 3
	TOUCHMODE_FRAME      = 2
	TOUCHMODE_OFF        = 0
	TOUCHMODE_ONESHOT    = 1
	AW_SAMPLES           = 1
)
View Source
const (
	DLSWAP_DONE  = 0
	DLSWAP_LINE  = 1
	DLSWAP_FRAME = 2
)

REG_DLSWAP values.

View Source
const DEFAULT = 0

Variables

View Source
var (
	Default320x240 = DisplayConfig{
		Hcycle: 408, Hsize: 320, Hsync0: 0, Hsync1: 10, Hoffset: 70,
		Vcycle: 263, Vsize: 240, Vsync0: 0, Vsync1: 2, Voffset: 13,
		ClkPol: 0, ClkMHz: 6,
	}
	Default480x272 = DisplayConfig{
		Hcycle: 548, Hsize: 480, Hsync0: 0, Hsync1: 41, Hoffset: 43,
		Vcycle: 292, Vsize: 272, Vsync0: 0, Vsync1: 10, Voffset: 12,
		ClkPol: 1, ClkMHz: 9,
	}
	Default800x480 = DisplayConfig{
		Hcycle: 928, Hsize: 800, Hsync0: 0, Hsync1: 48, Hoffset: 88,
		Vcycle: 525, Vsize: 480, Vsync0: 0, Vsync1: 3, Voffset: 32,
		ClkPol: 1, ClkMHz: 30,
	}
)

Functions

This section is empty.

Types

type CE

type CE struct {
	DL
}

CE extends DL to help to write Co-processor Engine commands to the CE command FIFO or to any memory location. The effect of executing most commands is the co-processor engine writes display-list commands to the RAM_DL memory. Unlike the other writers CE methods can use multiple read and write transactions to achieve more complex operations.

func (*CE) Append

func (w *CE) Append(addr, num int)

Append appends more commands resident in RAM_G to the current display list memory address where the offset is specified in REG_CMD_DL.

func (*CE) BgColor

func (w *CE) BgColor(rgb uint32)

BgColor sets the background color.

func (*CE) Button

func (w *CE) Button(x, y, width, height int, font byte, options uint16)

Button writes only header of CMD_BUTTON command (without label string). Use Write* methods to write button label. Label string must be terminated with zero byte and padded to align to 4 byte boundary (see Writer.Align32).

func (*CE) ButtonString

func (w *CE) ButtonString(x, y, width, height int, font byte, options uint16, s string)

ButtonString draws a button with label s.

func (*CE) CSketch

func (w *CE) CSketch(x, y, width, height, addr int, format byte, freq int)

CSketch - deprecated (FT801).

func (*CE) Calibrate

func (w *CE) Calibrate() int

Calibrate execute the touch screen calibration routine. It returns the address to the status value (status != 0 means success).

func (*CE) Clock

func (w *CE) Clock(x, y, r int, options uint16, h, m, s, ms int)

Clock draws an analog clock.

func (*CE) Close

func (w *CE) Close() int

Close ends the wrtie transaction. If written to the co-processor engine FIFO it waits for the co-processor to process all written commands (use Writer.Close to avoid waiting for CE).

func (*CE) ColdStart

func (w *CE) ColdStart()

ColdStart sets co-processor engine state to default values.

func (*CE) DLStart

func (w *CE) DLStart()

DLStart starts a new display list.

func (*CE) Dial

func (w *CE) Dial(x, y, r int, options uint16, val int)

Dial draws a rotary dial control.

func (*CE) FgColor

func (w *CE) FgColor(rgb uint32)

FgColor sets the foreground color.

func (*CE) Gauge

func (w *CE) Gauge(x, y, r int, options uint16, major, minor, val, max int)

Gauge draws a gauw.

func (*CE) GetMatrix

func (w *CE) GetMatrix()

GetMatrix retrieves the current matrix within the context of the graphics engine.

func (*CE) GetProps

func (w *CE) GetProps()

GetProps gets the image properties decompressed by LoadImaw.

func (*CE) GetPtr

func (w *CE) GetPtr()

GetPtr gets the end memory address of data inflated by Inflate command.

func (*CE) GradColor

func (w *CE) GradColor(rgb uint32)

GradColor sets the 3D button highlight color.

func (*CE) Gradient

func (w *CE) Gradient(x0, y0 int, rgb0 uint32, x1, y1 int, rgb1 uint32)

Gradienta draws a smooth color gradient.

func (*CE) Inflate

func (w *CE) Inflate(addr int)

Inflate decompresses the following compressed data into RAM_G.

func (*CE) Interrupt

func (w *CE) Interrupt()

Interrupt triggers interrupt INT_CMDFLAG.

func (*CE) Keys

func (w *CE) Keys(x, y, width, height int, font byte, options uint16)

Keys writes only header of CMD_KEYS command (without key labels). Use Write* methods to write key labels. Labels string must be terminated with zero byte and padded to align to 4 byte boundary (see Writer.Align32).

func (*CE) KeysString

func (w *CE) KeysString(x, y, width, height int, font byte, options uint16, s string)

KeysString draws a row of keys using s.

func (*CE) LoadIdentity

func (w *CE) LoadIdentity()

LoadIdentity instructs the graphics engine to set the current matrix to the identity matrix, so it is able to form the new matrix as requested by Scale, Rotate, Translate command.

func (*CE) LoadImage

func (w *CE) LoadImage(addr int, options uint16)

LoadImage decompresses the following JPEG image data into a bitmap at specified address (EVE2 supports also PNG). Image data should be padded to align to 4 byte boundary (see Writer.Align32).

func (w *CE) Logo()

Logo plays FTDI logo animation.

func (*CE) MediaFIFO

func (w *CE) MediaFIFO(addr, size int)

MediaFIFO sets up a streaming media FIFO in RAM_G.

func (*CE) MemCRC

func (w *CE) MemCRC(addr, num int)

MemCRC computes a CRC-32 for a block of EVE memory.

func (*CE) MemCpy

func (w *CE) MemCpy(dst, src, num int)

MemCpy copies a block of memory.

func (*CE) MemSet

func (w *CE) MemSet(addr int, val byte, num int)

MemSet fills memory with a byte value.

func (*CE) MemWrite

func (w *CE) MemWrite(addr, num int)

MemWrite writes the following bytes into memory.

func (*CE) MemZero

func (w *CE) MemZero(addr, num int)

MemZero writes zero to a block of memory.

func (*CE) Number

func (w *CE) Number(x, y int, font byte, options uint16, n int)

Number draws number.

func (*CE) PlayVideo

func (w *CE) PlayVideo(options uint32)

PlayVideo plays back MJPEG-encoded AVI video.

func (*CE) Progress

func (w *CE) Progress(x, y, width, height int, options uint16, val, max int)

Progress draws a progress bar.

func (*CE) ROMFont

func (w *CE) ROMFont(font, romslot byte)

ROMFont loads a ROM font into bitmap handle (EVE2).

func (*CE) RegRead

func (w *CE) RegRead(addr int)

RegRead reads a register value.

func (*CE) Rotate

func (w *CE) Rotate(a int)

Rotate applies a rotation to the current matrix in units of 2π/65536.

func (*CE) Scale

func (w *CE) Scale(sx, sy int)

Scale applies a scale to the current matrix (sx, sy are signed 16.16-bit fixed-point numbers).

func (*CE) Screensaver

func (w *CE) Screensaver()

Screensaver starts an animated screensaver.

func (*CE) Scrollbar

func (w *CE) Scrollbar(x, y, width, height int, options uint16, val, size, max int)

Progress draws a scroll bar.

func (*CE) SetBase

func (w *CE) SetBase(base int)

SetBase sets the base for number output (EVE2).

func (*CE) SetBitmap

func (w *CE) SetBitmap(addr int, format byte, width, height int)

SetBitmap takes a snapshot of part of the current screen.

func (*CE) SetFont

func (w *CE) SetFont(font byte, addr int)

SetFont sets up a custom font.

func (*CE) SetFont2

func (w *CE) SetFont2(font byte, addr, firstchar int)

SetFont2 sets up a custom font (EVE2).

func (*CE) SetMatrix

func (w *CE) SetMatrix()

SetMatrix assigns the value of the current matrix to the bitmap transform matrix of the graphics engine by generating display list commands.

func (*CE) SetRotate

func (w *CE) SetRotate(r byte)

SetRotate rotate the screen (EVE2).

func (*CE) SetScratch

func (w *CE) SetScratch(handle byte)

SetScratch sets the scratch bitmap for widget use (EVE2).

func (*CE) Sketch

func (w *CE) Sketch(x, y, width, height, addr int, format byte)

Sketch starts a continuous sketch update. It does not display anything, only draws to the bitmap located in RAM_G, at address addr.

func (*CE) Slider

func (w *CE) Slider(x, y, width, height int, options uint16, val, max int)

Slider draws a slider.

func (*CE) Snapshot

func (w *CE) Snapshot(addr int)

Snapshot takes a snapshot of the current screen.

func (*CE) Snapshot2

func (w *CE) Snapshot2(format byte, addr, x, y, width, height int)

Snapshot2 takes a snapshot of part of the current screen (EVE2).

func (*CE) Spinner

func (w *CE) Spinner(x, y int, style uint16, scale int)

Spinner starts an animated spinner.

func (*CE) Stop

func (w *CE) Stop()

Stop stops any of spinner, screensaver or sketch.

func (*CE) Swap

func (w *CE) Swap()

Swap swaps the current display list.

func (*CE) Text

func (w *CE) Text(x, y int, font byte, options uint16)

Text writes only header of CMD_TEXT command (without text string). Use Write* methods to write text. Text string must be terminated with zero byte.

w.Text(20, 30, 26, eve.DEFAULT)
fmt.Fprintf(&ge, "x=%d y=%d\000", x, y)
w.Align(4)

func (*CE) TextString

func (w *CE) TextString(x, y int, font byte, options uint16, s string)

TextString draws text.

func (*CE) Toggle

func (w *CE) Toggle(x, y, width int, font byte, options uint16, state bool)

Toggle writes only header of CMD_TOGGLE command (without label string). Use Write* methods to write toggle label. Label string must be terminated with zero byte and padded to align to 4 byte boundary (see Writer.Align32).

func (*CE) ToggleString

func (w *CE) ToggleString(x, y, width int, font byte, opts uint16, state bool, s string)

Toggle draws a toggle switch using s as label.

func (*CE) Track

func (w *CE) Track(x, y, width, height, tag int)

Track tracks touches for a graphics object.

func (*CE) Translate

func (w *CE) Translate(tx, ty int)

Translate applies a translation to the current matrix (tx, ty are signed 16.16-bit fixed-point numbers).

func (*CE) VideoFrame

func (w *CE) VideoFrame(dst, ptr int)

VideoFrame loads the next frame of video.

func (*CE) VideoStart

func (w *CE) VideoStart()

VideoStart initializes the AVI video decoder.

type Config

type Config struct {
	OutBits uint16 // Bits 8-0 set number of red, green, blue output signals.
	Rotate  uint8  // Screen rotation controll.
	Dither  uint8  // Dithering controll (reset default 1).
	Swizzle uint8  // Control the arrangement of output RGB pins.
	Spread  uint8  // Control the color signals spread (reset default 1).
}

type DCI

type DCI interface {
	// SetClk sets the communication interface clock speed. If clkHz = 0 the
	// communication interface can be disabled to save power.
	SetClk(clkHz int)

	// Begin begins new read/write transaction.
	Begin()

	// Read reads len(p) bytes into p.
	Read(p []byte)

	// Write writes len(p) bytes from p.
	Write(p []byte)

	// End finishes the current read/write transaction.
	End()

	// Err returns an error encountered while executing the last Read, Write,
	// End command. DCI should stop executing commands until the error will be
	// cleared.
	Err(clear bool) error

	// SetPDN sets the PD_N pin to the least significant bit of pdn.
	SetPDN(pdn int)
}

DCI defines Data and Control Interface to the EVE Display Controller.

type DL

type DL struct {
	Writer
}

DL allows to write display list commands.

func (*DL) AlphaFunc

func (w *DL) AlphaFunc(fun, ref uint8)

AlphaFunc sets the alpha test function.

func (*DL) Begin

func (w *DL) Begin(prim uint8)

Begin begins drawing a graphics primitive.

func (*DL) BitmapHandle

func (w *DL) BitmapHandle(handle uint8)

BitmapHandle selscts the bitmap handle.

func (*DL) BitmapLayout

func (w *DL) BitmapLayout(format uint8, linestride, height int)

BitmapLayout sets the bitmap memory format and layout for the current handle.

func (*DL) BitmapSize

func (w *DL) BitmapSize(options uint8, width, height int)

BitmapSize sets the screen drawing of bitmaps for the current handle.

func (*DL) BitmapSource

func (w *DL) BitmapSource(addr int)

BitmapSource sets the source address of bitmap data in graphics memory RAM_G.

func (*DL) BitmapTransformA

func (w *DL) BitmapTransformA(prec uint8, a int)

BitmapTransA sets the A coefficient of the bitmap transform matrix (a is signed 8.8-bit fixed-point number).

func (*DL) BitmapTransformB

func (w *DL) BitmapTransformB(prec uint8, b int)

BitmapTransformB sets the B coefficient of the bitmap transform matrix (b is signed 8.8-bit fixed-point number).

func (*DL) BitmapTransformC

func (w *DL) BitmapTransformC(prec uint8, c int)

BitmapTransformC sets the C coefficient of the bitmap transform matrix (c is signed 8.8-bit fixed-point number).

func (*DL) BitmapTransformD

func (w *DL) BitmapTransformD(prec uint8, d int)

BitmapTransformD sets the D coefficient of the bitmap transform matrix (d is signed 8.8-bit fixed-point number).

func (*DL) BitmapTransformE

func (w *DL) BitmapTransformE(prec uint8, e int)

BitmapTransformE sets the E coefficient of the bitmap transform matrix (e is signed 8.8-bit fixed-point number).

func (*DL) BitmapTransformF

func (w *DL) BitmapTransformF(prec uint8, f int)

BitmapTransformF sets the F coefficient of the bitmap transform matrix (f is signed 8.8-bit fixed-point number).

func (*DL) BlendFunc

func (w *DL) BlendFunc(src, dst uint8)

BlendFunc configures pixel arithmetic.

func (*DL) Call

func (w *DL) Call(dest int)

Call executes a sequence of commands at another location in the display list.

func (*DL) Cell

func (w *DL) Cell(cell int)

Cell sets the bitmap cell number for the Vertex2f command.

func (*DL) Clear

func (w *DL) Clear(cst uint8)

Clear clears buffers to preset values.

func (*DL) ClearColorA

func (w *DL) ClearColorA(alpha uint8)

ClearColorA sets the clear value for the alpha channel.

func (*DL) ClearColorRGB

func (w *DL) ClearColorRGB(rgb uint32)

ClearColorRGB sets the clear values for red, green and blue channels.

func (*DL) ClearStencil

func (w *DL) ClearStencil(s uint8)

ClearStencil sets the clear value for the stencil buffer.

func (*DL) ClearTag

func (w *DL) ClearTag(t int)

ClearTag sets the clear value for the stencil buffer.

func (*DL) ColorA

func (w *DL) ColorA(alpha uint8)

ColorA sets the current color alpha.

func (*DL) ColorMask

func (w *DL) ColorMask(rgba uint8)

ColorMask enables or disables writing of color components.

func (*DL) ColorRGB

func (w *DL) ColorRGB(rgb uint32)

ColorRGB sets the current color red, green and blue.

func (*DL) Display

func (w *DL) Display()

Display ends the display list (following command will be ignored).

func (*DL) End

func (w *DL) End()

End ends drawing a graphics primitive.

func (*DL) Jump

func (w *DL) Jump(dest int)

Jump executes commands at another location in the display list. Dest is the command number in display list (address = RAM_DL + dest*4).

func (*DL) LineWidth

func (w *DL) LineWidth(width int)

LineWidth sets the width of lines to be drawn with primitive LINES in 1/16 pixel precision.

func (*DL) Macro

func (w *DL) Macro(m int)

Macro executes a single command from a macro register.

func (*DL) Nop

func (w *DL) Nop()

Nop does nothing.

func (*DL) PaletteSource

func (w *DL) PaletteSource(addr int)

PaletteSource sets the base address of the palette (EVE2).

func (*DL) PointSize

func (w *DL) PointSize(size int)

PointSize sets the radius of points.

func (*DL) RestoreContext

func (w *DL) RestoreContext()

RestoreContext restores the current graphics context from the context stack.

func (*DL) Return

func (w *DL) Return()

Return returns from a previous CALL command.

func (*DL) SaveContext

func (w *DL) SaveContext()

SaveContext pushes the current graphics context on the context stack.

func (*DL) ScissorSize

func (w *DL) ScissorSize(width, height int)

ScissorSize sets the size of the scissor clip rectangle.

func (*DL) ScissorXY

func (w *DL) ScissorXY(x, y int)

ScissorXY sets the size of the scissor clip rectangle.

func (*DL) StencilFunc

func (w *DL) StencilFunc(fun, ref, mask uint8)

StencilFunc sets function and reference value for stencil testing.

func (*DL) StencilMask

func (w *DL) StencilMask(mask uint8)

StencilMask controls the writing of individual bits in the stencil planes.

func (*DL) StencilOp

func (w *DL) StencilOp(sfail, spass uint8)

StencilOp sets stencil test actions.

func (*DL) SwapDL

func (w *DL) SwapDL() int

SwapDL closes the write transaction, clears the IntSwap interrupt flag and schedules the display lists swap to be performed after rendering the current frame. It returns the address just after the last write operation.

func (*DL) Tag

func (w *DL) Tag(t int)

Tag attaches the tag value for the following graphics objects drawn on the screen. The initial tag buffer value is 255.

func (*DL) TagMask

func (w *DL) TagMask(en bool)

TagMask controls the writing of the tag buffer.

func (*DL) Vertex2f

func (w *DL) Vertex2f(x, y int)

Vertex2f starts the operation of graphics primitives at the specified screen coordinate, in the pixel precision set by VertexFormat (default: 1/16 pixel).

func (*DL) Vertex2ii

func (w *DL) Vertex2ii(x, y int, handle uint8, cell int)

Vertex2ii starts the operation of graphics primitive at the specified coordinates in pixel precision.

func (*DL) VertexFormat

func (w *DL) VertexFormat(frac uint)

VertexFormat sets the precision of Vertex2f coordinates (EVE2).

func (*DL) VertexTranslateX added in v0.1.1

func (w *DL) VertexTranslateX(x int)

VertexTranslateX specifies the offset added to vertex x coordinates (EVE2).

func (*DL) VertexTranslateY added in v0.1.1

func (w *DL) VertexTranslateY(y int)

VertexTranslateY specifies the offset added to vertex y coordinates (EVE2).

type DisplayConfig

type DisplayConfig struct {
	Hcycle  uint16 // Total number of clocks per line.(Th)
	Hsize   uint16 // Active width of LCD display.....(Thd)
	Hsync0  uint8  // Start of horizontal sync pulse..(Thf)
	Hsync1  uint8  // End of horizontal sync pulse....(Thf+Thp)
	Hoffset uint8  // Start of active line............(Thp+Thb)
	ClkPol  uint8  // Define active edge of pixel clock.
	Vcycle  uint16 // Total number of lines per scree.(Tv)
	Vsize   uint16 // Active height of LCD display....(Tvd)
	Vsync0  uint8  // Start of vertical sync pulse....(Tvf)
	Vsync1  uint8  // End of vertical sync pulse......(Tvf+Tvp)
	Voffset uint8  // Start of active screen..........(Tvp+Tvb)
	ClkMHz  uint8  // Pixel Clock MHz.................(Fclk)
}

DisplayConfig contains LCD timing parameters. It seems to be an error in datasheet that describes HOFFSET as non-visible part of line (Thf+Thp+Thb) and VOFFSET as number of non-visible lines (Tvf+Tvp+Tvb).

type Driver

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

func NewDriver

func NewDriver(dci DCI, n int) *Driver

NewDriver returns a new driver to the EVE graphics controller. It uses dci for communication and allocates n bytes for internal write buffer. The returned driver has limited functionality until you call Init method because some methods like MemMap, ReadReg, WriteReg, RR, RW, DL, CE require the knowledge about EVE version.

func (*Driver) CE

func (d *Driver) CE(addr int) *CE

CE starts a new co-processor engine command writing transaction at the address addr. The special address -1 makes it write to the co-processor engine FIFO.

func (*Driver) ClearInt

func (d *Driver) ClearInt(flags IntFlags)

ClearInt reads the REG_INT_FLAGS register and accumulates read flags in the internal variable. After that it clears the flags specified by mask.

func (*Driver) DL

func (d *Driver) DL(addr int) *DL

DL starts a new display list writing transaction at the address addr. The special address -1 makes it wait for IntSwap and start writting at the beggining of RAM_DL.

func (*Driver) Err

func (d *Driver) Err(clear bool) error

Err returns the value of the internal error register. If clear is true the error register is cleared.

func (*Driver) HostCmd

func (d *Driver) HostCmd(cmd HostCmd, param byte)

HostCmd invokes a host command. Param is a command parameter. It must be zero in case of commands that do not require parameters.

func (*Driver) Init

func (d *Driver) Init(dcf *DisplayConfig, cfg *Config) error

Init initializes EVE and writes first display list. dcf describes display configuration. cfg describes EVE configuration and can be nil to use reset defaults.

func (*Driver) IntFlags

func (d *Driver) IntFlags() IntFlags

IntFlags reads the REG_INT_FLAGS register, accumulates the read flags in the internal variable and returns its value.

func (*Driver) MemMap

func (d *Driver) MemMap() *MemMap

MemMap returns the memory map.

func (*Driver) Note

func (d *Driver) Note() *rtos.Note

Note returns the note used to wait for IRQ.

func (*Driver) R

func (d *Driver) R(addr int) *Reader

R starts a new memory reading transaction at the address addr.

func (*Driver) ReadReg

func (d *Driver) ReadReg(r Register) uint32

ReadReg reads from register.

func (*Driver) ReadUint32

func (d *Driver) ReadUint32(addr int) uint32

ReadUint32 reads 32-bit word from address addr.

func (*Driver) RegAddr

func (d *Driver) RegAddr(r Register) int

RegAddr returns address of r register.

func (*Driver) SetBacklight

func (d *Driver) SetBacklight(pwmduty int)

SetBacklight sets the PWM duty cycle of backlight output. The allowed pwmduty range is from 0 to 128.

func (*Driver) SetIntMask

func (d *Driver) SetIntMask(mask IntFlags)

SetIntMask sets interrupt mask.

func (*Driver) SetNote

func (d *Driver) SetNote(n *rtos.Note)

SetNote sets the note that will be used to wait for IRQ.

func (*Driver) Size added in v1.0.1

func (d *Driver) Size() (width, height int)

Size returns the screen size.

func (*Driver) TouchScreenXY

func (d *Driver) TouchScreenXY() (x, y int)

TouchScreenXY reads the coordinaters of touch point.

func (*Driver) TouchTag

func (d *Driver) TouchTag() int

TouchTag returns the current touch tag or zero in case of no touch.

func (*Driver) TouchTagXY

func (d *Driver) TouchTagXY() (x, y int)

TouchTagXY returns the coordinates of touch point corresponding to the current tag.

func (*Driver) Tracker

func (d *Driver) Tracker() (val int, tag uint16)

Tracker returns touch value and touch tag.

func (*Driver) W

func (d *Driver) W(addr int) *Writer

W starts a new memory writing transaction at the address addr.

func (*Driver) WaitInt

func (d *Driver) WaitInt(flags IntFlags)

WaitInt provides a convenient way to wait for EVE interrupts. It sleeps on the note set by SetNote method or polls REG_INT_FLAGS register if the note is not set. Use IntFLags, SetIntMask methods and note directly if you want to share the note with other event sources or limit the sleep time (timeout).

func (*Driver) WriteReg

func (d *Driver) WriteReg(r Register, u uint32)

WriteReg writes to register.

func (*Driver) WriteUint32

func (d *Driver) WriteUint32(addr int, u uint32)

WriteUint32 writes 32-bit word to address addr.

type HostCmd

type HostCmd byte

HostCmd represents EVE host command.

const (
	ACTIVE  HostCmd = 0x00 // Switch mode to Active.
	STANDBY HostCmd = 0x41 // Switch mode to Standby: PLL and Oscillator on.
	SLEEP   HostCmd = 0x42 // Switch mode to Sleep: PLL and Oscillator off.
	PD_ROMS HostCmd = 0x49 // Power down individual ROMs.
	PWRDOWN HostCmd = 0x50 // Switch off LDO, Clock, PLL and Oscillator.

	CLKEXT HostCmd = 0x44 // Select PLL external clock source.
	CLKINT HostCmd = 0x48 // Select PLL internal clock source (EVE2).
	CLKSEL HostCmd = 0x61 // Select PLL multiple.
	CLKMAX HostCmd = 0x62 // Select PLL maximum clock.

	RST_PULSE HostCmd = 0x68 // Send reset pulse to FT81x core.

	PINDRIVE     HostCmd = 0x70 // Set pins drive strength (EVE2).
	PIN_PD_STATE HostCmd = 0x71 // Set pins state in PwrDown mode (EVE2).
)

type IntFlags

type IntFlags uint8

IntFlags represents EVE interrupt flags.

const (
	IntSwap         IntFlags = 1 << 0 // Display list swap occurred.
	IntTouch        IntFlags = 1 << 1 // Touch detected.
	IntTag          IntFlags = 1 << 2 // Touch-screen tag value change.
	IntSound        IntFlags = 1 << 3 // Sound effect ended.
	IntPlayback     IntFlags = 1 << 4 // Audio playback ended.
	IntCmdEmpty     IntFlags = 1 << 5 // Command FIFO empty.
	IntCmdFlag      IntFlags = 1 << 6 // Command FIFO flag.
	IntConvComplete IntFlags = 1 << 7 // Touch-screen conversions completed.
)

type MemMap

type MemMap struct {
	RAM_G          MemRegion
	ROM_FONT       MemRegion
	RAM_DL         MemRegion
	RAM_PAL        MemRegion
	RAM_REG        MemRegion
	RAM_CMD        MemRegion
	RAM_SCREENSHOT MemRegion
}

type MemRegion

type MemRegion struct {
	Start int
	Size  int
}

type Reader

type Reader driver

func (*Reader) Close

func (r *Reader) Close()

Close closes the read transaction.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

func (*Reader) ReadUint16

func (r *Reader) ReadUint16() uint16

func (*Reader) ReadUint32

func (r *Reader) ReadUint32() uint32

func (*Reader) ReadUint8

func (r *Reader) ReadUint8() uint8

type Register

type Register uint32
const (
	REG_ID                Register = 0x0000_0000
	REG_FRAMES            Register = 0x0004_0004
	REG_CLOCK             Register = 0x0008_0008
	REG_FREQUENCY         Register = 0x000C_000C
	REG_RENDERMODE        Register = 0x0010_0010
	REG_SNAPY             Register = 0x0014_0014
	REG_SNAPSHOT          Register = 0x0018_0018
	REG_SNAPFORMAT        Register = 0x001C_FFFF
	REG_CPURESET          Register = 0x0020_001C
	REG_TAP_CRC           Register = 0x0024_0020
	REG_TAP_MASK          Register = 0x0028_0024
	REG_HCYCLE            Register = 0x002C_0028
	REG_HOFFSET           Register = 0x0030_002C
	REG_HSIZE             Register = 0x0034_0030
	REG_HSYNC0            Register = 0x0038_0034
	REG_HSYNC1            Register = 0x003C_0038
	REG_VCYCLE            Register = 0x0040_003C
	REG_VOFFSET           Register = 0x0044_0040
	REG_VSIZE             Register = 0x0048_0044
	REG_VSYNC0            Register = 0x004C_0048
	REG_VSYNC1            Register = 0x0050_004C
	REG_DLSWAP            Register = 0x0054_0050
	REG_ROTATE            Register = 0x0058_0054
	REG_OUTBITS           Register = 0x005C_0058
	REG_DITHER            Register = 0x0060_005C
	REG_SWIZZLE           Register = 0x0064_0060
	REG_CSPREAD           Register = 0x0068_0064
	REG_PCLK_POL          Register = 0x006C_0068
	REG_PCLK              Register = 0x0070_006C
	REG_TAG_X             Register = 0x0074_0070
	REG_TAG_Y             Register = 0x0078_0074
	REG_TAG               Register = 0x007C_0078
	REG_VOL_PB            Register = 0x0080_007C
	REG_VOL_SOUND         Register = 0x0084_0080
	REG_SOUND             Register = 0x0088_0084
	REG_PLAY              Register = 0x008C_0088
	REG_GPIO_DIR          Register = 0x0090_008C
	REG_GPIO              Register = 0x0094_0090
	REG_GPIOX_DIR         Register = 0x0098_FFFF
	REG_GPIOX             Register = 0x009C_FFFF
	REG_INT_FLAGS         Register = 0x00A8_0098
	REG_INT_EN            Register = 0x00AC_009C
	REG_INT_MASK          Register = 0x00B0_00A0
	REG_PLAYBACK_START    Register = 0x00B4_00A4
	REG_PLAYBACK_LENGTH   Register = 0x00B8_00A8
	REG_PLAYBACK_READPTR  Register = 0x00BC_00AC
	REG_PLAYBACK_FREQ     Register = 0x00C0_00B0
	REG_PLAYBACK_FORMAT   Register = 0x00C4_00B4
	REG_PLAYBACK_LOOP     Register = 0x00C8_00B8
	REG_PLAYBACK_PLAY     Register = 0x00CC_00BC
	REG_PWM_HZ            Register = 0x00D0_00C0
	REG_PWM_DUTY          Register = 0x00D4_00C4
	REG_MACRO_0           Register = 0x00D8_00C8
	REG_MACRO_1           Register = 0x00DC_00CC
	REG_CMD_READ          Register = 0x00F8_00E4
	REG_CMD_WRITE         Register = 0x00FC_00E8
	REG_CMD_DL            Register = 0x0100_00EC
	REG_TOUCH_MODE        Register = 0x0104_00F0
	REG_CTOUCH_EXTENDED   Register = 0x0108_00F4
	REG_TOUCH_ADC_MODE    Register = 0x0108_00F4
	REG_TOUCH_CHARGE      Register = 0x010C_00F8
	REG_CTOUCH_REG        Register = 0xFFFF_00F8
	REG_TOUCH_SETTLE      Register = 0x0110_00FC
	REG_TOUCH_OVERSAMPLE  Register = 0x0114_0100
	REG_TOUCH_RZTHRESH    Register = 0x0118_0104
	REG_TOUCH_RAW_XY      Register = 0x011C_0108
	REG_CTOUCH_TOUCH1_XY  Register = 0x011C_0108
	REG_CTOUCH_TOUCH4_Y   Register = 0x0120_010C
	REG_TOUCH_RZ          Register = 0x0120_010C
	REG_CTOUCH_TOUCH0_XY  Register = 0x0124_0110
	REG_TOUCH_SCREEN_XY   Register = 0x0124_0110
	REG_TOUCH_TAG_XY      Register = 0x0128_0114
	REG_TOUCH_TAG         Register = 0x012C_0118
	REG_TOUCH_TAG1_XY     Register = 0x0130_FFFF
	REG_TOUCH_TAG1        Register = 0x0134_FFFF
	REG_TOUCH_TAG2_XY     Register = 0x0138_FFFF
	REG_TOUCH_TAG2        Register = 0x013C_FFFF
	REG_TOUCH_TAG3_XY     Register = 0x0140_FFFF
	REG_TOUCH_TAG3        Register = 0x0144_FFFF
	REG_TOUCH_TAG4_XY     Register = 0x0148_FFFF
	REG_TOUCH_TAG4        Register = 0x014C_FFFF
	REG_TOUCH_TRANSFORM_A Register = 0x0150_011C
	REG_TOUCH_TRANSFORM_B Register = 0x0154_0120
	REG_TOUCH_TRANSFORM_C Register = 0x0158_0124
	REG_TOUCH_TRANSFORM_D Register = 0x015C_0128
	REG_TOUCH_TRANSFORM_E Register = 0x0160_012C
	REG_TOUCH_TRANSFORM_F Register = 0x0164_0130
	REG_TOUCH_CONFIG      Register = 0x0168_FFFF
	REG_CTOUCH_TOUCH4_X   Register = 0x016C_0138
	REG_BIST_EN           Register = 0x0174_FFFF
	REG_TRIM              Register = 0x0180_016C
	REG_ANA_COMP          Register = 0x0184_FFFF
	REG_SPI_WIDTH         Register = 0x0188_FFFF
	REG_CTOUCH_TOUCH2_XY  Register = 0x018C_0174
	REG_TOUCH_DIRECT_XY   Register = 0x018C_0174
	REG_TOUCH_DIRECT_Z1Z2 Register = 0x0190_0178
	REG_CTOUCH_TOUCH3_XY  Register = 0x0190_0178
	REG_DATESTAMP         Register = 0x0564_FFFF
	REG_CMDB_SPACE        Register = 0x0574_FFFF
	REG_CMDB_WRITE        Register = 0x0578_FFFF
	REG_TRACKER           Register = 0x7000_6C00
	REG_TRACKER_1         Register = 0x7004_FFFF
	REG_TRACKER_2         Register = 0x7008_FFFF
	REG_TRACKER_3         Register = 0x700C_FFFF
	REG_TRACKER_4         Register = 0x7010_FFFF
	REG_MEDIAFIFO_READ    Register = 0x7014_FFFF
	REG_MEDIAFIFO_WRITE   Register = 0x7018_FFFF
)

Register list, offset from RAM_REG: FT81 FT80

type Writer

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

Writer extends DLW to allow write arbitrary data.

func (*Writer) Addr added in v0.1.5

func (w *Writer) Addr() int

Addr returns the address just after the last write operation. The address is calculated and may be ahead of actual writes due to internal buffering.

func (*Writer) Align

func (w *Writer) Align(n int)

Align writes random data to align the write address to n.

func (*Writer) Close added in v0.1.0

func (w *Writer) Close() int

Close closes the wrtie transaction and returns the address just after the last write operation.

func (*Writer) Flush added in v0.1.0

func (w *Writer) Flush()

Flush writes any buffered data to the underlying DCI.

func (*Writer) Height added in v0.1.0

func (w *Writer) Height() int

Height returns screen height.

func (*Writer) Width added in v0.1.0

func (w *Writer) Width() int

Width returns screen width.

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

func (*Writer) Write16

func (w *Writer) Write16(v ...uint16)

Write16 writes 16-bit words.

func (*Writer) Write32 added in v0.1.0

func (w *Writer) Write32(v ...uint32)

Write32 writes 32-bit words.

func (*Writer) Write8

func (w *Writer) Write8(v ...uint8)

Write8 writes bytes.

func (*Writer) WriteString

func (w *Writer) WriteString(s string) (int, error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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