Commit 080b139a authored by rswindell's avatar rswindell
Browse files

Added get/set baud rate functions.

parent 41776908
......@@ -69,6 +69,8 @@ extern "C" {
COM_HANDLE comOpen(const char* device);
BOOL comClose(COM_HANDLE);
long comGetBaudRate(COM_HANDLE);
BOOL comSetBaudRate(COM_HANDLE, ulong rate);
int comGetModemStatus(COM_HANDLE);
int comRaiseDTR(COM_HANDLE);
int comLowerDTR(COM_HANDLE);
......
......@@ -69,6 +69,28 @@ BOOL comClose(COM_HANDLE handle)
return CloseHandle(handle);
}
long comGetBaudRate(COM_HANDLE handle)
{
DCB dcb;
if(GetCommState(handle, &dcb)!=TRUE)
return COM_ERROR;
return dcb.BaudRate;
}
BOOL comSetBaudRate(COM_HANDLE handle, unsigned long rate)
{
DCB dcb;
if(GetCommState(handle, &dcb)!=TRUE)
return FALSE;
dcb.BaudRate=rate;
return SetCommState(handle, &dcb);
}
int comGetModemStatus(COM_HANDLE handle)
{
DWORD status=0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment