kopia lustrzana https://github.com/kosme/arduinoFFT
rodzic
78ec583c60
commit
b0e4c69bcb
|
@ -3,7 +3,7 @@
|
|||
Example of use of the FFT library to compute FFT for several signals over a range of frequencies.
|
||||
The exponent is calculated once before the execution since it is a constant.
|
||||
This saves resources during the execution of the sketch and reduces the compiled size.
|
||||
The sketch shows the time that the computing is taking.
|
||||
The sketch shows the time that the computation takes.
|
||||
Copyright (C) 2014 Enrique Condes
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"email": "contact@arduinoos.com"
|
||||
}
|
||||
],
|
||||
"version": "1.6",
|
||||
"version": "1.6.1",
|
||||
"frameworks": ["arduino","mbed","espidf"],
|
||||
"platforms": "*",
|
||||
"headers": "arduinoFFT.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name=arduinoFFT
|
||||
version=1.6
|
||||
version=1.6.1
|
||||
author=Enrique Condes <enrique@shapeoko.com>
|
||||
maintainer=Enrique Condes <enrique@shapeoko.com>
|
||||
sentence=A library for implementing floating point Fast Fourier Transform calculations on Arduino.
|
||||
|
|
|
@ -103,9 +103,10 @@ void arduinoFFT::Compute(FFTDirection dir) {
|
|||
}
|
||||
// Scaling for reverse transform /
|
||||
if (dir != FFT_FORWARD) {
|
||||
double reciprocal = 1.0 / this->_samples;
|
||||
for (uint16_t i = 0; i < this->_samples; i++) {
|
||||
this->_vReal[i] /= this->_samples;
|
||||
this->_vImag[i] /= this->_samples;
|
||||
this->_vReal[i] *= reciprocal;
|
||||
this->_vImag[i] *= reciprocal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,9 +170,10 @@ void arduinoFFT::Compute(double *vReal, double *vImag, uint16_t samples,
|
|||
}
|
||||
// Scaling for reverse transform
|
||||
if (dir != FFT_FORWARD) {
|
||||
double reciprocal = 1.0 / samples;
|
||||
for (uint16_t i = 0; i < samples; i++) {
|
||||
vReal[i] /= samples;
|
||||
vImag[i] /= samples;
|
||||
vReal[i] *= reciprocal;
|
||||
vImag[i] *= reciprocal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +537,7 @@ uint8_t arduinoFFT::Exponent(uint16_t value) {
|
|||
#warning("This method may not be accessible on future revisions.")
|
||||
// Calculates the base 2 logarithm of a value
|
||||
uint8_t result = 0;
|
||||
while (((value >> result) & 1) != 1)
|
||||
while (value >>= 1)
|
||||
result++;
|
||||
return (result);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue