-
Notifications
You must be signed in to change notification settings - Fork 0
/
sfsegrfredfsxde
52 lines (42 loc) · 1.06 KB
/
sfsegrfredfsxde
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
#include <MDR32F9Qx_rst_clk.h>
#define DELAY(T) for (i = T; i > 0; i--)
int i;
#define vd3 PORT_Pin_1
#define btn PORT_Pin_3
#define prt MDR_PORTE
#define prt1 MDR_PORTC
int main(){
RST_CLK_PCLKcmd(RST_CLK_PCLK_PORTC, ENABLE);
RST_CLK_PCLKcmd(RST_CLK_PCLK_PORTE, ENABLE);
PORT_InitTypeDef Nastroyka;
Nastroyka.PORT_OE = PORT_OE_OUT;
Nastroyka.PORT_Pin = (vd3);
Nastroyka.PORT_FUNC = PORT_FUNC_PORT;
Nastroyka.PORT_MODE = PORT_MODE_DIGITAL;
Nastroyka.PORT_SPEED = PORT_SPEED_SLOW;
PORT_Init ((prt1), &Nastroyka);
//btn
PORT_InitTypeDef Nastroyka_bb;
Nastroyka_bb.PORT_Pin = (btn);
Nastroyka_bb.PORT_OE = PORT_OE_IN;
Nastroyka_bb.PORT_FUNC = PORT_FUNC_PORT;
Nastroyka_bb.PORT_MODE = PORT_MODE_DIGITAL;
Nastroyka_bb.PORT_SPEED = PORT_SPEED_SLOW;
PORT_Init ((prt), &Nastroyka_bb);
PORT_ResetBits((prt1), vd3);
DELAY(10000);
PORT_SetBits((prt1), vd3);
DELAY(10000);
PORT_ResetBits((prt1), vd3);
while (1)
{
if (PORT_ReadInputDataBit((prt),(btn))==1)
{
PORT_SetBits((prt1), (vd3));
}
else
{
PORT_ResetBits((prt1), vd3);
}
}
}