Documentation
¶
Index ¶
- Constants
- Variables
- func GetLibraryVersion() uint32
- type BitBang
- type BitMode
- type Device
- func (d *Device) Close() (e error)
- func (d *Device) GetStatus() (rx_queue, tx_queue, events int32, e error)
- func (d *Device) Purge() (e error)
- func (d *Device) Read(p []byte) (n int, e error)
- func (d *Device) Reset() (e error)
- func (d *Device) SetBaudRate(baud uint) (e error)
- func (d *Device) SetBitMode(mode BitMode) (e error)
- func (d *Device) SetChars(event, err byte) (e error)
- func (d *Device) SetFlowControl(f FlowControl) (e error)
- func (d *Device) SetLatency(latency int) (e error)
- func (d *Device) SetLineProperty(props LineProperties) (e error)
- func (d *Device) SetTimeout(read_timeout, write_timeout int) (e error)
- func (d *Device) SetTransferSize(read_size, write_size int) (e error)
- func (d *Device) Write(p []byte) (n int, e error)
- type DeviceInfo
- type FlowControl
- type LineProperties
- type Spi
- func (s *Spi) Read(b []byte) (n int, e error)
- func (s *Spi) ReadGPIO(state byte) (e error)
- func (s *Spi) SetClk(freq int) (e error)
- func (s *Spi) SetGPIO(outputs byte) (e error)
- func (s *Spi) Transfer(b []byte) (r []byte, e error)
- func (s *Spi) Write(b []byte) (n int, e error)
- func (s *Spi) WriteGPIO(state byte) (e error)
Constants ¶
View Source
const ( RESET BitMode = 0x00 ASYNC_BITBANG = 0x01 MPSSE = 0x02 SYNC_BITBANG = 0x04 HOST_EMU = 0x08 FAST_OPTO = 0x10 CBUS_BITBANG = 0x20 SYNCHRONOUS = 0x40 )
View Source
const ( DISABLED FlowControl = 0x0000 RTS_CTS = 0x0100 DTR_DSR = 0x0200 XON_XOFF = 0x0400 )
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 ( DISABLE_X5 = 0x8A ENABLE_X5 = 0x8B SET_CLK_DIV = 0x86 SET_LOW_BITS = 0x80 SPI_0_WRITE = 0x11 SPI_0_READ = 0x24 SPI_0_TXRX = 0x31 )
MPSSE Commands
View Source
const (
CHECK_RX_DELAY_MS = 200
)
View Source
const CHUNK_SIZE = 1 << 16
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 BitBang ¶
type BitBang struct {
// contains filtered or unexported fields
}
func InitializeBitBang ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(di DeviceInfo) (d *Device, e error)
func (*Device) SetBaudRate ¶
func (*Device) SetBitMode ¶
func (*Device) SetFlowControl ¶
func (d *Device) SetFlowControl(f FlowControl) (e error)
func (*Device) SetLatency ¶
func (*Device) SetLineProperty ¶
func (d *Device) SetLineProperty(props LineProperties) (e error)
func (*Device) SetTimeout ¶
func (*Device) SetTransferSize ¶
type DeviceInfo ¶
type DeviceInfo struct {
// 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
type LineProperties ¶
type LineProperties struct {
Bits bitsPerWord
StopBits stopBits
Parity parity
}
Click to show internal directories.
Click to hide internal directories.