]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blobdiff - pmsm-control/test_sw/pmsm_state.h
Added speed computation.
[fpga/rpi-motor-control.git] / pmsm-control / test_sw / pmsm_state.h
index e028201678e7a3c512f52bd338052762227d8318..8c80265a1b44df8ce6d1b892bf240adf269b2dfc 100644 (file)
@@ -4,6 +4,8 @@
 #include <stdint.h>
 #include <semaphore.h>
 
+#define OLD_POS_NUM 50
+
 struct rpi_in;
 
 struct rpi_state{
@@ -20,8 +22,9 @@ struct rpi_state{
 
        int duty;                       /* duty cycle of pwm */
        int desired_pos;                /* desired position */
-       int old_pos;                    /* one cycle old 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 */