summaryrefslogtreecommitdiff
path: root/xbee.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-11-19 20:02:14 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-11-19 20:02:14 +0100
commit307cfe164910eccc70c086c083595d637c7fb987 (patch)
treef9845dc9647518840faf469580f581cf65d9fced /xbee.cpp
parentc265553652444293f90189c7481fb7eb16f28115 (diff)
Moved driver related files to a subdirectory.
Diffstat (limited to 'xbee.cpp')
-rw-r--r--xbee.cpp51
1 files changed, 0 insertions, 51 deletions
diff --git a/xbee.cpp b/xbee.cpp
deleted file mode 100644
index efee619..0000000
--- a/xbee.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "xbee.h"
-
-#include "usart.h"
-#include "mutex.h"
-
-Mutex xbee_mutex;
-
-void xbee_send(uint16_t type, int len, const uint8_t* buf) {
- xbee_mutex.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);
-
- xbee_mutex.unlock();
-}