]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blob - pmsm-control/test_sw/rp_spi.h
28de88db6302f5f4ddbae997566a64993a664f15
[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         uint16_t adc_m_count;           /*current measurments count*/
19         uint8_t debug_rx[16];
20         uint16_t index_position;        /* raw position of irc_i */
21 };
22
23 /**
24  * \brief Testovaci funkce.
25  */
26 void transfer(void);
27
28 /**
29  * \brief Inicializace pro spi.
30  */
31 int spi_init(void);
32
33 /**
34  * \brief Uzavreni spi.
35  */
36 void spi_disable(void);
37
38 struct rpi_in spi_read(uint8_t *);
39
40 #endif /*RP_SPI*/