main_ubi_sdk v 0.1.3
This is UBI4 documentation
one_wire_port.h
Go to the documentation of this file.
1/*
2 ******************************************************************************
3 * @file one_wire_port.h
4 * @author A.Alborov
5 ******************************************************************************
6*/
7
8#ifndef MAIN_ONE_WIRE_PORT_H_
9#define MAIN_ONE_WIRE_PORT_H_
10
11
13
14#ifdef UBI_SDK_TARGET_ESP32
15
16#include "stdint.h"
17#include "driver/uart.h"
18
19
20
21
22typedef struct
23{
24 int uart_port_num;
25 int uart_owd_pin;
26 int one_wire_control_pin;
27
28 uint8_t* rx_buffer;
29 uint16_t rx_buffer_size;
30
31 uint8_t* tx_buffer;
32 uint16_t tx_buffer_size;
33
34 uart_config_t uart_config;
35
36 ports_enum port_type;
37
38
39}one_wire_init_port_struct;
40
41
42typedef enum
43{
44 OWME_RECEIVE = 0x00,
45 OWME_TRANSMIT = 0x01
46}one_wire_mode_enum;
47
48
49typedef struct
50{
52 TaskHandle_t ReceiveTask;
53 bool enableRecieverTask;
54 one_wire_init_port_struct* init_struct;
55
56 uart_isr_handle_t isr_handle;
57
58 volatile one_wire_mode_enum current_mode;
59
60 xSemaphoreHandle rx_task_semaphore;
61 uint32_t wait_time_ms;
62 int receive_size;
63 int last_rx_delta_size;
64 int last_tx_size;
65
66 bool tx_wait_rx_enable;
67
68
69}one_wire_port_struct;
70
71
72
73void one_wire_initialize_port();
74uint8_t* one_wire_port_get_buffer();
75void one_wire_port_write(uint8_t *buf, uint8_t size);
76
77void one_wire_enable_rx(one_wire_port_struct* out_port_struct);
78
79
80void one_wire_port_init(one_wire_init_port_struct* init_struct, one_wire_port_struct** out_port_struct);
81
82
83#endif
84#endif /* MAIN_ONE_WIRE_PORT_H_ */
ports_enum
Definition a_port.h:47
Definition a_port.h:99