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

ref: 68abb4c6d986c3d7f3f04aa5c6610190960c1104 stm32h747i-disco-usb-image-viewer/firmware/include/clocks.h -rw-r--r-- 1.2 KiB
68abb4c6 — Rutherther chore: tidy up rust code 2 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdint.h>
#include <stdbool.h>

#ifndef CLOCKS_H
#define CLOCKS_H

typedef enum {
  CLOCK_PLL1 = 0,
  CLOCK_PLL2 = 1,
  CLOCK_PLL3 = 2,
} clock_pll_t;

typedef enum {
  CLOCK_SOURCE_HSI = 0,
  CLOCK_SOURCE_HSE = 1,
  CLOCK_SOURCE_CSI = 2,
  CLOCK_SOURCE_PLL_1_P_CK = 3,
} sysclock_source_t;

typedef enum {
  PLL_SOURCE_HSI = 0,
  PLL_SOURCE_CSI = 1,
  PLL_SOURCE_HSE = 2,
  PLL_SOURCE_NONE = 3,
} pll_source_t;

typedef enum {
  CLOCK_HSI,
  CLOCK_HSE,
  CLOCK_HSI48,
} clock_t;

void clocks_enable(clock_t clock);
bool clocks_ready(clock_t clock);
void clocks_wait_ready(clock_t clock);

void clocks_pll_configure(clock_pll_t pll, uint8_t vcosel,
                          uint8_t divm, pll_source_t source,
                          uint16_t divn, uint8_t divp, uint8_t divq,
                          uint8_t divr);
void clocks_pll_enable(clock_pll_t pll);
void clocks_pll_disable(clock_pll_t pll);
void clocks_pll_wait_ready(clock_pll_t pll, uint16_t timeout_us);

void clocks_system_clock_source(sysclock_source_t source, uint8_t d1cpre,
                                uint8_t d1ppre, uint8_t hpre,
                                uint16_t timeout_us);

#endif // CLOCKS_H
Do not follow this link