TuyaOS
tuya_cloud_types.h
1/*
2tuya_cloud_types.h
3Copyright(C),2018-2020, 涂鸦科技 www.tuya.comm
4*/
5
6#ifndef TUYA_CLOUD_TYPES_H
7#define TUYA_CLOUD_TYPES_H
8
9#include "tuya_iot_config.h"
10#include <stdarg.h>
11
12#if OPERATING_SYSTEM == SYSTEM_LINUX
13#include <ctype.h>
14#endif
15
16#include <stddef.h>
17#include <stdint.h>
18#include <stdbool.h>
19#include <string.h>
20#include "tuya_error_code.h"
21
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27typedef int OPERATE_RET;
28typedef long long DLONG_T;
29typedef DLONG_T *PDLONG_T;
30typedef float FLOAT_T;
31typedef FLOAT_T *PFLOAT_T;
32typedef signed int INT_T;
33typedef int *PINT_T;
34typedef void *PVOID_T;
35typedef char CHAR_T;
36typedef char *PCHAR_T;
37typedef signed char SCHAR_T;
38typedef unsigned char UCHAR_T;
39typedef short SHORT_T;
40typedef unsigned short USHORT_T;
41typedef short *PSHORT_T;
42typedef long LONG_T;
43typedef unsigned long ULONG_T;
44typedef long *PLONG_T;
45typedef unsigned char BYTE_T;
46typedef BYTE_T *PBYTE_T;
47typedef unsigned int UINT_T;
48typedef unsigned int *PUINT_T;
49typedef int BOOL_T;
50typedef BOOL_T *PBOOL_T;
51typedef long long int INT64_T;
52typedef INT64_T *PINT64_T;
53typedef unsigned long long int UINT64_T;
54typedef UINT64_T *PUINT64_T;
55typedef unsigned int UINT32_T;
56typedef unsigned int *PUINT32_T;
57typedef int INT32_T;
58typedef int *PINT32_T;
59typedef short INT16_T;
60typedef INT16_T *PINT16_T;
61typedef unsigned short UINT16_T;
62typedef UINT16_T *PUINT16_T;
63typedef signed char INT8_T;
64typedef INT8_T *PINT8_T;
65typedef unsigned char UINT8_T;
66typedef UINT8_T *PUINT8_T;
67typedef ULONG_T TIME_MS;
68typedef ULONG_T TIME_S;
69typedef unsigned int TIME_T;
70typedef double DOUBLE_T;
71typedef unsigned short WORD_T;
72typedef WORD_T *PWORD_T;
73typedef unsigned int DWORD_T;
74typedef DWORD_T *PDWORD_T;
75
76#ifndef FALSE
77#define FALSE 0
78#endif
79
80#ifndef TRUE
81#define TRUE 1
82#endif
83
84#ifndef IN
85#define IN
86#endif
87
88#ifndef OUT
89#define OUT
90#endif
91
92#ifndef INOUT
93#define INOUT
94#endif
95
96#ifndef VOID
97#define VOID void
98#endif
99
100#ifndef VOID_T
101#define VOID_T void
102#endif
103
104
105#ifndef CONST
106#define CONST const
107#endif
108
109#ifndef STATIC
110#define STATIC static
111#endif
112
113#ifndef SIZEOF
114#define SIZEOF sizeof
115#endif
116
117#ifndef INLINE
118#define INLINE inline
119#endif
120
121#ifndef NULL
122#ifdef __cplusplus
123#define NULL 0
124#else
125#define NULL ((void *)0)
126#endif
127#endif
128
129#ifndef bool_t
130typedef int bool_t;
131#endif
132
133#ifndef true
134#define true 1
135#endif
136
137#ifndef false
138#define false 0
139#endif
140
141typedef size_t SIZE_T;
142
143#ifndef MAX
144#define MAX(a,b) (((a) > (b)) ? (a) : (b))
145#endif
146
147#ifndef MIN
148#define MIN(a,b) (((a) < (b)) ? (a) : (b))
149#endif
150
151#ifndef BIT
152#define BIT(nr) (1UL << (nr))
153#endif
154#define MAKEWORD(a, b) ((WORD_T)(((BYTE_T)(a)) | ((WORD_T)((BYTE_T)(b))) << 8))
155#define MAKELONG(a, b) ((LONG_T)(((WORD_T)(a)) | ((DWORD_T)((WORD_T)(b))) << 16))
156#define LOWORD(l) ((WORD_T)(l))
157#define HIWORD(l) ((WORD_T)(((DWORD_T)(l) >> 16) & 0xFFFF))
158#define LOBYTE(w) ((BYTE_T)(w))
159#define HIBYTE(w) ((BYTE_T)(((WORD_T)(w) >> 8) & 0xFF))
160
161#define WORD_SWAP(X) (((X << 8) | (X >> 8))&0xFFFF)
162#define DWORD_SWAP(X) ( (((X)&0xff)<<24) + \
163 (((X)&0xff00)<<8) + \
164 (((X)&0xff0000)>>8) + \
165 (((X)&0xff000000)>>24) )
166#define DDWORD_SWAP(X) { \
167 unsigned long temp_low, temp_high; \
168 temp_low = DWORD_SWAP((unsigned long)((X) & 0xffffffff)); \
169 temp_high = DWORD_SWAP((unsigned long)((X) >> 32)); \
170 X = 0; \
171 X |= temp_low; \
172 X <<= 32; \
173 X |= temp_high;\
174}
175
176#if defined(LITTLE_END) && (LITTLE_END==1)
177#define UNI_NTOHS(X) WORD_SWAP(X)
178#define UNI_HTONS(X) WORD_SWAP(X)
179#define UNI_NTOHL(X) DWORD_SWAP(X)
180#define UNI_HTONL(X) DWORD_SWAP(X)
181#define UNI_NTOHLL(X) DDWORD_SWAP(X)
182#define UNI_HTONLL(X) DDWORD_SWAP(X)
183
184#else
185
186#define UNI_NTOHS(X) X
187#define UNI_HTONS(X) X
188#define UNI_NTOHL(X) X
189#define UNI_HTONL(X) X
190#define UNI_NTOHLL(X) X
191#define UNI_HTONLL(X) X
192
193#endif
194
195#define OFFSOF(s,m) ((SIZE_T)(&(((s*)0)->m)))
196#define CNTSOF(a) (sizeof(a)/sizeof(a[0]))
197#define CNTR_OF(ptr, type, member) \
198 ({(type *)( (char *)ptr - OFFSOF(type,member) );}) // continer of
199
200typedef struct
201{
202 char ip[16]; /* ip addr: xxx.xxx.xxx.xxx */
203 char mask[16]; /* net mask: xxx.xxx.xxx.xxx */
204 char gw[16]; /* gateway: xxx.xxx.xxx.xxx */
205}NW_IP_S;
206
207#define MAC_ADDR_LEN 6
208typedef struct {
209 UINT8_T mac[MAC_ADDR_LEN];
210}NW_MAC_S;
211
212typedef enum {
213 TUYA_IO_BITS_0,
214 TUYA_IO_BITS_1,
215 TUYA_IO_BITS_2,
216 TUYA_IO_BITS_3,
217 TUYA_IO_BITS_4,
218 TUYA_IO_BITS_5,
219 TUYA_IO_BITS_6,
220 TUYA_IO_BITS_7,
221 TUYA_IO_BITS_8,
222 TUYA_IO_BITS_9,
223 TUYA_IO_BITS_10,
224 TUYA_IO_BITS_11,
225 TUYA_IO_BITS_12,
226 TUYA_IO_BITS_13,
227 TUYA_IO_BITS_14,
228 TUYA_IO_BITS_15,
229 TUYA_IO_BITS_16,
230 TUYA_IO_BITS_17,
231 TUYA_IO_BITS_18,
232 TUYA_IO_BITS_19,
233 TUYA_IO_BITS_20,
234 TUYA_IO_BITS_21,
235 TUYA_IO_BITS_22,
236 TUYA_IO_BITS_23,
237 TUYA_IO_BITS_24,
238 TUYA_IO_BITS_25,
239 TUYA_IO_BITS_26,
240 TUYA_IO_BITS_27,
241 TUYA_IO_BITS_28,
242 TUYA_IO_BITS_29,
243 TUYA_IO_BITS_30,
244 TUYA_IO_BITS_31,
245}TUYA_ADDR_BITS_DEF_E;
246
250typedef enum {
251 TUYA_ADC_NUM_0 = 0, // ADC 0
252 TUYA_ADC_NUM_1 = 1, // ADC 1
253 TUYA_ADC_NUM_2 = 2, // ADC 2
254 TUYA_ADC_NUM_3 = 3, // ADC 3
255 TUYA_ADC_NUM_4 = 4, // ADC 4
256 TUYA_ADC_NUM_5 = 5, // ADC 5
257 TUYA_ADC_NUM_6 = 6, // ADC 6
258 TUYA_ADC_NUM_MAX,
259} TUYA_ADC_NUM_E;
260typedef enum {
261 TUYA_ADC_INNER_SAMPLE_VOL = 0,
262 TUYA_ADC_EXTERNAL_SAMPLE_VOL
263} TUYA_ADC_TYPE_E;
264
268typedef enum {
269 TUYA_ADC_SINGLE = 0,
270 TUYA_ADC_CONTINUOUS,
271 TUYA_ADC_SCAN,
272} TUYA_ADC_MODE_E;
273
274typedef struct {
275 UINT32_T ch_0 : 1;
276 UINT32_T ch_1 : 1;
277 UINT32_T ch_2 : 1;
278 UINT32_T ch_3 : 1;
279 UINT32_T ch_4 : 1;
280 UINT32_T ch_5 : 1;
281 UINT32_T ch_6 : 1;
282 UINT32_T ch_7 : 1;
283 UINT32_T ch_8 : 1;
284 UINT32_T ch_9 : 1;
285 UINT32_T ch_10 : 1;
286 UINT32_T ch_11 : 1;
287 UINT32_T ch_12 : 1;
288 UINT32_T ch_13 : 1;
289 UINT32_T ch_14 : 1;
290 UINT32_T ch_15 : 1;
291 UINT32_T rsv :16;
293
294typedef union {
296 UINT32_T data;
298
302typedef struct {
303 TUYA_AD_DA_CH_LIST_U ch_list; // adc channel list
304 UINT8_T ch_nums; // adc channel number,specifies the number of channels in ch_list that will be converted
305 UINT8_T width; // sampling width
306 UINT32_T freq; // sampling frequency
307 TUYA_ADC_TYPE_E type; // sampling type
308 TUYA_ADC_MODE_E mode; // sampling mode
309 UINT16_T conv_cnt; // sampling times
310 UINT32_T ref_vol; // reference voltage (bat: mv), if dont support set reference voltage, ignore it
312
317typedef enum {
318 TUYA_DAC_NUM_0 = 0, // DAC 0
319 TUYA_DAC_NUM_1 = 1, // DAC 1
320 TUYA_DAC_NUM_2 = 2, // DAC 2
321 TUYA_DAC_NUM_3 = 3, // DAC 3
322 TUYA_DAC_NUM_4 = 4, // DAC 4
323 TUYA_DAC_NUM_5 = 5, // DAC 5
324 TUYA_DAC_NUM_6 = 6, // DAC 6
325 TUYA_DAC_NUM_MAX,
326} TUYA_DAC_NUM_E;
330typedef struct {
331 TUYA_AD_DA_CH_LIST_U ch_list; // dac channel list
332 UINT8_T ch_nums; // dac channel number
333 UINT8_T width; // output width
334 UINT32_T freq; // convert freq
336
337typedef struct{
338 UINT8_T *data;
339 UINT32_T len;
341
342typedef enum {
343 TUYA_DAC_WRITE_FIFO = 0, /*设置DAC的FIIO的数据*/
344 TUYA_DAC_SET_BASE_CFG, /*设置DAC的基本配置*/
345} TUYA_DAC_CMD_E;
346
347typedef struct{
348 TUYA_DAC_CMD_E cmd;
349 VOID * argu;
351
356typedef enum {
357 TUYA_FLASH_TYPE_BTL0 = 0,
358 TUYA_FLASH_TYPE_BTL1,
359 TUYA_FLASH_TYPE_STACK,
360 TUYA_FLASH_TYPE_APP,
361 TUYA_FLASH_TYPE_OTA,
362 TUYA_FLASH_TYPE_USER0,
363 TUYA_FLASH_TYPE_USER1,
364 TUYA_FLASH_TYPE_KV_DATA,
365 TUYA_FLASH_TYPE_KV_SWAP,
366 TUYA_FLASH_TYPE_KV_KEY,
367 TUYA_FLASH_TYPE_UF,
368 TUYA_FLASH_TYPE_INFO,
369 TUYA_FLASH_TYPE_KV_UF,
370 TUYA_FLASH_TYPE_KV_PROTECT,
371 TUYA_FLASH_TYPE_RCD,
372 TUYA_FLASH_TYPE_MAX,
373} TUYA_FLASH_TYPE_E;
374
379typedef struct {
380 UINT_T block_size;
381 UINT_T start_addr;
382 UINT_T size;
384
389#ifndef TUYA_FLASH_TYPE_MAX_PARTITION_NUM
390#define TUYA_FLASH_TYPE_MAX_PARTITION_NUM 10
391#endif
392
393typedef struct {
394 UINT_T partition_num;
395 TUYA_FLASH_PARTITION_T partition[TUYA_FLASH_TYPE_MAX_PARTITION_NUM];
397
405typedef UINT16_T TUYA_PIN_NAME_E;
409#define TUYA_IO_PIN_0 0
410#define TUYA_IO_PIN_1 1
411#define TUYA_IO_PIN_2 2
412#define TUYA_IO_PIN_3 3
413#define TUYA_IO_PIN_4 4
414#define TUYA_IO_PIN_5 5
415#define TUYA_IO_PIN_6 6
416#define TUYA_IO_PIN_7 7
417#define TUYA_IO_PIN_8 8
418#define TUYA_IO_PIN_9 9
419#define TUYA_IO_PIN_10 10
420#define TUYA_IO_PIN_11 11
421#define TUYA_IO_PIN_12 12
422#define TUYA_IO_PIN_13 13
423#define TUYA_IO_PIN_14 14
424#define TUYA_IO_PIN_15 15
425#define TUYA_IO_PIN_16 16
426#define TUYA_IO_PIN_17 17
427#define TUYA_IO_PIN_18 18
428#define TUYA_IO_PIN_19 19
429#define TUYA_IO_PIN_20 20
430#define TUYA_IO_PIN_21 21
431#define TUYA_IO_PIN_22 22
432#define TUYA_IO_PIN_23 23
433#define TUYA_IO_PIN_24 24
434#define TUYA_IO_PIN_25 25
435#define TUYA_IO_PIN_26 26
436#define TUYA_IO_PIN_27 27
437#define TUYA_IO_PIN_28 28
438#define TUYA_IO_PIN_29 29
439#define TUYA_IO_PIN_30 30
440#define TUYA_IO_PIN_31 31
441#define TUYA_IO_PIN_32 32
442#define TUYA_IO_PIN_33 33
443#define TUYA_IO_PIN_34 34
444#define TUYA_IO_PIN_35 35
445#define TUYA_IO_PIN_36 36
446#define TUYA_IO_PIN_37 37
447#define TUYA_IO_PIN_38 38
448#define TUYA_IO_PIN_39 39
449#define TUYA_IO_PIN_40 40
450#define TUYA_IO_PIN_41 41
451#define TUYA_IO_PIN_42 42
452#define TUYA_IO_PIN_43 43
453#define TUYA_IO_PIN_44 44
454#define TUYA_IO_PIN_45 45
455#define TUYA_IO_PIN_46 46
456#define TUYA_IO_PIN_47 47
457#define TUYA_IO_PIN_48 48
458#define TUYA_IO_PIN_49 49
459#define TUYA_IO_PIN_50 50
460#define TUYA_IO_PIN_51 51
461#define TUYA_IO_PIN_52 52
462#define TUYA_IO_PIN_53 53
463#define TUYA_IO_PIN_54 54
464#define TUYA_IO_PIN_55 55
465#define TUYA_IO_PIN_56 56
466#define TUYA_IO_PIN_57 57
467#define TUYA_IO_PIN_58 58
468#define TUYA_IO_PIN_59 59
469#define TUYA_IO_PIN_60 60
470
471#define TUYA_IO_PIN_MAX 0xFFFF
476typedef UINT16_T TUYA_PIN_FUNC_E;
477
482#define TUYA_IIC0_SCL 0x0
483#define TUYA_IIC0_SDA 0x1
484#define TUYA_IIC1_SCL 0x2
485#define TUYA_IIC1_SDA 0x3
486#define TUYA_IIC2_SCL 0x4
487#define TUYA_IIC2_SDA 0x5
488
489#define TUYA_UART0_TX 0x100
490#define TUYA_UART0_RX 0x101
491#define TUYA_UART0_RTS 0x102
492#define TUYA_UART0_CTS 0x103
493#define TUYA_UART1_TX 0x104
494#define TUYA_UART1_RX 0x105
495#define TUYA_UART1_RTS 0x106
496#define TUYA_UART1_CTS 0x107
497#define TUYA_UART2_TX 0x108
498#define TUYA_UART2_RX 0x109
499#define TUYA_UART2_RTS 0x10A
500#define TUYA_UART2_CTS 0x10B
501#define TUYA_UART3_TX 0x10C
502#define TUYA_UART3_RX 0x10D
503#define TUYA_UART3_RTS 0x10E
504#define TUYA_UART3_CTS 0x10F
505
506#define TUYA_SPI0_MISO 0x200
507#define TUYA_SPI0_MOSI 0x201
508#define TUYA_SPI0_CLK 0x202
509#define TUYA_SPI0_CS 0x203
510#define TUYA_SPI1_MISO 0x204
511#define TUYA_SPI1_MOSI 0x205
512#define TUYA_SPI1_CLK 0x206
513#define TUYA_SPI1_CS 0x207
514#define TUYA_SPI2_MISO 0x208
515#define TUYA_SPI2_MOSI 0x209
516#define TUYA_SPI2_CLK 0x20A
517#define TUYA_SPI2_CS 0x20B
518
519#define TUYA_PWM0 0x300
520#define TUYA_PWM1 0x301
521#define TUYA_PWM2 0x302
522#define TUYA_PWM3 0x303
523#define TUYA_PWM4 0x304
524#define TUYA_PWM5 0x305
525
526#define TUYA_ADC0 0x400
527#define TUYA_ADC1 0x401
528#define TUYA_ADC2 0x402
529#define TUYA_ADC3 0x403
530#define TUYA_ADC4 0x404
531#define TUYA_ADC5 0x405
532
533#define TUYA_DAC0 0x500
534#define TUYA_DAC1 0x501
535#define TUYA_DAC2 0x502
536#define TUYA_DAC3 0x503
537#define TUYA_DAC4 0x504
538#define TUYA_DAC5 0x505
539
540#define TUYA_I2S0_SCK 0x600
541#define TUYA_I2S0_WS 0x601
542#define TUYA_I2S0_SDO_0 0x602
543#define TUYA_I2S0_SDI_0 0x603
544#define TUYA_I2S1_SCK 0x604
545#define TUYA_I2S1_WS 0x605
546#define TUYA_I2S1_SDO_0 0x606
547#define TUYA_I2S1_SDI_0 0x607
548
549#define TUYA_GPIO 0x700
550
551#define TUYA_PIN_FUNC_MAX 0xFFFF
552
553typedef struct {
554 TUYA_PIN_NAME_E pin;
555 TUYA_PIN_FUNC_E pin_func;
560typedef enum {
561 TUYA_GPIO_NUM_0, // GPIO 0
562 TUYA_GPIO_NUM_1, // GPIO 1
563 TUYA_GPIO_NUM_2, // GPIO 2
564 TUYA_GPIO_NUM_3, // GPIO 3
565 TUYA_GPIO_NUM_4, // GPIO 4
566 TUYA_GPIO_NUM_5, // GPIO 5
567 TUYA_GPIO_NUM_6, // GPIO 6
568 TUYA_GPIO_NUM_7, // GPIO 7
569 TUYA_GPIO_NUM_8, // GPIO 8
570 TUYA_GPIO_NUM_9, // GPIO 9
571 TUYA_GPIO_NUM_10, // GPIO 10
572 TUYA_GPIO_NUM_11, // GPIO 11
573 TUYA_GPIO_NUM_12, // GPIO 12
574 TUYA_GPIO_NUM_13, // GPIO 13
575 TUYA_GPIO_NUM_14, // GPIO 14
576 TUYA_GPIO_NUM_15, // GPIO 15
577 TUYA_GPIO_NUM_16, // GPIO 16
578 TUYA_GPIO_NUM_17, // GPIO 17
579 TUYA_GPIO_NUM_18, // GPIO 18
580 TUYA_GPIO_NUM_19, // GPIO 19
581 TUYA_GPIO_NUM_20, // GPIO 20
582 TUYA_GPIO_NUM_21, // GPIO 21
583 TUYA_GPIO_NUM_22, // GPIO 22
584 TUYA_GPIO_NUM_23, // GPIO 23
585 TUYA_GPIO_NUM_24, // GPIO 24
586 TUYA_GPIO_NUM_25, // GPIO 25
587 TUYA_GPIO_NUM_26, // GPIO 26
588 TUYA_GPIO_NUM_27, // GPIO 27
589 TUYA_GPIO_NUM_28, // GPIO 28
590 TUYA_GPIO_NUM_29, // GPIO 29
591 TUYA_GPIO_NUM_30, // GPIO 30
592 TUYA_GPIO_NUM_31, // GPIO 31
593 TUYA_GPIO_NUM_32, // GPIO 32
594 TUYA_GPIO_NUM_33, // GPIO 33
595 TUYA_GPIO_NUM_34, // GPIO 34
596 TUYA_GPIO_NUM_35,
597 TUYA_GPIO_NUM_36,
598 TUYA_GPIO_NUM_37,
599 TUYA_GPIO_NUM_38,
600 TUYA_GPIO_NUM_39,
601 TUYA_GPIO_NUM_40,
602 TUYA_GPIO_NUM_41,
603 TUYA_GPIO_NUM_42,
604 TUYA_GPIO_NUM_43,
605 TUYA_GPIO_NUM_44,
606 TUYA_GPIO_NUM_45,
607 TUYA_GPIO_NUM_46,
608 TUYA_GPIO_NUM_47,
609 TUYA_GPIO_NUM_48,
610 TUYA_GPIO_NUM_49,
611 TUYA_GPIO_NUM_50,
612 TUYA_GPIO_NUM_51,
613 TUYA_GPIO_NUM_52,
614 TUYA_GPIO_NUM_53,
615 TUYA_GPIO_NUM_54,
616 TUYA_GPIO_NUM_55,
617 TUYA_GPIO_NUM_56,
618 TUYA_GPIO_NUM_57,
619 TUYA_GPIO_NUM_58,
620 TUYA_GPIO_NUM_59,
621 TUYA_GPIO_NUM_60,
622 TUYA_GPIO_NUM_61,
623 TUYA_GPIO_NUM_62,
624 TUYA_GPIO_NUM_63,
625 TUYA_GPIO_NUM_MAX,
626} TUYA_GPIO_NUM_E;
627
631typedef enum {
632 TUYA_GPIO_LEVEL_LOW = 0,
633 TUYA_GPIO_LEVEL_HIGH,
634} TUYA_GPIO_LEVEL_E;
635
639typedef enum {
640 TUYA_GPIO_INPUT = 0,
641 TUYA_GPIO_OUTPUT,
642} TUYA_GPIO_DRCT_E;
643
647typedef enum {
648 TUYA_GPIO_PULLUP = 0, // for input
649 TUYA_GPIO_PULLDOWN, // for input
650 TUYA_GPIO_HIGH_IMPEDANCE, // for input
651 TUYA_GPIO_FLOATING, // for input
652 TUYA_GPIO_PUSH_PULL, // for output
653 TUYA_GPIO_OPENDRAIN, // for output
654 TUYA_GPIO_OPENDRAIN_PULLUP, // for output
655} TUYA_GPIO_MODE_E;
656
660typedef enum {
661 TUYA_GPIO_IRQ_RISE = 0,
662 TUYA_GPIO_IRQ_FALL,
663 TUYA_GPIO_IRQ_RISE_FALL,
664 TUYA_GPIO_IRQ_LOW,
665 TUYA_GPIO_IRQ_HIGH,
666} TUYA_GPIO_IRQ_E;
667
671typedef struct {
672 TUYA_GPIO_MODE_E mode;
673 TUYA_GPIO_DRCT_E direct;
674 TUYA_GPIO_LEVEL_E level;
676
677typedef VOID_T (*TUYA_GPIO_IRQ_CB)(VOID_T *args);
678
682typedef struct {
683 TUYA_GPIO_IRQ_E mode;
684 TUYA_GPIO_IRQ_CB cb;
685 VOID_T *arg;
687
692typedef enum {
693 TUYA_I2C_NUM_0, // I2C 0
694 TUYA_I2C_NUM_1, // I2C 1
695 TUYA_I2C_NUM_2, // I2C 2
696 TUYA_I2C_NUM_3, // I2C 3
697 TUYA_I2C_NUM_4, // I2C 4
698 TUYA_I2C_NUM_5, // I2C 5
699 TUYA_I2C_NUM_MAX,
700} TUYA_I2C_NUM_E;
701
706typedef enum {
707 TUYA_IIC_MODE_MASTER,
708 TUYA_IIC_MODE_SLAVE
709}TUYA_IIC_ROLE_E;
710
715typedef enum {
716 TUYA_IIC_BUS_SPEED_100K = 0,
717 TUYA_IIC_BUS_SPEED_400K = 1,
718 TUYA_IIC_BUS_SPEED_1M = 2,
719 TUYA_IIC_BUS_SPEED_3_4M = 3
720}TUYA_IIC_SPEED_E;
721
726typedef enum {
727 TUYA_IIC_ADDRESS_7BIT = 0,
728 TUYA_IIC_ADDRESS_10BIT = 1
729} TUYA_IIC_ADDR_MODE_E;
730
735typedef struct {
736 TUYA_IIC_ROLE_E role;
737 TUYA_IIC_SPEED_E speed;
738 TUYA_IIC_ADDR_MODE_E addr_width;
740
741typedef struct {
742 UINT32_T busy : 1;
743 UINT32_T mode : 1;
744 UINT32_T direction : 1;
745 UINT32_T general_call : 1;
746 UINT32_T arbitration_lost : 1;
747 UINT32_T bus_error : 1;
749
754typedef enum {
755 TUYA_IIC_EVENT_TRANSFER_DONE = 0,
756 TUYA_IIC_EVENT_TRANSFER_INCOMPLETE = 1,
757 TUYA_IIC_EVENT_SLAVE_TRANSMIT = 2,
758 TUYA_IIC_EVENT_SLAVE_RECEIVE = 3,
759 TUYA_IIC_EVENT_ADDRESS_NACK = 4,
760 TUYA_IIC_EVENT_GENERAL_CALL = 5,
761 TUYA_IIC_EVENT_ARBITRATION_LOST = 6,
762 TUYA_IIC_EVENT_BUS_ERROR = 7,
763 TUYA_IIC_EVENT_BUS_CLEAR = 8
764} TUYA_IIC_IRQ_EVT_E;
765
766typedef VOID_T (*TUYA_I2C_IRQ_CB)(TUYA_I2C_NUM_E port, TUYA_IIC_IRQ_EVT_E event);
767
772// #define TUYA_I2C_FLAG_WR (1u << 0) // write flag
773// #define TUYA_I2C_FLAG_RD (1u << 1) // read flag
774// #define TUYA_I2C_FLAG_ADDR_10BIT (1u << 2) // 10bits addr mode
775// #define TUYA_I2C_FLAG_NO_START (1u << 3) // no start
776// #define TUYA_I2C_FLAG_IGNORE_NACK (1u << 4) // ignore NACK
777// #define TUYA_I2C_FLAG_NO_READ_ACK (1u << 5) // read without ACK
778// #define TUYA_I2C_FLAG_NO_ADDR (1u << 6) // masg without addr
779
784// typedef struct {
785// UINT32_T flags;
786// UINT16_T addr;
787// UINT16_T len;
788// UINT8_T *buff;
789// } TUYA_I2C_MSG_T;
790
795typedef enum {
796 TUYA_PWM_NUM_0, // PWM 0
797 TUYA_PWM_NUM_1, // PWM 1
798 TUYA_PWM_NUM_2, // PWM 2
799 TUYA_PWM_NUM_3, // PWM 3
800 TUYA_PWM_NUM_4, // PWM 4
801 TUYA_PWM_NUM_5, // PWM 5
802 TUYA_PWM_NUM_MAX,
803} TUYA_PWM_NUM_E;
804
808typedef enum {
809 TUYA_PWM_NEGATIVE = 0,
810 TUYA_PWM_POSITIVE,
811} TUYA_PWM_POLARITY_E;
812
816typedef enum {
817 TUYA_PWM_CNT_UP = 0, //default use
818 TUYA_PWM_CNT_UP_AND_DOWN, //can use in duplex complementation mode.
819} TUYA_PWM_COUNT_E;
820
824typedef struct {
825 TUYA_PWM_POLARITY_E polarity;
826 TUYA_PWM_COUNT_E count_mode;
827 //pulse duty cycle = duty / cycle; exp duty = 5000,cycle = 10000; pulse duty cycle = 50%
828 UINT_T duty;
829 UINT_T cycle;
830 UINT_T frequency; // (bet: Hz)
832
837typedef enum {
838 TUYA_SPI_NUM_0, // SPI 0
839 TUYA_SPI_NUM_1, // SPI 1
840 TUYA_SPI_NUM_2, // SPI 2
841 TUYA_SPI_NUM_3, // SPI 3
842 TUYA_SPI_NUM_4, // SPI 4
843 TUYA_SPI_NUM_5, // SPI 5
844 TUYA_SPI_NUM_MAX,
845} TUYA_SPI_NUM_E;
846
847typedef enum {
848 TUYA_SPI_MODE0 = 0, // CPOL = 0, CPHA = 0
849 TUYA_SPI_MODE1 = 1, // CPOL = 0, CPHA = 1
850 TUYA_SPI_MODE2 = 2, // CPOL = 1, CPHA = 0
851 TUYA_SPI_MODE3 = 3 // CPOL = 1, CPHA = 1
852} TUYA_SPI_MODE_E;
853
858typedef enum {
859 TUYA_SPI_ORDER_MSB2LSB = 0, // SPI Bit order from MSB to LSB
860 TUYA_SPI_ORDER_LSB2MSB = 1, // SPI Bit order from LSB to MSB
861} TUYA_SPI_BIT_ORDER_E;
862
863/*----- SPI Control Codes: Mode -----*/
864typedef enum {
865 TUYA_SPI_ROLE_INACTIVE,
866 TUYA_SPI_ROLE_MASTER,
867 TUYA_SPI_ROLE_SLAVE,
868 TUYA_SPI_ROLE_MASTER_SIMPLEX,
869 TUYA_SPI_ROLE_SLAVE_SIMPLEX
870} TUYA_SPI_ROLE_E;
871
876typedef enum {
877 TUYA_SPI_DATA_BIT8 = 0,
878 TUYA_SPI_DATA_BIT16,
879} TUYA_SPI_DATABITS_E;
880
885typedef enum {
886 TUYA_SPI_AUTO_TYPE = 0, // hardware auto set
887 TUYA_SPI_SOFT_TYPE, // software manual set
888 TUYA_SPI_SOFT_ONE_WIRE_TYPE, // software manual set(miso mosi pin multiplexing)
889} TUYA_SPI_TYPE_E;
890
895typedef struct {
896 TUYA_SPI_ROLE_E role;
897 TUYA_SPI_MODE_E mode;
898 TUYA_SPI_TYPE_E type;
899 TUYA_SPI_DATABITS_E databits;
900 TUYA_SPI_BIT_ORDER_E bitorder;
901 UINT_T freq_hz;
904
905/****** SPI Event *****/
906typedef enum {
907 TUYA_SPI_EVENT_TRANSFER_COMPLETE = 0,
908 TUYA_SPI_EVENT_TX_COMPLETE,
909 TUYA_SPI_EVENT_RX_COMPLETE,
910 TUYA_SPI_EVENT_DATA_LOST,
911 TUYA_SPI_EVENT_MODE_FAULT
912}TUYA_SPI_IRQ_EVT_E;
913
918typedef VOID_T (*TUYA_SPI_IRQ_CB)(TUYA_SPI_NUM_E port, TUYA_SPI_IRQ_EVT_E event);
919
924typedef struct {
925 UINT32_T busy : 1;
926 UINT32_T data_lost : 1;
927 UINT32_T mode_fault : 1;
929
938typedef enum {
939 TUYA_I2S_NUM_0 = 0,
940 TUYA_I2S_NUM_1 = 1,
941 TUYA_I2S_NUM_MAX,
942} TUYA_I2S_NUM_E;
943
948typedef enum {
949 TUYA_I2S_MODE_MASTER = (0x1 << 0),
950 TUYA_I2S_MODE_SLAVE = (0x1 << 1),
951 TUYA_I2S_MODE_TX = (0x1 << 2),
952 TUYA_I2S_MODE_RX = (0x1 << 3),
953} TUYA_I2S_MODE_E;
954
955typedef enum {
956 TUYA_I2S_BITS_PER_SAMPLE_8BIT = 8,
957 TUYA_I2S_BITS_PER_SAMPLE_16BIT = 16,
958 TUYA_I2S_BITS_PER_SAMPLE_24BIT = 24,
959 TUYA_I2S_BITS_PER_SAMPLE_32BIT = 32,
960} TUYA_I2S_BITS_PER_SAMP_E;
961
962typedef enum {
963 TUYA_I2S_CHANNEL_FMT_RIGHT_LEFT,
964 TUYA_I2S_CHANNEL_FMT_ALL_RIGHT,
965 TUYA_I2S_CHANNEL_FMT_ALL_LEFT,
966 TUYA_I2S_CHANNEL_FMT_ONLY_RIGHT,
967 TUYA_I2S_CHANNEL_FMT_ONLY_LEFT,
968} TUYA_I2S_CHANNEL_FMT_E;
969
970typedef enum {
971 I2S_COMM_FORMAT_STAND_I2S = 0X01,
972 I2S_COMM_FORMAT_STAND_MSB = 0X02,
973 I2S_COMM_FORMAT_STAND_PCM_SHORT = 0x04,
974 I2S_COMM_FORMAT_STAND_PCM_LONG = 0x0C,
975 I2S_COMM_FORMAT_STAND_MAX,
976} TUYA_I2S_COMM_FORMAT_E;
977
978typedef struct {
979 TUYA_I2S_MODE_E mode;
980 UINT32_T sample_rate;
981 UINT32_T mclk;
982 TUYA_I2S_BITS_PER_SAMP_E bits_per_sample;
983 TUYA_I2S_CHANNEL_FMT_E channel_format;
984 TUYA_I2S_COMM_FORMAT_E communication_format;
985 UINT32_T i2s_dma_flags;
987
988 // 文件访问权限
989#define TUYA_IRUSR 0400 /* Read by owner. */
990#define TUYA_IWUSR 0200 /* Write by owner. */
991#define TUYA_IXUSR 0100 /* Execute by owner. */
992
993
994 // 缓冲区搜索起始位置类型
995#define TUYA_SEEK_SET 0 /* Seek from beginning of file. */
996#define TUYA_SEEK_CUR 1 /* Seek from current position. */
997#define TUYA_SEEK_END 2 /* Seek from end of file. */
998
999#define TUYA_R_OK 4
1000#define TUYA_W_OK 2
1001#define TUYA_X_OK 1
1002#define TUYA_F_OK 0
1003
1004typedef VOID_T* TUYA_DIR;
1005typedef VOID_T* TUYA_FILEINFO;
1006typedef VOID_T* TUYA_FILE;
1007
1008
1012typedef enum {
1013 TUYA_CPU_SLEEP,
1014 TUYA_CPU_DEEP_SLEEP,
1015} TUYA_CPU_SLEEP_MODE_E;
1016
1020typedef VOID_T (*TUYA_PRE_SLEEP_CB)(VOID_T);
1021
1025typedef VOID_T (*TUYA_POST_WAKEUP_CB)(VOID_T);
1026
1030typedef struct {
1031 TUYA_PRE_SLEEP_CB pre_sleep_cb;
1032 TUYA_POST_WAKEUP_CB post_wakeup_cb;
1034
1035typedef struct {
1036 UINT32_T use_ratio; // cpu used ratio
1038
1039#if OPERATING_SYSTEM != SYSTEM_NON_OS
1040typedef UINT64_T SYS_TICK_T;
1041typedef UINT64_T SYS_TIME_T;
1042#else
1043typedef UINT_T SYS_TICK_T;
1044typedef UINT_T SYS_TIME_T;
1045#endif
1046/*
1047 * reasons for restart
1048 */
1049typedef enum {
1050 TUYA_RESET_REASON_POWERON = 0,
1051 TUYA_RESET_REASON_HW_WDOG = 1,
1052 TUYA_RESET_REASON_FAULT = 2,
1053 TUYA_RESET_REASON_SW_WDOG = 3,
1054 TUYA_RESET_REASON_SOFTWARE = 4,
1055 TUYA_RESET_REASON_DEEPSLEEP = 5,
1056 TUYA_RESET_REASON_EXTERNAL = 6,
1057 TUYA_RESET_REASON_UNKNOWN = 7,
1058 TUYA_RESET_REASON_FIB = 8,
1059 TUYA_RESET_REASON_BOOTLOADER = 8,
1060 TUYA_RESET_REASON_CRASH = 10,
1061 TUYA_RESET_REASON_FLASH = 11,
1062 TUYA_RESET_REASON_FATAL = 12,
1063 TUYA_RESET_REASON_BROWNOUT = 13,
1064 TUYA_RESET_REASON_UNSUPPORT = 0xFF,
1065} TUYA_RESET_REASON_E;
1066
1067
1068/* ota */
1069#define TUYA_OTA_FILE_MD5_LEN 16
1070
1071/*
1072 * ota upgrade type
1073 */
1074typedef enum {
1075 TUYA_OTA_FULL = 1,
1076 TUYA_OTA_DIFF = 2,
1077} TUYA_OTA_TYPE_E;
1078
1079
1080typedef enum {
1081 TUYA_OTA_PATH_AIR = 0,
1082 TUYA_OTA_PATH_UART = 1,
1083 TUYA_OTA_PATH_BLE = 2,
1084 TUYA_OTA_PATH_ZIGBEE = 3,
1085 TUYA_OTA_PATH_SEC_A = 4,
1086 TUYA_OTA_PATH_SEC_B = 5,
1087 TUYA_OTA_PATH_INVALID = 255
1088}TUYA_OTA_PATH_E;
1089
1090
1091typedef struct {
1092 UINT32_T len;
1093 UINT32_T crc32;
1094 UINT8_T md5[TUYA_OTA_FILE_MD5_LEN];
1096
1097/*
1098 * ota pack data
1099 */
1100typedef struct {
1101 UINT_T total_len;
1102 UINT_T offset;
1103 UCHAR_T* data;
1104 UINT_T len;
1105 VOID_T* pri_data;
1107
1112typedef enum {
1113 TUYA_UART_NUM_0, // UART 0
1114 TUYA_UART_NUM_1, // UART 1
1115 TUYA_UART_NUM_2, // UART 2
1116 TUYA_UART_NUM_3, // UART 3
1117 TUYA_UART_NUM_4, // UART 4
1118 TUYA_UART_NUM_5, // UART 5
1119 TUYA_UART_NUM_MAX,
1120} TUYA_UART_NUM_E;
1121
1122typedef enum {
1123 TUYA_UART_SYS = 0,
1124 TUYA_UART_USB,
1125 TUYA_UART_SDIO,
1126 TUYA_UART_MAX_TYPE,
1127} TUYA_UART_TYPE_E;
1128
1133typedef enum {
1134 TUYA_UART_DATA_LEN_5BIT = 0x05,
1135 TUYA_UART_DATA_LEN_6BIT = 0x06,
1136 TUYA_UART_DATA_LEN_7BIT = 0x07,
1137 TUYA_UART_DATA_LEN_8BIT = 0x08,
1138} TUYA_UART_DATA_LEN_E;
1139
1144typedef enum {
1145 TUYA_UART_STOP_LEN_1BIT = 0x01,
1146 TUYA_UART_STOP_LEN_1_5BIT1 = 0x02,
1147 TUYA_UART_STOP_LEN_2BIT = 0x03,
1148} TUYA_UART_STOP_LEN_E;
1149
1154typedef enum {
1155 TUYA_UART_PARITY_TYPE_NONE = 0,
1156 TUYA_UART_PARITY_TYPE_ODD = 1,
1157 TUYA_UART_PARITY_TYPE_EVEN = 2,
1158} TUYA_UART_PARITY_TYPE_E;
1159
1160typedef enum {
1161 TUYA_UART_FLOWCTRL_NONE = 0,
1162 TUYA_UART_FLOWCTRL_RTSCTS,
1163 TUYA_UART_FLOWCTRL_XONXOFF,
1164 TUYA_UART_FLOWCTRL_DTRDSR,
1165} TUYA_UART_FLOWCTRL_TYPE_E;
1166
1167#define TUYA_UART_PORT_ID(port_type, port_num) ((((port_type) << 16) & 0xFFFF0000) | (port_num))
1168#define TUYA_UART_GET_PORT_TYPE(port_id) (((port_id) >> 16) & 0xFFFF)
1169#define TUYA_UART_GET_PORT_NUMBER(port_id) ((port_id) & 0xFFFF)
1170
1175typedef struct {
1176 UINT_T baudrate;
1177 TUYA_UART_PARITY_TYPE_E parity;
1178 TUYA_UART_DATA_LEN_E databits;
1179 TUYA_UART_STOP_LEN_E stopbits;
1180 TUYA_UART_FLOWCTRL_TYPE_E flowctrl;
1182
1183
1194typedef VOID_T (*TUYA_UART_IRQ_CB)(TUYA_UART_NUM_E port_id);
1195
1200typedef enum{
1201 TUYA_UART_SUSPEND_CMD = 0,
1202 TUYA_UART_RESUME_CMD,
1203 TUYA_UART_FLUSH_CMD,
1204 TUYA_UART_RECONFIG_CMD,
1205 TUYA_UART_USER_CMD,
1206 TUYA_UART_MAX_CMD = 1000
1207}TUYA_UART_IOCTL_CMD_E;
1208
1209
1210typedef struct {
1211 UINT_T interval_ms;
1213
1218typedef enum {
1219 TUYA_TIMER_NUM_0, // TIMER 0
1220 TUYA_TIMER_NUM_1, // TIMER 1
1221 TUYA_TIMER_NUM_2, // TIMER 2
1222 TUYA_TIMER_NUM_3, // TIMER 3
1223 TUYA_TIMER_NUM_4, // TIMER 4
1224 TUYA_TIMER_NUM_5, // TIMER 5
1225 TUYA_TIMER_NUM_MAX,
1226} TUYA_TIMER_NUM_E;
1227
1228#define TUYA_TIMER_CFG(__CFG, __MODE, __CB, __ARG) \
1229 (__CFG)->mode = __MODE; \
1230 (__CFG)->cb = __CB; \
1231 (__CFG)->arg = __ARG
1232
1233typedef enum {
1234 TUYA_TIMER_MODE_ONCE = 0,
1235 TUYA_TIMER_MODE_PERIOD
1236} TUYA_TIMER_MODE_E;
1237
1238typedef VOID (*TUYA_TIMER_ISR_CB)(VOID *args);
1239
1240typedef struct {
1241 TUYA_TIMER_MODE_E mode;
1242 TUYA_TIMER_ISR_CB cb;
1243 VOID *args;
1245
1246
1250typedef struct {
1251 TUYA_GPIO_NUM_E gpio_num;
1252 TUYA_GPIO_LEVEL_E level;
1254
1258typedef struct {
1259 TUYA_TIMER_NUM_E timer_num;
1260 TUYA_TIMER_MODE_E mode;
1261 UINT32_T ms;
1263
1267typedef enum {
1268 TUYA_WAKEUP_SOURCE_GPIO,
1269 TUYA_WAKEUP_SOURCE_TIMER,
1270} TUYA_WAKEUP_SOURCE_E;
1271
1275typedef struct {
1276 TUYA_WAKEUP_SOURCE_E source;
1277 union {
1278 TUYA_WAKEUP_SOURCE_GPIO_T gpio_param;
1279 TUYA_WAKEUP_SOURCE_TIMER_T timer_param;
1280 } wakeup_para;
1282
1283
1284#ifndef TUYA_FD_MAX_COUNT
1285#if defined(SYSTEM_LINUX) && (OPERATING_SYSTEM == SYSTEM_LINUX)
1286/* max fd numbers in linux */
1287#define TUYA_FD_MAX_COUNT (1024)
1288#else
1289/* max fd numbers in other system */
1290#define TUYA_FD_MAX_COUNT (64)
1291#endif
1292#endif
1293
1294typedef INT_T TUYA_OPT_LEVEL;
1295typedef INT_T TUYA_OPT_NAME;
1296
1297/* tuyaos definition of fd operations */
1298typedef struct {
1299 UINT8_T placeholder[(TUYA_FD_MAX_COUNT+7)/8];
1301
1302/* tuyaos definition of socket protocol */
1303typedef enum {
1304 PROTOCOL_TCP = 0,
1305 PROTOCOL_UDP = 1,
1306 PROTOCOL_RAW = 2,
1307}TUYA_PROTOCOL_TYPE_E;
1308
1309/* tuyaos definition of transfer type */
1310typedef enum {
1311 TRANS_RECV = 0,
1312 TRANS_SEND = 1,
1313}TUYA_TRANS_TYPE_E;
1314
1315
1316/* tuyaos definition of IP addr */
1317typedef UINT_T TUYA_IP_ADDR_T;
1318
1319/* tuyaos errorno */
1320typedef INT_T TUYA_ERRNO;
1321#define UNW_SUCCESS 0
1322#define UNW_FAIL -1
1323#define UNW_EINTR -2
1324#define UNW_EBADF -3
1325#define UNW_EAGAIN -4
1326#define UNW_ENOMEM -28
1327#define UNW_EFAULT -5
1328#define UNW_EBUSY -6
1329#define UNW_EINVAL -7
1330#define UNW_ENFILE -8
1331#define UNW_EMFILE -9
1332#define UNW_ENOSPC -10
1333#define UNW_EPIPE -11
1334#define UNW_EWOULDBLOCK -12
1335#define UNW_ENOTSOCK -13
1336#define UNW_ENOPROTOOPT -14
1337#define UNW_EADDRINUSE -15
1338#define UNW_EADDRNOTAVAIL -16
1339#define UNW_ENETDOWN -17
1340#define UNW_ENETUNREACH -18
1341#define UNW_ENETRESET -19
1342#define UNW_ECONNRESET -20
1343#define UNW_ENOBUFS -21
1344#define UNW_EISCONN -22
1345#define UNW_ENOTCONN -23
1346#define UNW_ETIMEDOUT -24
1347#define UNW_ECONNREFUSED -25
1348#define UNW_EHOSTDOWN -26
1349#define UNW_EHOSTUNREACH -27
1350#define UNW_EMSGSIZE -29
1351#define TUYA_ERRNO_NOT_SUPPORT 255
1352
1357#define TKL_THREAD_PRI_HIGHEST 8
1358#define TKL_THREAD_PRI_HIGH 7
1359#define TKL_THREAD_PRI_BELOW_HIGH 6
1360#define TKL_THREAD_PRI_ABOVE_NORMAL 5
1361#define TKL_THREAD_PRI_NORMAL 4
1362#define TKL_THREAD_PRI_BELOW_NORML 3
1363#define TKL_THREAD_PRI_ABOVE_LOW 2
1364#define TKL_THREAD_PRI_LOW 1
1365#define TKL_THREAD_PRI_LOWEST 0
1366
1367#ifdef __cplusplus
1368}
1369#endif
1370
1371#endif // TUYA_CLOUD_TYPES_H
1372
Definition: tuya_cloud_types.h:201
Definition: tuya_cloud_types.h:208
adc config
Definition: tuya_cloud_types.h:302
Definition: tuya_cloud_types.h:274
Definition: tuya_cloud_types.h:1035
dac config //xbf
Definition: tuya_cloud_types.h:330
Definition: tuya_cloud_types.h:347
Definition: tuya_cloud_types.h:337
Definition: tuya_cloud_types.h:1298
Definition: tuya_cloud_types.h:393
flash partition information
Definition: tuya_cloud_types.h:379
gpio config
Definition: tuya_cloud_types.h:671
gpio interrupt config
Definition: tuya_cloud_types.h:682
Definition: tuya_cloud_types.h:978
UINT32_T mclk
Definition: tuya_cloud_types.h:981
UINT32_T sample_rate
Definition: tuya_cloud_types.h:980
TUYA_I2S_COMM_FORMAT_E communication_format
Definition: tuya_cloud_types.h:984
TUYA_I2S_MODE_E mode
Definition: tuya_cloud_types.h:979
TUYA_I2S_CHANNEL_FMT_E channel_format
Definition: tuya_cloud_types.h:983
UINT32_T i2s_dma_flags
Definition: tuya_cloud_types.h:985
TUYA_I2S_BITS_PER_SAMP_E bits_per_sample
Definition: tuya_cloud_types.h:982
i2c cfg
Definition: tuya_cloud_types.h:735
Definition: tuya_cloud_types.h:741
UINT32_T direction
Direction: 0=Transmitter, 1=Receiver
Definition: tuya_cloud_types.h:744
UINT32_T arbitration_lost
Master lost arbitration(in case of multi-masters) (cleared on start of next Master operation)
Definition: tuya_cloud_types.h:746
UINT32_T general_call
General Call(address 0) indication (cleared on start of next Slave operation)
Definition: tuya_cloud_types.h:745
UINT32_T mode
Mode: 0=Slave, 1=Master
Definition: tuya_cloud_types.h:743
UINT32_T busy
Transmitter/Receiver busy flag,1 is busy.
Definition: tuya_cloud_types.h:742
UINT32_T bus_error
Bus error detected (cleared on start of next Master/Slave operation)
Definition: tuya_cloud_types.h:747
Definition: tuya_cloud_types.h:553
Definition: tuya_cloud_types.h:1100
UINT_T offset
ota image offset
Definition: tuya_cloud_types.h:1102
UINT_T total_len
ota image totle len
Definition: tuya_cloud_types.h:1101
void * pri_data
private pointer
Definition: tuya_cloud_types.h:1105
UINT_T len
ota data len
Definition: tuya_cloud_types.h:1104
UCHAR_T * data
ota data
Definition: tuya_cloud_types.h:1103
Definition: tuya_cloud_types.h:1091
pwm config
Definition: tuya_cloud_types.h:824
sleep callback
Definition: tuya_cloud_types.h:1030
spi config
Definition: tuya_cloud_types.h:895
UINT_T spi_dma_flags
Definition: tuya_cloud_types.h:902
SPI Status
Definition: tuya_cloud_types.h:924
UINT32_T busy
Transmitter/Receiver busy flag,1 is busy
Definition: tuya_cloud_types.h:925
UINT32_T data_lost
Data lost: Receive overflow / Transmit underflow (cleared on start of transfer operation)
Definition: tuya_cloud_types.h:926
UINT32_T mode_fault
Mode fault detected; optional (cleared on start of transfer operation)
Definition: tuya_cloud_types.h:927
Definition: tuya_cloud_types.h:1240
uart config
Definition: tuya_cloud_types.h:1175
tuya wake source base cfg
Definition: tuya_cloud_types.h:1275
tuya wake source gpio
Definition: tuya_cloud_types.h:1250
tuya wake source timer
Definition: tuya_cloud_types.h:1258
Definition: tuya_cloud_types.h:1210
Definition: tuya_cloud_types.h:294