Class to determine the frequency of an input array
FrequencyFinder.h@0:78c2ee8ea962, 2012-11-25 (annotated)
- Committer:
- melangeaddict
- Date:
- Sun Nov 25 23:10:33 2012 +0000
- Revision:
- 0:78c2ee8ea962
[mbed] converted /tuner/FrequencyFinder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
melangeaddict | 0:78c2ee8ea962 | 1 | #pragma once |
melangeaddict | 0:78c2ee8ea962 | 2 | #include "mbed.h" |
melangeaddict | 0:78c2ee8ea962 | 3 | #include "FFT.h" |
melangeaddict | 0:78c2ee8ea962 | 4 | |
melangeaddict | 0:78c2ee8ea962 | 5 | #include "NewTextLCD.h" |
melangeaddict | 0:78c2ee8ea962 | 6 | |
melangeaddict | 0:78c2ee8ea962 | 7 | using namespace std; |
melangeaddict | 0:78c2ee8ea962 | 8 | |
melangeaddict | 0:78c2ee8ea962 | 9 | const int size=4096; |
melangeaddict | 0:78c2ee8ea962 | 10 | |
melangeaddict | 0:78c2ee8ea962 | 11 | class FrequencyFinder{ |
melangeaddict | 0:78c2ee8ea962 | 12 | public: |
melangeaddict | 0:78c2ee8ea962 | 13 | |
melangeaddict | 0:78c2ee8ea962 | 14 | FrequencyFinder(PinName input); |
melangeaddict | 0:78c2ee8ea962 | 15 | ~FrequencyFinder(); |
melangeaddict | 0:78c2ee8ea962 | 16 | |
melangeaddict | 0:78c2ee8ea962 | 17 | float find_frequency(); |
melangeaddict | 0:78c2ee8ea962 | 18 | void get_data(); |
melangeaddict | 0:78c2ee8ea962 | 19 | void take_abs(); |
melangeaddict | 0:78c2ee8ea962 | 20 | int find_peak(); |
melangeaddict | 0:78c2ee8ea962 | 21 | int find_max(int); |
melangeaddict | 0:78c2ee8ea962 | 22 | void initialize_array(); |
melangeaddict | 0:78c2ee8ea962 | 23 | void copy_data(); |
melangeaddict | 0:78c2ee8ea962 | 24 | |
melangeaddict | 0:78c2ee8ea962 | 25 | private: |
melangeaddict | 0:78c2ee8ea962 | 26 | float signal_array[size]; |
melangeaddict | 0:78c2ee8ea962 | 27 | int index; |
melangeaddict | 0:78c2ee8ea962 | 28 | int peak; |
melangeaddict | 0:78c2ee8ea962 | 29 | int frequency_final; |
melangeaddict | 0:78c2ee8ea962 | 30 | |
melangeaddict | 0:78c2ee8ea962 | 31 | Ticker ticker; |
melangeaddict | 0:78c2ee8ea962 | 32 | AnalogIn _signal_in; |
melangeaddict | 0:78c2ee8ea962 | 33 | AnalogOut _dc_offset; |
melangeaddict | 0:78c2ee8ea962 | 34 | |
melangeaddict | 0:78c2ee8ea962 | 35 | }; |