-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrs232.cc
51 lines (41 loc) · 1002 Bytes
/
rs232.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
***********************************************
*
* Author: Frank Andre Moreno Vera
*
* Copyright (C) 2014 Frank Andre Moreno Vera
*
*
***********************************************
*/
#ifndef kranfix_rs232_rs232_cc
#define kranfix_rs232_rs232_cc
#include "rs232.h"
// Only for testing purpouse
//#undef __cplusplus
//#undef __linux__
#ifndef __cplusplus
# ifdef __linux__
# include "rs232_linux.c"
# else
# include "rs232_win.c"
# endif
int kfx_RS232_IsAvailable(kfx_RS232 * h) { return h->available; }
void kfx_rs232_Print(kfx_RS232 * h, const char *text) /* sends a string to serial port */
{
while(*text != 0) kfx_rs232_WriteByte(h, *(text++));
}
#else
# ifdef __linux__
# include "rs232_linux.cc"
# else
# include "rs232_win.cc"
# endif // __linux__
// Sends a string to serial port till finding a '\0'
void kfx::RS232::Print(const char *text)
{
while(*text != 0) Write( *(text++) );
}
#endif // __cplusplus
#endif // kranfix_rs232_rs232_cc