/* UA1ZBE Custom Firmware - BCH(31,21) header */
#ifndef APP_POCSAG_BCH31_H
#define APP_POCSAG_BCH31_H

#include <stdint.h>
#include <stdbool.h>

/* Correct errors in a POCSAG 32-bit word in place.
 * Returns: 0 = no error, 1 = single corrected,
 *          2 = double corrected, -1 = uncorrectable */
int bch31_correct(uint32_t *word);

/* Extract 21 data bits from corrected word */
uint32_t bch31_get_data(uint32_t word);

/* Get 2-bit function code */
uint8_t bch31_get_func(uint32_t word);

/* Check if word is sync word */
bool bch31_is_sync(uint32_t word);

/* Check if word is idle word */
bool bch31_is_idle(uint32_t word);

#endif
