1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef APP_DEMO_CONFIG_H
17 #define APP_DEMO_CONFIG_H
18 
19 #define SEND_OLED_FILL_SCRRENC_CMD  ((unsigned char)0x0)
20 #define SEND_CMD_LEN    (8)
21 
22 #define OLED_X_POSITION_0    (0)
23 #define OLED_X_POSITION_15   (15)
24 #define OLED_X_POSITION_16   (16)
25 #define OLED_X_POSITION_18   (18)
26 #define OLED_X_POSITION_40   (40)
27 #define OLED_X_POSITION_48   (48)
28 #define OLED_X_POSITION_56   (56)
29 #define OLED_X_POSITION_60   (60)
30 #define OLED_X_POSITION_81   (81)
31 #define OLED_X_POSITION_120  (120)
32 
33 #define OLED_Y_POSITION_0     ((unsigned char)0x0)
34 #define OLED_Y_POSITION_1     ((unsigned char)0x1)
35 #define OLED_Y_POSITION_2     ((unsigned char)0x2)
36 #define OLED_Y_POSITION_3     ((unsigned char)0x3)
37 #define OLED_Y_POSITION_4     ((unsigned char)0x4)
38 #define OLED_Y_POSITION_5     ((unsigned char)0x5)
39 #define OLED_Y_POSITION_6     ((unsigned char)0x6)
40 #define OLED_Y_POSITION_7     ((unsigned char)0x7)
41 
42 #define OLED_DISPLAY_STRING_TYPE_1   (1)
43 #define OLED_DISPLAY_STRING_TYPE_16  (16)
44 
45 typedef enum {
46     TIME_COUNT_0 = 0,
47     TIME_COUNT_1,
48     TIME_COUNT_2,
49     TIME_COUNT_3,
50     TIME_COUNT_4,
51     TIME_COUNT_5,
52     TIME_COUNT_6
53 }TimeCountEnv;
54 
55 typedef struct LightTimer {
56     int Timer1Status;
57     int Timer1Count;
58     int Timer2Status;
59     int Timer2Count;
60     int Timer3Status;
61     int Timer3Count;
62     int Timer4Status;
63     int Timer4Count;
64     int Timer5Status;
65     int Timer5Count;
66     int Timer6Status;
67     int Timer6Count;
68     int Timer7Status;
69     int Timer7Count;
70     int Timer8Status;
71     int Timer8Count;
72     int Timer9Status;
73     int Timer9Count;
74     int Timer10Status;
75     int Timer10Count;
76     int TimerRedLightStatus;
77     int TimerYellowLightStatus;
78     int TimerGreenLightStatus;
79     int HumanTimerRedLightStatus;
80     int HumanTimerYellowLightStatus;
81     int HumanTimerGreenLightStatus;
82 }LightTimerCfg;
83 
84 typedef struct {
85     int timer1Count;
86     int timer2Count;
87 }TimerMsg;
88 
89 typedef struct {
90     unsigned int g_redLedAutoModuTimeCount;
91     unsigned int g_yellowLedAutoModuTimeCount;
92     unsigned int g_greenLedAutoModuTimeCount;
93     unsigned int g_redLedHumanModuTimeCount;
94     unsigned int g_yellowLedHumanModuTimeCount;
95     unsigned int g_greenLedHumanModuTimeCount;
96 }TrafficLedStatusType;
97 
98 typedef enum {
99     RED_LED_AUTOMODE_TIMECOUNT,
100     YELLOW_LED_AUTOMODE_TIMECOUNT,
101     GREEN_LED_AUTOMODE_TIMECOUNT,
102     RED_LED_HUMANMODE_TIMECOUNT,
103     YELLOW_LED_HUMANMODE_TIMECOUNT,
104     GREEN_LED_HUMANMODE_TIMECOUNT,
105 }TrafficLedStatusDef;
106 
107 
108 unsigned char DelayAndFreshScreen(unsigned int delayTime, unsigned char beepStatus);
109 void TrafficAutoModeSample(void);
110 void TrafficNormalType(void);
111 void TrafficHumanType(void);
112 void TrafficHumanModeSample(void);
113 void TrafficLightFunc(void);
114 void SoftwareTimersTaskEntry(void);
115 unsigned char GetLedStatus(TrafficLedStatusDef staDef);
116 unsigned char SetTimeCount(unsigned char setTimeCount);
117 #endif