TouchGFX + 0/4 examples
CodeScope will show references to touchgfx::HAL from the following samples and libraries:
Examples
STM32469I-Discovery
Demonstrations
STM32469I_EVAL
Demonstrations
STM324x9I_EVAL
Demonstrations
STM32F429I-Discovery
Demonstrations
 
Symbols
loading...
Files
loading...

touchgfx::HAL class

@class HAL HAL.hpp touchgfx/hal/HAL.hpp Hardware Abstraction Layer. Contains functions that are specific to the hardware platform the code is running on.

Syntax

class HAL { public:     HAL(DMA_Interface& dmaInterface, LCD& display, TouchController& touchCtrl, uint16_t width, uint16_t height) :         dma(dmaInterface),         lcdRef(display),         touchController(touchCtrl),         mcuInstrumentation(0),         buttonController(0),         taskDelayFunc(0),         frameBuffer0(0),         frameBuffer1(0),         frameBuffer2(0),         refreshStrategy(REFRESH_STRATEGY_DEFAULT),         fingerSize(1),         lockDMAToPorch(true),         touchSampleRate(1),         mcuLoadPct(0),         vSyncCnt(0),         vSyncForFrame(1),         vSyncCompensationEnabled(false),         clientDirty(false),         swapRequested(false),         lastTouched(false),         updateMCULoad(0),         cc_begin(0),         displayOrientationChangeRequested(false)     {         instance = this;         DISPLAY_WIDTH = width;         DISPLAY_HEIGHT = height;         DISPLAY_ROTATION = rotate0;         FRAME_BUFFER_WIDTH = DISPLAY_WIDTH;         FRAME_BUFFER_HEIGHT = DISPLAY_HEIGHT;         nativeDisplayOrientation = ((width >= height) ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);     }     virtual ~HAL() { }     static HAL* getInstance()     {         return instance;     }     virtual void setDisplayOrientation(DisplayOrientation orientation)     {         requestedOrientation = orientation;         displayOrientationChangeRequested = true;     }     DisplayOrientation getDisplayOrientation() const     {         if (DISPLAY_ROTATION == rotate0)         {             return nativeDisplayOrientation;         }         else         {             return (nativeDisplayOrientation == ORIENTATION_LANDSCAPE ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE);         }     }     void signalDMAInterrupt()     {         dma.signalDMAInterrupt();     }     void initialize();     virtual void taskEntry();     virtual void flushFrameBuffer();     virtual void flushFrameBuffer(const Rect& rect);     virtual void allowDMATransfers();     void frontPorchEntered()     {         allowDMATransfers();     }     virtual void flushDMA();     virtual uint16_t* lockFrameBuffer();     virtual void unlockFrameBuffer();     virtual uint16_t* getTFTFrameBuffer() const = 0;     static LCD& lcd()     {         return instance->lcdRef;     }     void lockDMAToFrontPorch(bool enableLock)     {         lockDMAToPorch = enableLock;     }     virtual void registerTextCache(Unicode::UnicodeChar* str, uint16_t length);     virtual const Unicode::UnicodeChar* cacheTextString(const Unicode::UnicodeChar* str);     virtual bool blockCopy(void* RESTRICT dest, const void* RESTRICT src, uint32_t numBytes);     virtual BlitOperations getBlitCaps()     {         return dma.getBlitCaps();     };     virtual void blitSetTransparencyKey(uint16_t key);     virtual void blitCopy(const uint16_t* pSrc, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t srcWidth, uint8_t alpha, bool hasTransparentPixels);     virtual void blitCopyARGB8888(const uint16_t* pSrc, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t srcWidth, uint8_t alpha);     virtual void blitCopyGlyph(const uint8_t* pSrc, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t srcWidth, colortype color, uint8_t alpha, BlitOperations operation);     virtual void blitFill(colortype color, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t alpha);     virtual void registerEventListener(UIEventListener& listener);     virtual uint16_t* copyFBRegionToMemory(Rect meAbs);     virtual uint16_t* copyFBRegionToMemory(Rect meAbs, uint16_t* dst, uint32_t stride);     uint16_t getDisplayWidth() const     {         return DISPLAY_WIDTH;     }     uint16_t getDisplayHeight() const     {         return DISPLAY_HEIGHT;     }     void swapFrameBuffers();     uint32_t getLCDRefreshCount()     {         return vSyncForFrame;     };     void setFrameRateCompensation(bool enabled)     {         vSyncCompensationEnabled = enabled;     };     void vSync()     {         vSyncCnt++;     };     virtual void backPorchExited()     {         swapFrameBuffers();         tick();     }     virtual void configureInterrupts() = 0;     virtual void enableInterrupts() = 0;     virtual void disableInterrupts() = 0;     virtual void enableLCDControllerInterrupt() = 0;     virtual bool sampleKey(uint8_t& key)     {         return false;     }     void setDragThreshold(uint8_t value)     {         gestures.setDragThreshold(value);     }     static uint16_t        DISPLAY_WIDTH;              static uint16_t        DISPLAY_HEIGHT;             static DisplayRotation DISPLAY_ROTATION;           static uint16_t        FRAME_BUFFER_WIDTH;         static uint16_t        FRAME_BUFFER_HEIGHT;        static bool            USE_DOUBLE_BUFFERING;       static bool            USE_ANIMATION_STORAGE;      virtual void setFrameBufferStartAddress(void* adr, uint16_t depth = 16, bool useDoubleBuffering = true, bool useAnimationStorage = true)     {         uint32_t bufferSizeInBytes = 0;         switch (depth)         {         case 32:         case 24:         case 16:         case 8:             bufferSizeInBytes = (DISPLAY_WIDTH * DISPLAY_HEIGHT) * (depth / 8);             break;         case 4:         case 2:         case 1:             bufferSizeInBytes = ((DISPLAY_WIDTH * depth + 7) / 8) * DISPLAY_HEIGHT;             break;         default:             assert(0 && "Unsupported bit depth");              break;         }         uint8_t* buffer = static_cast<uint8_t*>(adr);         frameBuffer0 = reinterpret_cast<uint16_t*>(buffer);         if (useDoubleBuffering)         {             buffer += bufferSizeInBytes;             frameBuffer1 = reinterpret_cast<uint16_t*>(buffer);         }         else         {             frameBuffer1 = 0;         }         if (useAnimationStorage)         {             buffer += bufferSizeInBytes;             frameBuffer2 = reinterpret_cast<uint16_t*>(buffer);         }         else         {             frameBuffer2 = 0;         }         USE_DOUBLE_BUFFERING = useDoubleBuffering;         USE_ANIMATION_STORAGE = useAnimationStorage;     }     virtual void setFrameBufferStartAddresses(void* frameBuffer, void* doubleBuffer, void* animationStorage)     {         assert(frameBuffer != 0 && "A framebuffer address must be set");         frameBuffer0 = reinterpret_cast<uint16_t*>(frameBuffer);         frameBuffer1 = reinterpret_cast<uint16_t*>(doubleBuffer);         frameBuffer2 = reinterpret_cast<uint16_t*>(animationStorage);         USE_DOUBLE_BUFFERING = doubleBuffer != 0;         USE_ANIMATION_STORAGE = animationStorage != 0;     }     void setTouchSampleRate(int8_t sampleRateInTicks)     {         if (sampleRateInTicks > 0)         {             touchSampleRate = sampleRateInTicks;         }     }     int8_t getTouchSampleRate() const     {         return touchSampleRate;     }     void setMCUActive(bool active);     uint32_t getCPUCycles();     void setMCUInstrumentation(MCUInstrumentation* mcuInstr)     {         mcuInstrumentation = mcuInstr;     }     void enableMCULoadCalculation(bool enabled)     {         updateMCULoad = enabled;     }     uint8_t getMCULoadPct() const     {         return mcuLoadPct;     }     void setButtonController(ButtonController* btnCtrl)     {         buttonController = btnCtrl;     }     ButtonController* getButtonController() const     {         return buttonController;     }     void setFingerSize(uint8_t size)     {         fingerSize = size;     }     uint8_t getFingerSize() const     {         return fingerSize;     }     uint16_t* getAnimationStorage() const     {         return frameBuffer2;     }     typedef enum     {         REFRESH_STRATEGY_DEFAULT,                              REFRESH_STRATEGY_OPTIM_SINGLE_BUFFER_TFT_CTRL      } FrameRefreshStrategy;     bool setFrameRefreshStrategy(FrameRefreshStrategy s)     {         if (s == REFRESH_STRATEGY_DEFAULT)         {             refreshStrategy = s;             return true;         }         else if (s == REFRESH_STRATEGY_OPTIM_SINGLE_BUFFER_TFT_CTRL)         {             if (taskDelayFunc != 0 && getTFTCurrentLine() != 0xFFFF && !HAL::USE_DOUBLE_BUFFERING)             {                 refreshStrategy = s;                 return true;             }             return false;         }         return false;     }     FrameRefreshStrategy getFrameRefreshStrategy() const     {         return refreshStrategy;     }     void registerTaskDelayFunction(void(*delayF)(uint16_t))     {         taskDelayFunc = delayF;     }     virtual void taskDelay(uint16_t ms)     {         if (taskDelayFunc)         {             taskDelayFunc(ms);         }     }     virtual uint16_t getTFTCurrentLine()     {         return 0xFFFFu;     } protected:     virtual void tick();     virtual bool beginFrame();     virtual void endFrame();     virtual void setTFTFrameBuffer(uint16_t* address) = 0;     uint16_t* getClientFrameBuffer()     {         if (USE_DOUBLE_BUFFERING && getTFTFrameBuffer() == frameBuffer0)         {             return frameBuffer1;         }         return frameBuffer0;     }     virtual void touch(int32_t x, int32_t y);     virtual void noTouch();     virtual void performDisplayOrientationChange()     {         if (requestedOrientation != nativeDisplayOrientation)         {             if (DISPLAY_ROTATION == rotate0)             {                 FRAME_BUFFER_WIDTH = DISPLAY_WIDTH;                 FRAME_BUFFER_HEIGHT = DISPLAY_HEIGHT;                 DISPLAY_HEIGHT = FRAME_BUFFER_WIDTH;                 DISPLAY_WIDTH = FRAME_BUFFER_HEIGHT;                 DISPLAY_ROTATION = rotate90;             }         }         else if (DISPLAY_ROTATION != rotate0)         {             FRAME_BUFFER_WIDTH = DISPLAY_HEIGHT;             FRAME_BUFFER_HEIGHT = DISPLAY_WIDTH;             DISPLAY_HEIGHT = FRAME_BUFFER_HEIGHT;             DISPLAY_WIDTH = FRAME_BUFFER_WIDTH;             DISPLAY_ROTATION = rotate0;         }     }     DMA_Interface&         dma;                              LCD&                   lcdRef;                           TouchController&       touchController;                  MCUInstrumentation*    mcuInstrumentation;               ButtonController*      buttonController;                 static                 bool isDrawing;                   Gestures               gestures;                         DisplayOrientation     nativeDisplayOrientation;         void(*taskDelayFunc)(uint16_t);                         uint16_t*              frameBuffer0;                     uint16_t*              frameBuffer1;                     uint16_t*              frameBuffer2;                     FrameRefreshStrategy   refreshStrategy;                  uint8_t                fingerSize;                       bool                   lockDMAToPorch;                   bool                   frameBufferUpdatedThisFrame;  private:     UIEventListener* listener;     static             HAL* instance;     int32_t            lastX;     int32_t            lastY;     int8_t             touchSampleRate;     uint8_t            mcuLoadPct;     uint8_t            vSyncCnt;     uint8_t            vSyncForFrame;     bool               vSyncCompensationEnabled;     bool               clientDirty;     bool               swapRequested;     bool               lastTouched;     bool               updateMCULoad;     uint32_t           cc_begin;     DisplayOrientation requestedOrientation;     bool               displayOrientationChangeRequested;     friend class LCD1bpp;     friend class LCD2bpp;     friend class LCD4bpp;     friend class LCD16bpp;     friend class LCD24bpp;     uint16_t* getDstAddress(uint16_t x, uint16_t y, uint16_t* startAddress) const; };

