ftdi

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 5 Imported by: 0 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.

Documentation

Index

Constants

View Source
const (
	BITS_8 bitsPerWord = 8
	BIST_7 bitsPerWord = 7
	STOP_1 stopBits    = 0
	STOP_2 stopBits    = 2
	NONE   parity      = 0
	ODD    parity      = 1
	EVEN   parity      = 2
	MARK   parity      = 3
	SPACE  parity      = 4
)
View Source
const (
	FT_OK                          = 0
	FT_INVALID_HANDLE              = 1
	FT_DEVICE_NOT_FOUND            = 2
	FT_DEVICE_NOT_OPENED           = 3
	FT_IO_ERROR                    = 4
	FT_INSUFFICIENT_RESOURCES      = 5
	FT_INVALID_PARAMETER           = 6
	FT_INVALID_BAUD_RATE           = 7
	FT_DEVICE_NOT_OPENED_FOR_ERASE = 8
	FT_DEVICE_NOT_OPENED_FOR_WRITE = 9
	FT_FAILED_TO_WRITE_DEVICE      = 10
	FT_EEPROM_READ_FAILED          = 11
	FT_EEPROM_WRITE_FAILED         = 12
	FT_EEPROM_ERASE_FAILED         = 13
	FT_EEPROM_NOT_PRESENT          = 14
	FT_EEPROM_NOT_PROGRAMMED       = 15
	FT_INVALID_ARGS                = 16
	FT_NOT_SUPPORTED               = 17
	FT_OTHER_ERROR                 = 18
)

FT_STATUS (DWORD)

View Source
const (
	CHECK_RX_DELAY_MS = 200
)

Variables

View Source
var (
	ErrInvalidHandle           = errors.New("FTDI :: Invalid device handle")
	ErrDeviceNotFound          = errors.New("FTDI :: Device not found")
	ErrDeviceNotOpened         = errors.New("FTDI :: Device not opened")
	ErrIO                      = errors.New("FTDI :: IO failed")
	ErrInsufficientResources   = errors.New("FTDI :: Insufficient resources")
	ErrInvalidParameter        = errors.New("FTDI :: Invalid parameter")
	ErrInvalidBaudRate         = errors.New("FTDI :: Invalid baud rate")
	ErrDeviceNotOpenedForErase = errors.New("FTDI :: Device not opened for erase")
	ErrDeviceNotOpenedForWrite = errors.New("FTDI :: Device not opened for write")
	ErrFailedToWriteDevice     = errors.New("FTDI :: Failed to write device")
	ErrEReadFailed             = errors.New("FTDI :: EEPROM read failed")
	ErrEWriteFailed            = errors.New("FTDI :: EEPROM write failed")
	ErrEEraseFailed            = errors.New("FTDI :: EEPROM erase failed")
	ErrENotPresent             = errors.New("FTDI :: EEPROM not present")
	ErrENotProgrammed          = errors.New("FTDI :: EEPROM not programmed")
	ErrInvalidArgs             = errors.New("FTDI :: Invalid arguments")
	ErrNotSupported            = errors.New("FTDI :: Device not supported")
	ErrOther                   = errors.New("FTDI :: Unknown FTDI error")
)

Functions

func GetLibraryVersion

func GetLibraryVersion() uint32

Return Library version, formatted to match D2XX

Types

type BitMode

type BitMode byte
const (
	RESET         BitMode = 0x00
	ASYNC_BITBANG BitMode = 0x01
	MPSSE         BitMode = 0x02
	SYNC_BITBANG  BitMode = 0x04
	HOST_EMU      BitMode = 0x08
	FAST_OPTO     BitMode = 0x10
	CBUS_BITBANG  BitMode = 0x20
	SYNCHRONOUS   BitMode = 0x40
)

type Device

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

func Open

func Open(di DeviceInfo) (d *Device, e error)

func (*Device) Close

func (d *Device) Close() (e error)

func (*Device) GetStatus

func (d *Device) GetStatus() (rx_queue, tx_queue, events int32, e error)

func (*Device) Purge

func (d *Device) Purge() (e error)

func (*Device) Read

func (d *Device) Read(p []byte) (n int, e error)

func (*Device) Reset

func (d *Device) Reset() (e error)

func (*Device) SetBaudRate

func (d *Device) SetBaudRate(baud uint) (e error)

func (*Device) SetBitMode

func (d *Device) SetBitMode(mode BitMode) (e error)

func (*Device) SetBreakOff

func (d *Device) SetBreakOff(props LineProperties) (e error)

func (*Device) SetBreakOn

func (d *Device) SetBreakOn(props LineProperties) (e error)

func (*Device) SetChars

func (d *Device) SetChars(event, err byte) (e error)

func (*Device) SetFlowControl

func (d *Device) SetFlowControl(f FlowControl) (e error)

func (*Device) SetLatency

func (d *Device) SetLatency(latency int) (e error)

func (*Device) SetLineProperty

func (d *Device) SetLineProperty(props LineProperties) (e error)

func (*Device) SetTimeout

func (d *Device) SetTimeout(read_timeout, write_timeout int) (e error)

func (*Device) SetTransferSize

func (d *Device) SetTransferSize(read_size, write_size int) (e error)

func (*Device) Write

func (d *Device) Write(p []byte) (n int, e error)

type DeviceInfo

type DeviceInfo struct {
	SerialNumber string
	Description  string
	// contains filtered or unexported fields
}

func GetDeviceList

func GetDeviceList() (dl []DeviceInfo, e error)

TODO: Need to expand multi-interface devices, and then to other FTDI chips

type FlowControl

type FlowControl uint16
const (
	DISABLED FlowControl = 0x0000
	RTS_CTS  FlowControl = 0x0100
	DTR_DSR  FlowControl = 0x0200
	XON_XOFF FlowControl = 0x0400
)

type LineProperties

type LineProperties struct {
	Bits     bitsPerWord
	StopBits stopBits
	Parity   parity
}

Jump to

Keyboard shortcuts

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