pca9685

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package pca9685 implements a PCA9685 HAT. It's probably also a generic PCA9685 but that has not been verified yet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BoardName      string `json:"board_name"`
	I2CName        string `json:"i2c_name"`
	I2CAddress     *int   `json:"i2c_address,omitempty"`
	PWMFrequencyHz int    `json:"pwm_frequency_hz,omitempty"`
}

Config describes a PCA9685 board attached to some other board via I2C.

func (*Config) Validate

func (config *Config) Validate(path string) ([]string, error)

Validate ensures all parts of the config are valid.

type PCA9685

type PCA9685 struct {
	generic.Unimplemented
	// contains filtered or unexported fields
}

PCA9685 is a general purpose 16-channel 12-bit PWM controller.

func New

func New(ctx context.Context, bus board.I2C, address byte) (*PCA9685, error)

New returns a new PCA9685 residing on the given bus and address.

func (*PCA9685) AnalogReaderByName

func (pca *PCA9685) AnalogReaderByName(name string) (board.AnalogReader, bool)

AnalogReaderByName returns the analog reader by the given name if it exists.

func (*PCA9685) AnalogReaderNames

func (pca *PCA9685) AnalogReaderNames() []string

AnalogReaderNames returns the name of all known analog readers.

func (*PCA9685) DigitalInterruptByName

func (pca *PCA9685) DigitalInterruptByName(name string) (board.DigitalInterrupt, bool)

DigitalInterruptByName returns the interrupt by the given name if it exists.

func (*PCA9685) DigitalInterruptNames

func (pca *PCA9685) DigitalInterruptNames() []string

DigitalInterruptNames returns the name of all known digital interrupts.

func (*PCA9685) GPIOPinByName

func (pca *PCA9685) GPIOPinByName(pin string) (board.GPIOPin, error)

GPIOPinByName returns a GPIOPin by name.

func (*PCA9685) GPIOPinNames

func (pca *PCA9685) GPIOPinNames() []string

GPIOPinNames returns the names of all known GPIO pins.

func (*PCA9685) I2CByName

func (pca *PCA9685) I2CByName(name string) (board.I2C, bool)

I2CByName returns the i2c by the given name if it exists.

func (*PCA9685) I2CNames

func (pca *PCA9685) I2CNames() []string

I2CNames returns the name of all known I2Cs.

func (*PCA9685) ModelAttributes

func (pca *PCA9685) ModelAttributes() board.ModelAttributes

ModelAttributes returns attributes related to the model of this board.

func (*PCA9685) SPIByName

func (pca *PCA9685) SPIByName(name string) (board.SPI, bool)

SPIByName returns the SPI by the given name if it exists.

func (*PCA9685) SPINames

func (pca *PCA9685) SPINames() []string

SPINames returns the name of all known SPIs.

func (*PCA9685) SetFrequency

func (pca *PCA9685) SetFrequency(ctx context.Context, frequency float64) error

SetFrequency sets the global PWM frequency for the pca.

func (*PCA9685) Status

func (pca *PCA9685) Status(ctx context.Context, extra map[string]interface{}) (*commonpb.BoardStatus, error)

Status returns the board status which is always empty.

Jump to

Keyboard shortcuts

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