-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstm32f0xx_nucleo_32.h
185 lines (145 loc) · 4.92 KB
/
stm32f0xx_nucleo_32.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
/**
******************************************************************************
* @file stm32f0xx_nucleo_32.h
* @author MCD Application Team
* @brief This file contains definitions for:
* - LED available on STM32F0xx-Nucleo_32 Kit from STMicroelectronics
* - 7 segment display from Gravitech
******************************************************************************
* @attention
*
* Copyright (c) 2016 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 __STM32F0XX_NUCLEO_32_H
#define __STM32F0XX_NUCLEO_32_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f0xx_hal.h"
/** @addtogroup BSP
* @{
*/
/** @defgroup STM32F0XX_NUCLEO_32 NUCLEO 32
* @brief This section contains the exported types, constants and functions
* required to use the Nucleo 32 board.
* @{
*/
/** @defgroup STM32F0XX_NUCLEO_32_Exported_Types Exported Types
* @{
*/
typedef enum
{
LED3 = 0,
LED_GREEN = LED3
} Led_TypeDef;
/**
* @}
*/
/** @defgroup STM32F0XX_NUCLEO_32_Exported_Constants Exported Constants
* @brief Define for STM32F0XX_NUCLEO_32 board
* @{
*/
#if !defined (USE_STM32F0XX_NUCLEO_32)
#define USE_STM32F0XX_NUCLEO_32
#endif
/** @defgroup STM32F0XX_NUCLEO_LED LED Constants
* @{
*/
#define LEDn 1
#define LED3_PIN GPIO_PIN_3
#define LED3_GPIO_PORT GPIOB
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#define LEDx_GPIO_CLK_ENABLE(__INDEX__) do {LED3_GPIO_CLK_ENABLE(); } while(0)
#define LEDx_GPIO_CLK_DISABLE(__INDEX__) LED3_GPIO_CLK_DISABLE())
/**
* @}
*/
/** @defgroup STM32F0XX_NUCLEO_32_BUS BUS Constants
* @{
*/
#if defined(HAL_I2C_MODULE_ENABLED)
/*##################### I2C2 ###################################*/
/* User can use this section to tailor I2Cx instance used and associated resources */
/* Definition for I2C1 Pins */
#define BSP_I2C1 I2C1
#define BSP_I2C1_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE()
#define BSP_I2C1_CLK_DISABLE() __HAL_RCC_I2C1_CLK_DISABLE()
#define BSP_I2C1_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET()
#define BSP_I2C1_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET()
#define BSP_I2C1_SCL_PIN GPIO_PIN_6 /* PB.6 add wire between D5 and A5 */
#define BSP_I2C1_SDA_PIN GPIO_PIN_7 /* PB.7 add wire between D4 and A4 */
#define BSP_I2C1_GPIO_PORT GPIOB /* GPIOB */
#define BSP_I2C1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define BSP_I2C1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#define BSP_I2C1_SCL_SDA_AF GPIO_AF1_I2C1
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
on accurate values, they just guarantee that the application will not remain
stuck if the I2C communication is corrupted.
You may modify these timeout values depending on CPU frequency and application
conditions (interrupts routines ...). */
#define BSP_I2C1_TIMEOUT_MAX 1000
/* I2C TIMING is calculated in case of the I2C Clock source is the SYSCLK = 32 MHz */
/* Set TIMING to 0x009080B5 to reach 100 KHz speed (Rise time = 50ns, Fall time = 10ns) */
//#define I2C1_TIMING 0x009080B5
#define I2C1_TIMING 0xB0420F13
#endif /* HAL_I2C_MODULE_ENABLED */
/**
* @}
*/
/**
* @}
*/
/** @defgroup STM32F0XX_NUCLEO_32_Exported_Functions Exported Functions
* @{
*/
uint32_t BSP_GetVersion(void);
void BSP_LED_Init(Led_TypeDef Led);
void BSP_LED_On(Led_TypeDef Led);
void BSP_LED_Off(Led_TypeDef Led);
void BSP_LED_Toggle(Led_TypeDef Led);
/**
* @}
*/
/**
* @}
*/
/** @defgroup STM32F0XX_NUCLEO_32_GRAVITECH_4DIGITS GRAVITECH 4 DIGITS
* @brief This section contains the exported functions
* required to use Gravitech shield 7 Segment Display
* @{
*/
/** @defgroup STM32_GRAVITECH_4DIGITS_Exported_Constants Exported Constants
* @{
*/
#define DIGIT4_SEG7_RESET 10000
/**
* @}
*/
/** @defgroup STM32_GRAVITECH_4DIGITS_Exported_Functions Exported Functions
* @{
*/
HAL_StatusTypeDef BSP_DIGIT4_SEG7_Init(void);
HAL_StatusTypeDef BSP_DIGIT4_SEG7_Display(uint32_t Value);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F0XX_NUCLEO_32_H */