drivers

package
v0.0.0-...-f592e1d Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLSM6DS3Address = 0x6b
View Source
const DefaultPCA9685Address = 0x40
View Source
const DefaultSSD1306Address = 0x3c

Variables

This section is empty.

Functions

This section is empty.

Types

type LSM6DS3

type LSM6DS3 struct {
	// contains filtered or unexported fields
}

LSM6DS3 is a Driver for the LSM6DS3 6-axis Accelerometer Gyroscope Sensor

func (*LSM6DS3) Init

func (lsm6ds3 *LSM6DS3) Init(i2c *i2c.I2C, options *LSM6DS3Options) (*LSM6DS3, error)

Init creates the new LSM6DS3 driver with specified i2c interface and options

func (*LSM6DS3) Name

func (lsm6ds3 *LSM6DS3) Name() string

func (*LSM6DS3) ReadAccelerationData

func (lsm6ds3 *LSM6DS3) ReadAccelerationData() (LSM6DS3Data, error)

func (*LSM6DS3) ReadData

func (lsm6ds3 *LSM6DS3) ReadData() (LSM6DS3Data, LSM6DS3Data, float32, error)

func (*LSM6DS3) ReadGyroData

func (lsm6ds3 *LSM6DS3) ReadGyroData() (LSM6DS3Data, error)

func (*LSM6DS3) ReadTemperatureData

func (lsm6ds3 *LSM6DS3) ReadTemperatureData() (float32, error)

type LSM6DS3Data

type LSM6DS3Data struct {
	X int32
	Y int32
	Z int32
}

type LSM6DS3Options

type LSM6DS3Options struct {
	Name      string
	InCelsius bool
}

LSM6DS3Options for controller

type PCA9685

type PCA9685 struct {
	// contains filtered or unexported fields
}

PCA9685 is a Driver for the PCA9685 16-channel 12-bit PWM/Servo controller

func (*PCA9685) GetFreq

func (pca9685 *PCA9685) GetFreq() float32

GetFreq returns frequency value

func (*PCA9685) GetOptions

func (pca9685 *PCA9685) GetOptions() *PCA9685Options

func (*PCA9685) Init

func (pca9685 *PCA9685) Init(i2c *i2c.I2C, options *PCA9685Options) (*PCA9685, error)

Init creates the new PCA9685 driver with specified i2c interface and options

func (*PCA9685) Name

func (pca9685 *PCA9685) Name() string

func (*PCA9685) Reset

func (pca9685 *PCA9685) Reset() error

Reset the chip

func (*PCA9685) SetChannel

func (pca9685 *PCA9685) SetChannel(chn, on, off int) error

SetChannel sets a single PWM channel

func (*PCA9685) SetFreq

func (pca9685 *PCA9685) SetFreq(freq float32) error

SetFreq sets the PWM frequency in Hz for controller

type PCA9685Options

type PCA9685Options struct {
	Name       string
	StepCount  float32
	Frequency  float32
	ClockSpeed float32

	Mode1    byte
	PreScale byte
	Led0On   byte
}

PCA9685Options for controller

type SSD1306

type SSD1306 struct {
	// contains filtered or unexported fields
}

SSD1306 is a Driver for the PCA9685 16-channel 12-bit PWM/Servo controller

func (*SSD1306) BufferSize

func (ssd1306 *SSD1306) BufferSize() int

BufferSize returns the memory size of the display buffer.

func (*SSD1306) Clear

func (ssd1306 *SSD1306) Clear()

Clear clears the display buffer.

func (*SSD1306) Display

func (ssd1306 *SSD1306) Display() error

func (*SSD1306) GetOptions

func (ssd1306 *SSD1306) GetOptions() *SSD1306Options

func (*SSD1306) Init

func (ssd1306 *SSD1306) Init(i2c *i2c.I2C, options *SSD1306Options) (*SSD1306, error)

Init creates the new PCA9685 driver with specified i2c interface and options

func (*SSD1306) Off

func (ssd1306 *SSD1306) Off() error

Off turns the display off.

func (*SSD1306) On

func (ssd1306 *SSD1306) On() error

On turns the display on.

func (*SSD1306) Reset

func (ssd1306 *SSD1306) Reset() error

Reset clears display.

func (*SSD1306) SetBDisplayBuffer

func (ssd1306 *SSD1306) SetBDisplayBuffer(buf []byte)

SetBDisplayBuffer the display buffer to a byte array

func (*SSD1306) SetContrast

func (ssd1306 *SSD1306) SetContrast(contrast byte) error

func (*SSD1306) SetPixel

func (ssd1306 *SSD1306) SetPixel(x, y, c int)

SetPixel sets a pixel in the buffer.

func (*SSD1306) ShowImage

func (ssd1306 *SSD1306) ShowImage(img image.Image) (err error)

type SSD1306Init

type SSD1306Init struct {
	// contains filtered or unexported fields
}

func (*SSD1306Init) GetSequence

func (ssd1306Init *SSD1306Init) GetSequence(screenFlipped bool) []byte

func (*SSD1306Init) Init128X32

func (ssd1306Init *SSD1306Init) Init128X32() *SSD1306Init

func (*SSD1306Init) Init128X64

func (ssd1306Init *SSD1306Init) Init128X64() *SSD1306Init

func (*SSD1306Init) Init96X16

func (ssd1306Init *SSD1306Init) Init96X16() *SSD1306Init

type SSD1306Options

type SSD1306Options struct {
	Name        string
	Width       int
	Height      int
	PageSize    int
	ExternalVCC bool
}

Directories

Path Synopsis
Before usage you should load the i2c-dev kernel module
Before usage you should load the i2c-dev kernel module

Jump to

Keyboard shortcuts

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