| 1 | #ifndef LFSAMPLING_H |
| 2 | #define LFSAMPLING_H |
| 3 | |
| 4 | /** |
| 5 | * acquisition of Cotag LF signal. Similar to other LF, since the Cotag has such long datarate RF/384 |
| 6 | * and is Manchester?, we directly gather the manchester data into bigbuff |
| 7 | **/ |
| 8 | void doCotagAcquisition(size_t sample_size); |
| 9 | uint32_t doCotagAcquisitionManchester(void); |
| 10 | |
| 11 | /** |
| 12 | * acquisition of T55x7 LF signal. Similart to other LF, but adjusted with @marshmellows thresholds |
| 13 | * the data is collected in BigBuf. |
| 14 | **/ |
| 15 | void doT55x7Acquisition(size_t sample_size); |
| 16 | |
| 17 | /** |
| 18 | * Initializes the FPGA for reader-mode (field on), and acquires the samples. |
| 19 | * @return number of bits sampled |
| 20 | **/ |
| 21 | uint32_t SampleLF(bool silent); |
| 22 | |
| 23 | /** |
| 24 | * Initializes the FPGA for snoop-mode (field off), and acquires the samples. |
| 25 | * @return number of bits sampled |
| 26 | **/ |
| 27 | uint32_t SnoopLF(); |
| 28 | |
| 29 | // adds sample size to default options |
| 30 | uint32_t DoPartialAcquisition(int trigger_threshold, bool silent, int sample_size); |
| 31 | |
| 32 | /** |
| 33 | * @brief Does sample acquisition, ignoring the config values set in the sample_config. |
| 34 | * This method is typically used by tag-specific readers who just wants to read the samples |
| 35 | * the normal way |
| 36 | * @param trigger_threshold |
| 37 | * @param silent |
| 38 | * @return number of bits sampled |
| 39 | */ |
| 40 | uint32_t DoAcquisition_default(int trigger_threshold, bool silent); |
| 41 | /** |
| 42 | * @brief Does sample acquisition, using the config values set in the sample_config. |
| 43 | * @param trigger_threshold |
| 44 | * @param silent |
| 45 | * @return number of bits sampled |
| 46 | */ |
| 47 | |
| 48 | uint32_t DoAcquisition_config( bool silent); |
| 49 | |
| 50 | /** |
| 51 | * Setup the FPGA to listen for samples. This method downloads the FPGA bitstream |
| 52 | * if not already loaded, sets divisor and starts up the antenna. |
| 53 | * @param divisor : 1, 88> 255 or negative ==> 134.8 KHz |
| 54 | * 0 or 95 ==> 125 KHz |
| 55 | * |
| 56 | **/ |
| 57 | void LFSetupFPGAForADC(int divisor, bool lf_field); |
| 58 | |
| 59 | /** |
| 60 | * Called from the USB-handler to set the sampling configuration |
| 61 | * The sampling config is used for std reading and snooping. |
| 62 | * |
| 63 | * Other functions may read samples and ignore the sampling config, |
| 64 | * such as functions to read the UID from a prox tag or similar. |
| 65 | * |
| 66 | * Values set to '0' implies no change (except for averaging) |
| 67 | * @brief setSamplingConfig |
| 68 | * @param sc |
| 69 | */ |
| 70 | void setSamplingConfig(sample_config *sc); |
| 71 | |
| 72 | sample_config * getSamplingConfig(); |
| 73 | |
| 74 | void printConfig(); |
| 75 | |
| 76 | |
| 77 | #endif // LFSAMPLING_H |