From 87c3fd0d0537a08480d9dfa4e04ff36057e929d5 Mon Sep 17 00:00:00 2001 From: Thiti Yamsung Date: Mon, 21 Mar 2016 15:20:04 +0700 Subject: [PATCH] Add function serialPutBin() for put binarys to serial. Signed-off-by: Thiti Yamsung --- wiringPi/wiringSerial.c | 11 +++++++++++ wiringPi/wiringSerial.h | 1 + 2 files changed, 12 insertions(+) diff --git a/wiringPi/wiringSerial.c b/wiringPi/wiringSerial.c index ca976a9..cdc4dd1 100644 --- a/wiringPi/wiringSerial.c +++ b/wiringPi/wiringSerial.c @@ -159,6 +159,17 @@ void serialPuts (const int fd, const char *s) } /* + * serialPuts: + * Send binarys to serial port + ********************************************************************************* + */ + +void serialPutBin (const int fd, const char *bin, unsigned int size) +{ + write (fd, bin, size) ; +} + +/* * serialPrintf: * Printf over Serial ********************************************************************************* diff --git a/wiringPi/wiringSerial.h b/wiringPi/wiringSerial.h index 430dc73..63514c5 100644 --- a/wiringPi/wiringSerial.h +++ b/wiringPi/wiringSerial.h @@ -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 serialPutBin (const int fd, const char *bin, unsigned int size) ; extern void serialPrintf (const int fd, const char *message, ...) ; extern int serialDataAvail (const int fd) ; extern int serialGetchar (const int fd) ;