-
Notifications
You must be signed in to change notification settings - Fork 2
/
stm32h743i_eval_io.h
204 lines (175 loc) · 6.22 KB
/
stm32h743i_eval_io.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/**
******************************************************************************
* @file stm32h743i_eval_io.h
* @author MCD Application Team
* @brief This file contains the common defines and functions prototypes for
* the stm32h743i_eval_io.c driver.
******************************************************************************
* @attention
*
* Copyright (c) 2019 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef STM32H743I_EVAL_IO_H
#define STM32H743I_EVAL_IO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32h743i_eval_conf.h"
#include "stm32h743i_eval_errno.h"
/* Include common IO driver */
#include "../Common/io.h"
/* Include IO component driver */
#include "../Components/mfxstm32l152/mfxstm32l152.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM32H743I_EVAL
* @{
*/
/** @addtogroup STM32H743I_EVAL_IO
* @{
*/
/** @defgroup STM32H743I_EVAL_IO_Exported_Types IO Exported Types
* @{
*/
typedef struct
{
uint32_t IsInitialized; /* IO_IsInitialized */
uint32_t Functions; /* Selected functions */
}IOEXPANDER_Ctx_t;
typedef struct
{
uint32_t Pin; /*!< Specifies the IO pins to be configured */
uint32_t Mode; /*!< Specifies the operating mode for the selected pins */
uint32_t Pull; /*!< Specifies the Pull-up or Pull-Down activation for the selected pins */
}BSP_IO_Init_t;
/**
* @}
*/
/** @defgroup STM32H743I_EVAL_IO_Exported_Constants IO Exported Constants
* @{
*/
/**
* @brief IOExpander modes
*/
#define IOEXPANDER_IO_MODE 1U
#define IOEXPANDER_IDD_MODE 2U /* Not used */
#define IOEXPANDER_TS_MODE 4U /* Not used */
/**
* @brief IOExpander instances number
*/
#define IOEXPANDER_INSTANCES_NBR 1U
/**
* @brief IOExpander pins control
*/
#define IO_PIN_RESET 0U
#define IO_PIN_SET 1U
/**
* @brief IOExpander IOs definition
*/
#define IO_PIN_0 MFXSTM32L152_GPIO_PIN_0
#define IO_PIN_1 MFXSTM32L152_GPIO_PIN_1
#define IO_PIN_2 MFXSTM32L152_GPIO_PIN_2
#define IO_PIN_3 MFXSTM32L152_GPIO_PIN_3
#define IO_PIN_4 MFXSTM32L152_GPIO_PIN_4
#define IO_PIN_5 MFXSTM32L152_GPIO_PIN_5
#define IO_PIN_6 MFXSTM32L152_GPIO_PIN_6
#define IO_PIN_7 MFXSTM32L152_GPIO_PIN_7
#define IO_PIN_8 MFXSTM32L152_GPIO_PIN_8
#define IO_PIN_9 MFXSTM32L152_GPIO_PIN_9
#define IO_PIN_10 MFXSTM32L152_GPIO_PIN_10
#define IO_PIN_11 MFXSTM32L152_GPIO_PIN_11
#define IO_PIN_12 MFXSTM32L152_GPIO_PIN_12
#define IO_PIN_13 MFXSTM32L152_GPIO_PIN_13
#define IO_PIN_14 MFXSTM32L152_GPIO_PIN_14
#define IO_PIN_15 MFXSTM32L152_GPIO_PIN_15
#define IO_PIN_16 MFXSTM32L152_GPIO_PIN_16
#define IO_PIN_17 MFXSTM32L152_GPIO_PIN_17
#define IO_PIN_18 MFXSTM32L152_GPIO_PIN_18
#define IO_PIN_19 MFXSTM32L152_GPIO_PIN_19
#define IO_PIN_20 MFXSTM32L152_GPIO_PIN_20
#define IO_PIN_21 MFXSTM32L152_GPIO_PIN_21
#define IO_PIN_22 MFXSTM32L152_GPIO_PIN_22
#define IO_PIN_23 MFXSTM32L152_GPIO_PIN_23
#define IO_PIN_ALL MFXSTM32L152_GPIO_PINS_ALL
/**
* @brief IOExpander IOs pull define
*/
#define IO_NOPULL MFXSTM32L152_GPIO_NOPULL
#define IO_PULLUP MFXSTM32L152_GPIO_PULLUP
#define IO_PULLDOWN MFXSTM32L152_GPIO_PULLDOWN
/**
* @brief IOExpander IOs mode define
*/
#define IO_MODE_OFF MFXSTM32L152_GPIO_MODE_OFF
#define IO_MODE_ANALOG MFXSTM32L152_GPIO_MODE_ANALOG
#define IO_MODE_INPUT MFXSTM32L152_GPIO_MODE_INPUT
#define IO_MODE_OUTPUT_OD MFXSTM32L152_GPIO_MODE_OUTPUT_OD
#define IO_MODE_OUTPUT_PP MFXSTM32L152_GPIO_MODE_OUTPUT_PP
#define IO_MODE_IT_RISING_EDGE MFXSTM32L152_GPIO_MODE_IT_RISING_EDGE
#define IO_MODE_IT_FALLING_EDGE MFXSTM32L152_GPIO_MODE_IT_FALLING_EDGE
#define IO_MODE_IT_LOW_LEVEL MFXSTM32L152_GPIO_MODE_IT_LOW_LEVEL
#define IO_MODE_IT_HIGH_LEVEL MFXSTM32L152_GPIO_MODE_IT_HIGH_LEVEL
/**
* @brief MFX_IRQOUT pin
*/
#define MFX_IRQOUT_PIN GPIO_PIN_8
#define MFX_IRQOUT_GPIO_PORT GPIOI
#define MFX_IRQOUT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE()
#define MFX_IRQOUT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE()
#define MFX_IRQOUT_EXTI_IRQn EXTI9_5_IRQn
#define IO_EXTI_LINE EXTI_LINE_8
#define IO_I2C_ADDRESS 0x84U
#define IO_I2C_ADDRESS_2 0x86U
/**
* @}
*/
/** @addtogroup STM32H743I_EVAL_IO_Exported_Variables
* @{
*/
extern IOEXPANDER_Ctx_t IO_Ctx[];
extern MFXSTM32L152_Object_t Io_CompObj;
extern EXTI_HandleTypeDef hio_exti;
/**
* @}
*/
/** @addtogroup STM32H743I_EVAL_IO_Exported_Functions
* @{
*/
int32_t BSP_IO_Init(uint32_t Instance, BSP_IO_Init_t *Init);
int32_t BSP_IO_DeInit(uint32_t Instance);
int32_t BSP_IO_GetIT(uint32_t Instance, uint32_t Pins);
int32_t BSP_IO_ClearIT(uint32_t Instance, uint32_t Pins);
int32_t BSP_IO_WritePin(uint32_t Instance, uint32_t Pin, uint32_t PinState);
int32_t BSP_IO_ReadPin(uint32_t Instance, uint32_t Pin);
int32_t BSP_IO_TogglePin(uint32_t Instance, uint32_t Pin);
int32_t BSP_IOEXPANDER_Init(uint32_t Instance, uint32_t Functions);
int32_t BSP_IOEXPANDER_DeInit(uint32_t Instance);
void BSP_IOEXPANDER_ITConfig(void);
void BSP_IO_IRQHandler(uint32_t Instance);
void BSP_IO_Callback(uint32_t Instance);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* STM32H743I_EVAL_IO_H */