wiointerface

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 7 Imported by: 0

README

wiointerface

Wiointerface is library for developing and tinygo software for wio terminal. This is private "under development release" for making applications using this library. There will be interface compatility breaks at future

Idea of this library is to allow compile microcontroller software on tinygo and test/demo version for pc

On PC libsdl interface lsA,S and D keys are 3 keys on top of wio terminal. Arrow keys match to arrow pad on wio and return key is "press joystic down" button

background pic used in sim

Demo programs

Demo programs under cmd directory are compiled with command

tinygo build -target=wioterminal -o out.uf2

I personally use script to

mkdir -p mountti
mount /dev/sda ./mountti/
tinygo build -target=wioterminal -o ulos.uf2
cp ulos.uf2 ./mountti
umount ./mountti

Building demo on PC is just

go build

Test programs

  • ambient just shows how to use BME280 on wio terminal (left side I2C connector)
  • chip8 is just chip8 emulator
  • marijodemo just drawing some scrolling sprites

Documentation

Overview

Thin wrapper for wio terminal.

Instead of having custom made machine package etc... have some interfaces For some reason machine package is in included in devices. Very non testable situation

Interfaces also allow more high level abstraction instead of playng with device registers

Actual implementation on hardware is simpler than what comes from ili9341

Index

Constants

View Source
const (
	WIODISPLAY_W = 320
	WIODISPLAY_H = 240
	TITLEDISPLAY = "wio simulator"
)
View Source
const (
	BACKGROUNDPNG_VIEW_X0 = 85
	BACKGROUNDPNG_VIEW_Y0 = 111
	BACKGROUNDPNG_VIEW_X1 = 917
	BACKGROUNDPNG_VIEW_Y1 = 660
)
View Source
const (
	Rotation0 = iota
	Rotation90
	Rotation180
	Rotation270
	Rotation0Mirror
	Rotation90Mirror
	Rotation180Mirror
	Rotation270Mirror
)

Clockwise rotation of the screen.

View Source
const (
	KEYMASK_UP     uint32 = 1 << 0
	KEYMASK_DOWN   uint32 = 1 << 1
	KEYMASK_LEFT   uint32 = 1 << 2
	KEYMASK_RIGHT  uint32 = 1 << 3
	KEYMASK_CENTER uint32 = 1 << 4

	KEYMASK_A uint32 = 1 << 5
	KEYMASK_B uint32 = 1 << 6
	KEYMASK_C uint32 = 1 << 7
)

Variables

This section is empty.

Functions

func RGBATo565

func RGBATo565(c color.RGBA) uint16

Types

type Rotation

type Rotation uint8

type Sdlwio

type Sdlwio struct {
	Landscape bool
	Flipped   bool
	// contains filtered or unexported fields
}

func InitSdlwio

func InitSdlwio() (*Sdlwio, error)

func (*Sdlwio) Backlight

func (p *Sdlwio) Backlight(on bool) error

func (*Sdlwio) Close

func (p *Sdlwio) Close() error

func (*Sdlwio) EndWrite

func (p *Sdlwio) EndWrite() error

func (*Sdlwio) GetWioKeys

func (p *Sdlwio) GetWioKeys() uint32

func (*Sdlwio) Init

func (p *Sdlwio) Init(rotation Rotation) error

func (*Sdlwio) SetRotation

func (p *Sdlwio) SetRotation(rotation Rotation) error

func (*Sdlwio) SetScroll

func (p *Sdlwio) SetScroll(line int16)

func (*Sdlwio) SetScrollArea

func (p *Sdlwio) SetScrollArea(topFixedArea int16, bottomFixedArea int16) error

func (*Sdlwio) SetWindow

func (p *Sdlwio) SetWindow(x int16, y int16, w int16, h int16) error

func (*Sdlwio) Sleep

func (p *Sdlwio) Sleep(sleeping bool) error

func (*Sdlwio) StartWrite

func (p *Sdlwio) StartWrite() error

func (*Sdlwio) Write16bit

func (p *Sdlwio) Write16bit(arr []uint16) error

func (*Sdlwio) Write16bitbytes

func (p *Sdlwio) Write16bitbytes(arr []byte) error

func (*Sdlwio) Write8bit

func (p *Sdlwio) Write8bit(arr []byte) error

type SdlwioBackgroundFrame

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

type WioInterface

type WioInterface interface {
	Backlight(on bool) error

	//Display SPI
	Init(rotation Rotation) error
	SetWindow(x int16, y int16, w int16, h int16) error

	StartWrite() error
	EndWrite() error
	Write8bit(arr []byte) error
	Write16bitbytes(arr []byte) error
	Write16bit(arr []uint16) error

	Sleep(sleeping bool) error

	SetRotation(rotation Rotation) error

	SetScrollArea(topFixedArea int16, bottomFixedArea int16) error

	SetScroll(line int16)
	// Keys
	GetWioKeys() uint32
}

Jump to

Keyboard shortcuts

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