MBED firmware for MAXREFDES117 Heart Rate / SpO2 sensor. Tested on KL25Z, K64F, and MAX32600MBED#
Dependencies: mbed
Diff: algorithm/algorithm.h
- Revision:
- 3:7c0fb55eb3ff
- Parent:
- 0:346a7fa07998
--- a/algorithm/algorithm.h Thu Apr 21 18:25:34 2016 +0000 +++ b/algorithm/algorithm.h Thu Apr 21 19:38:17 2016 +0000 @@ -69,11 +69,11 @@ #define FS 100 #define BUFFER_SIZE (FS* 5) #define HR_FIFO_SIZE 7 -#define MA4_SIZE 4 // DONOT CHANGE -#define HAMMING_SIZE 5// DONOT CHANGE +#define MA4_SIZE 4 // DO NOT CHANGE +#define HAMMING_SIZE 5// DO NOT CHANGE #define min(x,y) ((x) < (y) ? (x) : (y)) -const uint16_t uw_hamm[31]={ 41, 276, 512, 276, 41 }; //Hamm= long16(512* hamming(5)'); +const uint16_t auw_hamm[31]={ 41, 276, 512, 276, 41 }; //Hamm= long16(512* hamming(5)'); //SPO2table is computed as -45.060*ratioAverage* ratioAverage + 30.354 *ratioAverage + 94.845 ; const uint8_t uch_spo2_table[184]={ 95, 95, 95, 96, 96, 96, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, @@ -85,16 +85,16 @@ 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 31, 30, 29, 28, 27, 26, 25, 23, 22, 21, 20, 19, 17, 16, 15, 14, 12, 11, 10, 9, 7, 6, 5, 3, 2, 1 } ; -static int32_t n_dx[ BUFFER_SIZE-MA4_SIZE]; // delta -static int32_t n_x[ BUFFER_SIZE]; //ir -static int32_t n_y[ BUFFER_SIZE]; //red +static int32_t an_dx[ BUFFER_SIZE-MA4_SIZE]; // delta +static int32_t an_x[ BUFFER_SIZE]; //ir +static int32_t an_y[ BUFFER_SIZE]; //red -void maxim_heart_rate_and_oxygen_saturation(uint32_t *un_ir_buffer , int32_t n_ir_buffer_length, uint32_t *un_red_buffer , int32_t *n_spo2, int8_t *ch_spo2_valid , int32_t *n_heart_rate , int8_t *ch_hr_valid); -void maxim_find_peaks( int32_t *n_locs, int32_t *n_npks, int32_t *n_x, int32_t n_size, int32_t n_min_height, int32_t n_min_distance, int32_t n_max_num ); -void maxim_peaks_above_min_height( int32_t *n_locs, int32_t *n_npks, int32_t *n_x, int32_t n_size, int32_t n_min_height ); -void maxim_remove_close_peaks( int32_t *n_locs, int32_t *n_npks, int32_t *n_x, int32_t n_min_distance ); -void maxim_sort_ascend( int32_t *n_x, int32_t n_size ); -void maxim_sort_indices_descend( int32_t *n_x, int32_t *n_indx, int32_t n_size); +void maxim_heart_rate_and_oxygen_saturation(uint32_t *pun_ir_buffer , int32_t n_ir_buffer_length, uint32_t *pun_red_buffer , int32_t *pn_spo2, int8_t *pch_spo2_valid , int32_t *pn_heart_rate , int8_t *pch_hr_valid); +void maxim_find_peaks( int32_t *pn_locs, int32_t *pn_npks, int32_t *pn_x, int32_t n_size, int32_t n_min_height, int32_t n_min_distance, int32_t n_max_num ); +void maxim_peaks_above_min_height( int32_t *pn_locs, int32_t *pn_npks, int32_t *pn_x, int32_t n_size, int32_t n_min_height ); +void maxim_remove_close_peaks( int32_t *pn_locs, int32_t *pn_npks, int32_t *pn_x, int32_t n_min_distance ); +void maxim_sort_ascend( int32_t *pn_x, int32_t n_size ); +void maxim_sort_indices_descend( int32_t *pn_x, int32_t *pn_indx, int32_t n_size); #endif /* ALGORITHM_H_ */ \ No newline at end of file