adafruit / Adafruit_ZeroFFT

simple FFT for cortex m0
BSD 3-Clause "New" or "Revised" License
42 stars 18 forks source link

using data from PDM.h for fft calculations #10

Closed lambtor closed 4 years ago

lambtor commented 4 years ago

I'm sure there's probably a better place for this question, but if I'm looking to leverage the adafruit_zerofft library with the nrf52 version of PDM.h, how would I want to do that?

I've tried invoking PDM.read() with a samplebuffer just for 1 value, but I keep getting zeroes for all results. I'm trying to get the equivalent expected value for pdm.read() in the target line below.

pdm_tft.ino example:

for (uint8_t samplenum=0; samplenum < (DECIMATION/16) ; samplenum++) {
//this line here ---------------------------
       uint16_t sample = pdm.read() & 0xFFFF;    

       ADAPDM_REPEAT_LOOP_16(      // manually unroll loop: for (int8_t b=0; b<16; b++) 
         {       
           if (sample & 0x1) {
             runningsum += *sinc_ptr;     // do the convolution
           }
           sinc_ptr++;
           sample >>= 1;
        }
      )
    }
ladyada commented 4 years ago

if you are using adafruit hardware you can post in the adafruit forums