]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blobdiff - pmsm-control/test_sw/pmsm_state.h
Setters made inline.
[fpga/rpi-motor-control.git] / pmsm-control / test_sw / pmsm_state.h
index a148e1cfd0405f8a3a20dbe0e7ddbdddbe8bf458..b1946a653b2a0bfd07aa797cef97be942089bb23 100644 (file)
@@ -8,14 +8,16 @@
 #define MAX_DUTY       170
 #define MAX_SPEED      (7*OLD_POS_NUM)
 
-#define LOG_ROWS       2
-#define LOG_DEF_COL    500
-#define MAX_LOGS       1000
-#define LOG_PERIOD     10
+#define LOG_ROWS       11
+#define LOG_DEF_COL    8000
+#define MAX_LOGS       8000
+#define LOG_PERIOD     2
 
 struct rpi_in;
 
 struct rpi_state{
+       //const unsigned MAX_DUTY;      /*Max duty*/
+
        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. */
@@ -36,6 +38,7 @@ struct rpi_state{
        char commutate;                 /* zapina prepocet duty na jednotlive pwm */
        char pos_reg_ena;               /* position regulation enable */
        char spd_reg_ena;               /* speed rugulation enable */
+       unsigned short alpha_offset;    /* offset between 'alpha' and 'a' axis */
 
        int spd_err_sum;                /* for speed pid regulator */
 
@@ -43,8 +46,29 @@ struct rpi_state{
        int log_col_count;              /* number of log columns */
        int log_col;                    /* current colimn */
        char doLogs;                    /* schall we make logs? */
+
+       void (*main_commutator)(struct rpi_state*);     /* primarni komutator */
+       void (*main_controller)(struct rpi_state*);     /* primarni regulator */
 };
 
-void freeLogs();
+/**
+ * Index OK.
+ */
+inline void setIndexOK(struct rpi_state*);
+
+/**
+ * Index Lost.
+ */
+inline void setIndexLost(struct rpi_state*);
+
+/**
+ * Turn commutation on.
+ */
+inline void setCommutationOn(struct rpi_state*);
+
+/**
+ * Turn commutation off.
+ */
+inline void setCommutationOff(struct rpi_state*);
 
 #endif /*PMSM_STATE*/