Fields

DISPLAY_ROTATION

No summary provided. Read more...

FRAME_BUFFER_WIDTH

No summary provided. Read more...

FRAME_BUFFER_HEIGHT

No summary provided. Read more...

USE_DOUBLE_BUFFERING

No summary provided. Read more...

USE_ANIMATION_STORAGE

No summary provided. Read more...

DISPLAY_WIDTH

No summary provided. Read more...

DISPLAY_HEIGHT

No summary provided. Read more...

mcuLoadPct

No summary provided. Read more...

vSyncCnt

No summary provided. Read more...

vSyncForFrame

No summary provided. Read more...

vSyncCompensationEnabled

No summary provided. Read more...

clientDirty

No summary provided. Read more...

swapRequested

No summary provided. Read more...

lastTouched

No summary provided. Read more...

updateMCULoad

No summary provided. Read more...

cc_begin

No summary provided. Read more...

requestedOrientation

No summary provided. Read more...

displayOrientationChangeRequested

No summary provided. Read more...

dma

No summary provided. Read more...

lcdRef

No summary provided. Read more...

touchController

No summary provided. Read more...

mcuInstrumentation

No summary provided. Read more...

buttonController

No summary provided. Read more...

isDrawing

No summary provided. Read more...

gestures

No summary provided. Read more...

