kopia lustrzana https://github.com/kosme/arduinoFFT
Merge pull request #50 from HorstBaerbel/master
Fix compile error on Arduino due to small_typepull/59/head
commit
5eaad08339
|
@ -117,7 +117,7 @@ fft.complexToMagnitude();
|
|||
delete [] real;
|
||||
// ... replace vReal in library with imag ...
|
||||
fft.setArrays(imag, nullptr);
|
||||
// ... keep doin whatever ...
|
||||
// ... keep doing whatever ...
|
||||
```
|
||||
* All function names are camelCase case now (start with lower-case character), e.g. "windowing()" instead of "Windowing()".
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
02/22/20 v1.9.2
|
||||
Fix compilation on AVR systems.
|
||||
|
||||
02/22/20 v1.9.1
|
||||
Add setArrays() function because of issue #32.
|
||||
Add API migration info to README and improve README.
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
"email": "bim.overbohm@googlemail.com"
|
||||
}
|
||||
],
|
||||
"version": "1.9.1",
|
||||
"version": "1.9.2",
|
||||
"frameworks": ["arduino","mbed","espidf"],
|
||||
"platforms": "*"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name=arduinoFFT
|
||||
version=1.9.1
|
||||
version=1.9.2
|
||||
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.
|
||||
|
|
|
@ -58,6 +58,7 @@ enum class FFTDirection
|
|||
Reverse,
|
||||
Forward
|
||||
};
|
||||
|
||||
enum class FFTWindow
|
||||
{
|
||||
Rectangle, // rectangle (Box car)
|
||||
|
@ -138,7 +139,7 @@ public:
|
|||
}
|
||||
// Compute the FFT
|
||||
#ifdef __AVR__
|
||||
small_type index = 0;
|
||||
uint_fast8_t index = 0;
|
||||
#endif
|
||||
T c1 = -1.0;
|
||||
T c2 = 0.0;
|
||||
|
@ -166,8 +167,8 @@ public:
|
|||
u1 = z;
|
||||
}
|
||||
#ifdef __AVR__
|
||||
c2 = pgm_read_T_near(&(_c2[index]));
|
||||
c1 = pgm_read_T_near(&(_c1[index]));
|
||||
c2 = pgm_read_float_near(&(_c2[index]));
|
||||
c1 = pgm_read_float_near(&(_c1[index]));
|
||||
index++;
|
||||
#else
|
||||
T cTemp = 0.5 * c1;
|
||||
|
@ -385,31 +386,10 @@ public:
|
|||
|
||||
private:
|
||||
#ifdef __AVR__
|
||||
static const T _c1[] PROGMEM = {
|
||||
0.0000000000, 0.7071067812, 0.9238795325, 0.9807852804,
|
||||
0.9951847267, 0.9987954562, 0.9996988187, 0.9999247018,
|
||||
0.9999811753, 0.9999952938, 0.9999988235, 0.9999997059,
|
||||
0.9999999265, 0.9999999816, 0.9999999954, 0.9999999989,
|
||||
0.9999999997};
|
||||
static const T _c2[] PROGMEM = {
|
||||
1.0000000000, 0.7071067812, 0.3826834324, 0.1950903220,
|
||||
0.0980171403, 0.0490676743, 0.0245412285, 0.0122715383,
|
||||
0.0061358846, 0.0030679568, 0.0015339802, 0.0007669903,
|
||||
0.0003834952, 0.0001917476, 0.0000958738, 0.0000479369,
|
||||
0.0000239684};
|
||||
static const float _c1[] PROGMEM;
|
||||
static const float _c2[] PROGMEM;
|
||||
#endif
|
||||
static constexpr T _WindowCompensationFactors[10] = {
|
||||
1.0000000000 * 2.0, // rectangle (Box car)
|
||||
1.8549343278 * 2.0, // hamming
|
||||
1.8554726898 * 2.0, // hann
|
||||
2.0039186079 * 2.0, // triangle (Bartlett)
|
||||
2.8163172034 * 2.0, // nuttall
|
||||
2.3673474360 * 2.0, // blackman
|
||||
2.7557840395 * 2.0, // blackman nuttall
|
||||
2.7929062517 * 2.0, // blackman harris
|
||||
3.5659039231 * 2.0, // flat top
|
||||
1.5029392863 * 2.0 // welch
|
||||
};
|
||||
static const T _WindowCompensationFactors[10];
|
||||
|
||||
// Mathematial constants
|
||||
#ifndef TWO_PI
|
||||
|
@ -469,4 +449,36 @@ private:
|
|||
uint_fast8_t _power = 0;
|
||||
};
|
||||
|
||||
#ifdef __AVR__
|
||||
template <typename T>
|
||||
const float ArduinoFFT<T>::_c1[] PROGMEM = {
|
||||
0.0000000000, 0.7071067812, 0.9238795325, 0.9807852804,
|
||||
0.9951847267, 0.9987954562, 0.9996988187, 0.9999247018,
|
||||
0.9999811753, 0.9999952938, 0.9999988235, 0.9999997059,
|
||||
0.9999999265, 0.9999999816, 0.9999999954, 0.9999999989,
|
||||
0.9999999997};
|
||||
|
||||
template <typename T>
|
||||
const float ArduinoFFT<T>::_c2[] PROGMEM = {
|
||||
1.0000000000, 0.7071067812, 0.3826834324, 0.1950903220,
|
||||
0.0980171403, 0.0490676743, 0.0245412285, 0.0122715383,
|
||||
0.0061358846, 0.0030679568, 0.0015339802, 0.0007669903,
|
||||
0.0003834952, 0.0001917476, 0.0000958738, 0.0000479369,
|
||||
0.0000239684};
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
const T ArduinoFFT<T>::_WindowCompensationFactors[10] = {
|
||||
1.0000000000 * 2.0, // rectangle (Box car)
|
||||
1.8549343278 * 2.0, // hamming
|
||||
1.8554726898 * 2.0, // hann
|
||||
2.0039186079 * 2.0, // triangle (Bartlett)
|
||||
2.8163172034 * 2.0, // nuttall
|
||||
2.3673474360 * 2.0, // blackman
|
||||
2.7557840395 * 2.0, // blackman nuttall
|
||||
2.7929062517 * 2.0, // blackman harris
|
||||
3.5659039231 * 2.0, // flat top
|
||||
1.5029392863 * 2.0 // welch
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue