/*
 * sync_pulse.h
 *
 *  Created on: Nov 25, 2025
 *      Author: herli
 */

#ifndef INC_SYNC_PULSE_H_
#define INC_SYNC_PULSE_H_

#include "main.h"
#include "stm32g4xx_hal.h"

// Extern TIM8 handle (generated by CubeMX in tim.c)
extern TIM_HandleTypeDef htim8;

//extern volatile int watchdog_active;
uint8_t SYNC_Pulse_IsSyncoutMode(void);
void SYNC_Pulse_Poll(void);

/**
 * @brief Switch PA15 into TIM8_CH1 PWM output mode.
 */
void SYNC_Pulse_EnableTIM8(void);
void SYNC_PULSE_TIM_START(void);
void SYNC_PULSE_TIM_STOP(void);
void SYNC_Pulse_SetCallback(void (*cb)(void));

/**
 * @brief Switch PA15 back to GPIO push-pull output for software toggling.
 */
void SYNC_Pulse_EnableGPIO(void);

void SYNC_Pulse_GPIO_set(uint8_t state);



#endif /* INC_SYNC_PULSE_H_ */
