diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-09-06 17:05:53 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-09-06 17:05:53 +0200 |
commit | c3b4382302a7ac74ad12a4d315d1d2c15204ca54 (patch) | |
tree | c6bc8d87011d050c7d6689da8f8e25f10b59541f /stm32f091/main.cpp | |
parent | 7485a5b3c30d5b707cd238b1f7a6ddd9516f06bd (diff) |
WIP makefile for stm32
Diffstat (limited to 'stm32f091/main.cpp')
-rw-r--r-- | stm32f091/main.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/stm32f091/main.cpp b/stm32f091/main.cpp new file mode 100644 index 0000000..180240e --- /dev/null +++ b/stm32f091/main.cpp @@ -0,0 +1,21 @@ +#include <stm32f0xx.h> +#include <stdint.h> + +#define PORT GPIOA +#define PIN 5 + +int main() { + RCC->AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN; + + PORT->MODER &= ~(0b11 << (PIN * 2)); + PORT->MODER |= (0b01 << (PIN * 2)); + + uint8_t led = 1; + + while (1) { + PORT->ODR &= ~(1 << PIN); + PORT->ODR |= (led << PIN); + led ^= 1; + for (unsigned long i = 0; i < 50000; i++) asm("nop"); + } +} |