Documentation
¶
Overview ¶
A wrapper library for Microchip's MCP2210 USB-to-SPI Bridge. It is heavly based on github.com/GeertJohan/go.hid.
Index ¶
- Constants
- type MCP2210
- func (this *MCP2210) Close()
- func (this *MCP2210) GetBytesPerTransfer() int
- func (this *MCP2210) GetGPIOValue(pin uint16) (uint8, error)
- func (this *MCP2210) GetInterruptCount() (uint16, error)
- func (this *MCP2210) GetSPIClock() uint32
- func (this *MCP2210) ReadEEPROM(address byte) (byte, error)
- func (this *MCP2210) SetGPIOValue(pin uint16, state uint16) error
- func (this *MCP2210) WriteEEPROM(address byte, data byte) error
- func (this *MCP2210) Xfer(sendBuffer []byte) ([]byte, error)
Constants ¶
View Source
const ( // Pin direction: input DirectionIn = 0x00 // Pin direction: output DirectionOut = 0x01 // Pin value: inactive/low ValueInactive = 0x00 // Pin value: active/high ValueActive = 0x01 // Pin function: GPIO FunctionGPIO = 0x00 // Pin function: SPI Chip-Select FunctionChipSelect = 0x01 // Pin function: Alternative FunctionAlternative = 0x02 )
GPIO constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MCP2210 ¶
type MCP2210 struct {
// contains filtered or unexported fields
}
func (*MCP2210) GetBytesPerTransfer ¶
func (*MCP2210) GetGPIOValue ¶
Get the current value of a GPIO pin. Returns ValueInactive or ValueActive.
func (*MCP2210) GetInterruptCount ¶
Gets the external interrupt counter value and resets it to zero. Interrupt signaling is available on GP6, if it is configured with alternative pin function.
func (*MCP2210) GetSPIClock ¶
Returns the currently used SPI clock in Hz.
func (*MCP2210) ReadEEPROM ¶
Reads the byte stored at a specific address in EEPROM.
func (*MCP2210) SetGPIOValue ¶
Sets the value of a GPIO pin. pin Number of the pin to set. state New pinstate, use ValueInactive or ValueActive
func (*MCP2210) WriteEEPROM ¶
Writes data to the specified Address in EEPROM.
Click to show internal directories.
Click to hide internal directories.