gobot: gobot.io/x/gobot/platforms/raspi Index | Files

package raspi

import "gobot.io/x/gobot/platforms/raspi"

Package raspi contains the Gobot adaptor for the Raspberry Pi.

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


Package Files

doc.go pwm_pin.go raspi_adaptor.go raspi_pin_map.go

type Adaptor Uses

type Adaptor struct {
    PiBlasterPeriod uint32
    // contains filtered or unexported fields

Adaptor is the Gobot Adaptor for the Raspberry Pi

func NewAdaptor Uses

func NewAdaptor() *Adaptor

NewAdaptor creates a Raspi Adaptor

func (*Adaptor) Connect Uses

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

Connect starts connection with board and creates digitalPins and pwmPins adaptor maps

func (*Adaptor) DigitalPin Uses

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

DigitalPin returns matched digitalPin for specified values

func (*Adaptor) DigitalRead Uses

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

DigitalRead reads digital value from pin

func (*Adaptor) DigitalWrite Uses

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

DigitalWrite writes digital value to specified pin

func (*Adaptor) Finalize Uses

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

Finalize closes connection to board and pins

func (*Adaptor) GetConnection Uses

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

GetConnection returns an i2c 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 Uses

func (r *Adaptor) GetDefaultBus() int

GetDefaultBus returns the default i2c bus for this platform

func (*Adaptor) GetSpiConnection Uses

func (r *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 Uses

func (r *Adaptor) GetSpiDefaultBits() int

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

func (*Adaptor) GetSpiDefaultBus Uses

func (r *Adaptor) GetSpiDefaultBus() int

GetSpiDefaultBus returns the default spi bus for this platform.

func (*Adaptor) GetSpiDefaultChip Uses

func (r *Adaptor) GetSpiDefaultChip() int

GetSpiDefaultChip returns the default spi chip for this platform.

func (*Adaptor) GetSpiDefaultMaxSpeed Uses

func (r *Adaptor) GetSpiDefaultMaxSpeed() int64

GetSpiDefaultMaxSpeed returns the default spi bus for this platform.

func (*Adaptor) GetSpiDefaultMode Uses

func (r *Adaptor) GetSpiDefaultMode() int

GetSpiDefaultMode returns the default spi mode for this platform.

func (*Adaptor) Name Uses

func (r *Adaptor) Name() string

Name returns the Adaptor's name

func (*Adaptor) PWMPin Uses

func (r *Adaptor) PWMPin(pin string) (raspiPWMPin sysfs.PWMPinner, err error)

PWMPin returns a raspi.PWMPin which provides the sysfs.PWMPinner interface

func (*Adaptor) PwmWrite Uses

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

PwmWrite writes a PWM signal to the specified pin

func (*Adaptor) ServoWrite Uses

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

ServoWrite writes a servo signal to the specified pin

func (*Adaptor) SetName Uses

func (r *Adaptor) SetName(n string)

SetName sets the Adaptor's name

type PWMPin Uses

type PWMPin struct {
    // contains filtered or unexported fields

PWMPin is the Raspberry Pi implementation of the PWMPinner interface. It uses Pi Blaster.

func NewPWMPin Uses

func NewPWMPin(pin string) *PWMPin

NewPwmPin returns a new PWMPin

func (*PWMPin) DutyCycle Uses

func (p *PWMPin) DutyCycle() (duty uint32, err error)

DutyCycle returns the duty cycle for the pin

func (*PWMPin) Enable Uses

func (p *PWMPin) Enable(e bool) (err error)

Enable enables/disables the PWM pin

func (*PWMPin) Export Uses

func (p *PWMPin) Export() error

Export exports the pin for use by the Raspberry Pi

func (*PWMPin) InvertPolarity Uses

func (p *PWMPin) InvertPolarity(invert bool) (err error)

InvertPolarity does not do anything when using PiBlaster

func (*PWMPin) Period Uses

func (p *PWMPin) Period() (period uint32, err error)

Period returns the current PWM period for pin

func (*PWMPin) Polarity Uses

func (p *PWMPin) Polarity() (polarity string, err error)

Polarity returns the polarity either normal or inverted

func (*PWMPin) SetDutyCycle Uses

func (p *PWMPin) SetDutyCycle(duty uint32) (err error)

SetDutyCycle writes the duty cycle to the pin

func (*PWMPin) SetPeriod Uses

func (p *PWMPin) SetPeriod(period uint32) (err error)

SetPeriod uses PiBlaster setting and cannot be changed once set

func (*PWMPin) Unexport Uses

func (p *PWMPin) Unexport() error

Unexport unexports the pin and releases the pin from the operating system

Package raspi imports 12 packages (graph) and is imported by 18 packages. Updated 2020-12-02. Refresh now. Tools for package owners.