nativeDisplayOrientation

No summary provided. Read more...

taskDelayFunc

No summary provided. Read more...

frameBuffer0

No summary provided. Read more...

frameBuffer1

No summary provided. Read more...

frameBuffer2

No summary provided. Read more...

refreshStrategy

No summary provided. Read more...

fingerSize

No summary provided. Read more...

lockDMAToPorch

No summary provided. Read more...

frameBufferUpdatedThisFrame

No summary provided. Read more...

listener

No summary provided. Read more...

instance

No summary provided. Read more...

lastX

No summary provided. Read more...

lastY

No summary provided. Read more...

touchSampleRate

No summary provided. Read more...

Methods

getInstance()

@fn static HAL* HAL::getInstance() Gets the HAL instance. Gets the HAL instance. Read more...

setDisplayOrientation()

@fn virtual void HAL::setDisplayOrientation(DisplayOrientation orientation) Sets the desired display orientation (landscape or portrait). Sets the desired display orientation (landscape or portrait). If desired orientation is different from the native orientation of the display, a rotation is automatically applied. The rotation does not incur any performance cost. Read more...

getDisplayOrientation() const

@fn DisplayOrientation HAL::getDisplayOrientation() const Gets the current display orientation. Gets the current display orientation. Will be equal to the native orientation of the display unless setDisplayOrientation has been explicitly called earlier. Read more...

