X-Git-Url: https://rtime.felk.cvut.cz/gitweb/fpga/rpi-motor-control.git/blobdiff_plain/f11e0e40b525a7dfd9d452e02e676ee6cd0478a2..32aaacc65b9f894bea0897421277f71375a7f825:/pmsm-control/test_sw/pmsm_state.c diff --git a/pmsm-control/test_sw/pmsm_state.c b/pmsm-control/test_sw/pmsm_state.c index 3938dc7..acfd347 100644 --- a/pmsm-control/test_sw/pmsm_state.c +++ b/pmsm-control/test_sw/pmsm_state.c @@ -1,5 +1,6 @@ #include "pmsm_state.h" #include "commutators.h" +#include "controllers.h" /** * Index Lost. @@ -36,3 +37,32 @@ inline void setCommutationOff(struct rpi_state* this){ this->commutate=0; this->main_commutator=zero_commutator; } + +/** + * Turn on speed regulation. + */ +inline void setRegulationSpeed(struct rpi_state* this){ + this->spd_reg_ena=1; + this->pos_reg_ena=0; + this->main_controller=spd_pid; +} + +/** + * \brief Turn on position regulation + */ +inline void setRegulationPos(struct rpi_state* this){ + this->spd_reg_ena=0; + this->pos_reg_ena=1; + this->main_controller=pos_pid; +} + +/** + * \brief Turn off regulation. + */ +inline void setRegulationOff(struct rpi_state* this){ + this->spd_reg_ena=0; + this->pos_reg_ena=0; + this->main_controller=zero_controller; + + +}