diff options
Diffstat (limited to 'simplemotion.h')
| -rw-r--r-- | simplemotion.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/simplemotion.h b/simplemotion.h index c189af8..38d97e8 100644 --- a/simplemotion.h +++ b/simplemotion.h @@ -46,10 +46,18 @@ typedef int32_t smint32; typedef int16_t smint16;
typedef int8_t smint8;
typedef int8_t smbool;
+typedef smint32 smint;
#define smtrue 1
#define smfalse 0
typedef int SM_STATUS;
typedef smuint8 smaddr;
+typedef struct
+{
+ smbool is_simplemotion_device;//smtrue if usable in SM lib
+ char device_name[64];//name that should be fed to smOpenBus
+ char description[128];//such as "SimpleMotion USB"
+} SM_BUS_DEVICE_INFO;
+
//comment out to disable, gives smaller & faster code
#define ENABLE_DEBUG_PRINTS
@@ -91,7 +99,10 @@ LIB smbus smOpenBus( const char * devicename ); LIB void smSetBaudrate( unsigned long pbs );
/** Set timeout of how long to wait reply packet from bus. Must be set before smOpenBus and cannot be changed afterwards
- * max value 5000ms. In unix this is rounded to 100ms (rounding downwards), so 99 or less gives 0ms timeout.
+ * max value 5000ms. Range may depend on underyling OS / drivers. If supplied argument is lower than minimum supported by drivers,
+ * then driver minimum is used without notice (return SM_OK).
+ *
+ * In unix PC serial port minimum is 100ms, on Windows serial port recommended minimum is 30ms and with FTDI driver 10ms. On TCP/IP: TBD.
*
*This is the only function that returns SM_STATUS which doesn't accumulate status bits to be read with getCumulativeStatus because it has no bus handle
*/
@@ -147,6 +158,28 @@ LIB SM_STATUS smGetBufferClock( const smbus handle, const smaddr targetaddr, smu *content are application specific and defined . */
LIB SM_STATUS smFastUpdateCycle( smbus handle, smuint8 nodeAddress, smuint16 write1, smuint16 write2, smuint16 *read1, smuint16 *read2);
+/** Return number of bus devices found. details of each device may be consequently fetched by smGetBusDeviceDetails() */
+LIB smint smGetNumberOfDetectedBuses();
+
+/** Fetch information of detected bus nodes at certain index. Example:
+
+ smint num=smGetNumberOfDetectedBuses();
+ for(int i=0;i<num;i++)
+ {
+ SM_BUS_DEVICE_INFO info;
+ SM_STATUS s=smGetBusDeviceDetails(i,&info);
+ if(s==SM_OK)
+ {
+ ...do something with info...
+ }
+ else
+ {
+ ...report error...
+ }
+ }
+*/
+LIB SM_STATUS smGetBusDeviceDetails( smint index, SM_BUS_DEVICE_INFO *info );
+
#ifdef __cplusplus
}
#endif
|
