Browse Source

added length-specified (in addition to null-terminated) serial put

pull/72/head
Phil Dougherty 4 years ago
parent
commit
434451c5cf
2 changed files with 12 additions and 0 deletions
  1. +11
    -0
      wiringPi/wiringSerial.c
  2. +1
    -0
      wiringPi/wiringSerial.h

+ 11
- 0
wiringPi/wiringSerial.c View File

@@ -171,6 +171,17 @@ void serialPuts (const int fd, const char *s)
}

/*
* serialPut:
* Send an n character buffer to the serial port
*********************************************************************************
*/

void serialPut (const int fd, const char *s, const int n)
{
write (fd, s, n) ;
}

/*
* serialPrintf:
* Printf over Serial
*********************************************************************************


+ 1
- 0
wiringPi/wiringSerial.h View File

@@ -29,6 +29,7 @@ extern void serialClose (const int fd) ;
extern void serialFlush (const int fd) ;
extern void serialPutchar (const int fd, const unsigned char c) ;
extern void serialPuts (const int fd, const char *s) ;
extern void serialPut (const int fd, const char *s, const int n) ;
extern void serialPrintf (const int fd, const char *message, ...) ;
extern int serialDataAvail (const int fd) ;
extern int serialGetchar (const int fd) ;


Loading…
Cancel
Save