Skip to content

Commit

Permalink
Work on the idea in StephenBlackWasAlreadyTaken#10
Browse files Browse the repository at this point in the history
  • Loading branch information
saercnap committed Jan 6, 2015
1 parent dcfe70d commit 2d30246
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions apps/dexdrip/dexdrip.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ typedef struct _Dexcom_packet {
uint8 LQI;
} Dexcom_packet;

typedef struct _Buffered_packet {
Dexcom_packet packet;
int16 wixel_battery;
uint32 offset;
} Buffered_packet;

XDATA Buffered_packet packet_buffer[48];
uint8 buffered_packets = 0;

void uartEnable() {
U1UCR |= 0x40; //CTS/RTS ON
delayMs(1000);
Expand Down Expand Up @@ -182,6 +191,19 @@ void print_packet(Dexcom_packet* pPkt) {
uartDisable();
}

void load_buffer(Dexcom_packet* pPkt) {
packet_buffer[buffered_packets].packet.len = pPkt->len;
packet_buffer[buffered_packets].offset = getMs();
buffered_packets++;
}

void unload_buffer() {
while (buffered_packets > 0) {
// do stuff
buffered_packets--;
}
}

void makeAllOutputs() {
int XDATA i;
for (i=0; i < 16; i++) {
Expand Down Expand Up @@ -343,7 +365,9 @@ void main() {
if(!get_packet(&Pkt))
continue;

load_buffer(&Pkt);
print_packet(&Pkt);
unload_buffer();

RFST = 4;
delayMs(80);
Expand Down

0 comments on commit 2d30246

Please sign in to comment.