26 #include <util/crc16.h> 39 uint16_t crc = 0xffff;
41 crc = _crc_ccitt_update(crc, *ptr++);
42 return (crc == 0xf0b8);
49 if (m_sample) m_integrator++;
51 if (m_sample != m_last_sample) {
54 ((m_pll_ramp < RAMP_TRANSITION) ? RAMP_INC_RETARD : RAMP_INC_ADVANCE);
55 m_last_sample = m_sample;
59 m_pll_ramp += RAMP_INC;
61 if (m_pll_ramp >= RAMP_MAX) {
67 if (m_integrator >= INTEGRATOR_THRESHOLD)
70 m_pll_ramp -= RAMP_MAX;
79 uint8_t data = m_codec->
decode8(m_bits);
89 if (m_count < MESSAGE_MIN || m_count >
MESSAGE_MAX) {
95 m_buffer[m_length++] = data;
96 if (m_length >= m_count) {
120 void* buf,
size_t len,
128 if (!m_done)
return (
ETIME);
132 || (hp->
network != s_rf->m_addr.network)
139 size_t rxlen = m_length -
sizeof(
header_t) - 3;
143 memcpy(buf, m_buffer +
sizeof(
header_t) + 1, rxlen);
144 s_rf->m_dest = hp->
dest;
static const uint8_t MESSAGE_MAX
const uint8_t BITS_PER_SYMBOL
const uint16_t START_SYMBOL
static uint32_t since(uint32_t start)
static bool is_valid_crc(uint8_t *ptr, uint8_t count)
virtual uint8_t decode8(uint16_t symbol)
int link_quality_indicator()
static const uint8_t BROADCAST
int recv(uint8_t &src, uint8_t &port, void *buf, size_t len, uint32_t ms=0L)