X-Git-Url: https://rtime.felk.cvut.cz/gitweb/fpga/rpi-motor-control.git/blobdiff_plain/b98f70ee3eed3af0cbbc9d5869ac1e7626534ef4..6841e483f0b370a6ea2b41c958945d3db9285c90:/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 b3a3125..47401d8 100644 --- a/pmsm-control/test_sw/pmsm_state.h +++ b/pmsm-control/test_sw/pmsm_state.h @@ -16,6 +16,8 @@ struct rpi_in; struct rpi_state{ + //const unsigned MAX_DUTY; /*Max duty*/ + struct rpi_in* spi_dat; /* spi data */ sem_t thd_par_sem; /* data metual exlusion access */ uint8_t test; /* configuratin byte - pwm enabl. bits etc. */ @@ -44,8 +46,48 @@ struct rpi_state{ int log_col_count; /* number of log columns */ int log_col; /* current colimn */ char doLogs; /* schall we make logs? */ + + void (*main_commutator)(struct rpi_state*); /* primarni komutator */ + void (*main_controller)(struct rpi_state*); /* primarni regulator */ + + char error; /* detekce chyboveho stavu */ + + int8_t h1_old,h2_old,h3_old; /* stare hodnoty hallu */ }; -void freeLogs(); +/** + * Index OK. + */ +inline void setIndexOK(struct rpi_state*); + +/** + * Index Lost. + */ +inline void setIndexLost(struct rpi_state*); + +/** + * Turn commutation on. + */ +inline void setCommutationOn(struct rpi_state*); + +/** + * Turn commutation off. + */ +inline void setCommutationOff(struct rpi_state*); + +/** + * Turn on speed regulation. + */ +inline void setRegulationSpeed(struct rpi_state*); + +/** + * \brief Turn on position regulation + */ +inline void setRegulationPos(struct rpi_state*); + +/** + * \brief Turn off regulation. + */ +inline void setRegulationOff(struct rpi_state*); #endif /*PMSM_STATE*/