24 #include <util/crc16.h> 37 uint16_t crc = 0xffff;
40 while (m_enabled)
yield();
43 uint8_t count = 1 +
sizeof(
header_t) + len + 2;
44 crc = _crc_ccitt_update(crc, count);
45 *tp++ = m_codec->
encode4(count >> 4);
46 *tp++ = m_codec->
encode4(count);
50 header.
network = s_rf->m_addr.network;
51 header.
src = s_rf->m_addr.device;
54 uint8_t* bp = (uint8_t*) &header;
55 for (uint8_t i = 0; i <
sizeof(header); i++) {
57 crc = _crc_ccitt_update(crc, data);
58 *tp++ = m_codec->
encode4(data >> 4);
65 uint8_t *bp = (uint8_t*) vp->buf;
66 for (uint8_t i = 0; i < vp->size; i++) {
68 crc = _crc_ccitt_update(crc, data);
69 *tp++ = m_codec->
encode4(data >> 4);
78 *tp++ = m_codec->
encode4(crc >> 4);
80 *tp++ = m_codec->
encode4(crc >> 12);
81 *tp++ = m_codec->
encode4(crc >> 8);
99 return (
send(dest, port, vec));
virtual uint8_t encode4(uint8_t nibble)=0
static const uint8_t PAYLOAD_MAX
void * buf
Buffer pointer.
const uint8_t PREAMBLE_MAX
int send(uint8_t dest, uint8_t port, const iovec_t *vec)
void iovec_arg(iovec_t *&vp, const void *buf, size_t size)
void iovec_end(iovec_t *&vp)
size_t iovec_size(const iovec_t *vec)