Handle buttons & encoders in View, not Model
This commit is contained in:
		@ -1,40 +1,42 @@
 | 
			
		||||
/* USER CODE BEGIN Header */
 | 
			
		||||
/**
 | 
			
		||||
  ******************************************************************************
 | 
			
		||||
  * File Name          : TouchGFXHAL.cpp
 | 
			
		||||
  ******************************************************************************
 | 
			
		||||
  * This file was created by TouchGFX Generator 4.21.1. This file is only
 | 
			
		||||
  * generated once! Delete this file from your project and re-generate code
 | 
			
		||||
  * using STM32CubeMX or change this file manually to update it.
 | 
			
		||||
  ******************************************************************************
 | 
			
		||||
  * @attention
 | 
			
		||||
  *
 | 
			
		||||
  * Copyright (c) 2023 STMicroelectronics.
 | 
			
		||||
  * All rights reserved.
 | 
			
		||||
  *
 | 
			
		||||
  * This software is licensed under terms that can be found in the LICENSE file
 | 
			
		||||
  * in the root directory of this software component.
 | 
			
		||||
  * If no LICENSE file comes with this software, it is provided AS-IS.
 | 
			
		||||
  *
 | 
			
		||||
  ******************************************************************************
 | 
			
		||||
  */
 | 
			
		||||
 ******************************************************************************
 | 
			
		||||
 * File Name          : TouchGFXHAL.cpp
 | 
			
		||||
 ******************************************************************************
 | 
			
		||||
 * This file was created by TouchGFX Generator 4.21.1. This file is only
 | 
			
		||||
 * generated once! Delete this file from your project and re-generate code
 | 
			
		||||
 * using STM32CubeMX or change this file manually to update it.
 | 
			
		||||
 ******************************************************************************
 | 
			
		||||
 * @attention
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2023 STMicroelectronics.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * This software is licensed under terms that can be found in the LICENSE file
 | 
			
		||||
 * in the root directory of this software component.
 | 
			
		||||
 * If no LICENSE file comes with this software, it is provided AS-IS.
 | 
			
		||||
 *
 | 
			
		||||
 ******************************************************************************
 | 
			
		||||
 */
 | 
			
		||||
/* USER CODE END Header */
 | 
			
		||||
 | 
			
		||||
#include <TouchGFXHAL.hpp>
 | 
			
		||||
 | 
			
		||||
/* USER CODE BEGIN TouchGFXHAL.cpp */
 | 
			
		||||
#include "STWButtonController.hpp"
 | 
			
		||||
STWButtonController stwBC;
 | 
			
		||||
 | 
			
		||||
using namespace touchgfx;
 | 
			
		||||
 | 
			
		||||
