embd: github.com/kidoman/embd/controller/pca9685 Index | Files

package pca9685

import "github.com/kidoman/embd/controller/pca9685"

Package pca9685 allows interfacing with the pca9685 16-channel, 12-bit PWM Controller through I2C protocol.


Package Files


type PCA9685 Uses

type PCA9685 struct {
    Bus  embd.I2CBus
    Addr byte
    Freq int
    // contains filtered or unexported fields

PCA9685 represents a PCA9685 PWM generator.

func New Uses

func New(bus embd.I2CBus, addr byte) *PCA9685

New creates a new PCA9685 interface.

func (*PCA9685) AnalogChannel Uses

func (d *PCA9685) AnalogChannel(channel int) *pwmChannel

func (*PCA9685) Close Uses

func (d *PCA9685) Close() error

Close stops the controller and resets mode and pwm controller registers.

func (*PCA9685) ServoChannel Uses

func (d *PCA9685) ServoChannel(channel int) *pwmChannel

func (*PCA9685) SetPwm Uses

func (d *PCA9685) SetPwm(channel, onTime, offTime int) error

SetPwm sets the ON and OFF time registers for pwm signal shaping. channel: 0-15 onTime/offTime: 0-4095

func (*PCA9685) Sleep Uses

func (d *PCA9685) Sleep() error

Sleep puts the controller in sleep mode. Does not change the pwm control registers.

func (*PCA9685) Wake Uses

func (d *PCA9685) Wake() error

Wake allows the controller to exit sleep mode and resume with PWM generation.

Package pca9685 imports 6 packages (graph) and is imported by 9 packages. Updated 2016-07-25. Refresh now. Tools for package owners.