diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/radio-controller.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/radio-controller.cpp b/src/radio-controller.cpp index 132f581..c71aaa5 100644 --- a/src/radio-controller.cpp +++ b/src/radio-controller.cpp @@ -1,28 +1,40 @@ -#include "main.h" +#include "radio-controller.h" #include "stm32f1xx_hal.h" -#include <cstdio> +#include <cstring> #include "mcu/arm/semihosting.h" #ifdef HAL_IWDG_MODULE_ENABLED extern IWDG_HandleTypeDef hiwdg; #endif +extern TIM_HandleTypeDef htim1; + void main_pre_init() { -// SystemInit(); } void main_post_init() { semihosting::enable(); + + HAL_TIM_Base_Start(&htim1); } +static uint32_t tick_next = 0; + void main_loop() { // printf("hello world!"); + auto now = HAL_GetTick(); + + if (now >= tick_next) { + uint32_t cnt = __HAL_TIM_GET_COUNTER(&htim1); + printf("cnt=%lu, now=%lu\n", cnt, now); + tick_next += 1000; + } #ifdef HAL_IWDG_MODULE_ENABLED HAL_IWDG_Refresh(&hiwdg); #endif } -void it_tim1(TIM_HandleTypeDef *htim1) { +void it_tim1() { ; } |