Documentation
¶
Index ¶
- Constants
- func ByteToUint8Array(s []byte) (r [32]int8)
- func GetModuleName(moduletype uint16) string
- func IsModuleConnected(moduletype uint16) bool
- func NumToBytes(num interface{}) ([]byte, error)
- type RevPiControl
- func (c *RevPiControl) Close() (err error)
- func (c *RevPiControl) FindVariable(name string) (found bool)
- func (c *RevPiControl) GetBitValue(pSpiValue *SPIValue) (err error)
- func (c *RevPiControl) GetDeviceInfo(devInfo *SDeviceInfo) (result int, err error)
- func (c *RevPiControl) GetDeviceInfoList() (devInfo []SDeviceInfo, err error)
- func (c *RevPiControl) GetVariableInfo(name string) (pSpiVariable *SPIVariable, err error)
- func (c *RevPiControl) Open() (err error)
- func (c *RevPiControl) Read(offset uint32, pData []byte) (n int, err error)
- func (ctrl *RevPiControl) ReadAI(name string) (v uint32, err error)
- func (ctrl *RevPiControl) ReadDI(name string) (v bool, err error)
- func (c *RevPiControl) Reset() (err error)
- func (c *RevPiControl) ResetCounter(address uint8, bitfield uint16) (result int, err error)
- func (c *RevPiControl) SetBitValue(pSpiValue *SPIValue) (err error)
- func (c *RevPiControl) UpdateFirmware(addrP uint32) (result int, err error)
- func (c *RevPiControl) WaitForEvent() (err error)
- func (c *RevPiControl) Write(offset uint32, pData []byte) (n int, err error)
- func (ctrl *RevPiControl) WriteAO(name string, v uint32) (err error)
- func (ctrl *RevPiControl) WriteDO(name string, v bool) (err error)
- type SDIOResetCounter
- type SDeviceInfo
- type SEntryInfo
- type SPIValue
- type SPIVariable
Constants ¶
const ( PICONTROL_DEVICE = "/dev/piControl0" REV_PI_DEV_FIRST_RIGHT = 0x20 REV_PI_DEV_CNT_MAX = 0x40 REV_PI_ERROR_MSG_LEN = 0x100 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 PICONTROL_UPLOAD_FIRMWARE = 0x40084bc8 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 ¶
ByteToUint8Array converts a byte slice to a uint8 array.
func GetModuleName ¶
GetModuleName returns a friendly name for a RevPi module type.
func IsModuleConnected ¶
IsModuleConnected checks whether a RevPi module is conneted.
func NumToBytes ¶
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) ReadAI ¶ added in v0.1.0
func (ctrl *RevPiControl) ReadAI(name string) (v uint32, err error)
func (*RevPiControl) ReadDI ¶ added in v0.1.0
func (ctrl *RevPiControl) ReadDI(name string) (v bool, err 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 SDeviceInfo ¶
type SDeviceInfo struct { I8uAddress uint8 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_0 [2]byte }