Documentation ¶
Overview ¶
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
Index ¶
- type Adaptor
- func (r *Adaptor) Connect() (err error)
- func (r *Adaptor) DigitalPin(pin string, dir string) (sysfsPin sysfs.DigitalPinner, err error)
- func (r *Adaptor) DigitalRead(pin string) (val int, err error)
- func (r *Adaptor) DigitalWrite(pin string, val byte) (err error)
- func (r *Adaptor) Finalize() (err error)
- func (r *Adaptor) GetConnection(address int, bus int) (connection i2c.Connection, err error)
- func (r *Adaptor) GetDefaultBus() int
- func (r *Adaptor) GetSpiConnection(busNum, chipNum, mode, bits int, maxSpeed int64) (connection spi.Connection, err error)
- func (r *Adaptor) GetSpiDefaultBits() int
- func (r *Adaptor) GetSpiDefaultBus() int
- func (r *Adaptor) GetSpiDefaultChip() int
- func (r *Adaptor) GetSpiDefaultMaxSpeed() int64
- func (r *Adaptor) GetSpiDefaultMode() int
- func (r *Adaptor) Name() string
- func (r *Adaptor) PWMPin(pin string) (raspiPWMPin sysfs.PWMPinner, err error)
- func (r *Adaptor) PwmWrite(pin string, val byte) (err error)
- func (r *Adaptor) ServoWrite(pin string, angle byte) (err error)
- func (r *Adaptor) SetName(n string)
- type PWMPin
- func (p *PWMPin) DutyCycle() (duty uint32, err error)
- func (p *PWMPin) Enable(e bool) (err error)
- func (p *PWMPin) Export() error
- func (p *PWMPin) InvertPolarity(invert bool) (err error)
- func (p *PWMPin) Period() (period uint32, err error)
- func (p *PWMPin) Polarity() (polarity string, err error)
- func (p *PWMPin) SetDutyCycle(duty uint32) (err error)
- func (p *PWMPin) SetPeriod(period uint32) (err error)
- func (p *PWMPin) Unexport() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶
type Adaptor struct { PiBlasterPeriod uint32 // contains filtered or unexported fields }
Adaptor is the Gobot Adaptor for the Raspberry Pi
func (*Adaptor) Connect ¶
Connect starts connection with board and creates digitalPins and pwmPins adaptor maps
func (*Adaptor) DigitalPin ¶
DigitalPin returns matched digitalPin for specified values
func (*Adaptor) DigitalRead ¶
DigitalRead reads digital value from pin
func (*Adaptor) DigitalWrite ¶
DigitalWrite writes digital value to specified pin
func (*Adaptor) GetConnection ¶
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 ¶
GetDefaultBus returns the default i2c bus for this platform
func (*Adaptor) GetSpiConnection ¶
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 ¶
GetSpiDefaultBits returns the default spi number of bits for this platform.
func (*Adaptor) GetSpiDefaultBus ¶
GetSpiDefaultBus returns the default spi bus for this platform.
func (*Adaptor) GetSpiDefaultChip ¶
GetSpiDefaultChip returns the default spi chip for this platform.
func (*Adaptor) GetSpiDefaultMaxSpeed ¶
GetSpiDefaultMaxSpeed returns the default spi bus for this platform.
func (*Adaptor) GetSpiDefaultMode ¶
GetSpiDefaultMode returns the default spi mode for this platform.
func (*Adaptor) ServoWrite ¶
ServoWrite writes a servo signal to the specified pin
type PWMPin ¶
type PWMPin struct {
// contains filtered or unexported fields
}
PWMPin is the Raspberry Pi implementation of the PWMPinner interface. It uses Pi Blaster.
func (*PWMPin) InvertPolarity ¶
InvertPolarity does not do anything when using PiBlaster
func (*PWMPin) SetDutyCycle ¶
SetDutyCycle writes the duty cycle to the pin