MCPcopy Create free account
hub / github.com/DISTORTEC/distortos / configureApbClockDivider

Function configureApbClockDivider

source/chip/STM32/STM32F0/STM32F0-RCC.cpp:55–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55int configureApbClockDivider(const uint8_t ppre)
56{
57 static const std::pair<decltype(ppre), decltype(RCC_CFGR_PPRE_DIV1)> associations[]
58 {
59 {ppreDiv1, RCC_CFGR_PPRE_DIV1},
60 {ppreDiv2, RCC_CFGR_PPRE_DIV2},
61 {ppreDiv4, RCC_CFGR_PPRE_DIV4},
62 {ppreDiv8, RCC_CFGR_PPRE_DIV8},
63 {ppreDiv16, RCC_CFGR_PPRE_DIV16},
64 };
65
66 for (auto& association : associations)
67 if (association.first == ppre)
68 {
69 RCC->CFGR = (RCC->CFGR & ~RCC_CFGR_PPRE) | association.second;
70 return 0;
71 }
72
73 return EINVAL;
74}
75
76int configurePrediv(const uint8_t prediv)
77{

Callers 1

chipLowLevelInitializerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected