From 8665bdbf682bdff02576a6f4393f09bc56572043 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 11 May 2017 11:36:52 +0200 Subject: wip --- src/radio-controller.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src') 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 +#include #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() { ; } -- cgit v1.2.3