signalDMAInterrupt()

@fn void HAL::signalDMAInterrupt() Notify the framework that a DMA interrupt has occurred. Notify the framework that a DMA interrupt has occurred. Read more...

initialize()

@fn void HAL::initialize(); This function is responsible for initializing the entire framework. This function is responsible for initializing the entire framework. Read more...

taskEntry()

@fn virtual void HAL::taskEntry(); Main event loop. Main event loop. Will wait for VSYNC signal, and then process next frame. Call this function from your GUI task. Read more...

flushFrameBuffer()

@fn virtual void HAL::flushFrameBuffer(); This function is called whenever the framework has performed a complete draw. On some platforms, a local frame buffer needs to be pushed to the display through a SPI channel or similar. Implement that functionality here. This function is called whenever the framework has performed a complete draw. Read more...

flushFrameBuffer()

@fn virtual void HAL::flushFrameBuffer(); This function is called whenever the framework has performed a complete draw. On some platforms, a local frame buffer needs to be pushed to the display through a SPI channel or similar. Implement that functionality here. This function is called whenever the framework has performed a complete draw. Read more...

allowDMATransfers()

@fn virtual void HAL::allowDMATransfers(); Allow the DMA to start transfers. Allow the DMA to start transfers. Front Porch Entry is a good place to call this. Read more...

frontPorchEntered()

