I am working on a program for the STM32F103C8T6 and I couldn't find the GPIOA_OTYPER constant. I want to set PA0 to PA7 as push pull for 8bits parallel output. When I google for the constants I find several websites doing it different ways:
#define RCC_AHB1ENR (*((volatile unsigned int*)0x40023830))
#define GPIOA_MODER (*((volatile unsigned int*)0x40020000))
#define GPIOA_BSRR (*((volatile unsigned int*)0x40020018))
#define RCC_AHB1ENR RCC_BASE + 0x30
#define GPIOA_MODER GPIOA_BASE + 0x00
#define GPIOA_BSRR GPIOA_BASE + 0x18
Are we all reinventing the wheel in every project?
Shouldn't there be a header file to set them all at once?
I could not find it, and if there is one, where can I find it?
If you are defining things like this yourself, you are definitely re-inventing the wheel. What you are looking for is CMSIS.
This provides standard definitions for all ARM Cortex-M CPUs. Vendors also add their own definitions for their products, e.g. ST Micro have their own definitions that cover the peripherals included in their STM32 line of MCUs. e.g. here's ST Micro's STM32F1 repo which contains CMSIS definitions for the MCU you are using.
If you've created a project using STM32CubeIDE then all this stuff will be in the Drivers/CMSIS
directory in your project, so you don't need to add it yourself.