summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbee.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/xbee.h b/xbee.h
index 53f9288..f868972 100644
--- a/xbee.h
+++ b/xbee.h
@@ -1,7 +1,13 @@
#ifndef XBEE_H
#define XBEE_H
+#include "mutex.h"
+
+Mutex xbm;
+
void xbee_send(uint16_t type, int len, const uint8_t* buf) {
+ xbm.lock();
+
// Start and length.
usart_send(0x7e);
usart_send(((len + 16) >> 8) & 0xff);
@@ -40,6 +46,8 @@ void xbee_send(uint16_t type, int len, const uint8_t* buf) {
}
usart_send(chsum);
+
+ xbm.unlock();
}
#endif