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