summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-05-11 11:36:52 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2017-05-11 11:36:52 +0200
commit8665bdbf682bdff02576a6f4393f09bc56572043 (patch)
tree54b1f51c0b3e5f5dd577720a9cd54e28be19d97f /src
parenteabbd037f5f605a9ecf06185cd62594eb4564bce (diff)
downloadradio-controller-8665bdbf682bdff02576a6f4393f09bc56572043.tar.gz
radio-controller-8665bdbf682bdff02576a6f4393f09bc56572043.tar.bz2
radio-controller-8665bdbf682bdff02576a6f4393f09bc56572043.tar.xz
radio-controller-8665bdbf682bdff02576a6f4393f09bc56572043.zip
wip
Diffstat (limited to 'src')
-rw-r--r--src/radio-controller.cpp20
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() {
;
}