123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /*
- * aprs_decoder.h
- *
- * Created on: Sep 1, 2019
- * Author: curiousmuch
- */
- #ifndef APRS_DECODER_H_
- #define APRS_DECODER_H_
- #include <stdio.h>
- #include "freertos/FreeRTOS.h"
- //#define uint8_t unsigned int
- //#define uint32_t unsigned int
- 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 /* APRS_DECODER_H_ */
|