/*
 * debug.c
 *
 *  Created on: Apr 20, 2026
 *      Author: user
 */
#include <stdio.h>
#include <string.h>
#include "main.h"

extern UART_HandleTypeDef huart1;
extern uint8_t pulsanti;
extern uint16_t stPulsanti;
extern omCiclo_st stCiclo;

void debug(void){
	static uint8_t mempulsanti=0;
	static uint16_t memstPulsanti=0;
	static omCiclo_st memstCiclo=omchiuso;
	char s [100];

	if(mempulsanti!=pulsanti){
		mempulsanti=pulsanti;
		sprintf(s,"\npulsanti=%X",pulsanti);
		HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
	}
	if(memstPulsanti!=stPulsanti){
		memstPulsanti=stPulsanti;
		sprintf(s,"\nstpulsanti=%X",stPulsanti);
		HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
	}
	if(memstCiclo!=stCiclo){
		memstCiclo=stCiclo;
		sprintf(s,"\nstCiclo=%d",stCiclo);
		HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
	}

}
