]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blob - pmsm-control/test_sw/rp_spi.h
7d2dd7f3a1fc45f7d4d6bd6b9ba345f21e1d58e6
[fpga/rpi-motor-control.git] / pmsm-control / test_sw / rp_spi.h
1 /**
2  * \file rp_spi.h
3  */
4
5 #include <stdint.h> /*uint32_t*/
6
7 /**
8  * \brief Struktura pro prichozi data z fpga.
9  */
10 struct rpi_in{
11         uint64_t pozice;                /*use twice the origin size to avoid underflow when sunstracting offset*/
12         uint32_t ch0, ch1, ch2;
13         int8_t hal1,hal2,hal3;          /* bool values */
14         int8_t en1, en2, en3;           /*(bool)last read pwm-enable values - !they are changed after reading ! */
15         int8_t shdn1,shdn2,shdn3;       /*(bool)last read shutdown values - !they are changed after reading ! */
16         int8_t b54, b53, b52, b51, b50, b49, b48, b47, b46, b45, b44, b43, b42, b41, b40, b39, b38, b37, b36; /*bits for debug*/
17         uint16_t adc_m_count;           /*current measurments count*/
18         uint8_t debug_rx[16];
19 };
20
21 /**
22  * \brief Testovaci funkce.
23  */
24 extern void transfer(void);
25
26 /**
27  * \brief Inicializace pro spi.
28  */
29 extern int spi_init(void);
30
31 /**
32  * \brief Uzavreni spi.
33  */
34 extern void spi_disable(void);
35
36 extern struct rpi_in spi_read(uint8_t *);