@fn void HAL::frontPorchEntered() Has to be called from within the LCD IRQ routine when the Front Porch Entry is reached. Has to be called from within the LCD IRQ routine when the Front Porch Entry is reached. Read more...

flushDMA()

@fn virtual void HAL::flushDMA(); This function blocks until the DMA queue (containing BlitOps) is empty. This function blocks until the DMA queue (containing BlitOps) is empty. Read more...

setFrameBufferStartAddress()

@fn virtual void HAL::setFrameBufferStartAddress(void* adr, uint16_t depth = 16, bool useDoubleBuffering = true, bool useAnimationStorage = true) Sets the address used for frame buffers, usually located in external memory. Sets the address used for frame buffers, usually located in external memory. Will reserve memory for one or two frame buffers based on display size. Will optionally also reserve memory for a third frame buffer used for animationStorage. Read more...

setFrameBufferStartAddresses()

@fn virtual void HAL::setFrameBufferStartAddresses(void* frameBuffer, void* doubleBuffer, void* animationStorage) Sets frame buffer start addresses. Sets individual frame buffer start addresses. Read more...

setTouchSampleRate()

@fn void HAL::setTouchSampleRate(int8_t sampleRateInTicks) Sets the number of ticks between each touch screen sample. Sets the number of ticks between each touch screen sample. Read more...

getTouchSampleRate() const

@fn int8_t HAL::getTouchSampleRate() const Gets the number of ticks between each touch screen sample. Gets the number of ticks between each touch screen sample. Read more...

setMCUActive()

@fn void HAL::setMCUActive(bool active); Register if MCU is active by measuring cpu cycles. Register if MCU is active by measuring cpu cycles. If user wishes to track MCU load, this method should be called whenever the OS Idle task is scheduled in or out. This method makes calls to a concrete implementation of GPIO functionality and a concrete implementation of cpu cycles. Read more...

getCPUCycles()

@fn uint32_t HAL::getCPUCycles(); Gets the current cycle counter. Gets the current cycle counter. Read more...

lockFrameBuffer()

@fn virtual uint16_t* HAL::lockFrameBuffer(); Waits for the frame buffer to become available for use. Waits for the frame buffer to become available for use (i.e. not used by DMA transfers). Read more...

unlockFrameBuffer()

@fn virtual void HAL::unlockFrameBuffer(); Unlocks the frame buffer (MUST be called exactly once for each call to lockFrameBuffer()). Unlocks the frame buffer (MUST be called exactly once for each call to lockFrameBuffer()). Read more...

getTFTFrameBuffer() const

@fn virtual uint16_t* HAL::getTFTFrameBuffer() const = 0; Gets the frame buffer address used by the TFT controller. Gets the frame buffer address used by the TFT controller. Read more...

lcd()

@fn static LCD& HAL::lcd() Gets a reference to the LCD. Gets a reference to the LCD. Read more...

lockDMAToFrontPorch()

@fn void HAL::lockDMAToFrontPorch(bool enableLock) Function to set whether the DMA transfers are locked to the TFT update cycle. Function to set whether the DMA transfers are locked to the TFT update cycle. If locked, DMA transfer will not begin until the TFT controller has finished updating the display. If not locked, DMA transfers will begin as soon as possible. Default is true (DMA is locked with TFT). Disabling the lock will in most cases significantly increase rendering performance. It is therefore strongly recommended to disable it. Depending on platform this may in rare cases cause rendering problems (visible tearing on display). Please see the chapter "Optimizing DMA During TFT Controller Access" for details on this setting. Read more...

registerTextCache()

@fn virtual void HAL::registerTextCache(Unicode::UnicodeChar* str, uint16_t length); Configures HAL to use the supplied buffer as text string cache. Configures HAL to use the supplied buffer as text string cache. The buffer must be large enough to hold the longest string in the system. Setting this buffer is only required if cacheTextString() is actually used and its implementation requires a buffer. @see cacheTextString. Read more...

cacheTextString()

