-
Notifications
You must be signed in to change notification settings - Fork 0
/
DIO_Interface.h
134 lines (121 loc) · 3.02 KB
/
DIO_Interface.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
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
/*******************************************************/
/* Author : Bishoy Medhat */
/* Version : V01 */
/* Date : 4 FEB 2019 */
/*******************************************************/
/* Description */
/* ------------ */
/* This file defines the APIs corresponding to DIO */
/*******************************************************/
/* Comment: Header file guard */
#ifndef DIO_Interface_H
#define DIO_Interface_H
/* Comment: DIO Pin index assignation */
#define DIO_u8_PIN_0 0
#define DIO_u8_PIN_1 1
#define DIO_u8_PIN_2 2
#define DIO_u8_PIN_3 3
#define DIO_u8_PIN_4 4
#define DIO_u8_PIN_5 5
#define DIO_u8_PIN_6 6
#define DIO_u8_PIN_7 7
#define DIO_u8_PIN_8 8
#define DIO_u8_PIN_9 9
#define DIO_u8_PIN_10 10
#define DIO_u8_PIN_11 11
#define DIO_u8_PIN_12 12
#define DIO_u8_PIN_13 13
#define DIO_u8_PIN_14 14
#define DIO_u8_PIN_15 15
#define DIO_u8_PIN_16 16
#define DIO_u8_PIN_17 17
#define DIO_u8_PIN_18 18
#define DIO_u8_PIN_19 19
#define DIO_u8_PIN_20 20
#define DIO_u8_PIN_21 21
#define DIO_u8_PIN_22 22
#define DIO_u8_PIN_23 23
#define DIO_u8_PIN_24 24
#define DIO_u8_PIN_25 25
#define DIO_u8_PIN_26 26
#define DIO_u8_PIN_27 27
#define DIO_u8_PIN_28 28
#define DIO_u8_PIN_29 29
#define DIO_u8_PIN_30 30
#define DIO_u8_PIN_31 31
/* */
#define GROUP_A 0
#define GROUP_B 1
#define GROUP_C 2
#define GROUP_D 3
/* Comment: DIO Pin Value */
#define DIO_u8_HIGH 1
#define DIO_u8_LOW 0
/* Comment: DIO Pin Direction */
#define DIO_u8_OUTPUT 1
#define DIO_u8_INPUT 0
/* */
#define DIO_u8_MAXPINNB 32
#define DIO_u8_MAXPORTNB 4
#define DIO_u8_MAXPORTDIR 0xff
#define DIO_u8_MINPORTDIR 0x00
#define DIO_u8_MAXPORTVAL 0xff
#define DIO_u8_MINPORTVAL 0x00
enum pins // giving pins numbers..
{
A0,
A1,
A2,
A3,
A4,
A5,
A6,
A7,
B0,
B1,
B2,
B3,
B4,
B5,
B6,
B7,
C0,
C1,
C2,
C3,
C4,
C5,
C6,
C7,
D0,
D1,
D2,
D3,
D4,
D5,
D6,
D7
};
/* Description: This function shall initialize the */
/* direction and initial value for DIO */
/* pins */
void DIO_voidInitialize(void);
/* Description: This function shall set certain value */
/* to certain DIO channel */
u8 DIO_u8SetPinDirection(u8 Copy_u8PinNB, u8 Copy_u8PinDirection);
/* */
/* */
u8 DIO_u8SetPinValue(u8 Copy_u8PinNB, u8 Copy_u8PinValue);
/* */
/* */
u8 DIO_u8SetPortDirection(u8 Copy_u8PortNB, u8 Copy_u8PortDirection);
/* */
/* */
u8 DIO_u8SetPortValue(u8 Copy_u8PortNB, u8 Copy_u8PortValue);
/* */
/* */
u8 DIO_u8GetPinValue(u8 Copy_u8PinNB, u8 *Copy_u8PinValue);
/* */
/* */
u8 DIO_u8GetPortValue(u8 Copy_u8PortNB, u8 *Copy_u8PortValue);
#endif