// Enable clock access to the port.
// Set pin mode
// Set pin as o/p
#include "stm32f4xx.h" // Device header
#define RED (1U << 3) // PIN PA3
#define VIOLET (1U << 2) // PIN PA2
#define GREEN (1U << 2) // PIN PA5 Onboard LED
#define GPIOA_CLOCK (1U << 0)
#define RED_OUT_BIT (1U << 6) // General purpose output mode, no alternate function, no analog, no input mode
#define VIOLET_OUT_BIT (1U << 4) // General purpose output mode, no alternate function, no analog, no input mode
#define GREEN_OUT_BIT (1U << 10) // General purpose output mode, no alternate function, no analog, no input mode
int main() {
RCC -> AHB1ENR |= GPIOA_CLOCK;
GPIOA -> MODER |= RED_OUT_BIT | VIOLET_OUT_BIT | GREEN_OUT_BIT;
while(1) {
GPIOA -> ODR |= RED | VIOLET | GREEN;
}
}