33 lines
494 B
C
33 lines
494 B
C
/* counter.c
|
|
*
|
|
* Created on: Jan 17, 2018
|
|
* Author: wn
|
|
*/
|
|
|
|
#include "counter.h"
|
|
#include "stm32f1xx_hal.h"
|
|
#include <PontCoopScheduler.h>
|
|
#include <diag/Trace.h>
|
|
|
|
extern TIM_HandleTypeDef htim2;
|
|
extern TIM_HandleTypeDef htim1;
|
|
|
|
|
|
void counterExec(void *handle) {
|
|
trace_printf("counterExec\n");
|
|
|
|
volatile uint32_t cnt = __HAL_TIM_GET_COUNTER(&htim2);
|
|
trace_printf("%d\n", cnt);
|
|
|
|
}
|
|
|
|
void counterInit() {
|
|
HAL_TIM_Base_Start(&htim2);
|
|
|
|
schAdd(counterExec, NULL, 0, 100);
|
|
}
|
|
|
|
|
|
|
|
|