blob: c8ce1df81ae143d9f95db6cb06d4b6ffb90f74bf (
plain)
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
|
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file GPIOv3/stm32_gpio.h
* @brief STM32 GPIO units common header.
* @note This file requires definitions from the ST STM32 header file.
*
* @addtogroup STM32_GPIOv3
* @{
*/
#ifndef STM32_GPIO_H
#define STM32_GPIO_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* Discarded definitions from the ST headers, the PAL driver uses its own
definitions in order to have an unified handling for all devices.
Unfortunately the ST headers have no uniform definitions for the same
objects across the various sub-families.*/
#undef GPIOA
#undef GPIOB
#undef GPIOC
#undef GPIOD
#undef GPIOE
#undef GPIOF
#undef GPIOG
#undef GPIOH
#undef GPIOI
#undef GPIOJ
#undef GPIOK
/**
* @name GPIO ports definitions
* @{
*/
#define GPIOA ((stm32_gpio_t *)GPIOA_BASE)
#define GPIOB ((stm32_gpio_t *)GPIOB_BASE)
#define GPIOC ((stm32_gpio_t *)GPIOC_BASE)
#define GPIOD ((stm32_gpio_t *)GPIOD_BASE)
#define GPIOE ((stm32_gpio_t *)GPIOE_BASE)
#define GPIOF ((stm32_gpio_t *)GPIOF_BASE)
#define GPIOG ((stm32_gpio_t *)GPIOG_BASE)
#define GPIOH ((stm32_gpio_t *)GPIOH_BASE)
#define GPIOI ((stm32_gpio_t *)GPIOI_BASE)
#define GPIOJ ((stm32_gpio_t *)GPIOJ_BASE)
#define GPIOK ((stm32_gpio_t *)GPIOK_BASE)
/** @} */
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/**
* @brief STM32 GPIO registers block.
*/
typedef struct {
volatile uint32_t MODER;
volatile uint32_t OTYPER;
volatile uint32_t OSPEEDR;
volatile uint32_t PUPDR;
volatile uint32_t IDR;
volatile uint32_t ODR;
volatile union {
uint32_t W;
struct {
uint16_t set;
uint16_t clear;
} H;
} BSRR;
volatile uint32_t LOCKR;
volatile uint32_t AFRL;
volatile uint32_t AFRH;
volatile uint32_t BRR;
volatile uint32_t ASCR;
} stm32_gpio_t;
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#endif /* STM32_GPIO_H */
/** @} */
|