From 9f9bca0f197ee7920dc4daa81cbb4c6698e660a7 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 5 Jun 2013 11:50:33 +0200 Subject: Bridge protocol frame lenght is now a 16-bit field. Added more efficient Bridge.trasnfer() methods. --- libraries/Bridge/Bridge.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'libraries/Bridge/Bridge.h') diff --git a/libraries/Bridge/Bridge.h b/libraries/Bridge/Bridge.h index ff5cd5f..c7b5361 100644 --- a/libraries/Bridge/Bridge.h +++ b/libraries/Bridge/Bridge.h @@ -65,8 +65,20 @@ public: void flush() { stream.flush(); } // Trasnfer a frame (with error correction and response) - uint8_t transfer(const uint8_t *buff, uint8_t len, - uint8_t *rxbuff=NULL, uint8_t rxlen=0); + uint8_t transfer(const uint8_t *buff1, uint16_t len1, + const uint8_t *buff2, uint16_t len2, + const uint8_t *buff3, uint16_t len3, + uint8_t *rxbuff, uint16_t rxlen); + // multiple inline versions of the same function to allow efficient frame concatenation + uint8_t transfer(const uint8_t *buff1, uint16_t len1) + { transfer(buff1, len1, NULL, 0); } + uint8_t transfer(const uint8_t *buff1, uint16_t len1, + uint8_t *rxbuff, uint16_t rxlen) + { transfer(buff1, len1, NULL, 0, rxbuff, rxlen); } + uint8_t transfer(const uint8_t *buff1, uint16_t len1, + const uint8_t *buff2, uint16_t len2, + uint8_t *rxbuff, uint16_t rxlen) + { transfer(buff1, len1, buff2, len2, NULL, 0, rxbuff, rxlen); } private: uint8_t index; int timedRead(unsigned int timeout); -- cgit v1.2.3-18-g5258