fix interfaccia

This commit is contained in:
nzasch
2022-01-12 01:09:32 +01:00
parent b9a7a1e15b
commit 6d0c31556a
435 changed files with 436215 additions and 10940 deletions

View File

@@ -235,6 +235,12 @@ void start_transmit(void){
} else if(TX_TYPE == TX_TYPE_SI5351){
si5351_on();
}
if(modulation == MOD_CWL || modulation == MOD_CWU){
// TONO su DAC
HAL_TIM_Base_Start(&htim6);
HAL_DAC_Start(&hdac1,DAC_CHANNEL_1);
HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, lf_buffer, (LF_BUFFER_SIZE * 2), DAC_ALIGN_12B_R);
}
}
void stop_transmit(void){
@@ -252,6 +258,12 @@ void stop_transmit(void){
} else if(TX_TYPE == TX_TYPE_SI5351){
si5351_off();
}
if(modulation == MOD_CWL || modulation == MOD_CWU){
// DAC
HAL_TIM_Base_Stop(&htim6);
HAL_DAC_Stop(&hdac1,DAC_CHANNEL_1);
HAL_DAC_Stop_DMA(&hdac1, DAC_CHANNEL_1);
}
}
void start_receive(void){
@@ -276,9 +288,9 @@ void stop_receive(void){
HAL_DAC_Stop_DMA(&hdac1, DAC_CHANNEL_1);
}
void set_gain(void){
void set_rx_gain(void){
HAL_OPAMP_Stop(&hopamp1);
switch (gain){
switch (rx_gain){
case 1:
hopamp1.Init.PgaGain = OPAMP_PGA_GAIN_2_OR_MINUS_1;
break;
@@ -301,9 +313,8 @@ void set_gain(void){
hopamp1.Init.PgaGain = OPAMP_PGA_GAIN_2_OR_MINUS_1;
break;
}
HAL_OPAMP_Init(&hopamp1);
HAL_OPAMP_Start(&hopamp1);
HAL_OPAMP_Init(&hopamp1);
HAL_OPAMP_Start(&hopamp1);
}
@@ -367,7 +378,7 @@ int main(void)
audio_filter_init();
// diag();
HAL_OPAMP_Start(&hopamp1);
set_gain();
set_rx_gain();
HAL_TIM_Base_Start_IT(&htim7);
HAL_UART_Receive_IT(&huart1, uart_rx_buf, 1);
// HAL_UART_Receive_IT(&huart2, uart_rx_buf, 1);
@@ -376,7 +387,6 @@ int main(void)
// rooto!
si53531_initialize();
}
start_receive();
/* USER CODE END 2 */
@@ -387,7 +397,7 @@ int main(void)
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_TogglePin(GPIO1_GPIO_Port, GPIO1_Pin);
// HAL_GPIO_TogglePin(GPIO1_GPIO_Port, GPIO1_Pin);
// receive = transmit = 0;
if(receive){
if(rx_adc_buffer_ready){
@@ -399,7 +409,7 @@ int main(void)
if(half_rx_dac_buffer_empty){
// HAL_GPIO_WritePin(GPIO1_GPIO_Port, GPIO1_Pin, SET);
if (modulation == MOD_DC) dc_demodulator(if_I, LF_BUFFER_SIZE, prefilter_lf_buffer);
else if(modulation == MOD_LSB || modulation == MOD_USB) ssb_demodulator(if_I, if_Q, LF_BUFFER_SIZE, prefilter_lf_buffer, NCO2_INCREMENT);
else if(modulation == MOD_LSB || modulation == MOD_USB || modulation == MOD_CWL || modulation == MOD_CWU) ssb_demodulator(if_I, if_Q, LF_BUFFER_SIZE, prefilter_lf_buffer, NCO2_INCREMENT);
else if (modulation == MOD_AM) am_demodulator(if_I, if_Q, LF_BUFFER_SIZE, prefilter_lf_buffer);
arm_fir_q31(&audio_filter_struct, prefilter_lf_buffer, lf_buffer[lf_buffer_toggle], RX_AUDIO_FILTER_BLOCK_SIZE);
// arm_fir_q31(&audio_filter_struct, prefilter_lf_buffer, lf_buffer_test[lf_buffer_toggle], AUDIO_FILTER_BLOCK_SIZE);
@@ -419,6 +429,12 @@ int main(void)
else if(modulation == MOD_LSB || modulation == MOD_USB) ssb_modulator(if_I, if_Q, LF_BUFFER_SIZE, prefilter_lf_buffer, NCO2_INCREMENT);
else if (modulation == MOD_AM) am_modulator(if_I, if_Q, LF_BUFFER_SIZE, prefilter_lf_buffer);
}
if(half_rx_dac_buffer_empty && (modulation == MOD_CWL || modulation == MOD_CWU)){
generate_tone(lf_buffer[lf_buffer_toggle], LF_BUFFER_SIZE);
half_rx_dac_buffer_empty = 0;
}
}
if(tick){
// consuma coda comandi