May 2018
Intermediate to advanced
324 pages
8h 45m
English
Enabling a digital output is possible by setting the mode to output in the mode register bits corresponding to the given pin. To be able to control the level of pin D13, which is also connected to an LED on our reference platform, we need to access the following registers:
#define GPIOD_BASE 0x40020c00#define GPIOD_MODE (*(volatile uint32_t *)(GPIOD_BASE + 0x00))#define GPIOD_OTYPE (*(volatile uint32_t *)(GPIOD_BASE + 0x04))#define GPIOD_PUPD (*(volatile uint32_t *)(GPIOD_BASE + 0x0c))#define GPIOD_ODR (*(volatile uint32_t *)(GPIOD_BASE + 0x14))#define GPIOD_BSRR (*(volatile uint32_t *)(GPIOD_BASE + 0x18))
In later examples, alternate functions are used to change the pin assignment. The two registers containing the alternate ...
Read now
Unlock full access