diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-11-19 18:48:57 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-11-19 19:47:07 +0100 |
commit | 501b5765964affe9b48c88a5b580bd321170cc38 (patch) | |
tree | cb769d45cc3e6edabdb7faf5172d50d06e81584e /xbee.h | |
parent | 9363133fd8880d60cfa01c4e0e7e183fb2b4079e (diff) |
Avoid symbol conflicts from usart.h and xbee.h.
Diffstat (limited to 'xbee.h')
-rw-r--r-- | xbee.h | 49 |
1 files changed, 2 insertions, 47 deletions
@@ -1,53 +1,8 @@ #ifndef XBEE_H #define XBEE_H -#include "mutex.h" +#include <stdint.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); - usart_send((len + 16) & 0xff); - - // Frame type and ID. - usart_send(0x10); - usart_send(0x01); - - // Destination address. - usart_send(0x00); - usart_send(0x13); - usart_send(0xa2); - usart_send(0x00); - usart_send(0x40); - usart_send(0x6f); - usart_send(0x19); - usart_send(0xf1); - - usart_send(0xff); - usart_send(0xfe); - usart_send(0x00); - usart_send(0x00); - - uint8_t chsum = 0x83; - - usart_send(type & 0xff); - chsum -= type & 0xff; - usart_send(type >> 8); - chsum -= type >> 8; - - // Payload - for(int i = 0; i < len; i++) { - usart_send(buf[i]); - chsum -= buf[i]; - } - - usart_send(chsum); - - xbm.unlock(); -} +void xbee_send(uint16_t type, int len, const uint8_t* buf); #endif |