12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #ifndef APRS_DECODER_H_
- #define APRS_DECODER_H_
- #include <stdio.h>
- #include "freertos/FreeRTOS.h"
- typedef enum {
- NORMAL,
- FRAME_DECODED,
- ERROR_FCS_MISMATCH,
- ERROR_PACKET_FORMAT,
- ERROR_BUFFER_OVERFLOW
- } decoder_output_t;
- typedef enum {
- NONE,
- BUFFER_OVERFLOW,
- BIT_STUFFING_FAILURE,
- FCS_MISMATCH,
- } decoder_error_t;
- typedef enum {
- FLAG_SEARCH,
- FLAG_FOUND,
- FRAME_START,
- FRAME_BREAK,
- ABORT,
- } decoder_state_t;
- typedef struct {
- decoder_state_t decoder_state;
- uint8_t *frame_buffer;
- uint32_t frame_buffer_index;
- uint32_t frame_buffer_len;
- uint32_t frame_len;
- uint8_t flag_buffer;
- uint8_t flag_buffer_index;
- uint8_t byte_buffer;
- uint8_t byte_buffer_index;
- uint8_t current_nrzi_bit;
- uint8_t previous_nrzi_bit;
- uint8_t current_bit;
- uint8_t one_count;
- uint8_t skip_bit_flag;
- uint8_t packet_rx;
- } decoder_varibles_t;
- uint8_t get_rx_status(void);
- void frame_buffer_init(uint8_t *buf, uint32_t len);
- void aprs_decoder_init(void);
- decoder_output_t aprs_decoder_feed_bit(uint8_t nrzi_bit);
- #endif
|