pca9548

package
v3.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package pca9548 is a driver for an 8 port I²C multiplexer that is available from multiple vendors. The main features of this multiplexer is that its has 8 channels and is capable of voltage level translation.

Adjusting the Bus CLK

The bus clock is slaved to the master bus clock, different clock for each port is currently not supported. The Maximum clock for this device is 400kHz.

Datasheet

https://www.nxp.com/docs/en/data-sheet/PCA9548A.pdf

Index

Constants

This section is empty.

Variables

View Source
var DefaultOpts = Opts{Addr: 0x70}

DefaultOpts is the recommended default options.

Functions

This section is empty.

Types

type Dev

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

Dev is handle to a pca9548 I²C Multiplexer.

func New

func New(bus i2c.Bus, opts *Opts) (*Dev, error)

New creates a new handle to a pca9548 I²C multiplexer.

func (*Dev) Halt

func (d *Dev) Halt() error

Halt does nothing.

func (*Dev) RegisterPorts

func (d *Dev) RegisterPorts(alias string) ([]string, error)

RegisterPorts registers multiplexer ports with the host. These ports can then be used as any other i2c.Bus. Busses will be named "alias0", "alias1" etc. If using more than one multiplexer note that the alias must be unique. Returns slice of ports names registered and error.

func (*Dev) String

func (d *Dev) String() string

String returns the bus base name for multiplexer ports.

type Opts

type Opts struct {
	// Addr is the pca9548 I²C Address. Valid addresses for the NXP pca9548 are
	// 0x70 to 0x77. The address is set by pulling A0~A2 low or high. Please
	// refer to the datasheet.
	Addr int
}

Opts is the pca9548 configuration.

Jump to

Keyboard shortcuts

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