diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-10-10 00:17:48 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-10-10 00:17:48 +0200 |
commit | d91d26ffc2a763469d403a8a297b2905785e80a8 (patch) | |
tree | fc55c2fb497851938145bb043f7d4af027ede56a | |
parent | 9a2a640c575ade2a4589e1954271abe3ed1e3f79 (diff) |
Lock xbee while writing a message.
-rw-r--r-- | xbee.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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 |