STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
gpio_reg.h
Go to the documentation of this file.
1
9#ifndef GPIO_REG_H
10#define GPIO_REG_H
11
12#include <stdint.h>
13
18
21#define GPIOA_BASE (0x40020000UL)
22#define GPIOB_BASE (0x40020400UL)
23#define GPIOC_BASE (0x40020800UL)
24#define GPIOD_BASE (0x40020C00UL)
25#define GPIOE_BASE (0x40021000UL)
26#define GPIOF_BASE (0x40021400UL)
27#define GPIOG_BASE (0x40021800UL)
28#define GPIOH_BASE (0x40021C00UL)
30
32typedef struct GpioRegisters_t
33{
34 volatile uint32_t MODER;
35 volatile uint32_t OTYPER;
36 volatile uint32_t OSPEEDR;
37 volatile uint32_t PUPDR;
38 volatile const uint32_t IDR;
39 volatile uint32_t ODR;
40 volatile uint32_t BSRR;
41 volatile uint32_t LCKR;
42 volatile uint32_t AFRL;
43 volatile uint32_t AFRH;
45
48#define GPIOA ((GpioRegisters_t *)GPIOA_BASE)
49#define GPIOB ((GpioRegisters_t *)GPIOB_BASE)
50#define GPIOC ((GpioRegisters_t *)GPIOC_BASE)
51#define GPIOD ((GpioRegisters_t *)GPIOD_BASE)
52#define GPIOE ((GpioRegisters_t *)GPIOE_BASE)
53#define GPIOF ((GpioRegisters_t *)GPIOF_BASE)
54#define GPIOG ((GpioRegisters_t *)GPIOG_BASE)
55#define GPIOH ((GpioRegisters_t *)GPIOH_BASE)
57
60#define GPIO_MODE_INPUT (0x0U)
61#define GPIO_MODE_OUTPUT (0x1U)
62#define GPIO_MODE_AF (0x2U)
63#define GPIO_MODE_ANALOG (0x3U)
65
68#define GPIO_OTYPE_PP (0x0U)
69#define GPIO_OTYPE_OD (0x1U)
71
74#define GPIO_OSPEED_LOW (0x0U)
75#define GPIO_OSPEED_MEDIUM (0x1U)
76#define GPIO_OSPEED_FAST (0x2U)
77#define GPIO_OSPEED_HIGH (0x3U)
79
82#define GPIO_PUPD_NONE (0x0U)
83#define GPIO_PUPD_UP (0x1U)
84#define GPIO_PUPD_DOWN (0x2U)
86
94#define GPIOA_MODER_RESET (0xA8000000U)
95#define GPIOA_PUPDR_RESET (0x64000000U)
96#define GPIOB_MODER_RESET (0x00000280U)
97#define GPIOB_OSPEEDR_RESET (0x000000C0U)
98#define GPIOB_PUPDR_RESET (0x00000100U)
100
102
103#endif /* GPIO_REG_H */
GPIO port register block.
Definition gpio_reg.h:33
volatile uint32_t ODR
0x14: output data
Definition gpio_reg.h:39
volatile uint32_t OTYPER
0x04: output type, 1 bit per pin
Definition gpio_reg.h:35
volatile uint32_t PUPDR
0x0C: pull-up/pull-down, 2 bits per pin
Definition gpio_reg.h:37
volatile const uint32_t IDR
0x10: input data, <span class="regaccess">ro</span>
Definition gpio_reg.h:38
volatile uint32_t AFRH
0x24: alternate function, pins 8-15
Definition gpio_reg.h:43
volatile uint32_t OSPEEDR
0x08: output speed, 2 bits per pin
Definition gpio_reg.h:36
volatile uint32_t BSRR
0x18: bit set/reset, <span class="regaccess">wo</span>
Definition gpio_reg.h:40
volatile uint32_t MODER
0x00: mode, 2 bits per pin
Definition gpio_reg.h:34
volatile uint32_t LCKR
0x1C: configuration lock
Definition gpio_reg.h:41
volatile uint32_t AFRL
0x20: alternate function, pins 0-7
Definition gpio_reg.h:42