X-Git-Url: https://rtime.felk.cvut.cz/gitweb/fpga/rpi-motor-control.git/blobdiff_plain/1a8d767b097d1536b264d8bae3e9d5c16617f835..f15910a53d32ae3ee1611055150798e47336aa4f:/pmsm-control/test_sw/pmsm_state.h diff --git a/pmsm-control/test_sw/pmsm_state.h b/pmsm-control/test_sw/pmsm_state.h index b50b250..d645791 100644 --- a/pmsm-control/test_sw/pmsm_state.h +++ b/pmsm-control/test_sw/pmsm_state.h @@ -4,6 +4,15 @@ #include #include +#define OLD_POS_NUM 50 +#define MAX_DUTY 170 +#define MAX_SPEED (7*OLD_POS_NUM) + +#define LOG_ROWS 5 +#define LOG_DEF_COL 1000 +#define MAX_LOGS 1000 +#define LOG_PERIOD 5 + struct rpi_in; struct rpi_state{ @@ -20,11 +29,22 @@ struct rpi_state{ int duty; /* duty cycle of pwm */ int desired_pos; /* desired position */ + int old_pos[OLD_POS_NUM]; /* old positions */ int desired_spd; /* desired speed */ + int speed; char commutate; /* zapina prepocet duty na jednotlive pwm */ char pos_reg_ena; /* position regulation enable */ char spd_reg_ena; /* speed rugulation enable */ + + int spd_err_sum; /* for speed pid regulator */ + + int *logs[LOG_ROWS]; /* logs */ + int log_col_count; /* number of log columns */ + int log_col; /* current colimn */ + char doLogs; /* schall we make logs? */ }; +void freeLogs(); + #endif /*PMSM_STATE*/