TuyaOS
tuya_gpio.h
浏览该文件的文档.
1
11#ifndef __TUYA_GPIO_H__
12#define __TUYA_GPIO_H__
13
14#ifdef __cplusplus
15 extern "C" {
16#endif
17
18#include "tuya_cloud_types.h"
19
20typedef enum {
21 TY_GPIOA_0 = 0,
22 TY_GPIOA_1,
23 TY_GPIOA_2,
24 TY_GPIOA_3,
25 TY_GPIOA_4,
26 TY_GPIOA_5,
27 TY_GPIOA_6,
28 TY_GPIOA_7,
29 TY_GPIOA_8,
30 TY_GPIOA_9,
31 TY_GPIOA_10,
32 TY_GPIOA_11,
33 TY_GPIOA_12,
34 TY_GPIOA_13,
35 TY_GPIOA_14,
36 TY_GPIOA_15,
37 TY_GPIOA_16,
38 TY_GPIOA_17,
39 TY_GPIOA_18,
40 TY_GPIOA_19,
41 TY_GPIOA_20,
42 TY_GPIOA_21,
43 TY_GPIOA_22,
44 TY_GPIOA_23,
45 TY_GPIOA_24,
46 TY_GPIOA_25,
47 TY_GPIOA_26,
48 TY_GPIOA_27,
49 TY_GPIOA_28,
50 TY_GPIOA_29,
51 TY_GPIOA_30,
52 TY_GPIOA_31,
53 TY_GPIOB_0 = 32,
54 TY_GPIOB_1,
55 TY_GPIOB_2,
56 TY_GPIOB_3,
57 TY_GPIOB_4,
58 TY_GPIOB_5,
59 TY_GPIOB_6,
60 TY_GPIOB_7,
61 TY_GPIOB_8,
62 TY_GPIOB_9,
63 TY_GPIOB_10,
64 TY_GPIOB_11,
65 TY_GPIOB_12,
66 TY_GPIOB_13,
67 TY_GPIOB_14,
68 TY_GPIOB_15,
69 TY_GPIOB_16,
70 TY_GPIOB_17,
71 TY_GPIOB_18,
72 TY_GPIOB_19,
73 TY_GPIOB_20,
74 TY_GPIOB_21,
75 TY_GPIOB_22,
76 TY_GPIOB_23,
77 TY_GPIOB_24,
78 TY_GPIOB_25,
79 TY_GPIOB_26,
80 TY_GPIOB_27,
81 TY_GPIOB_28,
82 TY_GPIOB_29,
83 TY_GPIOB_30,
84 TY_GPIOB_31
85}TY_GPIO_PORT_E;
86
87typedef enum {
88 TY_GPIO_PULLUP, // Pad pull up
89 TY_GPIO_PULLDOWN, // Pad pull down
90 TY_GPIO_PULLUP_PULLDOWN, // Pad pull up + pull down
91 TY_GPIO_OPENDRAIN, // Pad open drain
92 TY_GPIO_FLOATING, // Pad floating
93} TY_GPIO_MODE_E;
94
95typedef enum {
96 TY_IRQ_NONE,
108
117OPERATE_RET tuya_gpio_inout_set(IN CONST TY_GPIO_PORT_E port, IN CONST BOOL_T in);
118
128OPERATE_RET tuya_gpio_inout_set_select(IN CONST TY_GPIO_PORT_E port,IN CONST BOOL_T in,IN CONST BOOL_T high);
129
138OPERATE_RET tuya_gpio_mode_set(IN CONST TY_GPIO_PORT_E port, IN CONST TY_GPIO_MODE_E mode);
139
147INT_T tuya_gpio_read(IN CONST TY_GPIO_PORT_E port);
148
149
158OPERATE_RET tuya_gpio_write(IN CONST TY_GPIO_PORT_E port, IN CONST BOOL_T high);
159
160
161
162#ifdef __cplusplus
163}
164#endif
165#endif
OPERATE_RET tuya_gpio_mode_set(IN CONST TY_GPIO_PORT_E port, IN CONST TY_GPIO_MODE_E mode)
gpio mode set
OPERATE_RET tuya_gpio_inout_set_select(IN CONST TY_GPIO_PORT_E port, IN CONST BOOL_T in, IN CONST BOOL_T high)
gpio inout select
TY_GPIO_IRQ_TRIG_E
Definition: tuya_gpio.h:95
@ TY_IRQ_LOW
Definition: tuya_gpio.h:106
@ TY_IRQ_BOTH
Definition: tuya_gpio.h:102
@ TY_IRQ_RISE
Definition: tuya_gpio.h:98
@ TY_IRQ_FALL
Definition: tuya_gpio.h:100
@ TY_IRQ_HIGH
Definition: tuya_gpio.h:104
OPERATE_RET tuya_gpio_write(IN CONST TY_GPIO_PORT_E port, IN CONST BOOL_T high)
gpio wriet
OPERATE_RET tuya_gpio_inout_set(IN CONST TY_GPIO_PORT_E port, IN CONST BOOL_T in)
gpio inout set
INT_T tuya_gpio_read(IN CONST TY_GPIO_PORT_E port)
gpio read