diff options
| author | Tero Kontkanen <tero.kontkanen@granitedevices.fi> | 2016-10-28 15:18:37 +0300 |
|---|---|---|
| committer | Tero Kontkanen <tero.kontkanen@granitedevices.fi> | 2016-10-28 15:18:37 +0300 |
| commit | f629f3a69e092a9299fd0d70dddd2efa6bbee2e7 (patch) | |
| tree | 0392c5a173b9f5e32115b764ceafcb559d2d2ef3 /simplemotion.c | |
| parent | 0490facebd118837d821d8d382dafc16cba475dc (diff) | |
| parent | fa9c9212d7e25e9eacbbfcc4e6a516b4d48ebbb5 (diff) | |
| download | SimpleMotionV2-f629f3a69e092a9299fd0d70dddd2efa6bbee2e7.tar.gz SimpleMotionV2-f629f3a69e092a9299fd0d70dddd2efa6bbee2e7.zip | |
Merge branch 'develop'
Diffstat (limited to 'simplemotion.c')
| -rw-r--r-- | simplemotion.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/simplemotion.c b/simplemotion.c index cea0238..ea773ac 100644 --- a/simplemotion.c +++ b/simplemotion.c @@ -222,6 +222,27 @@ smbus smOpenBus( const char * devicename ) return handle;
}
+/** Change baudrate of SM communication port. This does not affect already opened ports but the next smOpenBus will be opened at the new speed.
+ Calling this is optional. By default SM bus and all slave devices operates at 460800 BPS speed.
+ Parameters:
+ -bps: bus speed in bits per second. for possible choices, see rs232.c (but note that all speeds are not necessarily supported by SM devices)
+ Typical usage is:
+ - first call smSetParameter(handle,0,SMP_BUS_SPEED,N) to change speed of all connected slaves to N PBS
+ - then close port with smCloseBus
+ - then call smSetBaudrate(N)
+ - then open bus again with smOpenBus
+
+ Note that in upcoming SM device firmware versions, bitrate will be reset to default (460800) if device side SM bus watchdog timer has been enabled, and it timeouts.
+ This allows re-establishing connection at defautl speed if connection breaks up and SM bus watchdog timeout gets exceeded. To identify is device supports this,
+ read parameter SMP_SM_VERSION. Values above 25 support this feature. Value 25 and below will not reset baudrate.
+
+ Note also that SMP_BUS_SPEED will not be saved in device flash memory - it will reset to default at every reset & power on.
+ */
+LIB void smSetBaudrate( unsigned long pbs )
+{
+ SMBusBaudrate=pbs;
+}
+
/** Close connection to given bus handle number. This frees communication link therefore makes it available for other apps for opening.
-return value: a SM_STATUS value, i.e. SM_OK if command succeed
*/
|
