kopia lustrzana https://github.com/kosme/arduinoFFT
Fix bug preventing sample number to be more that 128. New limit is 32768
rodzic
e30a5ed5cf
commit
959f0df554
|
@ -84,7 +84,7 @@ void loop()
|
||||||
// delay(2000); /* Repeat after delay */
|
// delay(2000); /* Repeat after delay */
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintVector(double *vData, uint8_t bufferSize, uint8_t scaleType)
|
void PrintVector(double *vData, uint16_t bufferSize, uint8_t scaleType)
|
||||||
{
|
{
|
||||||
for (uint16_t i = 0; i < bufferSize; i++)
|
for (uint16_t i = 0; i < bufferSize; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,7 +95,7 @@ void loop()
|
||||||
while(1); /* Run Once */
|
while(1); /* Run Once */
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintVector(double *vData, uint8_t bufferSize, uint8_t scaleType)
|
void PrintVector(double *vData, uint16_t bufferSize, uint8_t scaleType)
|
||||||
{
|
{
|
||||||
for (uint16_t i = 0; i < bufferSize; i++)
|
for (uint16_t i = 0; i < bufferSize; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,7 +81,7 @@ void loop()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintVector(double *vData, uint8_t bufferSize, uint8_t scaleType)
|
void PrintVector(double *vData, uint16_t bufferSize, uint8_t scaleType)
|
||||||
{
|
{
|
||||||
for (uint16_t i = 0; i < bufferSize; i++)
|
for (uint16_t i = 0; i < bufferSize; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name=arduinoFFT
|
name=arduinoFFT
|
||||||
version=1.1
|
version=1.2
|
||||||
author=kosme <enrique@shapeoko.com>
|
author=kosme <enrique@shapeoko.com>
|
||||||
maintainer=Enrique Condes <enrique@shapeoko.com>
|
maintainer=Enrique Condes <enrique@shapeoko.com>
|
||||||
sentence=A library for implementing Fast Fourier Transform on Arduino.
|
sentence=A library for implementing Fast Fourier Transform on Arduino.
|
||||||
|
|
|
@ -61,9 +61,9 @@ void arduinoFFT::Compute(double *vReal, double *vImag, uint16_t samples, uint8_t
|
||||||
/* Compute the FFT */
|
/* Compute the FFT */
|
||||||
double c1 = -1.0;
|
double c1 = -1.0;
|
||||||
double c2 = 0.0;
|
double c2 = 0.0;
|
||||||
uint8_t l2 = 1;
|
uint16_t l2 = 1;
|
||||||
for (uint8_t l = 0; (l < power); l++) {
|
for (uint8_t l = 0; (l < power); l++) {
|
||||||
uint8_t l1 = l2;
|
uint16_t l1 = l2;
|
||||||
l2 <<= 1;
|
l2 <<= 1;
|
||||||
double u1 = 1.0;
|
double u1 = 1.0;
|
||||||
double u2 = 0.0;
|
double u2 = 0.0;
|
||||||
|
@ -99,7 +99,7 @@ void arduinoFFT::Compute(double *vReal, double *vImag, uint16_t samples, uint8_t
|
||||||
void arduinoFFT::ComplexToMagnitude(double *vReal, double *vImag, uint16_t samples)
|
void arduinoFFT::ComplexToMagnitude(double *vReal, double *vImag, uint16_t samples)
|
||||||
{
|
{
|
||||||
/* vM is half the size of vReal and vImag */
|
/* vM is half the size of vReal and vImag */
|
||||||
for (uint8_t i = 0; i < samples; i++) {
|
for (uint16_t i = 0; i < samples; i++) {
|
||||||
vReal[i] = sqrt(sq(vReal[i]) + sq(vImag[i]));
|
vReal[i] = sqrt(sq(vReal[i]) + sq(vImag[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue