ft260

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ft260

FTDI FT260 Go library.

Written primarily to support Linux kernels that do not include FTDI FT260 USB HID to I2C host support.

Uses https://pkg.go.dev/github.com/bearsh/hid

Documentation

Index

Constants

View Source
const (
	VendorID  = 0x0403 // VendorID is the USB vendor ID.
	ProductID = 0x6030 // ProductID is the USB product ID.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChipVersion

type ChipVersion struct {
	ChipCode []byte
	Reserved []byte
}

ChipVersion contains the results of a Chip Version operation.

type Dev

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

Dev is the device handle.

func New

func New(dev *hid.Device) *Dev

New creates a new device handle.

func (*Dev) ChipVersion

func (dev *Dev) ChipVersion() (*ChipVersion, error)

ChipVersion performs a Chip Version operation.

func (*Dev) Close

func (dev *Dev) Close() error

Close closes the device.

func (*Dev) GetSystemStatus

func (dev *Dev) GetSystemStatus() (*SystemStatus, error)

GetSystemStatus performs a Get System Status operation.

func (*Dev) I2CInputReport

func (dev *Dev) I2CInputReport() ([]byte, error)

I2CInputReport performs an I²C Input Report operation.

func (*Dev) I2CInputReportWithTimeout added in v0.3.0

func (dev *Dev) I2CInputReportWithTimeout(timeout int) ([]byte, error)

I2CInputReportWithTimeout performs an I²C Input Report operation with timeout (ms). If timeout is -1, a blocking read is performed.

func (*Dev) I2CReadRequest

func (dev *Dev) I2CReadRequest(slaveAddr uint8, flag I2CCondition, dataLength uint16) error

I2CReadRequest performs an I²C Read Request operation.

func (*Dev) I2CReset

func (dev *Dev) I2CReset() error

I2CReset performs a I²C Reset operation.

func (*Dev) I2CWriteRequest

func (dev *Dev) I2CWriteRequest(slaveAddr uint8, data []byte, flag I2CCondition) (int, error)

I2CWriteRequest performs an I²C Write Request operation.

func (*Dev) SetI2CClockSpeed

func (dev *Dev) SetI2CClockSpeed(speedInKhz uint16) error

SetI2CClockSpeed performs a Set I²C Clock Speed operation.

func (*Dev) SetI2CMode

func (dev *Dev) SetI2CMode(enable bool) error

SetI2CMode performs a Set I2C Mode operation.

type I2CCondition

type I2CCondition uint8
const (
	I2CConditionNone          I2CCondition = 0
	I2CConditionStart         I2CCondition = 0x02
	I2CConditionRepeatedStart I2CCondition = 0x03
	I2CConditionStop          I2CCondition = 0x04
	I2CConditionStartAndStop  I2CCondition = 0x06
)

type SystemClockSpeed

type SystemClockSpeed uint8
const (
	SystemClockSpeed12MHz SystemClockSpeed = 0
	SystemClockSpeed24MHz SystemClockSpeed = 1
	SystemClockSpeed48MHz SystemClockSpeed = 2
)

type SystemStatus

type SystemStatus struct {
	ChipMode          uint8
	ClkCtl            SystemClockSpeed
	SuspendStatus     bool
	PowerEnableStatus bool
	I2CEnable         bool
	UARTMode          UARTMode
	HIDOverI2CEnable  bool
	GPIO2Function     uint8
	GPIOAFunction     uint8
	GPIOGFunction     uint8
	SuspendOutPol     uint8
	EnableWakeupInt   bool
	IntrCond          uint8
	EnablePowerSaving bool
	Reserved          []byte
}

SystemStatus contains the results of a Get System Status operation.

type UARTMode

type UARTMode uint8
const (
	UARTModeOff           UARTMode = 0
	UARTModeCtsRts        UARTMode = 1
	UARTModeDtrDts        UARTMode = 2
	UARTModeXonXoff       UARTMode = 3
	UARTModeNoFlowControl UARTMode = 4
)

Directories

Path Synopsis
tools
cli command

Jump to

Keyboard shortcuts

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