![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ECE 4180 Final Project
Dependencies: mbed PulseSensor mbed-rtos LSM9DS1_Library_cal
Diff: stepcounter.cpp
- Revision:
- 8:2d43385e7784
- Parent:
- 7:88d71c228407
- Child:
- 9:dcbd546412ea
--- a/stepcounter.cpp Wed Dec 01 00:20:32 2021 +0000 +++ b/stepcounter.cpp Thu Dec 02 00:58:37 2021 +0000 @@ -1,5 +1,11 @@ #include "stepcounter.h" - +uint8_t step_cnt = 1; +/* +filter_avg_t acc_data; +axis_info_t acc_sample; +peak_value_t acc_peak; +slid_reg_t acc_slid; +*/ void filter_calculate(filter_avg_t *filter, axis_info_t *sample) @@ -104,7 +110,7 @@ /* the most active axis */ char is_most_active(peak_value_t *peak) { - char res = MOST_ACTIVE_NULL; + char res = MOST_NULL; short x_change = ABS((peak->newmax.x - peak->newmin.x)); short y_change = ABS((peak->newmax.y - peak->newmin.y)); short z_change = ABS((peak->newmax.z - peak->newmin.z)); @@ -127,6 +133,7 @@ void detect_step(peak_value_t *peak, slid_reg_t *slid, axis_info_t *cur_sample) { // static step_cnt = 0; + //step_cnt++; char res = is_most_active(peak); switch (res) { @@ -168,4 +175,8 @@ default: break; } +} + +uint8_t get_step(){ + return step_cnt; } \ No newline at end of file