diff options
| author | TeroK <tero.k@granitedevices.fi> | 2014-01-16 14:28:27 -0800 |
|---|---|---|
| committer | TeroK <tero.k@granitedevices.fi> | 2014-01-16 14:28:27 -0800 |
| commit | 2ad7a9271d4336a988b78caf13252da3e0ff0f5a (patch) | |
| tree | afb06ccbb3966332e381f36fa5dd9d296b091e80 /busdevice.h | |
| parent | 575c3105208ed61dd34769f7917533417899e998 (diff) | |
| download | SimpleMotionV2-2ad7a9271d4336a988b78caf13252da3e0ff0f5a.tar.gz SimpleMotionV2-2ad7a9271d4336a988b78caf13252da3e0ff0f5a.zip | |
first release
Diffstat (limited to 'busdevice.h')
| -rw-r--r-- | busdevice.h | 35 |
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 |
