2023-03-23 07:55 AM
I've been drilling down into some code used to initialize the touch controller in STM32TouchController::init(), but am having a lot of trouble finding where in ST's api actually calls this init() function. I can see that the initialize() method on the static instance of TouchGFXHAL is called, which calls the parent class TouchGFXGeneratedHAL::initialize(), which eventually calls the top level parent class touchgfx::HAL::initialize(). In HAL.hpp I can see that the touchcontroller reference touchCtrl is stored by reference in the member variable touchController:
/**
* Initializes a new instance of the HAL class.
*
* @param [in] dmaInterface Reference to the DMA interface.
* @param [in] display Reference to the LCD.
* @param [in] touchCtrl Reference to the touch controller.
* @param width The width of the LCD display, in pixels.
* @param height The height of the LCD display, in pixels.
*/
HAL(DMA_Interface& dmaInterface, LCD& display, TouchController& touchCtrl, uint16_t width, uint16_t height)
: dma(dmaInterface),
lcdRef(display),
touchController(touchCtrl),
mcuInstrumentation(0),
buttonController(0),
frameBufferAllocator(0),
gestures(),
nativeDisplayOrientation(ORIENTATION_LANDSCAPE),
taskDelayFunc(0),
frameBuffer0(0),
frameBuffer1(0),
frameBuffer2(0),
refreshStrategy(REFRESH_STRATEGY_DEFAULT),
fingerSize(1),
lockDMAToPorch(false),
frameBufferUpdatedThisFrame(false),
auxiliaryLCD(0),
partialFrameBufferRect(),
listener(0),
lastX(0),
lastY(0),
touchSampleRate(1),
mcuLoadPct(0),
vSyncCnt(0),
vSyncForFrame(1),
vSyncCompensationEnabled(false),
clientDirty(false),
swapRequested(false),
lastTouched(false),
updateMCULoad(0),
cc_begin(0),
requestedOrientation(ORIENTATION_LANDSCAPE),
displayOrientationChangeRequested(false),
useAuxiliaryLCD(false),
useDMAAcceleration(true),
lastRenderMethod(HARDWARE)
{
instance = this;
FRAME_BUFFER_WIDTH = DISPLAY_WIDTH = width;
FRAME_BUFFER_HEIGHT = DISPLAY_HEIGHT = height;
DISPLAY_ROTATION = rotate0;
nativeDisplayOrientation = ((width >= height) ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
}
However, I can't for the life of me find the actual implementation of the parent class's initalize() function:
/**
* This function initializes the HAL, DMA, TouchController, and interrupts.
*
* @see configureInterrupts
*/
virtual void initialize();
From trial and error this is definitely the function that ends up caling touchController.init(), I just can't find where it does this. Any help is greatly appreciated...