gopicontrol

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PICONTROL_DEVICE               = "/dev/piControl0"
	KB_RESET                       = 0x4b0c
	KB_GET_DEVICE_INFO             = 0x4b0e
	KB_GET_DEVICE_INFO_LIST        = 0x4b0d
	KB_GET_VALUE                   = 0x4b0f
	KB_SET_VALUE                   = 0x4b10
	KB_FIND_VARIABLE               = 0x4b11
	KB_DIO_RESET_COUNTER           = 0x4b14
	KB_UPDATE_DEVICE_FIRMWARE      = 0x4b13
	KB_GET_LAST_MESSAGE            = 0x4b15
	KB_INTERN_IO_MSG               = 0x4b65
	KB_WAIT_FOR_EVENT              = 0x4b32
	PICONTROL_NOT_CONNECTED        = 0x8000
	PICONTROL_NOT_CONNECTED_MASK   = 0x7fff
	PICONTROL_SW_MODBUS_TCP_SLAVE  = 0x6001
	PICONTROL_SW_MODBUS_RTU_SLAVE  = 0x6002
	PICONTROL_SW_MODBUS_TCP_MASTER = 0x6003
	PICONTROL_SW_MODBUS_RTU_MASTER = 0x6004
)

Variables

This section is empty.

Functions

func ByteToUint8Array

func ByteToUint8Array(s []byte) (r [32]uint8)

ByteToUint8Array converts a byte slice to a uint8 array.

func GetModuleName

func GetModuleName(moduletype uint16) string

GetModuleName returns a friendly name for a RevPi module type.

func IsModuleConnected

func IsModuleConnected(moduletype uint16) bool

IsModuleConnected checks whether a RevPi module is conneted.

func NumToBytes

func NumToBytes(num interface{}) ([]byte, error)

NumToBytes converts a generic fixed-size value to its byte representation.

Types

type RevPiControl

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

RevPiControl is an object representing an open file handle to the piControl driver file descriptor.

func NewRevPiControl

func NewRevPiControl() *RevPiControl

NewRevPiControl creates a new RevPiControl object.

func (*RevPiControl) Close

func (c *RevPiControl) Close() (err error)

Close closes the file handle.

func (*RevPiControl) FindVariable

func (c *RevPiControl) FindVariable(name string) (found bool)

FindVariable checks if a variable with a specific name exists.

func (*RevPiControl) GetBitValue

func (c *RevPiControl) GetBitValue(pSpiValue *SPIValue) (err error)

GetBitValue gets the value of one bit in the process image.

func (*RevPiControl) GetDeviceInfo

func (c *RevPiControl) GetDeviceInfo(devInfo *SDeviceInfo) (result int, err error)

GetDeviceInfo gets a description of a connected device.

func (*RevPiControl) GetDeviceInfoList

func (c *RevPiControl) GetDeviceInfoList() (devInfo []SDeviceInfo, err error)

GetDeviceInfoList gets a description of connected devices as an array of 20 elements. Returns the number of detected devices.

func (*RevPiControl) GetVariableInfo

func (c *RevPiControl) GetVariableInfo(name string) (pSpiVariable *SPIVariable, err error)

GetVariableInfo gets information about a variable by name.

func (*RevPiControl) Open

func (c *RevPiControl) Open() (err error)

Open opens the file handle. see also: golang.org/x/sys/unix/syscall_unix_test.go

func (*RevPiControl) Read

func (c *RevPiControl) Read(offset uint32, pData []byte) (n int, err error)

Read gets process data from a specific position, reads len(pData) bytes from file. Returns number of bytes read or error.

func (*RevPiControl) Reset

func (c *RevPiControl) Reset() (err error)

Reset initializes the Pi Control Interface.

func (*RevPiControl) ResetCounter

func (c *RevPiControl) ResetCounter(address uint8, bitfield uint16) (result int, err error)

ResetCounter resets a counter.

func (*RevPiControl) SetBitValue

func (c *RevPiControl) SetBitValue(pSpiValue *SPIValue) (err error)

SetBitValue sets the value of one bit in the process image.

func (*RevPiControl) UpdateFirmware

func (c *RevPiControl) UpdateFirmware(addrP uint32) (result int, err error)

UpdateFirmware update a device firmware, check on the Kunubs website for details about updating firmware.

func (*RevPiControl) WaitForEvent

func (c *RevPiControl) WaitForEvent() (err error)

WaitForEvent waits for Reset of Pi Control Interface

func (*RevPiControl) Write

func (c *RevPiControl) Write(offset uint32, pData []byte) (n int, err error)

Write writes process data at a specific position, writes len(pData) bytes to file. Returns number of bytes read or error

type SDIOResetCounter

type SDIOResetCounter struct {
	I8uAddress   uint8
	Pad_cgo_0    [1]byte
	I16uBitfield uint16
}

type SDeviceInfo

type SDeviceInfo struct {
	I8uAddress       uint8
	Pad_cgo_0        [3]byte
	I32uSerialnumber uint32
	I16uModuleType   uint16
	I16uHW_Revision  uint16
	I16uSW_Major     uint16
	I16uSW_Minor     uint16
	I32uSVN_Revision uint32
	I16uInputLength  uint16
	I16uOutputLength uint16
	I16uConfigLength uint16
	I16uBaseOffset   uint16
	I16uInputOffset  uint16
	I16uOutputOffset uint16
	I16uConfigOffset uint16
	I16uFirstEntry   uint16
	I16uEntries      uint16
	I8uModuleState   uint8
	I8uActive        uint8
	I8uReserve       [30]uint8
	Pad_cgo_1        [2]byte
}

type SEntryInfo

type SEntryInfo struct {
	I8uAddress    uint8
	I8uType       uint8
	I16uIndex     uint16
	I16uBitLength uint16
	I8uBitPos     uint8
	Pad_cgo_0     [1]byte
	I16uOffset    uint16
	Pad_cgo_1     [2]byte
	I32uDefault   uint32
	StrVarName    [32]uint8
}

type SPIValue

type SPIValue struct {
	I16uAddress uint16
	I8uBit      uint8
	I8uValue    uint8
}

type SPIVariable

type SPIVariable struct {
	StrVarName  [32]uint8
	I16uAddress uint16
	I8uBit      uint8
	Pad_cgo_0   [1]byte
	I16uLength  uint16
}

Jump to

Keyboard shortcuts

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