1#include "main-header.h"
24 if (num == PACKETBUFFER_CC1101) {
25 return &packetbuffer1;
27 fatal_error(
"Invalid packet buffer %i", num);
38 void *buf = get_buf(num);
43 memset(buf, 0,
sizeof(packetbuffer1));
64static void packet_buf_overflow(
struct cnw_packetbuf *pkt,
int num) {
65 printf(
"Overflow in buf %i, BytesInBuf: %i\r\n", num, pkt->bytesinbuf);
85 if ((pkt->recvstarted != 0)
86 && ((mculib_get_seconds_since_boot() - pkt->recvstarted) > 5)
90 if (pkt->bytesinbuf == PACKETBUF_SIZE) {
91 packet_buf_overflow(pkt, num);
94 if (pkt->recvstarted == 0) {
95 pkt->recvstarted = mculib_get_seconds_since_boot();
97 pkt->buf[pkt->bytesinbuf] = b;
150 return (
byte *)&pkt->buf;
165 return pkt->bytesinbuf;
void packet_init()
initialize (reset, clear) all buffers
int packet_put_byte(const int num, const byte b)
add a byte to a buffer
void packet_mark_valid(const int num)
mark this buffer as containing a valid packet
int packet_getbytesinbuf(const int num)
count bytes in the buffer
byte * packet_getbuf(const int num)
get pointer to the contents of the buffer
int packet_isvalid(const int num)
initialize (reset, clear) a given buffer
void packet_buf_init(const int num)
initialize (reset, clear) a given buffer