It’s just a local variable inside of my primary .cpp file that has the main(void) function. This variable, shown below as “flag”, is only accessed by the main function and a callback function from TIM2_IRQHandler().
/*****************UartTesting.cpp************************/
#include <stm32f7xx_hal.h>
#include “core.h”
#include “definitions.h”
#include “gpio.h”
#include “uart.h”
#include “event.h”
/****************
*Some setup code went here
****************/
//Variable I am trying to watch live
volatile bool flag = false;
int main(void)
{
HAL_Init();
SystemClockConfig();
/****************
*Place holder for non-important code here…
****************/
for (;;)
{
if (flag)
//Do a thing
}
}
void testCallback()
{
testPin.toggle();
ledPin_Blue.toggle();
flag = true;
}
void TIM2_IRQHandler()
{
uint32_t isrflags = READ_REG(TIM2->SR);
isrflags &= ~(1 << 1u);
testCallback();
WRITE_REG(TIM2->SR, isrflags);
HAL_NVIC_DisableIRQ(TIM2_IRQn);
}