I would like to show adc values on my lcd screen on the stm32f746G - DISCO board. The main challenge comes from integrating the TouchGFX software. This generates the model, view, and presenter files necessary to output widgets and wildcards. I believe I have set up my adc pin correctly, PF10, as I am able to get the ADC value in main.cpp using:
while (1)
{
HAL_ADC_Start(&hadc3);
HAL_ADC_PollForConversion(&hadc3, 500);
hullVoltage = HAL_ADC_GetValue(&hadc3)*0.00080586;
HAL_Delay(1000);
}
But my main goal is showing this on my lcd screen. I have touchGFX setup where I can input a float to a wildcard in View.cpp. For example:
void Monitor_ScreenView::handleTickEvent()
{
Unicode::snprintfFloat(textArea2Buffer, 4, "%f", 3.14f);
textArea2.invalidate();
}
I will show you my model, view, and presenter cpp files to demonstrate where my issue lies.
model.cpp
#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
#ifndef SIMULATOR
#include "stm32746g_discovery.h"
#endif
void Model::getHullVoltage()
{
HAL_ADC_Start(&hadc3);
HAL_ADC_PollForConversion(&hadc3, 500);
hullVoltage = HAL_ADC_GetValue(&hadc3);
}
View.cpp
#include <gui/monitor_screen_screen/Monitor_ScreenView.hpp>
#include <gui/model/Model.hpp>
#ifndef SIMULATOR
#include "stm32746g_discovery.h"
#endif
void Monitor_ScreenView::handleTickEvent()
{
Unicode::snprintfFloat(textArea2Buffer, 4, "%f", presenter->getHullVoltage());
textArea2.invalidate();
}
presenter.cpp
#include <gui/monitor_screen_screen/Monitor_ScreenView.hpp>
#include <gui/monitor_screen_screen/Monitor_ScreenPresenter.hpp>
// my functions
float Monitor_ScreenPresenter::getHullVoltage()
{
return(model->hullVoltage);
}
The only error I get from this build is "hadc3 was not declared in this scope" from model.cpp.
I would be very gracious if I could get any insight from my code. Other than this, my code works, as I am able to turn on and off an LED with a button on the touch screen, I am able to print a float on the screen where I want, and I am able to get the adc value in main.cpp. I just need it to show on the screen every tick.
hadc3
is declared. If you can't find such code - that's the issue. – ProXicT