]> 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 5f63acff8f958a678f4f8e069544edd3c39774ea..8c80265a1b44df8ce6d1b892bf240adf269b2dfc 100644 (file)
@@ -4,18 +4,31 @@
 #include <stdint.h>
 #include <semaphore.h>
 
+#define OLD_POS_NUM 50
+
+struct rpi_in;
 
 struct rpi_state{
-       sem_t thd_par_sem;
-       uint8_t test;
-       uint16_t pwm1, pwm2, pwm3;
-       uint16_t t_pwm1, t_pwm2, t_pwm3;
-       char commutate;
-       int duty;                       /* duty cycle of pwm */
+       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. */
+       uint32_t tf_count;              /* number of transfer*/
+
        uint16_t index_dist;            /* distance to index position */
-       unsigned char index_ok;
-       uint32_t tf_count;              /*number of transfer*/
+       unsigned char index_ok;         /* we have actual index position */
+
+       uint16_t pwm1, pwm2, pwm3;      /* pwm duty cycles*/
+       uint16_t t_pwm1, t_pwm2, t_pwm3;/* debug*/
+
+       int duty;                       /* duty cycle of pwm */
        int desired_pos;                /* desired position */
-}rps;
+       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 */
+};
 
 #endif /*PMSM_STATE*/