Controll loop now more complex.
[fpga/rpi-motor-control.git] / pmsm-control / test_sw / pmsm_state.h
1 #ifndef PMSM_STATE
2 #define PMSM_STATE
3
4 #include <stdint.h>
5 #include <semaphore.h>
6
7 struct rpi_in;
8
9 struct rpi_state{
10         struct rpi_in* spi_dat;         /* spi data */
11         sem_t thd_par_sem;              /* data metual exlusion access */
12         uint8_t test;                   /* configuratin byte - pwm enabl. bits etc. */
13         uint32_t tf_count;              /* number of transfer*/
14
15         uint16_t index_dist;            /* distance to index position */
16         unsigned char index_ok;         /* we have actual index position */
17
18         uint16_t pwm1, pwm2, pwm3;      /* pwm duty cycles*/
19         uint16_t t_pwm1, t_pwm2, t_pwm3;/* debug*/
20
21         int duty;                       /* duty cycle of pwm */
22         int desired_pos;                /* desired position */
23         int desired_spd;                /* desired speed */
24
25         char commutate;                 /* zapina prepocet duty na jednotlive pwm */
26         char pos_reg_ena;               /* position regulation enable */
27         char spd_reg_ena;               /* speed rugulation enable */
28 };
29
30 #endif /*PMSM_STATE*/