| Line | |
|---|
| 1 | // Adafruit Circuit Playground microphone library |
|---|
| 2 | // by Phil Burgess / Paint Your Dragon. |
|---|
| 3 | // Fast Fourier transform section is derived from |
|---|
| 4 | // ELM-ChaN FFT library (see comments in ffft.S). |
|---|
| 5 | |
|---|
| 6 | #ifndef ADAFRUIT_CPLAY_MIC_H |
|---|
| 7 | #define ADAFRUIT_CPLAY_MIC_H |
|---|
| 8 | |
|---|
| 9 | #ifdef __GNUC__ |
|---|
| 10 | #define DEPRECATED(func) func __attribute__ ((deprecated)) |
|---|
| 11 | #elif defined(_MSC_VER) |
|---|
| 12 | #define DEPRECATED(func) __declspec(deprecated) func |
|---|
| 13 | #else |
|---|
| 14 | #pragma message("WARNING: You need to implement DEPRECATED for this compiler") |
|---|
| 15 | #define DEPRECATED(func) func |
|---|
| 16 | #endif |
|---|
| 17 | |
|---|
| 18 | #include "Adafruit_ZeroPDM.h" |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | /**************************************************************************/ |
|---|
| 22 | /*! |
|---|
| 23 | @brief Class that stores state and functions for the microphone on CircuitPlayground boards |
|---|
| 24 | */ |
|---|
| 25 | /**************************************************************************/ |
|---|
| 26 | class Adafruit_CPlay_Mic { |
|---|
| 27 | public: |
|---|
| 28 | Adafruit_CPlay_Mic(void) {}; // Empty constructor |
|---|
| 29 | int peak(uint16_t ms) __attribute__ ((deprecated)); |
|---|
| 30 | void capture(int16_t *buf, uint16_t nSamples), |
|---|
| 31 | fft(uint16_t *spectrum); |
|---|
| 32 | |
|---|
| 33 | float soundPressureLevel(uint16_t ms); |
|---|
| 34 | |
|---|
| 35 | private: |
|---|
| 36 | #if defined(ARDUINO_ARCH_SAMD) |
|---|
| 37 | static Adafruit_ZeroPDM pdm; |
|---|
| 38 | #endif |
|---|
| 39 | }; |
|---|
| 40 | |
|---|
| 41 | #endif // ADAFRUIT_CPLAY_MIC_H |
|---|
Note: See
TracBrowser
for help on using the repository browser.