diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-05-13 10:48:31 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-05-16 23:24:34 +0200 |
commit | 037d84bed61fb93a5292d0194bbf734fd2927378 (patch) | |
tree | 1e3062ea7309adcc274cdbe61f3505b04bc68dfe /src | |
parent | ce168959907bc922875902a703a1aebe2296ad2c (diff) | |
download | radio-controller-037d84bed61fb93a5292d0194bbf734fd2927378.tar.gz radio-controller-037d84bed61fb93a5292d0194bbf734fd2927378.tar.bz2 radio-controller-037d84bed61fb93a5292d0194bbf734fd2927378.tar.xz radio-controller-037d84bed61fb93a5292d0194bbf734fd2927378.zip |
wip
Diffstat (limited to 'src')
-rw-r--r-- | src/radio-controller.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/radio-controller.cpp b/src/radio-controller.cpp index c71aaa5..9795574 100644 --- a/src/radio-controller.cpp +++ b/src/radio-controller.cpp @@ -1,13 +1,18 @@ #include "radio-controller.h" #include "stm32f1xx_hal.h" -#include <cstring> #include "mcu/arm/semihosting.h" +#include "mcu/stm32cubemx/uart.h" +#include "mcu/stm32cubemx/debug.h" #ifdef HAL_IWDG_MODULE_ENABLED extern IWDG_HandleTypeDef hiwdg; #endif extern TIM_HandleTypeDef htim1; +extern UART_HandleTypeDef huart2; + +mcu::stm32cubemx::uart::uart_port uart2(&huart2); +mcu::stm32cubemx::debug::dbg<100> dbg(uart2); void main_pre_init() { } @@ -15,21 +20,33 @@ void main_pre_init() { void main_post_init() { semihosting::enable(); - HAL_TIM_Base_Start(&htim1); + printf("Radio Controller\n"); + + HAL_TIM_Base_Start_IT(&htim1); +// HAL_TIM_IC_Start_IT(&htim1, 1); + + uart2.enable(); } static uint32_t tick_next = 0; +static bool seen_high = false; + void main_loop() { -// printf("hello world!"); auto now = HAL_GetTick(); if (now >= tick_next) { +// puts(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_8) ? "1" : "0"); + uint32_t cnt = __HAL_TIM_GET_COUNTER(&htim1); - printf("cnt=%lu, now=%lu\n", cnt, now); + dbg.println("cnt=%lu, now=%lu, seen_high=%d", cnt, now, seen_high); tick_next += 1000; + seen_high = false; + dbg.println("wat"); } + seen_high |= HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_8); + #ifdef HAL_IWDG_MODULE_ENABLED HAL_IWDG_Refresh(&hiwdg); #endif |