int main(void) { HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_ADC1_Init(); MX_DMA2D_Init(); MX_FMC_Init(); MX_I2C3_Init(); MX_LTDC_Init(); MX_RNG_Init(); MX_SPI5_Init(); BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(LCD_BACKGROUND_LAYER, LCD_FRAME_BUFFER); BSP_LCD_LayerDefaultInit(LCD_FOREGROUND_LAYER, LCD_FRAME_BUFFER); BSP_LCD_SelectLayer(LCD_FOREGROUND_LAYER); BSP_LCD_Clear(LCD_COLOR_BLACK); BSP_LCD_DisplayOn(); uint8_t Button_Value; GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitStruct.Pin |= GPIO_PIN_0; GPIO_InitStruct.Mode = 0x00; GPIO_InitStruct.Pull = 0x02; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); while (1) { for(uint16_t i = 0; i < SIZE; i+=2) { HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1,1000); samples[i] = HAL_ADC_GetValue(&hadc1); samples[i+1] = 0; HAL_ADC_Stop(&hadc1); } Button_Value = HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0); if( Button_Value ) { fft(); } else { display_samples(samples); } } }
void spy_dump (spy_t s) { tabstop t; open_output(); spy_accumulate_children_stats(s); if (mode == SPY_DISPLAY_SAMPLES) { display_samples(s); } else { init_tabstop(&t); set_tabstop(s, &t); dump_header(&t); spy_dump_internal(s, &t); } }
void spy_dump_all () { int i; unsigned long total = 0; tabstop t; spy_t s; open_output(); init_tabstop(&t); for (i = 0; i < nspys; i++) { s = &spys[i]; spy_accumulate_children_stats(s); if (s->n == 0) continue; if (mode != SPY_DISPLAY_SAMPLES) set_tabstop(s, &t); total += spys[i].cumulative; } if (mode == SPY_DISPLAY_SAMPLES) { for (i = 0; i < nspys; i++) { s = &spys[i]; if (s->n == 0) continue; display_samples(s); } } else { dump_header(&t); for (i = 0; i < nspys; i++) { s = &spys[i]; if (s->n == 0) continue; spy_dump_internal(s, &t); } if (mode & SPY_DISPLAY_TOTAL) { fprintf(out, "total: %s.\n", r_dtoa(cycle_to_usec(total))); } } }