aboutsummaryrefslogtreecommitdiff
path: root/libraries/Bridge/Bridge.h
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-06-05 11:50:33 +0200
committerCristian Maglie <c.maglie@bug.st>2013-06-05 11:50:33 +0200
commit9f9bca0f197ee7920dc4daa81cbb4c6698e660a7 (patch)
treedf3f08342f37d5e4ad02a1d69fa0a6a80a80b808 /libraries/Bridge/Bridge.h
parent5b8fe8acbaa29d5e2673be4a1f1dbf8a4a1d784c (diff)
Bridge protocol frame lenght is now a 16-bit field. Added more efficient Bridge.trasnfer() methods.
Diffstat (limited to 'libraries/Bridge/Bridge.h')
-rw-r--r--libraries/Bridge/Bridge.h16
1 files changed, 14 insertions, 2 deletions
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);