~ruther/stm32h747i-disco-usb-image-viewer

ref: e93f5885314825e5ca6125b2274034dcedbb2132 stm32h747i-disco-usb-image-viewer/src/main.c -rw-r--r-- 534 bytes
e93f5885 — Rutherther feat: use cmsis for register definitions 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdint.h>
#include "stm32h747xx.h"

#define LED1_PIN 12
#define LED2_PIN 13

void main()
{
 RCC->AHB4ENR |= (1 << RCC_AHB4ENR_GPIOIEN_Pos);

  // do two dummy reads after enabling the peripheral clock
  volatile uint32_t dummy;
  dummy = RCC->AHB4ENR;
  dummy = RCC->AHB4ENR;

  GPIOI->MODER = (1 << GPIO_MODER_MODE12_Pos) | (1 << GPIO_MODER_MODE13_Pos);

  GPIOI->ODR ^= (1 << LED2_PIN);
  while(1)
  {
    GPIOI->ODR ^= (1 << LED1_PIN);
    GPIOI->ODR ^= (1 << LED2_PIN);
    for (uint32_t i = 0; i < 2000000; i++);
  }
}
Do not follow this link