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
52
53
56
57
60
61
64
65
68
69
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
127
128
131
132
135
136
139
140
143
144
145
146
147
148
149
150
/* ... */
#ifndef __IO_H
#define __IO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
typedef enum
{
IO_PIN_RESET = 0,
IO_PIN_SET
...}IO_PinState;
typedef enum
{
IO_MODE_INPUT = 0,
IO_MODE_OUTPUT,
IO_MODE_IT_RISING_EDGE,
IO_MODE_IT_FALLING_EDGE,
IO_MODE_IT_LOW_LEVEL,
IO_MODE_IT_HIGH_LEVEL,
IO_MODE_ANALOG,
IO_MODE_OFF,
IO_MODE_INPUT_PU,
IO_MODE_INPUT_PD,
IO_MODE_OUTPUT_OD,
IO_MODE_OUTPUT_OD_PU,
IO_MODE_OUTPUT_OD_PD,
IO_MODE_OUTPUT_PP,
IO_MODE_OUTPUT_PP_PU,
IO_MODE_OUTPUT_PP_PD,
IO_MODE_IT_RISING_EDGE_PU,
IO_MODE_IT_RISING_EDGE_PD,
IO_MODE_IT_FALLING_EDGE_PU,
IO_MODE_IT_FALLING_EDGE_PD,
IO_MODE_IT_LOW_LEVEL_PU,
IO_MODE_IT_LOW_LEVEL_PD,
IO_MODE_IT_HIGH_LEVEL_PU,
IO_MODE_IT_HIGH_LEVEL_PD,
...}IO_ModeTypedef;
/* ... */
typedef struct
{
void (*Init)(uint16_t);
uint16_t (*ReadID)(uint16_t);
void (*Reset)(uint16_t);
void (*Start)(uint16_t, uint32_t);
uint8_t (*Config)(uint16_t, uint32_t, IO_ModeTypedef);
void (*WritePin)(uint16_t, uint32_t, uint8_t);
uint32_t (*ReadPin)(uint16_t, uint32_t);
void (*EnableIT)(uint16_t);
void (*DisableIT)(uint16_t);
uint32_t (*ITStatus)(uint16_t, uint32_t);
void (*ClearIT)(uint16_t, uint32_t);
...}IO_DrvTypeDef;
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
#ifdef __cplusplus
}extern "C" { ... }
#endif
/* ... */
#endif