System Clock source in project using 'target' option #870
-
Hi, I have project with following configuration (I'am targeting the same MCU as on NUCLEO-F103RB board): <library>
<options>
<option name=":target">stm32f103rbt6</option>
<option name="modm:build:openocd.cfg">openocd.cfg</option>
<option name="modm:build:cmake:include_cmakelists">False</option>
<option name="modm:build:scons:include_sconstruct">False</option>
</options>
<modules>
<module>modm:build:scons</module>
<module>modm:build:cmake</module>
<module>modm:platform:core</module>
<module>modm:platform:gpio</module>
<module>modm:platform:timer:2</module>
</modules>
<repositories>
<repository><path>../submodules/modm/repo.lb</path></repository>
</repositories>
</library> I want to play around with timers and interrupts - exactly to use the Timer2::setPeriod(uint32_t microseconds, bool autoApply = true) But setPeriod() method expects the [Updated] struct SystemClock
{
static constexpr uint32_t Frequency = 72'000'000;
static constexpr uint32_t Ahb = Frequency;
static constexpr uint32_t Apb1 = Frequency / 2;
static constexpr uint32_t Apb2 = Frequency;
// ...
static bool inline enable()
{
// ...
}
} Then I can use Timer2::setPeriod<SystemClock>(period); (1) Is this the correct approach? Or is there a better way? (2) Maybe I don't know how to use the documentation, but the documentation didn't help me at all. Can anyone tell me where I can find this topic in the documentation? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That's how it is intended to be used, you can also define multiple SystemClock structs to switch them at runtime (at the cost of calling
The Timer API is simply lacking documentation, sorry about that! |
Beta Was this translation helpful? Give feedback.
That's how it is intended to be used, you can also define multiple SystemClock structs to switch them at runtime (at the cost of calling
Peripheral::initialize<SystemClock123>()
for everything you use anytime you switch).The Timer API is simply lacking documentation, sorry about that!