up2

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2018 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

README

UP2 (Squared)

The UP2 Board is a single board SoC computer based on the Intel Apollo Lake processor. It has built-in GPIO, PWM, SPI, and I2C interfaces.

For more info about the UP2 Board, go to http://www.up-board.org/upsquared/.

How to Install

We recommend updating to the latest Ubuntu when using the UP2.

You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your UP2, and run the program on the UP2 as documented here.

go get -d -u gobot.io/x/gobot/...

How to Use

The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself.

r := up2.NewAdaptor()
led := gpio.NewLedDriver(r, "13")

How to Connect

Compiling

Compile your Gobot program on your workstation like this:

$ GOARCH=386 GOOS=linux go build examples/up2_blink.go

Once you have compiled your code, you can you can upload your program and execute it on the UP2 from your workstation using the scp and ssh commands like this:

$ scp up2_blink ubuntu@192.168.1.xxx:/home/ubuntu/
$ ssh -t ubuntu@192.168.1.xxx "./up2_blink"

Documentation

Overview

Package up2 contains the Gobot adaptor for the Upboard UP2.

For further information refer to the UP2 README: https://github.com/hybridgroup/gobot/blob/master/platforms/upboard/up2/README.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adaptor

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

Adaptor represents a Gobot Adaptor for the Upboard UP2

func NewAdaptor

func NewAdaptor() *Adaptor

NewAdaptor creates a UP2 Adaptor

func (*Adaptor) Connect

func (c *Adaptor) Connect() (err error)

Connect initializes the board

func (*Adaptor) DigitalPin

func (c *Adaptor) DigitalPin(pin string, dir string) (sysfsPin sysfs.DigitalPinner, err error)

DigitalPin returns matched digitalPin for specified values

func (*Adaptor) DigitalRead

func (c *Adaptor) DigitalRead(pin string) (val int, err error)

DigitalRead reads digital value from the specified pin.

func (*Adaptor) DigitalWrite

func (c *Adaptor) DigitalWrite(pin string, val byte) (err error)

DigitalWrite writes digital value to the specified pin.

func (*Adaptor) Finalize

func (c *Adaptor) Finalize() (err error)

Finalize closes connection to board and pins

func (*Adaptor) GetConnection

func (c *Adaptor) GetConnection(address int, bus int) (connection i2c.Connection, err error)

GetConnection returns a connection to a device on a specified bus. Valid bus number is [0..1] which corresponds to /dev/i2c-0 through /dev/i2c-1.

func (*Adaptor) GetDefaultBus

func (c *Adaptor) GetDefaultBus() int

GetDefaultBus returns the default i2c bus for this platform

func (*Adaptor) GetSpiConnection

func (c *Adaptor) GetSpiConnection(busNum, chipNum, mode, bits int, maxSpeed int64) (connection spi.Connection, err error)

GetSpiConnection returns an spi connection to a device on a specified bus. Valid bus number is [0..1] which corresponds to /dev/spidev0.0 through /dev/spidev0.1.

func (*Adaptor) GetSpiDefaultBits added in v1.12.0

func (c *Adaptor) GetSpiDefaultBits() int

GetSpiDefaultBits returns the default spi number of bits for this platform.

func (*Adaptor) GetSpiDefaultBus

func (c *Adaptor) GetSpiDefaultBus() int

GetSpiDefaultBus returns the default spi bus for this platform.

func (*Adaptor) GetSpiDefaultChip added in v1.12.0

func (c *Adaptor) GetSpiDefaultChip() int

GetSpiDefaultChip returns the default spi chip for this platform.

func (*Adaptor) GetSpiDefaultMaxSpeed

func (c *Adaptor) GetSpiDefaultMaxSpeed() int64

GetSpiDefaultMaxSpeed returns the default spi max speed for this platform.

func (*Adaptor) GetSpiDefaultMode

func (c *Adaptor) GetSpiDefaultMode() int

GetSpiDefaultMode returns the default spi mode for this platform.

func (*Adaptor) Name

func (c *Adaptor) Name() string

Name returns the name of the Adaptor

func (*Adaptor) PWMPin

func (c *Adaptor) PWMPin(pin string) (sysfsPin sysfs.PWMPinner, err error)

PWMPin returns matched pwmPin for specified pin number

func (*Adaptor) PwmWrite

func (c *Adaptor) PwmWrite(pin string, val byte) (err error)

PwmWrite writes a PWM signal to the specified pin

func (*Adaptor) ServoWrite

func (c *Adaptor) ServoWrite(pin string, angle byte) (err error)

ServoWrite writes a servo signal to the specified pin

func (*Adaptor) SetName

func (c *Adaptor) SetName(n string)

SetName sets the name of the Adaptor

Jump to

Keyboard shortcuts

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