main_ubi_sdk v 0.1.3
This is UBI4 documentation
spi_master_port.h
Go to the documentation of this file.
1/*
2 ******************************************************************************
3 * @file spi_master_port.h
4 * @author A.Alborov
5 ******************************************************************************
6*/
7
8#ifndef MAIN_SPI_MASTER_PORT_H_
9#define MAIN_SPI_MASTER_PORT_H_
10
11
13
14//#define UBI_SDK_TARGET_ESP32
15
16
17#ifdef UBI_SDK_TARGET_ESP32
18
19#include "stdint.h"
20#include "driver/spi_master.h"
21
22
23
24
25typedef struct
26{
27 spi_host_device_t spi_host;
28 int mosi_pin;
29 int miso_pin;
30 int sclk_pin;
31 int cs_pin;
32
33 int clock_speed_hz;
34
35 uint8_t* rx_buffer;
36 uint16_t rx_buffer_size;
37
38 uint8_t* tx_buffer;
39 uint16_t tx_buffer_size;
40
41 spi_bus_config_t config;
42
43 ports_enum port_type;
44
45
46}spi_master_init_port_struct;
47
48
49
50typedef struct
51{
53
54 //TaskHandle_t ReceiveTask;
55 bool enableRecieverTask;
56 spi_master_init_port_struct* init_struct;
57 spi_device_handle_t spi;
58
59 spi_device_interface_config_t device_spi_config;
60
61// uart_isr_handle_t isr_handle;
62
63// xSemaphoreHandle rx_task_semaphore;
64 uint32_t wait_time_ms;
65 int receive_size;
66 int last_rx_delta_size;
67
68 bool tx_wait_rx_enable;
69
70}spi_master_port_struct;
71
72
73void spi_set_cs(spi_master_port_struct* spi_port_struct, uint8_t state);
74
75
76void spi_master_port_init(spi_master_init_port_struct* init_struct, spi_master_port_struct** spi_port_struct);
77
78
79#endif
80#endif /* MAIN_SPI_MASTER_PORT_H_ */
ports_enum
Definition a_port.h:47
Definition a_port.h:99