Files
armod/preamble.h

54 lines
1.5 KiB
C
Raw Normal View History

2022-10-24 19:41:38 +02:00
/*
* File: preamble.h
* Author: nzasch
*
* Created on 12 gennaio 2017, 15.05
*/
#ifndef PREAMBLE_H
#define PREAMBLE_H
#include <stdint.h>
#ifdef __XC16
#include <libq.h>
#include <dsp.h>
#else
typedef int16_t _Q0_15;
typedef int32_t _Q15_16;
typedef _Q0_15 _Q15;
typedef _Q15_16 _Q16;
typedef int16_t fractional;
#endif
#include "modem_types.h"
#include "demodulator.h"
#define MODEM_PREAMBLE_LENGTH 13U
#define MODEM_PREAMBLE_SQUELCH 0.7f // da 0 a 1
// ((16000 ? 32) ? 20) ? 13 = 325
#define MODEM_PREAMBLE_SEARCH_BUFF_SIZE 512U // circa (MODEM_PREAMBLE_LENGTH * MAX_BUFFERS_PER_SYMBOL) ma deve esere ^ di 2
#define MODEM_PREAMBLE_SEARCH_BUFF_SIZE_MASK (MODEM_PREAMBLE_SEARCH_BUFF_SIZE - 1)
extern fractional sync_values_sequence[MODEM_PREAMBLE_LENGTH * MAX_BUFFERS_PER_SYMBOL]; ///< buffer che contiene il modello di sequenza
extern _Q15_16 preamble_squelch_distance; ///< squelch pesato sulla lunghezza del preambolo
// extern uint8_t modem_preamble_pending, modem_preamble_done;
extern uint8_t modem_preamble_waiting, modem_post_preamble_delay, modem_post_preamble_timer;
extern uint16_t BuffersPerPreamble;
// protoz
void modem_set_up_preamble(void);
uint8_t modem_generate_preamble(uint8_t *ModulationSymbolsBuffer);
void modem_generate_preamble_fingerprint(uint8_t *ModulationSymbolsBuffer, fractional *symbols_values_sequence, uint8_t values_per_symbol);
_Q15_16 modem_get_preamble_max_correlation_index(uint8_t *ModulationSymbolsBuffer);
uint8_t modem_detect_preamble(fractional insymbol);
#endif /* PREAMBLE_H */