Skip to content

Commit

Permalink
example adding lptimer to stm32 and using it
Browse files Browse the repository at this point in the history
there is no real secondary lptimer on stm32 therefor timer5 is used
  • Loading branch information
kfessel committed Sep 15, 2022
1 parent 81d06c8 commit 3bb2929
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion boards/common/stm32/include/cfg_timer_tim2.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@ static const timer_conf_t timer_config[] = {
#endif
.bus = APB1,
.irqn = TIM2_IRQn
}
},
{
.dev = TIM5,
.max = 0xffffffff,
.rcc_mask = RCC_APB1ENR_TIM5EN,
.bus = APB1,
.irqn = TIM5_IRQn
},
};

#define TIMER_0_ISR isr_tim2
#define TIMER_1_ISR isr_tim5

#define TIMER_NUMOF ARRAY_SIZE(timer_config)
/** @} */
Expand Down
1 change: 1 addition & 0 deletions dist/tools/doccheck/exclude_patterns
Original file line number Diff line number Diff line change
Expand Up @@ -13119,3 +13119,4 @@ boards/esp32\-ttgo\-t\-beam/doc\.txt:[0-9]+: warning: unable to resolve referenc
boards/esp32\-wemos\-lolin\-d32\-pro/doc\.txt:[0-9]+: warning: explicit link request to 'esp32_wemos_lolin_d32_pro_optional_hardware' could not be resolved
drivers/include/xbee\.h:[0-9]+: warning: found documented return type for xbee_setup that does not return anything
boards/nrf52840dongle/doc\.txt:[0-9]+: warning: unable to resolve reference to 'nrf52840dongle_flash' for \\ref command
boards/common/stm32/include/cfg_timer_tim2\.h:[0-9]+: warning: Member TIMER_1_ISR \(macro definition\) of file cfg_timer_tim2\.h is not documented\.
3 changes: 3 additions & 0 deletions tests/ztimer_xsec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ USEMODULE += ztimer
USEMODULE += ztimer_usec
USEMODULE += ztimer_msec
USEMODULE += ztimer_sec
USEMODULE += ztimer_periph_lptimer

CFLAGS += "-DCONFIG_ZTIMER_LPTIMER_DEV=TIMER_DEV(1)" "-DCONFIG_ZTIMER_LPTIMER_FREQ=1000LU" "-DCONFIG_ZTIMER_LPTIMER_WIDTH=32" "-DCONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE=ZTIMER_CLOCK_NO_REQUIRED_PM_MODE"

# microbit qemu lacks rtt
TEST_ON_CI_BLACKLIST += microbit
Expand Down
2 changes: 1 addition & 1 deletion tests/ztimer_xsec/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(void)
{
puts("starting ztimers");
/* start a timer on each high level ztimer*/
ztimer_set(ZTIMER_SEC, &sec_tim, 1);
ztimer_set(ZTIMER_SEC, &sec_tim, 3);
ztimer_set(ZTIMER_MSEC, &msec_tim, 200);
ztimer_set(ZTIMER_USEC, &usec_tim, 100 * US_PER_MS);

Expand Down

0 comments on commit 3bb2929

Please sign in to comment.