summaryrefslogtreecommitdiff
path: root/controller/fw/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'controller/fw/src/main.c')
-rw-r--r--controller/fw/src/main.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/controller/fw/src/main.c b/controller/fw/src/main.c
index b100b16..6589297 100644
--- a/controller/fw/src/main.c
+++ b/controller/fw/src/main.c
@@ -197,7 +197,7 @@ int main(void)
clock_setup();
con_usart_init();
- con_printf("\033[2J\033[HBooting...\r\n");
+ con_printf("\033[0m\033[2J\033[HBooting...\r\n");
led_setup();
spi_flash_setup();
@@ -217,9 +217,22 @@ int main(void)
while (23) {
if (adc_fft_buf_ready_idx != -1) {
GPIOA->BSRR = 1<<11;
- adc_fft_buf_ready_idx = !adc_fft_buf_ready_idx; /* DEBUG */
- memcpy(adc_fft_buf[!adc_fft_buf_ready_idx], adc_fft_buf[adc_fft_buf_ready_idx] + FMEAS_FFT_LEN/2, sizeof(adc_fft_buf[0][0]) * FMEAS_FFT_LEN/2);
+ //adc_fft_buf_ready_idx = !adc_fft_buf_ready_idx; /* DEBUG */
+ //DEBUG:
+ //memcpy(adc_fft_buf[!adc_fft_buf_ready_idx], adc_fft_buf[adc_fft_buf_ready_idx] + FMEAS_FFT_LEN/2, sizeof(adc_fft_buf[0][0]) * FMEAS_FFT_LEN/2);
+
+ for (int i=0; i<168*1000*2; i++)
+ asm volatile ("nop");
+ /* BEGIN DEBUG */
+ con_printf_blocking("\r\n%06d: ", freq_sample_ts);
+ int old_idx = adc_fft_buf_ready_idx;
+ for (int i=0; i<FMEAS_FFT_LEN/2; i++)
+ con_printf_blocking("%03x ", adc_fft_buf[old_idx][FMEAS_FFT_LEN/2 + i]);
+ adc_fft_buf_ready_idx = -1;
+ freq_sample_ts++; /* TODO: also increase in case of freq measurement error? */
GPIOA->BSRR = 1<<11<<16;
+ continue;
+ /* END DEBUG */
GPIOA->BSRR = 1<<11;
float out;