pca9685

package
Version: v0.0.0-...-23a8c07 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PCA9685

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

PCA9685 represents a PCA9685 PWM generator.

func New

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

New creates a new PCA9685 interface.

func (*PCA9685) AnalogChannel

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

func (*PCA9685) Close

func (d *PCA9685) Close() error

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

func (*PCA9685) ServoChannel

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

func (*PCA9685) SetPwm

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

func (d *PCA9685) Sleep() error

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

func (*PCA9685) Wake

func (d *PCA9685) Wake() error

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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto