-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGestion_porte.h
80 lines (65 loc) · 1.32 KB
/
Gestion_porte.h
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
/*
* File: Gestion_porte.h
* Author: mohammed.bensalah
*
* Created on 30. août 2014, 18:12
*/
#include "General_func.h"
#include "SPI_function.h"
//Variables globales
extern char user [128];
#ifndef GESTION_PORTE_H
#define GESTION_PORTE_H
void SetDoorCode (int code);
void ChangeDoorPassword (int code);
int CheckDoorPassword (int code);
int OpenDoor(int code);
void SetDoorCode (int code)
{
//Variables locales
union myadress door_adress;
door_adress.adress = 0x36D;
WRITE_cmd_32(door_adress.nb,code);
}
void ChangeDoorPassword (int code)
{
//Variables locales
union myadress door_adress;
door_adress.adress = 0x36D;
WRITE_cmd_32(door_adress.nb,code);
}
int CheckDoorPassword(int code)
{
//Variables locales
union myadress door_adress;
int temp;
door_adress.adress = 0x36D;
temp = READ_cmd_32(door_adress.nb);
if (code == temp)
{
return 1;
}
else
{
return 0;
}
}
int OpenDoor(int code)
{
//Variables locales
union myadress door_adress;
int DoorCheck;
door_adress.adress = 0x36D;
DoorCheck = CheckDoorPassword(code);
if (DoorCheck == 1)
{
printf("%s DOOR OPEN",user);
LED4 = 1;
}
else
{
printf("%s DOOR NOT OPEN",user);
LED4 = 0;
}
}
#endif /* GESTION_PORTE_H */