pca9685

package
v0.39.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: AGPL-3.0 Imports: 12 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.

Package pca9685 is unimplemented for Macs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	I2CBus     string `json:"i2c_bus"`
	I2CAddress *int   `json:"i2c_address,omitempty"`
}

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

func (*Config) Validate

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

Validate ensures all parts of the config are valid.

type PCA9685

type PCA9685 struct {
	resource.Named
	resource.AlwaysRebuild
	resource.TriviallyCloseable
	// contains filtered or unexported fields
}

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

func New

func New(ctx context.Context, deps resource.Dependencies, conf resource.Config, logger logging.Logger) (*PCA9685, error)

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

func (*PCA9685) AnalogByName added in v0.26.0

func (pca *PCA9685) AnalogByName(name string) (board.Analog, error)

AnalogByName returns the analog pin by the given name if it exists.

func (*PCA9685) AnalogNames added in v0.26.0

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

AnalogNames returns the names of all known analog pins.

func (*PCA9685) DigitalInterruptByName

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

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

func (*PCA9685) DigitalInterruptNames

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

DigitalInterruptNames returns the names 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) Reconfigure added in v0.2.36

func (pca *PCA9685) Reconfigure(ctx context.Context, deps resource.Dependencies, conf resource.Config) error

Reconfigure reconfigures the board atomically and in place.

func (*PCA9685) SetFrequency

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

SetFrequency sets the global PWM frequency for the pca.

func (*PCA9685) SetPowerMode added in v0.2.28

func (pca *PCA9685) SetPowerMode(ctx context.Context, mode pb.PowerMode, duration *time.Duration) error

SetPowerMode sets the board to the given power mode. If provided, the board will exit the given power mode after the specified duration.

func (*PCA9685) StreamTicks added in v0.24.0

func (pca *PCA9685) StreamTicks(ctx context.Context, interrupts []board.DigitalInterrupt, ch chan board.Tick,
	extra map[string]interface{},
) error

StreamTicks streams digital interrupt ticks. The pca9685 board does not have the systems hardware to implement a Tick counter.

Jump to

Keyboard shortcuts

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