SDC C-Project CF Review 프로그램
LYW
2021-08-17 572aebd50409d2f11183d6ebbb9d12fe9041e7a5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/**
  ******************************************************************************
  * @file    /Project/Source/STRB_DataType.h
  * @author  Electronic Develope Team
  * @version V1.0.0
  * @date    2013-11-27
  * @brief   This file contains the Project Protocol Control.
  ******************************************************************************
  * @attention
  * STRB Protocol Data Type
  *D:\Work\Project\5.Enhanced-Strobe\3.Firmware\STROBE-WORK-IOTEST\Source\STRB_DataType.h
  ******************************************************************************
  */ 
 
#ifndef __STRB_DATATYPE_H
#define __STRB_DATATYPE_H
 
// #include "stm32f2xx_rtc.h"
 
 
enum PDG_PACKETDESTINATIONGROUP {
    PDG_FAIL,
    PDG_PLUSTEK, // Power User Interface
    PDG_GUI,
    PDG_MAIN,
    PDG_MAIN_BROADCAST,
    PDG_DRIVER,
    PDG_DRIVER_BROADCAST
};
 
 
 
enum PROTOCOL_TYPE {
    PT_NONE,
    PT_STROBE,
 
 
 
    PT_TEST = 200
};
 
struct ProtocolTable {
    unsigned char        cmd;
    unsigned short        size;
    unsigned short        tmo;
};
 
//#pragma push
//#pragma pack(1)
#pragma pack(push, 1)
 
/*
enum _PACKET_INDEX {
    PI_STX,
    PI_OID,
    PI_DID,
    PI_CMD,
    PI_LEN,
    PI_DAT,
    PI_CRC,
    PI_ETX
};
struct OLED_BasePacket_type {
    unsigned char        stx;         // 0x02
    unsigned char        o_id;        // 0x00 : GUI(Origin) or Main
    unsigned char        d_id;        // 0x10 ~ 0xFF(Destination)
    unsigned char        cmd;        // 'A' ~ 'Z'...
    unsigned char        len;        // Total Length(STX ~ ETX)
    unsigned char        dat[1];        // 0~n
    unsigned short        crc16;        // Big-endian
    unsigned char        etx;
};
*/
 
#define PACKET_LENGTH(datalen)  ((datalen)+12)
#define PACKET_ID(mid, did)    (unsigned char) ((mid & 0x0F)<<4 | (did&0x0F))
 
#define STDP_PREAMBLE        0x03AA5502
 
#define MAX_TRANSMIT_ID        8
#define MAX_TRANSMIT_CH        8
 
struct STRB_Packet_type {
    unsigned long        pre;        // PTSE
    unsigned short        len;
    unsigned char        typ;        //
    unsigned char        cmd;
    unsigned char        dat[1];
//    unsigned short        crc;
};
 
struct STRB_BasicPacket_type {
    unsigned long        pre;        // STDP_PREAMBLE
    unsigned short        len;
    unsigned char        typ;        // STROBE : 0x01,etc
    unsigned char        o_id;
    unsigned char        d_id;
    unsigned char        cmd;
    unsigned char        dat[1];
//    unsigned short        crc;
};
 
#define TRANSMIT_CONTROLLER_ID 0x10
#define STROBE_DEFAULT_ONTIME  30000
#define TRANSMIT_MAX_VOLT_VALUE 10000
struct STU_TRANSMIT_LIGHT_VALUE 
{
    unsigned short        volt;
    unsigned short        time;
};
 
struct STU_TRANSMIT_CONFIG 
{
    unsigned char        onoff;
    unsigned char        mode;
    unsigned char        polar;
    unsigned char        trg_sel;
    unsigned short        volt_min;
    unsigned short        volt_max;
};
 
 
//enum _PACKET_INDEX {
//    PI_STX,
//    PI_LEN = 4,
//    PI_OID = 7,
//    PI_DID,
//    PI_CMD,
//    PI_DAT,
//    PI_CRC
//};
 
// #define STDP_0x01_LENGTH(dat_len)        ((dat_len) + 12)
//enum _PACKET_INDEX { PI_PRE1, PI_PRE2, PI_PRE3, PI_PRE4, PI_LEN1, PI_LEN2, PI_TYPE, PI_OID, PI_DID, PI_CMD, PI_DAT };
 
 
struct DATA_Version_type {
    unsigned short            hw;
    unsigned short            fw;
    unsigned long            index;
    char                    str[32];
};
 
struct DATA_DateTime_type {
    // RTC_InitTypeDef init;
/*
    RTC_TimeTypeDef time; // H(0~23), M(0~59), S, dummy(0)
    RTC_DateTypeDef date; // W(1~7), M(1~12), D(1~31), Year(00~99)
*/
    unsigned char       time[4];
    unsigned char       date[4];
};
 
struct DATA_FW_Signature_type {
    unsigned short        code_len;
    unsigned short        chksum;
};
 
#define DATA_CODEPAGE_SIZE    128
 
struct DATA_FW_CodePage_type {
    unsigned short        page;
    unsigned char        data[DATA_CODEPAGE_SIZE];
};
 
 
//#pragma pop
#pragma pack(pop)
 
 
#endif // __STRB_DATATYPE_H