main_ubi_sdk v 0.1.3
This is UBI4 documentation
spi_slave_port.h
Go to the documentation of this file.
1/*
2 ******************************************************************************
3 * @file spi_slave_port.h
4 * @author A.Alborov
5 ******************************************************************************
6*/
7
8#ifndef INC_SPI_SLAVE_PORT_H_
9#define INC_SPI_SLAVE_PORT_H_
10
11#include "HAL_DRIVERS.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17
18#ifdef HAL_SPI_MODULE_ENABLED
19
20
21#include "UBI_SDK.h"
23
24#ifdef UBI_SDK_FAMILY_STM32
25#include "HAL_DRIVERS.h"
26#include "stdbool.h"
27
28#ifdef HAL_SPI_MODULE_ENABLED
29
30 typedef enum
31 {
32 SPIME_RECEIVE = 0x00,
33 SPIME_TRANSMIT = 0x01
34 }spi_mode_enum;
35
36 typedef enum
37 {
38 SPIRME_RECEIVE_IRQ = 0x00,
39 SPIRME_RECEIVE_COLLECT = 0x01
40 }spi_receive_mode_enum;
41
42 typedef struct
43 {
44 uint8_t* rx_buffer;
45 uint16_t rx_buffer_size;
46
47 uint8_t* tx_buffer;
48 uint16_t tx_buffer_size;
49 SPI_HandleTypeDef* config;
50
51 }spi_slave_init_port_struct;
52
53 typedef struct
54 {
56
57 spi_slave_init_port_struct* init_struct;
58
59 uint8_t wait_receive_enable;
60
61 spi_mode_enum current_mode;
62 spi_receive_mode_enum current_receive_mode;
63
64 uint32_t current_rx_offset;
65 uint32_t current_rx_len;
66
67 }spi_slave_port_struct;
68
69
70
71
72void spi_slave_port_init(spi_slave_init_port_struct* init_struct, spi_slave_port_struct** out_port_struct);
73void spi_slave_port_wait_receive(spi_slave_port_struct* port_str, uint32_t offset, uint32_t len);
74void spi_slave_port_start_receive(spi_slave_port_struct* port_str);
75void spi_slave_port_init0(SPI_HandleTypeDef* huart);
76
77void spi_slave_port_transmit(uint8_t* Buf, uint16_t Size);
78
79//void spi_slave_port_wait_receive(uint8_t* Buf, uint16_t Size);
80
81void spi_slave_port_receive(SPI_HandleTypeDef* huart);
82
83void spi_slave_port_start(void* p);
84
85void spi_slave_port_wait_fixed_receive();
86void spi_slave_port_wait_float_receive(uint16_t size);
87
88bool spi_slave_port_receive_float_len();
89
90#endif // HAL_SPI_MODULE_ENABLED
91#endif
92
93#endif //UBI_SDK_FAMILY_STM32
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif /* INC_SPI_SLAVE_PORT_H_ */
Definition a_port.h:99