Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
haoJin750TFT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
haoJin750TFT
Commits
a9444dc6
Commit
a9444dc6
authored
Aug 13, 2024
by
王佳伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wjw_dev' into 'dev'
Wjw dev See merge request
!34
parents
2e05216e
0007ebf4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
62 deletions
+77
-62
BackLight.c
Firmware/Source/Application/BackLight.c
+70
-60
AMT630H_Datas.c
Firmware/Source/Component/AMT630H/AMT630H_Datas.c
+5
-0
AMT630H_Datas.h
Firmware/Source/Component/AMT630H/AMT630H_Datas.h
+1
-1
Sys_Task_List.c
Firmware/Source/System/Sys_Task_List.c
+1
-1
No files found.
Firmware/Source/Application/BackLight.c
View file @
a9444dc6
...
...
@@ -63,88 +63,98 @@ void Data_Light_Res_service(Light_uint8_t deltaTime)//获取光感阻值,并
uint8_t
i
,
j
;
uint32_t
temp32
;
static
uint16_t
timeCount
=
0
;
if
(
timeCount
>=
LIGHT_DATA_TIME
)
if
(
GET_Backlight
()
==
Backlight_ATUO
)
{
timeCount
=
0
;
if
(
NtcDataCount
<
LIGHT_DATA_NUM
)
if
(
timeCount
>=
LIGHT_DATA_TIME
)
{
/*获取光敏电阻*/
LightRes
=
ADC_Read_Signal
(
ADC_CH_LIGHT_SENSITIVE
);
// ADC_Read_Signal(ADC_CH_FUEL1);
/*四舍五入*/
if
(
LightRes
<
32000
)
timeCount
=
0
;
if
(
NtcDataCount
<
LIGHT_DATA_NUM
)
{
if
(
LightRes
%
10
>=
5
)
/*获取光敏电阻*/
LightRes
=
ADC_Read_Signal
(
ADC_CH_LIGHT_SENSITIVE
);
// ADC_Read_Signal(ADC_CH_FUEL1);
/*四舍五入*/
if
(
LightRes
<
32000
)
{
if
(
LightRes
%
10
>=
5
)
{
LightRes
+=
5
;
}
}
else
{
LightRes
+=
5
;
LightRes
=
32000
;
}
/*由小到大插入数据*/
for
(
i
=
0
;
i
<
NtcDataCount
;
i
++
)
{
if
(
LightRes
<
NtcData
[
i
])
{
break
;
}
}
for
(
j
=
NtcDataCount
;
j
>
i
;
j
--
)
{
NtcData
[
j
]
=
NtcData
[
j
-
1
];
}
NtcData
[
i
]
=
LightRes
;
NtcDataCount
++
;
}
else
{
LightRes
=
32000
;
}
/*由小到大插入数据*/
for
(
i
=
0
;
i
<
NtcDataCount
;
i
++
)
{
if
(
LightRes
<
NtcData
[
i
])
/*一组数据采集完毕,取中间部分计算平均值*/
temp32
=
0
;
for
(
i
=
LIGHT_CAL_START
;
i
<
LIGHT_CAL_END
;
i
++
)
{
break
;
temp32
+=
NtcData
[
i
]
;
}
LightR
=
(
uint16_t
)
(
temp32
/
(
LIGHT_CAL_END
-
LIGHT_CAL_START
));
NtcDataCount
=
0
;
LightADCompleteFlg
=
1
;
}
for
(
j
=
NtcDataCount
;
j
>
i
;
j
--
)
{
NtcData
[
j
]
=
NtcData
[
j
-
1
];
}
NtcData
[
i
]
=
LightRes
;
NtcDataCount
++
;
}
else
timeCount
+=
deltaTime
;
if
(
LightADCompleteFlg
)
{
/*一组数据采集完毕,取中间部分计算平均值*/
temp32
=
0
;
for
(
i
=
LIGHT_CAL_START
;
i
<
LIGHT_CAL_END
;
i
++
)
if
(
LightR_Status
==
0
)
{
temp32
+=
NtcData
[
i
];
}
LightR
=
(
uint16_t
)
(
temp32
/
(
LIGHT_CAL_END
-
LIGHT_CAL_START
));
NtcDataCount
=
0
;
LightADCompleteFlg
=
1
;
}
}
timeCount
+=
deltaTime
;
if
(
LightADCompleteFlg
)
{
if
(
LightR_Status
==
0
)
{
if
(
LightR
>
20
)
{
LightR_Status_Count
++
;
if
(
LightR
>
20
)
{
LightR_Status_Count
++
;
}
else
{
LightR_Status_Count
=
0
;
}
TimerM_PWM_set_duty
(
TIMERM_COUNTER1
,
TIMERM_CHB
,
200
);
}
else
{
LightR_Status_Count
=
0
;
}
}
else
{
if
(
LightR
<
20
)
{
LightR_Status_Count
++
;
if
(
LightR
<
20
)
{
LightR_Status_Count
++
;
}
else
{
LightR_Status_Count
=
0
;
}
TimerM_PWM_set_duty
(
TIMERM_COUNTER1
,
TIMERM_CHB
,
800
);
}
else
if
(
LightR_Status_Count
>=
150
)
{
LightR_Status_Count
=
0
;
}
LightR_Status_Count
=
0
;
LightR_Status
=
!
LightR_Status
;
}
}
if
(
LightR_Status_Count
>=
150
)
{
LightR_Status_Count
=
0
;
LightR_Status
=
!
LightR_Status
;
}
}
else
{
BackLight_Process
();
}
}
...
...
Firmware/Source/Component/AMT630H/AMT630H_Datas.c
View file @
a9444dc6
...
...
@@ -4065,4 +4065,9 @@ void AMT630H_GUI_ReadPosittion_Display(void)
default:
break
;
}
}
uint8_t
GET_Backlight
(
void
)
{
return
g_u8Backlight
;
}
\ No newline at end of file
Firmware/Source/Component/AMT630H/AMT630H_Datas.h
View file @
a9444dc6
...
...
@@ -52,7 +52,7 @@ typedef enum
extern
void
AMT630H_GUI_DisplayProc
(
void
);
extern
void
AMT630H_GUI_Background
(
void
);
extern
uint8_t
GET_Backlight
(
void
);
...
...
Firmware/Source/System/Sys_Task_List.c
View file @
a9444dc6
...
...
@@ -84,7 +84,7 @@ void Sys_100ms_Tasks(void)
//Data_Mileage_Clear();
RTE_GPIO_Config
(
RTE_GPIO_PORT05_PIN04
,
GpioOut_High
);
BackLight_Process
();
//
BackLight_Process();
//TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 100);
// aaa = Menu_Item_Select_Get(MENU_ITEM_SELECT_AUTO);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment