wiringPi Version 2 - First commit (of v2)

This commit is contained in:
Gordon Henderson
2013-05-13 19:43:26 +01:00
parent 98bcb20d93
commit da38443cb2
97 changed files with 11243 additions and 1617 deletions

View File

@@ -41,7 +41,7 @@
*********************************************************************************
*/
int serialOpen (char *device, int baud)
int serialOpen (const char *device, const int baud)
{
struct termios options ;
speed_t myBaud ;
@@ -60,6 +60,7 @@ int serialOpen (char *device, int baud)
case 1200: myBaud = B1200 ; break ;
case 1800: myBaud = B1800 ; break ;
case 2400: myBaud = B2400 ; break ;
case 4800: myBaud = B4800 ; break ;
case 9600: myBaud = B9600 ; break ;
case 19200: myBaud = B19200 ; break ;
case 38400: myBaud = B38400 ; break ;
@@ -116,7 +117,7 @@ int serialOpen (char *device, int baud)
*********************************************************************************
*/
void serialFlush (int fd)
void serialFlush (const int fd)
{
tcflush (fd, TCIOFLUSH) ;
}
@@ -128,7 +129,7 @@ void serialFlush (int fd)
*********************************************************************************
*/
void serialClose (int fd)
void serialClose (const int fd)
{
close (fd) ;
}
@@ -140,7 +141,7 @@ void serialClose (int fd)
*********************************************************************************
*/
void serialPutchar (int fd, unsigned char c)
void serialPutchar (const int fd, const unsigned char c)
{
write (fd, &c, 1) ;
}
@@ -152,7 +153,7 @@ void serialPutchar (int fd, unsigned char c)
*********************************************************************************
*/
void serialPuts (int fd, char *s)
void serialPuts (const int fd, const char *s)
{
write (fd, s, strlen (s)) ;
}
@@ -163,7 +164,7 @@ void serialPuts (int fd, char *s)
*********************************************************************************
*/
void serialPrintf (int fd, char *message, ...)
void serialPrintf (const int fd, const char *message, ...)
{
va_list argp ;
char buffer [1024] ;
@@ -182,7 +183,7 @@ void serialPrintf (int fd, char *message, ...)
*********************************************************************************
*/
int serialDataAvail (int fd)
int serialDataAvail (const int fd)
{
int result ;
@@ -201,7 +202,7 @@ int serialDataAvail (int fd)
*********************************************************************************
*/
int serialGetchar (int fd)
int serialGetchar (const int fd)
{
uint8_t x ;