@fn virtual const Unicode::UnicodeChar* HAL::cacheTextString(const Unicode::UnicodeChar* str); This function can be used to cache a given string. This function can be used to cache a given string in a platform specific way to e.g. speed up access or in case the string is placed in a memory type that does not support random access such as NAND flash. Read more...

blockCopy()

@fn virtual bool HAL::blockCopy(void* RESTRICT dest, const void* RESTRICT src, uint32_t numBytes); This function performs a platform-specific memcpy. This function performs a platform-specific memcpy, if supported by the hardware. Read more...

getBlitCaps()

@fn virtual BlitOperations HAL::getBlitCaps() Function for obtaining the blit capabilities of the concrete HAL implementation. Function for obtaining the blit capabilities of the concrete HAL implementation. As default, will return whatever blitcaps are reported by the associated DMA object. Read more...

blitSetTransparencyKey()

@fn virtual void HAL::blitSetTransparencyKey(uint16_t key); Deprecated function which can be ignored. Only present for backwards compatibility in TouchGFX 4.x. Will be removed in TouchGFX 5. Read more...

blitCopy()

@fn virtual void HAL::blitCopy(const uint16_t* pSrc, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t srcWidth, uint8_t alpha, bool hasTransparentPixels); Blits a 2D source-array to the frame buffer performing alpha-blending. Blits a 2D source-array to the frame buffer performing alpha-blending(and transparency keying) as specified. Read more...

blitCopyARGB8888()

@fn virtual void HAL::blitCopyARGB8888(const uint16_t* pSrc, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t srcWidth, uint8_t alpha); Blits a 2D source-array to the frame buffer performing per-pixel alpha blending. Blits a 2D source-array to the frame buffer performing per-pixel alpha blending. Read more...

blitCopyGlyph()

@fn virtual void HAL::blitCopyGlyph(const uint8_t* pSrc, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t srcWidth, colortype color, uint8_t alpha, BlitOperations operation); Blits a 4bpp or 8bpp glyph - maybe use the same method and supply additional color mode arg. Blits a 4bpp or 8bpp glyph - maybe use the same method and supply additional color mode arg. Read more...

blitFill()

@fn virtual void HAL::blitFill(colortype color, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t alpha); Blits a color value to the frame buffer performing alpha-blending (and transparency keying) as specified. Blits a color value to the frame buffer performing alpha-blending (and transparency keying) as specified. Read more...

registerEventListener()

@fn virtual void HAL::registerEventListener(UIEventListener& listener); Registers an event handler implementation with the underlying event system. Registers an event handler implementation with the underlying event system. The actual HAL implementation decides whether or not multiple UIEventListener instances are allowed (including execution order). Read more...

copyFBRegionToMemory()

@fn virtual uint16_t* HAL::copyFBRegionToMemory(Rect meAbs); Copies a region of the currently displayed frame buffer to memory. Copies a region of the currently displayed frame buffer to memory. Used for e.g. SlideTransition and for displaying pre-rendered drawables e.g. in animations where redrawing the drawable is not necessary. Read more...

copyFBRegionToMemory()

@fn virtual uint16_t* HAL::copyFBRegionToMemory(Rect meAbs); Copies a region of the currently displayed frame buffer to memory. Copies a region of the currently displayed frame buffer to memory. Used for e.g. SlideTransition and for displaying pre-rendered drawables e.g. in animations where redrawing the drawable is not necessary. Read more...

getDisplayWidth() const

@fn uint16_t HAL::getDisplayWidth() const Gets display width. Gets display width. Read more...

getDisplayHeight() const

@fn uint16_t HAL::getDisplayHeight() const Gets display height. Gets display height. Read more...

swapFrameBuffers()

@fn void HAL::swapFrameBuffers(); Swaps the two frame buffers. Swaps the two frame buffers. Read more...

getLCDRefreshCount()

@fn uint32_t HAL::getLCDRefreshCount() Returns the number of VSync interrupts Returns the number of VSync interrupts between the current drawing operation and the last drawing operation, i.e. the number of lost frames. Read more...

setFrameRateCompensation()

@fn void HAL::setFrameRateCompensation(bool enabled) Enables or disables compensation for lost frames Enables or disables compensation for lost frames. See knowledge base article. Read more...

