#ifndef __TX_H
#define __TX_H

#include <stdint.h>
#include <arm_math.h>

#define TX_AUDIO_FILTER_INTERPOLATION_FACTOR (16)
#define TX_AUDIO_FILTER_BLOCK_SIZE (1024)
#define TX_AUDIO_FILTER_TAP_NUM (128)

extern uint8_t tx_signal, tx_signal_last;
extern q31_t tx_nco1_increment;

// buffer
extern volatile uint8_t half_tx_dac_buffer_empty, tx_dac_buffer_toggle;
extern volatile uint8_t tx_adc_buffer_ready;

// filtro audio
extern arm_fir_instance_q31 tx_audio_filter_I_struct, tx_audio_filter_Q_struct;
extern q31_t tx_audio_filter_I_state[TX_AUDIO_FILTER_BLOCK_SIZE + TX_AUDIO_FILTER_TAP_NUM - 1];
extern q31_t tx_audio_filter_Q_state[TX_AUDIO_FILTER_BLOCK_SIZE + TX_AUDIO_FILTER_TAP_NUM - 1];
extern int32_t tx_audio_filter_coeffs[TX_AUDIO_FILTER_TAP_NUM];

// modulatori

void ssb_modulator(q31_t *in_I, q31_t *in_Q, uint16_t size, q31_t *out, q31_t nco_freq);
void dc_modulator(q31_t *in, uint16_t size, q31_t *out);
void am_modulator(q31_t *in_I, q31_t *in_Q, uint16_t size, q31_t *out);

#endif
