coptonixrs232i2c

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 10 Imported by: 0

README

coptonix-rs232-i2c

Documentation

Index

Constants

View Source
const (
	DefaultReadTimeout = 5 * time.Second
	DefaultDelay       = 10 * time.Millisecond
)

Variables

View Source
var (
	ErrInvalidChecksum  = fmt.Errorf("invalid checksum")
	ErrChecksumMismatch = fmt.Errorf("checksum mismatch")
)
View Source
var (
	ErrInvalidResponse   = fmt.Errorf("invalid response")
	ErrInterruptDetected = fmt.Errorf("interrupt detected")
	ErrChecksumError     = fmt.Errorf("checksum error")
	ErrUnknownCommand    = fmt.Errorf("unknown command")
	ErrCommandMismatch   = fmt.Errorf("command mismatch")
)

Functions

func DefaultMode

func DefaultMode() serial.Mode

func OpenSerialPort

func OpenSerialPort(portName string, mode *serial.Mode, readTimeout time.Duration) (serial.Port, error)

Types

type Dev

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

func New

func New(port serial.Port, delay time.Duration) *Dev

func (*Dev) CheckSlaveAddress

func (dev *Dev) CheckSlaveAddress(addr uint8) (bool, error)

func (*Dev) Close

func (dev *Dev) Close() error

func (*Dev) GetSCLFrequency

func (dev *Dev) GetSCLFrequency() (uint32, error)

func (*Dev) ReadI2C

func (dev *Dev) ReadI2C(addr uint8, bytesToRead uint8) ([]uint8, bool, error)

func (*Dev) ScanI2C

func (dev *Dev) ScanI2C() ([]uint8, error)

func (*Dev) SetSCLFrequency

func (dev *Dev) SetSCLFrequency(freq uint32) (uint32, error)

func (*Dev) WriteI2C

func (dev *Dev) WriteI2C(addr uint8, data []uint8) (bool, error)

Directories

Path Synopsis
tools
cli command

Jump to

Keyboard shortcuts

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