]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blobdiff - pmsm-control/test_sw/rp_spi.h
Correct typo in rpi-mc-1 mapping to Ti AM437x based RICO board.
[fpga/rpi-motor-control.git] / pmsm-control / test_sw / rp_spi.h
index 999d7b344a74a42933dcacf10c1595f3c74b0408..4b1cfa6afbabaff0ec96e8c0479350d85e640c7d 100644 (file)
@@ -1,34 +1,42 @@
 /**
  * \file rp_spi.h
  */
-
+#ifndef RP_SPI
+#define RP_SPI
 #include <stdint.h> /*uint32_t*/
 
 /**
  * \brief Struktura pro prichozi data z fpga.
  */
 struct rpi_in{
-       uint64_t pozice;                /*use twice the origin size to avoid underflow when sunstracting offset*/
+       signed long int pozice;         /*continue with normal size and test it..*/
+       uint32_t pozice_raw;            /*with offset*/
        uint32_t ch0, ch1, ch2;
        int8_t hal1,hal2,hal3;          /* bool values */
        int8_t en1, en2, en3;           /*(bool)last read pwm-enable values - !they are changed after reading ! */
        int8_t shdn1,shdn2,shdn3;       /*(bool)last read shutdown values - !they are changed after reading ! */
-       int8_t b54, b53, b52, b51, b50, b49, b48, b47, b46, b45, b44, b43, b42, b41, b40, b39, b38, b37, b36; /*bits for debug*/
+       uint16_t adc_m_count;           /*current measurments count*/
+       uint8_t debug_rx[16];
+       uint16_t index_position;        /* raw position of irc_i */
 };
 
+struct rpi_state;
+
 /**
  * \brief Testovaci funkce.
  */
-extern void transfer(void);
+void transfer(void);
 
 /**
  * \brief Inicializace pro spi.
  */
-extern int spi_init(void);
+int spi_init(void);
 
 /**
  * \brief Uzavreni spi.
  */
-extern void spi_disable(void);
+void spi_disable(void);
+
+void spi_read(struct rpi_state*);
 
-extern struct rpi_in spi_read(uint8_t *);
+#endif /*RP_SPI*/