2022-09-01 08:02 PM
STM32H747-Disco, Cube IDE 1.10.1
I've designed a UI using the method of MPV a few times in the past using one processor(CM7). Now, I'm using CM4 for sd card and PWM, I can't seem to get the model.cpp to recognize TIM1 handler (htmi1). I had made a similar post previously stating that there is a problem with TIM_HandleTypeDef htim1, when placed in the model.cpp file as extern TIM_HandleTypeDef htim1. using the extern caused the file not to be able to compile.
The WHY I can't have it compile possibly has something to do with adding htim1.Instance->CCR1 = 100; to the model doesn't work either. In this particular case the PWM doesn't even start when htim1.Instance->CCR1 = 100; is added like it does in CM4 Main.
The CM4 is based on a GUI's slider value change calling a virtual function. No problem before using CM4 oppose to CM7.
Does anyone know the reason for not being able to vary the duty cycle or using TIM_HandleTypeDef htim1 in the Model configured in CM4 main?
#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
#include "stm32h7xx_hal.h"
TIM_HandleTypeDef htim1; Why extern doesn't work?
Model::Model() : modelListener(0)
{
}
void Model::tick()
{
}
void Model:: PWM_DELTA(int value)
{
value = value * 732; //constant to allow 0-100 percent
htim1.Instance->CCR1 = value; //change dutyclycle
//ReadPWM(value);
}
2022-09-02 04:35 PM
Once again! I did it! I'll continue further my reading on the dual core. This was my silly mistake!