Move clock sync logic to separate files
This commit is contained in:
20
Core/Src/Clock_Sync.c
Normal file
20
Core/Src/Clock_Sync.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include "Clock_Sync.h"
|
||||
|
||||
#include "CAN_Communication.h"
|
||||
|
||||
#include "stm32g4xx_hal_fdcan.h"
|
||||
#include "stm32g4xx_hal_tim.h"
|
||||
|
||||
static FDCAN_HandleTypeDef* can;
|
||||
static TIM_HandleTypeDef* timer;
|
||||
|
||||
void clock_sync_init(FDCAN_HandleTypeDef* can_handle,
|
||||
TIM_HandleTypeDef* timer_handle) {
|
||||
can = can_handle;
|
||||
timer = timer_handle;
|
||||
HAL_TIM_Base_Start_IT(timer);
|
||||
}
|
||||
|
||||
void clock_sync_handle_timer_complete() {
|
||||
CAN_Transmit(can, CLOCK_SYNC_ADDRESS, NULL, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user