Initial import
This commit is contained in:
80
demodulator.h
Normal file
80
demodulator.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* File: demodulator.h
|
||||
*/
|
||||
|
||||
#ifndef DEMODULATOR_H
|
||||
#define DEMODULATOR_H
|
||||
|
||||
#ifdef __XC16
|
||||
#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 <stdint.h>
|
||||
#include "modem_types.h"
|
||||
|
||||
#define MAX_PHASE_SKEW 10000L
|
||||
#define ADC_MAX_AMPLITUDE 10000L
|
||||
|
||||
typedef struct {
|
||||
fractional frequency;
|
||||
fractional phase;
|
||||
fractional amplitude;
|
||||
} detector_symbol;
|
||||
|
||||
extern detector_symbol detector_constellation[MAX_MODULATION_ALPHABET_SIZE], symbol_error, min_symbol_distance;
|
||||
|
||||
// TODO
|
||||
|
||||
typedef struct {
|
||||
uint8_t buffer[MAX_SYMBOL_BUFFER_SIZE];
|
||||
uint8_t index;
|
||||
uint8_t length;
|
||||
} symbol_buffer;
|
||||
|
||||
// extern symbol_buffer rx_symbol_buffer;
|
||||
|
||||
// buffer dei simboli
|
||||
extern uint8_t rx_symbol_buffer[MAX_SYMBOL_BUFFER_SIZE];
|
||||
extern uint8_t rx_symbol_buffer_index, rx_symbol_buffer_lenght;
|
||||
|
||||
extern uint8_t rx_sample_buffers_buffer[MAX_BUFFERS_PER_SYMBOL], rx_sample_buffer_index;
|
||||
|
||||
extern uint8_t volatile process_input_sample_buffer;
|
||||
|
||||
// zona del simbolo da esaminare:
|
||||
extern uint8_t rx_symbol_detected_part_offset, rx_symbol_detected_part_length;
|
||||
|
||||
// NCO
|
||||
extern fractional tanlock_nco_rotor_inc;
|
||||
|
||||
#ifdef __DSP_LIB__
|
||||
extern FIRStruct ph_det_lpFilterI, ph_det_lpFilterQ, ph_det_lpFilterFreq;
|
||||
#endif
|
||||
|
||||
void demodulator_setup(void);
|
||||
void demodulator_sample_buffer_demodulate(fractional *buffer, detector_symbol* outsymbol);
|
||||
|
||||
symbol find_constellation_center_values(symbol *constellation);
|
||||
int16_t get_angular_frequency(uint16_t frequency);
|
||||
void demodulator_prepare_constellation_symbols(symbol *constellation, detector_symbol *demod_constellation);
|
||||
detector_symbol demodulator_find_min_symbol_distance(detector_symbol *demod_constellation);
|
||||
uint8_t demodulator_most_frequent_value(uint8_t *serie, uint8_t range, uint8_t len);
|
||||
uint8_t demodulator_find_nearest_symbol(detector_symbol *in_symbol, detector_symbol *target_constellation, detector_symbol *moderror);
|
||||
|
||||
fractional demodulator_phase_detector(fractional sig_in);
|
||||
fractional demodulator_frequency_detector(fractional phase);
|
||||
|
||||
fractional _Q15atan2circle(fractional Y, fractional X);
|
||||
void FIR_init(void);
|
||||
|
||||
|
||||
#endif /* DEMODULATOR_H */
|
||||
|
||||
Reference in New Issue
Block a user