vSync()

@fn void HAL::vSync() Called by the VSync interrupt. Called by the VSync interrupt for counting of LCD refreshes. Read more...

backPorchExited()

@fn virtual void HAL::backPorchExited() Has to be called from within the LCD IRQ rutine when the Back Porch Exit is reached. Has to be called from within the LCD IRQ rutine when the Back Porch Exit is reached. Read more...

configureInterrupts()

@fn virtual void HAL::configureInterrupts() = 0; Configures the interrupts relevant for TouchGFX. Configures the interrupts relevant for TouchGFX. This primarily entails setting the interrupt priorities for the DMA and LCD interrupts. Read more...

enableInterrupts()

@fn virtual void HAL::enableInterrupts() = 0; Enables the DMA and LCD interrupts. Enables the DMA and LCD interrupts. Read more...

disableInterrupts()

@fn virtual void HAL::disableInterrupts() = 0; Disables the DMA and LCD interrupts. Disables the DMA and LCD interrupts. Read more...

enableLCDControllerInterrupt()

@fn virtual void HAL::enableLCDControllerInterrupt() = 0; Configure the LCD controller to fire interrupts at VSYNC. Configure the LCD controller to fire interrupts at VSYNC. Called automatically once TouchGFX initialization has completed. Read more...

sampleKey()

@fn virtual bool HAL::sampleKey(uint8_t& key) Sample external key event. Sample external key event. Read more...

setDragThreshold()

@fn void HAL::setDragThreshold(uint8_t value) Configure the threshold for reporting drag events. Configure the threshold for reporting drag events. A touch input movement must exceed this value in either axis in order to report a drag. Default value is 0. Read more...

setFrameRefreshStrategy()

@fn bool HAL::setFrameRefreshStrategy(FrameRefreshStrategy s) Set a specific strategy for handling timing and mechanism of frame buffer drawing. By setting a different frame refresh strategy, the internals of how TouchGFX interacts with the frame buffer can be modified. Currently there are two strategies available. This will increase over time. - REFRESH_STRATEGY_OPTIM_SINGLE_BUFFER_TFT_CTRL: this strategy is available on targets that use single buffering on a TFT controller based system. It requires an implementation of the getTFTCurrentLine() function as well as a task delay function being registered. The implementation of this strategy is that TouchGFX will carefully track the progress of the TFT controller, and draw parts of the frame buffer whenever possible. The effect is that the risk of tearing is much reduced compared to the default single buffer strategy of only drawing in porch areas. It does have a drawback of slightly increased MCU load. But in many cases employing this strategy will make it possible to avoid external RAM, by using just a single frame buffer in internal RAM and still avoid tearing. - REFRESH_STRATEGY_DEFAULT: This is a general strategy that works for all target configurations. Recommendation: Try using REFRESH_STRATEGY_OPTIM_SINGLE_BUFFER_TFT_CTRL if you're on a TFT controller based system (ie. non-8080) and you have a desire to avoid external RAM. Otherwise stick to REFRESH_STRATEGY_DEFAULT. Read more...

getFrameRefreshStrategy() const

@fn FrameRefreshStrategy HAL::getFrameRefreshStrategy() const Used internally by TouchGFX core to manage the timing and process of drawing into the frame buffer. @see bool setFrameRefreshStrategy(FrameRefreshStrategy s). Read more...

registerTaskDelayFunction()

@fn void HAL::registerTaskDelayFunction(void (*delayF)(uint16_t)) Registers a function capable of delaying GUI task execution In order to make use of the HAL::taskDelay function, a delay function must be registered by calling this function. Usually the delay function would be OSWrappers::taskDelay. Read more...

taskDelay()

@fn virtual void HAL::taskDelay(uint16_t ms) Delay GUI task execution by number of milliseconds This function requires the presence of a task delay function. If a task delay function has not been registered, it returns immediately. Otherwise it returns when number of milliseconds has passed. @see void registerTaskDelayFunction(void (*delayF)(uint16_t)). Read more...

getTFTCurrentLine()

