Jim Patterson / Mbed 2 deprecated MultiSensor_00

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers daq.h Source File

daq.h

Go to the documentation of this file.
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