aboutsummaryrefslogtreecommitdiff
path: root/busdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'busdevice.h')
-rw-r--r--busdevice.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/busdevice.h b/busdevice.h
new file mode 100644
index 0000000..580cda8
--- /dev/null
+++ b/busdevice.h
@@ -0,0 +1,35 @@
+
+//HW interface to phyiscal bus device
+
+#ifndef SM_BUSDEVICE
+#define SM_BUSDEVICE
+
+#include "simplemotion.h"
+#include "simplemotion_private.h"
+
+typedef smint8 smbusdevicehandle;
+
+#define SM_BAUDRATE 460800
+
+//ie "COM1" "VSD2USB"
+//return 0-1 if fails, otherwise handle number
+smbusdevicehandle smBDOpen( const char *devicename );
+
+//return true if ok
+smbool smBDClose( const smbusdevicehandle handle );
+
+//write one byte to trasmit buffer. send data with smBDTransmit()
+//returns smtrue on success. smfalse could mean buffer full error if forgot to call smBDTransmit
+smbool smBDWrite( const smbusdevicehandle handle , const smuint8 byte );
+
+//write transmit buffer to physical device
+//returns true on success
+smbool smBDTransmit(const smbusdevicehandle handle);
+
+//read one byte from bus. if byte not immediately available, block return up to SM_READ_TIMEOUT millisecs to wait data
+//returns true if byte read sucessfully
+smbool smBDRead( const smbusdevicehandle handle , smuint8 *byte );
+
+
+
+#endif