envea CAIRSENS PM Série Notice Technique page 57

Table des Matières

Publicité

Les langues disponibles

Les langues disponibles

20
Cairsens - UART Version
int
rs_close(void* port)
{
HANDLE h = (HANDLE)port;
CloseHandle(h);
return
0;
}
int
rs_setattr(void* port)
{
DCB dcb;
HANDLE h = (HANDLE)port;
ZeroMemory(&dcb, sizeof(dcb));
dcb.DCBlength = sizeof(dcb);
GetCommState(h, &dcb);
dcb.fBinary = TRUE;
dcb.BaudRate = CBR_9600;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
//Setup the flow control
dcb.fDsrSensitivity = FALSE;
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
if(!SetCommState(h, &dcb))
return
return
0;
}
int
rs_write(void* port,
{
DWORD n = 0;
HANDLE h = (HANDLE)port;
if(!WriteFile(h, data, bytes, &n, NULL))
return
return
n;
}
int
rs_read(void* port, void* data,
{
DWORD n = 0;
HANDLE h = (HANDLE)port;
if(!ReadFile(h, data, bytes, &n, NULL))
return
return
n;
}
int
rs_flush(void* port)
{
HANDLE h = (HANDLE)port;
FlushFileBuffers(h);
return
0;
}
int
rs_bytesWaiting(void* port)
{
//Check to see how many characters are unread
COMSTAT stat;
DWORD dwErrors = 0;
HANDLE h = (HANDLE)port;
if
(!ClearCommError(h, &dwErrors, &stat))
{
-1;
const
void* data,
int
-1;
int
bytes)
-1;
bytes)
© 2016 Cairpol

Publicité

Chapitres

Table des Matières
loading

Ce manuel est également adapté pour:

Cairsens pm1Cairsens pm2.5Cairsens pm10

Table des Matières