The bitreverse which is needed for the FFT and nomally calculated at run-time was generated with spreadsheet software and included as an array.
Also the loop of analogRead commands was generated as a series of commands using spreadsheet software.
Above you see the TFT display connected to an Arduino NANO showing a square wave signal.
With 128 samples you get 64 values in the frequency spectrum.
Not surprising, it shows not only the fundamental frequency but also the third, the fifth and the seventh harmonics.
After reading the samples the program shows the time response of the input signal, then clears the screen an shows the Fourier spectrum.
Download the source:
the bit reverse array
the "loop" of analogRead()
If you want to see the autocorrelation as well just use the TFTGraphAutoKo sketch.