diff --git a/Examples/FFT_01/FFT_01.ino b/Examples/FFT_01/FFT_01.ino index 412a26f..2404cd4 100644 --- a/Examples/FFT_01/FFT_01.ino +++ b/Examples/FFT_01/FFT_01.ino @@ -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++) { diff --git a/Examples/FFT_02/FFT_02.ino b/Examples/FFT_02/FFT_02.ino index e39f6a2..b6d3011 100644 --- a/Examples/FFT_02/FFT_02.ino +++ b/Examples/FFT_02/FFT_02.ino @@ -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++) { diff --git a/Examples/FFT_03/FFT_03.ino b/Examples/FFT_03/FFT_03.ino index f8b355f..ffa6171 100644 --- a/Examples/FFT_03/FFT_03.ino +++ b/Examples/FFT_03/FFT_03.ino @@ -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++) { diff --git a/library.properties b/library.properties index 045ccce..babcf21 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=arduinoFFT -version=1.1 +version=1.2 author=kosme maintainer=Enrique Condes sentence=A library for implementing Fast Fourier Transform on Arduino. diff --git a/src/arduinoFFT.cpp b/src/arduinoFFT.cpp index 2345b72..8e054c6 100644 --- a/src/arduinoFFT.cpp +++ b/src/arduinoFFT.cpp @@ -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; @@ -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])); } }