@fn virtual uint16_t HAL::getTFTCurrentLine() Get the current line (Y) of the TFT controller This function is used to obtain the progress of the TFT controller. More specifically, the line (or Y-value) currently being transferred. Note: The value must be adjusted to account for vertical back porch before returning, such that the value is always within the range of 0 &lt;= value &lt; actual display height in pixels It is used for the REFRESH_STRATEGY_OPTIM_SINGLE_BUFFER_TFT_CTRL frame refresh strategy in order to synchronize frame buffer drawing with TFT controller progress. If this strategy is used, the concrete HAL subclass must provide an override of this function that returns correct line value. If this strategy is not used, then the getTFTCurrentLine function is never called and can be disregarded. Read more...

tick()

@fn virtual void HAL::tick(); This function is called at each timer tick, depending on platform implementation. This function is called at each timer tick, depending on platform implementation. Read more...

beginFrame()

@fn virtual bool HAL::beginFrame(); Called when beginning to rendering a frame. Called when beginning to rendering a frame. Read more...

endFrame()

@fn virtual void HAL::endFrame(); Called when a rendering pass is completed. Called when a rendering pass is completed. Read more...

setTFTFrameBuffer()

@fn virtual void HAL::setTFTFrameBuffer(uint16_t* address) = 0; Sets the frame buffer address used by the TFT controller. Sets the frame buffer address used by the TFT controller. Read more...

getClientFrameBuffer()

@fn uint16_t* HAL::getClientFrameBuffer() Gets client frame buffer. Gets client frame buffer. Read more...

getDstAddress() const

No summary provided. Read more...

touch()

@fn virtual void HAL::touch(int32_t x, int32_t y); Called by the touch driver to indicate a touch. Called by the touch driver to indicate a touch. Read more...

noTouch()

@fn virtual void HAL::noTouch(); Called by the touch driver to indicate that no touch is currently detected. Called by the touch driver to indicate that no touch is currently detected. Read more...

performDisplayOrientationChange()

@fn virtual void HAL::performDisplayOrientationChange() Perform the actual display orientation change. Perform the actual display orientation change. Read more...

setMCUInstrumentation()

@fn void HAL::setMCUInstrumentation(MCUInstrumentation* mcuInstr) Stores a pointer to an instance of an MCU specific instrumentation class. Stores a pointer to an instance of an MCU specific instrumentation class. Read more...

enableMCULoadCalculation()

@fn void HAL::enableMCULoadCalculation(bool enabled) This method sets a flag that determines if generic HAL should calculate MCU load. This method sets a flag that determines if generic HAL should calculate MCU load based on concrete MCU instrumentation. Read more...

getMCULoadPct() const

@fn uint8_t HAL::getMCULoadPct() const Gets the current MCU load. Gets the current MCU load. Read more...

setButtonController()

@fn void HAL::setButtonController(ButtonController* btnCtrl) Stores a pointer to an instance of a specific implementation of a ButtonController. Stores a pointer to an instance of a specific implementation of a ButtonController. Read more...

getButtonController() const

@fn ButtonController* HAL::getButtonController() const Gets the ButtonController Gets the associated ButtonController. Read more...

setFingerSize()

@fn void HAL::setFingerSize(uint8_t size) Sets the finger size Sets the finger size in pixels. Setting the finger size to a size of more than 1 pixel will emulate a finger of width and height of 2*(fingersize-1)+1. This can be especially useful when trying to interact with small elements on a high ppi display. The finger size will influence which element is chosen as the point of interaction, when clicking, dragging, ... the display. A number of samples will be drawn from within the finger area and a best matching drawable will be chosen. The best matching algorithm will consider the size of the drawable and the distance from the touch point. Read more...

getFingerSize() const

@fn uint8_t HAL::getFingerSize() const Gets the finger size. Gets the finger size in pixels. Read more...

getAnimationStorage() const

@fn uint16_t* HAL::getAnimationStorage() const Gets the optional frame buffer used for animation storage. Gets the optional frame buffer used for animation storage. Read more...

Examples

touchgfx::HAL is referenced by 4 libraries and example projects.

References

Type Use

Variables of touchgfx::HAL type
touchgfx::HAL