Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
daq.h
00001 /** 00002 * @file daq.h 00003 * Header file for daq.cpp - a data acquisition system capable of 00004 * sampling from multiple ADCs in BURST mode to allow consistent, 00005 * high-rate sampling. The samples are passed to a bank of decimators 00006 * to allow the samples to be synchronised with another, slower 00007 * sampling clock or other sampling sources/ 00008 * 00009 * @brief Header file for daq.cpp 00010 * 00011 * @author James A C Patterson 00012 */ 00013 #ifndef DAQ_H 00014 #define DAQ_H 00015 00016 typedef void (*FuncPtr)(void); 00017 00018 class ADC_BURST { 00019 public: 00020 ADC_BURST (); 00021 ~ADC_BURST (); 00022 void attach(FuncPtr); 00023 void burst_isr(void); 00024 uint32_t data[4]; 00025 private: 00026 FuncPtr isr_pointer_; 00027 bool attached_; 00028 static ADC_BURST *instance; 00029 static void _burst_isr(void); 00030 }; 00031 00032 /** 00033 * Decimator class to implement simple low-pass filtering on uC 00034 * Unsigned integer decimator. Depth up to 32 samples. 00035 * Currently just behaves as a uniform weighted FIR 00036 */ 00037 class Decimator { 00038 public: 00039 Decimator (uint8_t); 00040 void write (uint16_t); 00041 uint16_t read (); 00042 private: 00043 uint8_t decimation_order_; 00044 uint8_t decimation_length_; 00045 uint8_t decimation_pointer_; 00046 uint16_t decimation_buffer_[32]; 00047 uint32_t accumulator_; 00048 }; 00049 #endif
Generated on Sat Jul 16 2022 02:18:32 by
1.7.2