void TouchGFXHAL::initialize()
 | 
			
		||||
{
 | 
			
		||||
    // Calling parent implementation of initialize().
 | 
			
		||||
    //
 | 
			
		||||
    // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
    // and implemented needed functionality here.
 | 
			
		||||
    // Please note, HAL::initialize() must be called to initialize the framework.
 | 
			
		||||
void TouchGFXHAL::initialize() {
 | 
			
		||||
  // Calling parent implementation of initialize().
 | 
			
		||||
  //
 | 
			
		||||
  // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
  // and implemented needed functionality here.
 | 
			
		||||
  // Please note, HAL::initialize() must be called to initialize the framework.
 | 
			
		||||
 | 
			
		||||
    TouchGFXGeneratedHAL::initialize();
 | 
			
		||||
  TouchGFXGeneratedHAL::initialize();
 | 
			
		||||
  setButtonController(&stwBC);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -42,14 +44,13 @@ void TouchGFXHAL::initialize()
 | 
			
		||||
 *
 | 
			
		||||
 * @return The address of the frame buffer currently being displayed on the TFT.
 | 
			
		||||
 */
 | 
			
		||||
uint16_t* TouchGFXHAL::getTFTFrameBuffer() const
 | 
			
		||||
{
 | 
			
		||||
    // Calling parent implementation of getTFTFrameBuffer().
 | 
			
		||||
    //
 | 
			
		||||
    // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
    // and implemented needed functionality here.
 | 
			
		||||
uint16_t *TouchGFXHAL::getTFTFrameBuffer() const {
 | 
			
		||||
  // Calling parent implementation of getTFTFrameBuffer().
 | 
			
		||||
  //
 | 
			
		||||
  // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
  // and implemented needed functionality here.
 | 
			
		||||
 | 
			
		||||
    return TouchGFXGeneratedHAL::getTFTFrameBuffer();
 | 
			
		||||
  return TouchGFXGeneratedHAL::getTFTFrameBuffer();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -57,106 +58,96 @@ uint16_t* TouchGFXHAL::getTFTFrameBuffer() const
 | 
			
		||||
 *
 | 
			
		||||
 * @param [in] address New frame buffer address.
 | 
			
		||||
 */
 | 
			
		||||
void TouchGFXHAL::setTFTFrameBuffer(uint16_t* address)
 | 
			
		||||
{
 | 
			
		||||
    // Calling parent implementation of setTFTFrameBuffer(uint16_t* address).
 | 
			
		||||
    //
 | 
			
		||||
    // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
    // and implemented needed functionality here.
 | 
			
		||||
void TouchGFXHAL::setTFTFrameBuffer(uint16_t *address) {
 | 
			
		||||
  // Calling parent implementation of setTFTFrameBuffer(uint16_t* address).
 | 
			
		||||
  //
 | 
			
		||||
  // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
  // and implemented needed functionality here.
 | 
			
		||||
 | 
			
		||||
    TouchGFXGeneratedHAL::setTFTFrameBuffer(address);
 | 
			
		||||
  TouchGFXGeneratedHAL::setTFTFrameBuffer(address);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This function is called whenever the framework has performed a partial draw.
 | 
			
		||||
 *
 | 
			
		||||
 * @param rect The area of the screen that has been drawn, expressed in absolute coordinates.
 | 
			
		||||
 * @param rect The area of the screen that has been drawn, expressed in absolute
 | 
			
		||||
 * coordinates.
 | 
			
		||||
 *
 | 
			
		||||
 * @see flushFrameBuffer().
 | 
			
		||||
 */
 | 
			
		||||
void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect& rect)
 | 
			
		||||
{
 | 
			
		||||
    // Calling parent implementation of flushFrameBuffer(const touchgfx::Rect& rect).
 | 
			
		||||
    //
 | 
			
		||||
    // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
    // and implemented needed functionality here.
 | 
			
		||||
    // Please note, HAL::flushFrameBuffer(const touchgfx::Rect& rect) must
 | 
			
		||||
    // be called to notify the touchgfx framework that flush has been performed.
 | 
			
		||||
    // To calculate he start adress of rect,
 | 
			
		||||
    // use advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect)
 | 
			
		||||
    // defined in TouchGFXGeneratedHAL.cpp
 | 
			
		||||
void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect &rect) {
 | 
			
		||||
  // Calling parent implementation of flushFrameBuffer(const touchgfx::Rect&
 | 
			
		||||
  // rect).
 | 
			
		||||
  //
 | 
			
		||||
  // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
  // and implemented needed functionality here.
 | 
			
		||||
  // Please note, HAL::flushFrameBuffer(const touchgfx::Rect& rect) must
 | 
			
		||||
  // be called to notify the touchgfx framework that flush has been performed.
 | 
			
		||||
  // To calculate he start adress of rect,
 | 
			
		||||
  // use advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect)
 | 
			
		||||
  // defined in TouchGFXGeneratedHAL.cpp
 | 
			
		||||
 | 
			
		||||
    TouchGFXGeneratedHAL::flushFrameBuffer(rect);
 | 
			
		||||
  TouchGFXGeneratedHAL::flushFrameBuffer(rect);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TouchGFXHAL::blockCopy(void* RESTRICT dest, const void* RESTRICT src, uint32_t numBytes)
 | 
			
		||||
{
 | 
			
		||||
    return TouchGFXGeneratedHAL::blockCopy(dest, src, numBytes);
 | 
			
		||||
bool TouchGFXHAL::blockCopy(void *RESTRICT dest, const void *RESTRICT src,
 | 
			
		||||
                            uint32_t numBytes) {
 | 
			
		||||
  return TouchGFXGeneratedHAL::blockCopy(dest, src, numBytes);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Configures the interrupts relevant for TouchGFX. This primarily entails setting
 | 
			
		||||
 * the interrupt priorities for the DMA and LCD interrupts.
 | 
			
		||||
 * Configures the interrupts relevant for TouchGFX. This primarily entails
 | 
			
		||||
 * setting the interrupt priorities for the DMA and LCD interrupts.
 | 
			
		||||
 */
 | 
			
		||||
void TouchGFXHAL::configureInterrupts()
 | 
			
		||||
{
 | 
			
		||||
    // Calling parent implementation of configureInterrupts().
 | 
			
		||||
    //
 | 
			
		||||
    // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
    // and implemented needed functionality here.
 | 
			
		||||
void TouchGFXHAL::configureInterrupts() {
 | 
			
		||||
  // Calling parent implementation of configureInterrupts().
 | 
			
		||||
  //
 | 
			
		||||
  // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
  // and implemented needed functionality here.
 | 
			
		||||
 | 
			
		||||
    TouchGFXGeneratedHAL::configureInterrupts();
 | 
			
		||||
  TouchGFXGeneratedHAL::configureInterrupts();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Used for enabling interrupts set in configureInterrupts()
 | 
			
		||||
 */
 | 
			
		||||
void TouchGFXHAL::enableInterrupts()
 | 
			
		||||
{
 | 
			
		||||
    // Calling parent implementation of enableInterrupts().
 | 
			
		||||
    //
 | 
			
		||||
    // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
    // and implemented needed functionality here.
 | 
			
		||||
void TouchGFXHAL::enableInterrupts() {
 | 
			
		||||
  // Calling parent implementation of enableInterrupts().
 | 
			
		||||
  //
 | 
			
		||||
  // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
  // and implemented needed functionality here.
 | 
			
		||||
 | 
			
		||||
    TouchGFXGeneratedHAL::enableInterrupts();
 | 
			
		||||
  TouchGFXGeneratedHAL::enableInterrupts();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Used for disabling interrupts set in configureInterrupts()
 | 
			
		||||
 */
 | 
			
		||||
void TouchGFXHAL::disableInterrupts()
 | 
			
		||||
{
 | 
			
		||||
    // Calling parent implementation of disableInterrupts().
 | 
			
		||||
    //
 | 
			
		||||
    // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
    // and implemented needed functionality here.
 | 
			
		||||
void TouchGFXHAL::disableInterrupts() {
 | 
			
		||||
  // Calling parent implementation of disableInterrupts().
 | 
			
		||||
  //
 | 
			
		||||
  // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
  // and implemented needed functionality here.
 | 
			
		||||
 | 
			
		||||
    TouchGFXGeneratedHAL::disableInterrupts();
 | 
			
		||||
  TouchGFXGeneratedHAL::disableInterrupts();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Configure the LCD controller to fire interrupts at VSYNC. Called automatically
 | 
			
		||||
 * once TouchGFX initialization has completed.
 | 
			
		||||
 * Configure the LCD controller to fire interrupts at VSYNC. Called
 | 
			
		||||
 * automatically once TouchGFX initialization has completed.
 | 
			
		||||
 */
 | 
			
		||||
void TouchGFXHAL::enableLCDControllerInterrupt()
 | 
			
		||||
{
 | 
			
		||||
    // Calling parent implementation of enableLCDControllerInterrupt().
 | 
			
		||||
    //
 | 
			
		||||
    // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
    // and implemented needed functionality here.
 | 
			
		||||
void TouchGFXHAL::enableLCDControllerInterrupt() {
 | 
			
		||||
  // Calling parent implementation of enableLCDControllerInterrupt().
 | 
			
		||||
  //
 | 
			
		||||
  // To overwrite the generated implementation, omit call to parent function
 | 
			
		||||
  // and implemented needed functionality here.
 | 
			
		||||
 | 
			
		||||
    TouchGFXGeneratedHAL::enableLCDControllerInterrupt();
 | 
			
		||||
  TouchGFXGeneratedHAL::enableLCDControllerInterrupt();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TouchGFXHAL::beginFrame()
 | 
			
		||||
{
 | 
			
		||||
    return TouchGFXGeneratedHAL::beginFrame();
 | 
			
		||||
}
 | 
			
		||||
bool TouchGFXHAL::beginFrame() { return TouchGFXGeneratedHAL::beginFrame(); }
 | 
			
		||||
 | 
			
		||||
void TouchGFXHAL::endFrame()
 | 
			
		||||
{
 | 
			
		||||
    TouchGFXGeneratedHAL::endFrame();
 | 
			
		||||
}
 | 
			
		||||
void TouchGFXHAL::endFrame() { TouchGFXGeneratedHAL::endFrame(); }
 | 
			
		||||
 | 
			
		||||
/* USER CODE END TouchGFXHAL.cpp */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user