aboutsummaryrefslogtreecommitdiff
path: root/busdevice.c
diff options
context:
space:
mode:
authorTero Kontkanen <tero.kontkanen@granitedevices.fi>2016-10-28 15:18:18 +0300
committerTero Kontkanen <tero.kontkanen@granitedevices.fi>2016-10-28 15:18:18 +0300
commitfa9c9212d7e25e9eacbbfcc4e6a516b4d48ebbb5 (patch)
treee243901845512055513c8e8522ac6243e4e0eb04 /busdevice.c
parentce55c8a4227539f4d4f57f7acc4aaff1d18c0001 (diff)
downloadSimpleMotionV2-fa9c9212d7e25e9eacbbfcc4e6a516b4d48ebbb5.tar.gz
SimpleMotionV2-fa9c9212d7e25e9eacbbfcc4e6a516b4d48ebbb5.zip
Added smSetBaudrate() to allow changing bus speed
Diffstat (limited to 'busdevice.c')
-rw-r--r--busdevice.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/busdevice.c b/busdevice.c
index 9bf82c8..c82e27b 100644
--- a/busdevice.c
+++ b/busdevice.c
@@ -10,6 +10,8 @@
//how much bytes available in transmit buffer
#define TANSMIT_BUFFER_LENGTH 128
+unsigned long SMBusBaudrate=SM_BAUDRATE; //the next opened port (with smOpenBus) will be opened with the PBS defined here (default 460800 BPS)
+
typedef struct _SMBusDevice
{
//common
@@ -65,7 +67,7 @@ smbusdevicehandle smBDOpen( const char *devicename )
if(strncmp(devicename,"COM",3) == 0 || strncmp(devicename,"/dev/tty",8) == 0) //use rs232 lib
{
- BusDevice[handle].comPort=OpenComport( devicename, SM_BAUDRATE );
+ BusDevice[handle].comPort=OpenComport( devicename, SMBusBaudrate );
if( BusDevice[handle].comPort == -1 )
{
return -1; //failed to open