ruc

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: GPL-3.0 Imports: 6 Imported by: 1

README

RUC

Remote Unicorn Control

WiP

Firmware, Protocol, Go-Client and some tools to display things via WiFi on your PIMORONI Stellar/Galactic/Cosmic* Unicorn.

Quickstart

  1. Flash the firmware
  2. Connect the Unicorn to your WiFi (TBD)
  3. Take a look at the examples or use cmd/rucli for basic operations

Protocol


*Untested on Stellar Unicorn and Cosmic Unicorn.

Documentation

Index

Constants

View Source
const (
	HeaderEncodedLen = 6
	PixelEncodedLen  = 5
)
View Source
const (
	MessageTypeSetPixels byte = iota
)

Variables

View Source
var (
	ErrEncHeaderLen  = errors.New("invalid length for encoded header")
	ErrEncMessageLen = errors.New("invalid length for encoded message")
	ErrEncPixelLen   = errors.New("invalid length for encoded pixel")
)

Functions

This section is empty.

Types

type Canvas

type Canvas struct {
	*gg.Context
	// contains filtered or unexported fields
}

func NewCanvas

func NewCanvas(width, height uint) *Canvas

func (*Canvas) GenSetPixelsMessage

func (c *Canvas) GenSetPixelsMessage(force bool) *SetPixelsMessage

type Client

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

func NewClient

func NewClient(unicorn string) (*Client, error)

func NewClientWithId

func NewClientWithId(unicorn string, id byte) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) Display

func (c *Client) Display(canvas *Canvas, force bool) error

func (*Client) Send

func (c *Client) Send(msg Message) error
type Header struct {
	SourceId byte
	Type     byte
	DataLen  uint16
}

func (*Header) DecodeHeader

func (h *Header) DecodeHeader(data []byte) error

func (*Header) EncodeHeader

func (h *Header) EncodeHeader() []byte

type Message

type Message interface {
	GetType() byte
	SetSourceId(id byte)
	GetSourceId() byte
	Encode() []byte
	Decode(data []byte) error
}

type Pixel

type Pixel struct {
	X uint8
	Y uint8
	R uint8
	G uint8
	B uint8
}

func (*Pixel) Decode

func (p *Pixel) Decode(data []byte) error

func (*Pixel) Encode

func (p *Pixel) Encode() []byte

func (*Pixel) RGB

func (p *Pixel) RGB() []byte

func (*Pixel) String

func (p *Pixel) String() string

type SetPixelsMessage

type SetPixelsMessage struct {
	Header
	Pixels []Pixel
}

func NewSetPixelsMessage

func NewSetPixelsMessage() *SetPixelsMessage

func (*SetPixelsMessage) AppendPixel

func (m *SetPixelsMessage) AppendPixel(p Pixel)

func (*SetPixelsMessage) Decode

func (m *SetPixelsMessage) Decode(data []byte) error

func (*SetPixelsMessage) Encode

func (m *SetPixelsMessage) Encode() []byte

func (*SetPixelsMessage) GetSourceId

func (m *SetPixelsMessage) GetSourceId() byte

func (*SetPixelsMessage) GetType

func (m *SetPixelsMessage) GetType() byte

func (*SetPixelsMessage) SetSourceId

func (m *SetPixelsMessage) SetSourceId(id byte)

func (*SetPixelsMessage) String

func (m *SetPixelsMessage) String() string

Directories

Path Synopsis
cmd
rucli command
emulator module
examples
bounce command

Jump to

Keyboard shortcuts

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