machine

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2019 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GPIO_INPUT = iota
	GPIO_OUTPUT
)
View Source
const (
	LED  = LED1
	LED1 = 0
	LED2 = 0
	LED3 = 0
	LED4 = 0
)

Fake LED numbers, for testing.

View Source
const (
	BUTTON  = BUTTON1
	BUTTON1 = 0
	BUTTON2 = 0
	BUTTON3 = 0
	BUTTON4 = 0
)

Fake button numbers, for testing.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADC

type ADC struct {
	Pin uint8
}

type GPIO

type GPIO struct {
	Pin uint8
}

func (GPIO) Configure

func (p GPIO) Configure(config GPIOConfig)

func (GPIO) Get

func (p GPIO) Get() bool

func (GPIO) High

func (p GPIO) High()

func (GPIO) Low

func (p GPIO) Low()

func (GPIO) Set

func (p GPIO) Set(value bool)

type GPIOConfig

type GPIOConfig struct {
	Mode GPIOMode
}

type GPIOMode

type GPIOMode uint8

type PWM

type PWM struct {
	Pin uint8
}

type RingBuffer

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

RingBuffer is ring buffer implementation inspired by post at https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php

It has some limitations currently due to how "volatile" variables that are members of a struct are not compiled correctly by TinyGo. See https://github.com/tinygo-org/tinygo/issues/151 for details.

func NewRingBuffer

func NewRingBuffer() *RingBuffer

NewRingBuffer returns a new ring buffer.

func (*RingBuffer) Get

func (rb *RingBuffer) Get() (byte, bool)

Get returns a byte from the buffer. If the buffer is empty, the method will return a false as the second value.

func (*RingBuffer) Put

func (rb *RingBuffer) Put(val byte) bool

Put stores a byte in the buffer. If the buffer is already full, the method will return false.

func (*RingBuffer) Used

func (rb *RingBuffer) Used() uint8

Used returns how many bytes in buffer have been used.

Jump to

Keyboard shortcuts

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