Overview
This group defines all required functions to initialize a correct communication via Common Serial Interface (CSI)
Functions | |
CSI_API long | CsiClose (struct CsiBus *pBus) |
Closes the serial connection and frees allocated resources. More... | |
CSI_API long | CsiConnectToDevice (struct CsiBus *pBus, const char *SerialDeviceName, uint32_t BaudRate, uint32_t TimeoutMs, struct CsiDev *pDev, uint8_t NodeId) |
The function initializes the bus object (pBus), the serial channel object (pChan) with the baud rate and timeout values and opens the serial connection to the device. More... | |
CSI_API long | CsiDevInit (struct CsiBus *pBus, uint8_t NodeId, struct CsiDev *pDev, enum CsiSerialProtocolVersion SerProtocolVersion) |
Initialize CSI device object with all parameters. More... | |
CSI_API long | CsiOpen (struct CsiBus *pBus, const char *DeviceName, uint32_t BaudRate, uint32_t TimeoutMs) |
Initialize CSI API and connection to CSI bus. More... | |
CSI_API long | CsiSetCommTimout (struct CsiBus *pBus, uint32_t TimeoutMs) |
Set timeout in milliseconds for bus communication (read/write). More... | |
Function Documentation
CSI_API long CsiClose | ( | struct CsiBus * | pBus | ) |
Closes the serial connection and frees allocated resources.
- Parameters
-
[in] pBus Reference of bus object to finish communicaton.
- Returns
- Error code - ERR_NOERR indicates success
CSI_API long CsiConnectToDevice | ( | struct CsiBus * | pBus, |
const char * | SerialDeviceName, | ||
uint32_t | BaudRate, | ||
uint32_t | TimeoutMs, | ||
struct CsiDev * | pDev, | ||
uint8_t | NodeId | ||
) |
The function initializes the bus object (pBus), the serial channel object (pChan) with the baud rate and timeout values and opens the serial connection to the device.
If the SerialDeviceName is empty, the function tries to autodetect the serial channel by reading the object 0x1000.If a device responds to this request, the serial channel has been detected.
- Parameters
-
[in] pBus Bus object to initialize. [in] SerialDeviceName Name of the serial port device (i.e. COM1). If the value of SerialDeviceName is 0, the function tries to auto detect the serial channel. [in] BaudRate The baud rate in bit / s (baud). You should use standard baud rates from TStandardBaudRate enumeration [in] TimeoutMs The timeout in milliseconds for serial protocol. [in] pDev Pointer to the device object [in] NodeId Node identifier of the device to connect
- Returns
- Error code - CSI_ERR_NOERR indicates successful initialization
- See also
- CsiDevInit()
CSI_API long CsiDevInit | ( | struct CsiBus * | pBus, |
uint8_t | NodeId, | ||
struct CsiDev * | pDev, | ||
enum CsiSerialProtocolVersion | SerProtocolVersion | ||
) |
Initialize CSI device object with all parameters.
After a call to this function all other functions that require a valid device object can be called.
- Parameters
-
[in] pBus Reference of bus object the device is attached to [in] NodeId NodeId of devicer to initialize [in] pDev Reference to device object to initialize [in] SerProtocolVersion The serial protocol version to use for communication. The CSI library supports older device with th V1 protocol and newer devices, such as Nemesys S and Nemesys M with the new V2 protocol.
- Returns
- Error code - CSI_ERR_NOERR indicates successful initialization
Referenced by NemDevInit(), and NemV4DevInit().
CSI_API long CsiOpen | ( | struct CsiBus * | pBus, |
const char * | DeviceName, | ||
uint32_t | BaudRate, | ||
uint32_t | TimeoutMs | ||
) |
Initialize CSI API and connection to CSI bus.
The function initializes the bus object (pBus) and the serial channel object (pChan) with the baud rate and timeout values and opens the serial connection to the device. A valid bus object is required for calls to function CsiDevInit().
- Parameters
-
[in] pBus Bus object to initialize. [in] DeviceName May Name of the serial port device (i.e. COM1) [in] BaudRate The baud rate in bit / s (baud). You should use standard baud rates from TStandardBaudRate enumeration [in] TimeoutMs The timeout in milliseconds for serial protocol.
- Returns
- Error code - CSI_ERR_NOERR indicates successful initialization
- See also
- CsiDevInit()
CSI_API long CsiSetCommTimout | ( | struct CsiBus * | pBus, |
uint32_t | TimeoutMs | ||
) |
Set timeout in milliseconds for bus communication (read/write).
- Parameters
-
[in] pBus Reference of bus object the device is attached to [in] TimeoutMs Timeout value in milliseconds
- Returns
- Error code - CSI_ERR_NOERR indicates successful initialization