my test
Embed:
(wiki syntax)
Show/hide line numbers
filter.h
00001 //****************************************************************************** 00002 // filter.h 00003 // 00004 // Description: Header file of filter module 00005 // 00006 // Author: Jason shen 00007 // Version 1.00 00008 // DDC BJ 00009 // October 2011 00010 // Built with IAR Embedded Workbench Version: 5.30A 00011 //****************************************************************************** 00012 //Change Log: 00013 //****************************************************************************** 00014 //Version: 1.00 00015 //Comments: Initial Release Version 00016 //****************************************************************************** 00017 00018 #ifndef FILTER_H 00019 #define FILTER_H 00020 #include "mbed.h" 00021 00022 00023 struct filter_args_s { 00024 float v[3]; //data buffer, record the 3 datas in queue 00025 float K_ini; //ini value of K 00026 float K_curr; //current value of K 00027 float K_inc; //increment value of K 00028 float K_max; //max value of K 00029 float threshold; // 00030 char dir_flag; //p_dir or n_dir 00031 char dir_cnt; //counts or p_dir or n_dir 00032 }; 00033 00034 class Filter 00035 { 00036 public: 00037 //int32_t first_order_filter(int32_t old_data, int32_t new_data, int32_t K, int32_t threshold); 00038 float first_order_filter(float old_data, float new_data, float K, float threshold); 00039 int32_t first_order_filter_adaptive_K(int32_t old_data, int32_t new_data, int32_t threshold, int32_t K_increment, int32_t K_max); 00040 float first_order_filter_adaptive_K(float new_data, filter_args_s *arg); 00041 int16_t SignalFilter(int16_t data, int16_t _filter, int16_t _order); 00042 void max_min(uint16_t data[], uint16_t n, uint16_t *max, uint16_t *min); 00043 void sum_avg(uint16_t data[], uint16_t n, uint32_t *sum, float *avg); 00044 void stdev(uint16_t data[], uint16_t n, float *s); 00045 }; 00046 00047 00048 #endif
Generated on Sat Aug 20 2022 09:59:31 by
1.7.2