Setters made inline.
[fpga/rpi-motor-control.git] / pmsm-control / test_sw / pmsm_state.c
1 #include "pmsm_state.h"
2 #include "commutators.h"
3
4 /**
5  * Index Lost.
6  */
7 inline void setIndexLost(struct rpi_state* this){
8         this->index_ok=0;
9         this->main_commutator=simple_hall_commutator;
10 }
11
12 /**
13  * Index OK.
14  */
15 inline void setIndexOK(struct rpi_state* this){
16         this->index_ok=1;
17         this->main_commutator=inv_trans_comm_2;
18 }
19
20 /**
21  * Turn commutation on.
22  */
23 inline void setCommutationOn(struct rpi_state* this){
24         this->commutate=1;
25         if (this->index_ok){
26                 this->main_commutator=inv_trans_comm_2;
27         }else{
28                 this->main_commutator=simple_hall_commutator;
29         }
30 }
31
32 /**
33  * Turn commutation off.
34  */
35 inline void setCommutationOff(struct rpi_state* this){
36         this->commutate=0;
37         this->main_commutator=zero_commutator;
38 }