chip

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

README

C.H.I.P.

The C.H.I.P. is a small, inexpensive ARM based single board computer, with many different IO interfaces available on the pin headers.

For documentation about the C.H.I.P. platform click here.

The C.H.I.P. Pro is a version of C.H.I.P. intended for use in embedded product development. Here is info about the C.H.I.P. Pro pin headers.

How to Install

We recommend updating to the latest Debian OS when using the C.H.I.P., however Gobot should also support older versions of the OS, should your application require this.

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 C.H.I.P and run the program on the C.H.I.P. itself as documented here.

Please refer to the main README.md

PWM support

Note that PWM might not be available in your kernel. In that case, you can install the required device tree overlay from the command line using Gort CLI commands on the C.H.I.P device. Here are the steps:

Install the required patched device tree compiler as described in the C.H.I.P docs:

gort chip install dtc

Now, install the pwm overlay to activate pwm on the PWM0 pin:

gort chip install pwm

Reboot the device to make sure the init script loads the overlay on boot.

How to Use

Please refer to one example for your platform, e.g. chip_button.go. The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself. If you want to use the C.H.I.P. Pro, use the NewProAdaptor() function like this:

chipProAdaptor := chip.NewProAdaptor()

How to Connect

Compiling

Compile your Gobot program on your workstation like this:

GOARM=7 GOARCH=arm GOOS=linux go build examples/chip_button.go

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

scp chip_button root@192.168.1.xx:
ssh -t root@192.168.1.xx "./chip_button"

Documentation

Overview

Package chip contains the Gobot adaptor for the CHIP and CHIP Pro

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adaptor

type Adaptor struct {
	*adaptors.DigitalPinsAdaptor
	*adaptors.PWMPinsAdaptor
	*adaptors.I2cBusAdaptor
	// contains filtered or unexported fields
}

Adaptor represents a Gobot Adaptor for a C.H.I.P.

func NewAdaptor

func NewAdaptor(opts ...interface{}) *Adaptor

NewAdaptor creates a C.H.I.P. Adaptor

Optional parameters:

adaptors.WithGpiodAccess():	use character device gpiod driver instead of sysfs
adaptors.WithSpiGpioAccess(sclk, nss, mosi, miso):	use GPIO's instead of /dev/spidev#.#

Optional parameters for PWM, see [adaptors.NewPWMPinsAdaptor]

func NewProAdaptor

func NewProAdaptor() *Adaptor

NewProAdaptor creates a C.H.I.P. Pro Adaptor

func (*Adaptor) Connect

func (a *Adaptor) Connect() error

Connect create new connection to board and pins.

func (*Adaptor) Finalize

func (a *Adaptor) Finalize() error

Finalize closes connection to board and pins

func (*Adaptor) Name

func (a *Adaptor) Name() string

Name returns the name of the Adaptor

func (*Adaptor) SetName

func (a *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