Aloha implementation of LoRa technology

Dependencies:   SX1276Lib mbed

Fork of SX1276PingPong by Semtech

Revision:
16:c3c6b13c3c42
Parent:
15:f790f35839db
--- a/AlohaPacket.h	Tue May 31 09:52:21 2016 +0000
+++ b/AlohaPacket.h	Wed Jun 08 22:15:29 2016 +0000
@@ -2,7 +2,9 @@
 #define ALOHAPACKET_H_
 
 #include "stdint.h"
-#include "crc.h"
+
+
+// TODO: Move everything to Aloha.h
 
 typedef struct 
 {
@@ -16,58 +18,8 @@
     uint8_t pd1;
 } DataStruct;
 
-inline void createAlohaPacket(uint8_t *output, HeaderStruct *header, DataStruct *data)
-{
-    // assume user has already allocated memory for output
-    
-    // create header
-    if (header)
-    {
-        output[0] = header->no;
-        output[0] |= header->fid << 4;
-    }
-    
-    // fit data
-    if (data)
-    {
-        output[1] = data->pd0;
-        output[2] = data->pd1;
-    }
-    
-    // calculate CRC
-    if (header && data)
-    {
-        output[3] = crc8(output, 3);
-    }
-}
+void createAlohaPacket(uint8_t *output, HeaderStruct *header, DataStruct *data);
 
-inline bool dissectAlohaPacket(uint8_t *input, HeaderStruct *header, DataStruct *data)
-{
-    // assume user has already prepare memory in *in
-    
-    // get header
-    if (header)
-    {
-        header->fid = input[0] >> 4; // higher four bits
-        header->no = input[0] & 0x0f; // lower four bits
-    }
-    
-    // get data
-    if (data)
-    {
-        data->pd0 = input[1];
-        data->pd1 = input[2];
-    }
-    
-    // check crc
-    if (header && data)
-    {
-        return input[3] == crc8(input, 3);
-    }
-    else
-    {
-        return false;
-    }
-}
+bool dissectAlohaPacket(uint8_t *input, HeaderStruct *header, DataStruct *data);
 
 #endif
\ No newline at end of file