- Updated the `isActive` function in `Header.jsx` to handle root path and include logic for other paths. chore: Update package-lock.json to remove peer dependencies - Removed unnecessary peer dependencies from various packages in `package-lock.json`. feat: Update frameworks.json to include example links - Changed `exemplo_codigo` to `exemplo` and added `exemplos` links for various frameworks in `frameworks.json`. feat: Add placa images to series.json - Included image paths for different ESP32 series in `series.json`. feat: Create CodeExample component for displaying code snippets - Added a new `CodeExample.jsx` component to fetch and display code examples dynamically. feat: Add example Arduino code for Wi-Fi connection - Created `arduino.ino` example for connecting to Wi-Fi. feat: Add example code for audio playback using ESP-ADF - Created `esp-adf.c` example for audio playback using ESP-ADF. feat: Add example code for DSP operations - Created `esp-dsp.c` example demonstrating basic DSP operations. feat: Add example code for ESP-IDF LED blinking - Created `esp-idf.c` example for blinking an LED using ESP-IDF. feat: Add example code for Matter integration - Created `esp-matter.c` example for Matter device initialization and event handling. feat: Add example code for neural network operations - Created `esp-nn.c` example demonstrating basic neural network operations. feat: Add example code for face detection using ESP-WHO - Created `esp-who.c` example for face detection using ESP-WHO library. feat: Add MicroPython example for LED blinking - Created `micropython.py` example for blinking an LED using MicroPython.
38 lines
908 B
C
38 lines
908 B
C
#include <stdio.h>
|
|
#include "esp_dsp.h"
|
|
|
|
#define N 8 // Tamanho do vetor
|
|
|
|
void app_main(void)
|
|
{
|
|
// Vetor de entrada (exemplo de sinal)
|
|
float x[N] = {1.0, -2.0, 3.0, -4.0, 2.5, -1.5, 0.0, 4.5};
|
|
float y[N]; // Vetor de saída
|
|
|
|
// Inicializa o ESP-DSP
|
|
esp_err_t ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE);
|
|
if (ret != ESP_OK) {
|
|
printf("Erro ao inicializar o ESP-DSP!\n");
|
|
return;
|
|
}
|
|
|
|
printf("Sinal de entrada:\n");
|
|
for (int i = 0; i < N; i++) {
|
|
printf("%f ", x[i]);
|
|
}
|
|
printf("\n");
|
|
|
|
// Calcula o quadrado de cada valor
|
|
dsps_mulc_f32(x, y, N, 1.0f);
|
|
dsps_mul_f32(y, y, y, N, 1, 1, 1);
|
|
|
|
// Soma todos os quadrados
|
|
float soma = 0;
|
|
dsps_sum_f32(y, N, &soma, 1);
|
|
|
|
// Calcula a magnitude (raiz da soma dos quadrados)
|
|
float magnitude = sqrtf(soma);
|
|
|
|
printf("Magnitude do vetor: %f\n", magnitude);
|
|
}
|