Documentation ¶
Overview ¶
Package eve provides a driver to FTDI/BRTCHIP Embedded Video Engine display controller.
Index ¶
- Constants
- Variables
- type CE
- func (w *CE) Append(addr, num int)
- func (w *CE) BgColor(rgb uint32)
- func (w *CE) Button(x, y, width, height int, font byte, options uint16)
- func (w *CE) ButtonString(x, y, width, height int, font byte, options uint16, s string)
- func (w *CE) CSketch(x, y, width, height, addr int, format byte, freq int)
- func (w *CE) Calibrate() int
- func (w *CE) Clock(x, y, r int, options uint16, h, m, s, ms int)
- func (w *CE) Close() int
- func (w *CE) ColdStart()
- func (w *CE) DLStart()
- func (w *CE) Dial(x, y, r int, options uint16, val int)
- func (w *CE) FgColor(rgb uint32)
- func (w *CE) Gauge(x, y, r int, options uint16, major, minor, val, max int)
- func (w *CE) GetMatrix()
- func (w *CE) GetProps()
- func (w *CE) GetPtr()
- func (w *CE) GradColor(rgb uint32)
- func (w *CE) Gradient(x0, y0 int, rgb0 uint32, x1, y1 int, rgb1 uint32)
- func (w *CE) Inflate(addr int)
- func (w *CE) Interrupt()
- func (w *CE) Keys(x, y, width, height int, font byte, options uint16)
- func (w *CE) KeysString(x, y, width, height int, font byte, options uint16, s string)
- func (w *CE) LoadIdentity()
- func (w *CE) LoadImage(addr int, options uint16)
- func (w *CE) Logo()
- func (w *CE) MediaFIFO(addr, size int)
- func (w *CE) MemCRC(addr, num int)
- func (w *CE) MemCpy(dst, src, num int)
- func (w *CE) MemSet(addr int, val byte, num int)
- func (w *CE) MemWrite(addr, num int)
- func (w *CE) MemZero(addr, num int)
- func (w *CE) Number(x, y int, font byte, options uint16, n int)
- func (w *CE) PlayVideo(options uint32)
- func (w *CE) Progress(x, y, width, height int, options uint16, val, max int)
- func (w *CE) ROMFont(font, romslot byte)
- func (w *CE) RegRead(addr int)
- func (w *CE) Rotate(a int)
- func (w *CE) Scale(sx, sy int)
- func (w *CE) Screensaver()
- func (w *CE) Scrollbar(x, y, width, height int, options uint16, val, size, max int)
- func (w *CE) SetBase(base int)
- func (w *CE) SetBitmap(addr int, format byte, width, height int)
- func (w *CE) SetFont(font byte, addr int)
- func (w *CE) SetFont2(font byte, addr, firstchar int)
- func (w *CE) SetMatrix()
- func (w *CE) SetRotate(r byte)
- func (w *CE) SetScratch(handle byte)
- func (w *CE) Sketch(x, y, width, height, addr int, format byte)
- func (w *CE) Slider(x, y, width, height int, options uint16, val, max int)
- func (w *CE) Snapshot(addr int)
- func (w *CE) Snapshot2(format byte, addr, x, y, width, height int)
- func (w *CE) Spinner(x, y int, style uint16, scale int)
- func (w *CE) Stop()
- func (w *CE) Swap()
- func (w *CE) Text(x, y int, font byte, options uint16)
- func (w *CE) TextString(x, y int, font byte, options uint16, s string)
- func (w *CE) Toggle(x, y, width int, font byte, options uint16, state bool)
- func (w *CE) ToggleString(x, y, width int, font byte, opts uint16, state bool, s string)
- func (w *CE) Track(x, y, width, height, tag int)
- func (w *CE) Translate(tx, ty int)
- func (w *CE) VideoFrame(dst, ptr int)
- func (w *CE) VideoStart()
- type Config
- type DCI
- type DL
- func (w *DL) AlphaFunc(fun, ref uint8)
- func (w *DL) Begin(prim uint8)
- func (w *DL) BitmapHandle(handle uint8)
- func (w *DL) BitmapLayout(format uint8, linestride, height int)
- func (w *DL) BitmapSize(options uint8, width, height int)
- func (w *DL) BitmapSource(addr int)
- func (w *DL) BitmapTransformA(prec uint8, a int)
- func (w *DL) BitmapTransformB(prec uint8, b int)
- func (w *DL) BitmapTransformC(prec uint8, c int)
- func (w *DL) BitmapTransformD(prec uint8, d int)
- func (w *DL) BitmapTransformE(prec uint8, e int)
- func (w *DL) BitmapTransformF(prec uint8, f int)
- func (w *DL) BlendFunc(src, dst uint8)
- func (w *DL) Call(dest int)
- func (w *DL) Cell(cell int)
- func (w *DL) Clear(cst uint8)
- func (w *DL) ClearColorA(alpha uint8)
- func (w *DL) ClearColorRGB(rgb uint32)
- func (w *DL) ClearStencil(s uint8)
- func (w *DL) ClearTag(t int)
- func (w *DL) ColorA(alpha uint8)
- func (w *DL) ColorMask(rgba uint8)
- func (w *DL) ColorRGB(rgb uint32)
- func (w *DL) Display()
- func (w *DL) End()
- func (w *DL) Jump(dest int)
- func (w *DL) LineWidth(width int)
- func (w *DL) Macro(m int)
- func (w *DL) Nop()
- func (w *DL) PaletteSource(addr int)
- func (w *DL) PointSize(size int)
- func (w *DL) RestoreContext()
- func (w *DL) Return()
- func (w *DL) SaveContext()
- func (w *DL) ScissorSize(width, height int)
- func (w *DL) ScissorXY(x, y int)
- func (w *DL) StencilFunc(fun, ref, mask uint8)
- func (w *DL) StencilMask(mask uint8)
- func (w *DL) StencilOp(sfail, spass uint8)
- func (w *DL) SwapDL() int
- func (w *DL) Tag(t int)
- func (w *DL) TagMask(en bool)
- func (w *DL) Vertex2f(x, y int)
- func (w *DL) Vertex2ii(x, y int, handle uint8, cell int)
- func (w *DL) VertexFormat(frac uint)
- func (w *DL) VertexTranslateX(x int)
- func (w *DL) VertexTranslateY(y int)
- type DisplayConfig
- type Driver
- func (d *Driver) CE(addr int) *CE
- func (d *Driver) ClearInt(flags IntFlags)
- func (d *Driver) DL(addr int) *DL
- func (d *Driver) Err(clear bool) error
- func (d *Driver) HostCmd(cmd HostCmd, param byte)
- func (d *Driver) Init(dcf *DisplayConfig, cfg *Config) error
- func (d *Driver) IntFlags() IntFlags
- func (d *Driver) MemMap() *MemMap
- func (d *Driver) Note() *rtos.Note
- func (d *Driver) R(addr int) *Reader
- func (d *Driver) ReadReg(r Register) uint32
- func (d *Driver) ReadUint32(addr int) uint32
- func (d *Driver) RegAddr(r Register) int
- func (d *Driver) SetBacklight(pwmduty int)
- func (d *Driver) SetIntMask(mask IntFlags)
- func (d *Driver) SetNote(n *rtos.Note)
- func (d *Driver) Size() (width, height int)
- func (d *Driver) TouchScreenXY() (x, y int)
- func (d *Driver) TouchTag() int
- func (d *Driver) TouchTagXY() (x, y int)
- func (d *Driver) Tracker() (val int, tag uint16)
- func (d *Driver) W(addr int) *Writer
- func (d *Driver) WaitInt(flags IntFlags)
- func (d *Driver) WriteReg(r Register, u uint32)
- func (d *Driver) WriteUint32(addr int, u uint32)
- type HostCmd
- type IntFlags
- type MemMap
- type MemRegion
- type Reader
- type Register
- type Writer
- func (w *Writer) Addr() int
- func (w *Writer) Align(n int)
- func (w *Writer) Close() int
- func (w *Writer) Flush()
- func (w *Writer) Height() int
- func (w *Writer) Width() int
- func (w *Writer) Write(p []byte) (int, error)
- func (w *Writer) Write16(v ...uint16)
- func (w *Writer) Write32(v ...uint32)
- func (w *Writer) Write8(v ...uint8)
- func (w *Writer) WriteString(s string) (int, error)
Constants ¶
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.
const ( NEVER = 0 LESS = 1 LEQUAL = 2 GREATER = 3 GEQUAL = 4 EQUAL = 5 NOTEQUAL = 6 ALWAYS = 7 )
Alpha/stencil function (ALPHA_FUNC, STENCIL_FUNC).
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).
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).
const ( NEAREST = 0 BILINEAR = 1 << 2 BORDER = 0 REPEATX = 1 << 1 REPEATY = 1 << 0 )
Bitmap options (BITMAP_SIZE).
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).
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).
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).
const ( //ZERO = 0 // Alredy defined in blending options. KEEP = 1 REPLACE = 2 INCR = 3 DECR = 4 INVERT = 5 )
Stencil test actions: sfail, spass.
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_LOGO = 0xFFFFFF31 CMD_CSKETCH = 0xFFFFFF35 // Arg: x, y, w, h, addr, format, freq (FT801) )
Graphics Engine Commands.
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).
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.
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.
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 )
const ( DLSWAP_DONE = 0 DLSWAP_LINE = 1 DLSWAP_FRAME = 2 )
REG_DLSWAP values.
const DEFAULT = 0
Variables ¶
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 ¶
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) Button ¶
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 ¶
ButtonString draws a button with label s.
func (*CE) Calibrate ¶
Calibrate execute the touch screen calibration routine. It returns the address to the status value (status != 0 means success).
func (*CE) Close ¶
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) 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) Keys ¶
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 ¶
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 ¶
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 (*CE) Scale ¶
Scale applies a scale to the current matrix (sx, sy are signed 16.16-bit fixed-point numbers).
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) SetScratch ¶
SetScratch sets the scratch bitmap for widget use (EVE2).
func (*CE) Sketch ¶
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) Text ¶
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 ¶
TextString draws text.
func (*CE) Toggle ¶
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 ¶
Toggle draws a toggle switch using s as label.
func (*CE) Translate ¶
Translate applies a translation to the current matrix (tx, ty are signed 16.16-bit fixed-point numbers).
func (*CE) VideoFrame ¶
VideoFrame loads the next frame of video.
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) BitmapHandle ¶
BitmapHandle selscts the bitmap handle.
func (*DL) BitmapLayout ¶
BitmapLayout sets the bitmap memory format and layout for the current handle.
func (*DL) BitmapSize ¶
BitmapSize sets the screen drawing of bitmaps for the current handle.
func (*DL) BitmapSource ¶
BitmapSource sets the source address of bitmap data in graphics memory RAM_G.
func (*DL) BitmapTransformA ¶
BitmapTransA sets the A coefficient of the bitmap transform matrix (a is signed 8.8-bit fixed-point number).
func (*DL) BitmapTransformB ¶
BitmapTransformB sets the B coefficient of the bitmap transform matrix (b is signed 8.8-bit fixed-point number).
func (*DL) BitmapTransformC ¶
BitmapTransformC sets the C coefficient of the bitmap transform matrix (c is signed 8.8-bit fixed-point number).
func (*DL) BitmapTransformD ¶
BitmapTransformD sets the D coefficient of the bitmap transform matrix (d is signed 8.8-bit fixed-point number).
func (*DL) BitmapTransformE ¶
BitmapTransformE sets the E coefficient of the bitmap transform matrix (e is signed 8.8-bit fixed-point number).
func (*DL) BitmapTransformF ¶
BitmapTransformF sets the F coefficient of the bitmap transform matrix (f is signed 8.8-bit fixed-point number).
func (*DL) ClearColorA ¶
ClearColorA sets the clear value for the alpha channel.
func (*DL) ClearColorRGB ¶
ClearColorRGB sets the clear values for red, green and blue channels.
func (*DL) ClearStencil ¶
ClearStencil sets the clear value for the stencil buffer.
func (*DL) Display ¶
func (w *DL) Display()
Display ends the display list (following command will be ignored).
func (*DL) Jump ¶
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 ¶
LineWidth sets the width of lines to be drawn with primitive LINES in 1/16 pixel precision.
func (*DL) PaletteSource ¶
PaletteSource sets the base address of the palette (EVE2).
func (*DL) RestoreContext ¶
func (w *DL) RestoreContext()
RestoreContext restores the current graphics context from the context stack.
func (*DL) SaveContext ¶
func (w *DL) SaveContext()
SaveContext pushes the current graphics context on the context stack.
func (*DL) ScissorSize ¶
ScissorSize sets the size of the scissor clip rectangle.
func (*DL) StencilFunc ¶
StencilFunc sets function and reference value for stencil testing.
func (*DL) StencilMask ¶
StencilMask controls the writing of individual bits in the stencil planes.
func (*DL) SwapDL ¶
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 ¶
Tag attaches the tag value for the following graphics objects drawn on the screen. The initial tag buffer value is 255.
func (*DL) Vertex2f ¶
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 ¶
Vertex2ii starts the operation of graphics primitive at the specified coordinates in pixel precision.
func (*DL) VertexFormat ¶
VertexFormat sets the precision of Vertex2f coordinates (EVE2).
func (*DL) VertexTranslateX ¶ added in v0.1.1
VertexTranslateX specifies the offset added to vertex x coordinates (EVE2).
func (*DL) VertexTranslateY ¶ added in v0.1.1
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Err returns the value of the internal error register. If clear is true the error register is cleared.
func (*Driver) HostCmd ¶
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 ¶
IntFlags reads the REG_INT_FLAGS register, accumulates the read flags in the internal variable and returns its value.
func (*Driver) ReadUint32 ¶
ReadUint32 reads 32-bit word from address addr.
func (*Driver) SetBacklight ¶
SetBacklight sets the PWM duty cycle of backlight output. The allowed pwmduty range is from 0 to 128.
func (*Driver) SetIntMask ¶
SetIntMask sets interrupt mask.
func (*Driver) TouchScreenXY ¶
TouchScreenXY reads the coordinaters of touch point.
func (*Driver) TouchTagXY ¶
TouchTagXY returns the coordinates of touch point corresponding to the current tag.
func (*Driver) WaitInt ¶
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) WriteUint32 ¶
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 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
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) Close ¶ added in v0.1.0
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.