Skip to content

Commit

Permalink
Fix bug preventing sample number to be more that 128. New limit is 32768
Browse files Browse the repository at this point in the history
  • Loading branch information
Enrique Condes committed Aug 4, 2017
1 parent e30a5ed commit 959f0df
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Examples/FFT_01/FFT_01.ino
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void loop()
// 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++)
{
Expand Down
2 changes: 1 addition & 1 deletion Examples/FFT_02/FFT_02.ino
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void loop()
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++)
{
Expand Down
2 changes: 1 addition & 1 deletion Examples/FFT_03/FFT_03.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=arduinoFFT
version=1.1
version=1.2
author=kosme <enrique@shapeoko.com>
maintainer=Enrique Condes <enrique@shapeoko.com>
sentence=A library for implementing Fast Fourier Transform on Arduino.
Expand Down
6 changes: 3 additions & 3 deletions src/arduinoFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ void arduinoFFT::Compute(double *vReal, double *vImag, uint16_t samples, uint8_t
/* Compute the FFT */
double c1 = -1.0;
double c2 = 0.0;
uint8_t l2 = 1;
uint16_t l2 = 1;
for (uint8_t l = 0; (l < power); l++) {
uint8_t l1 = l2;
uint16_t l1 = l2;
l2 <<= 1;
double u1 = 1.0;
double u2 = 0.0;
Expand Down Expand Up @@ -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)
{
/* 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]));
}
}
Expand Down

0 comments on commit 959f0df

Please sign in to comment.