TFT Internal Library

The mikroC PRO for ARM provides a library for working with Liquid Crystal Display (LCD) Controller which supports a variety of LCD and OLED panels.

Library Routines

TFTIntern_ModeSet

Prototype

unsigned long TFTIntern_ModeSet(unsigned short ui8Mode, unsigned long ui32PixClk, unsigned long ui32SysClk);

Description

This function sets the basic operating mode of the LCD controller and also its master clock.

Parameters
  • ui8Mode: specifies the basic operating mode to be used. Valid values :
    Value Description
    _TFT_INTERN_MODE_LIDD Used to select Lcd Interface Display Driver mode for character panels connected via an asynchronous interface (CS, WE, OE, ALE, data).
    _TFT_INTERN_MODE_RASTER Used to communicate with panels via a synchronous video interface using data and sync signals.
  • ui32PixClk:specifies the desired LCD controller pixel or master clock rate in Hz.
  • ui32SysClk: specifies the current system clock rate in Hz.
Returns

The actual LCD controller pixel clock or MCLK rate set.

Requires

Nothing.

Notes

None.

TFTIntern_ClockReset

Prototype

unsigned short TFTIntern_ClockReset(unsigned long ui32Clocks);

Description

This function allows sub-modules of the LCD controller to be reset under software control.

Parameters
  • ui8Mode: defines the subset of clock domains to be reset. Valid value is the logical OR of the following :
    Value Description
    _TFT_INTERN_CLOCK_MAIN causes the entire LCD controller module to be reset.
    _TFT_INTERN_CLOCK_DMA causes the DMA controller submodule to be reset.
    _TFT_INTERN_CLOCK_LIDD causes the LIDD submodule to be reset.
    _TFT_INTERN_CLOCK_CORE causes the core module, including the raster logic, to be reset.

In all cases, LCD controller register values are preserved across these resets.

Returns
  • 1 - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

None.

TFTIntern_LIDDConfigSet

Prototype

unsigned short TFTIntern_LIDDConfigSet(unsigned long ui32Config);

Description

This function is used when the LCD controller is configured in LIDD mode and specifies the configuration of the interface between the controller and the display panel.

Parameters
  • ui8Mode: ddefines the display interface configuration. Valid values :
    Value Description
    _LIDD_CONFIG_SYNC_MPU68 selects Sync MPU68 mode. LCDCP = EN, LCDLP = DIR, LCDFP = ALE, LCDAC = CS0, LCDMCLK = MCLK.
    _LIDD_CONFIG_ASYNC_MPU68 selects Async MPU68 mode. LCDCP = EN, LCDLP = DIR, LCDFP = ALE, LCDAC = CS0, LCDMCLK = CS1
    _LIDD_CONFIG_SYNC_MPU80 selects Sync MPU80 mode. LCDCP = RS, LCDLP = WS, LCDFP = ALE, LCDAC = CS0, LCDMCLK = MCLK.
    _LIDD_CONFIG_ASYNC_MPU80 selects Async MPU80 mode. LCDCP = RS, LCDLP = WS, LCDFP = ALE, LCDAC = CS0, LCDMCLK = CS1.
    _LIDD_CONFIG_ASYNC_HITACHI selects Hitachi (async) mode. LCDCP = N/C, LCDLP = DIR, LCDFP = ALE, LCDAC = E0, LCDMCLK = E1.

    Additional flags may be ORed with this parameter to control the polarities of various control signals :
    Value Description
    _LIDD_CONFIG_INVERT_ALE Address Latch Enable (ALE) polarity control. By default, ALE is active low. If this flag is set, it becomes active high.
    _LIDD_CONFIG_INVERT_RS_EN Read Strobe/Enable polarity control. By default, RS is active low and Enable is active high. If this flag is set, RS becomes active high and Enable active low.
    _LIDD_CONFIG_INVERT_WS_DIR Write Strobe/Direction polarity control. By default, WS is active low and Direction write low/read high. If this flag is set, WS becomes active high and Direction becomes write high/read low.
    _LIDD_CONFIG_INVERT_CS0 Chip Select 0/Enable 0 polarity control. By default, CS0 and E0 are active high. If this flag is set, they become active low.
    _LIDD_CONFIG_INVERT_CS1 Chip Select 1/Enable 1 polarity control. By default, CS1 and E1 are active high. If this flag is set, they become active low.

Returns
  • 1 - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

None.

TFTIntern_LIDDTimingSet

Prototype

unsigned short TFTIntern_LIDDTimingSet(unsigned long ui32CS, const TLCDIDDTiming *pTiming);

Description

This function is used in LIDD mode to set the setup, strobe and hold times for the various interface control signals.
Independent timings are stored for each of the two supported chip selects offered by the LCD controller.

Parameters
  • ui32CS: specifies the chip select whose timings are to be set.
  • pTiming: points to a structure containing the desired timing parameters. Definition of this structure
    typedef struct {
        // Write Strobe Set-Up cycles.  When performing a write access, this
        // field defines the number of MCLK cycles that Data Bus/Pad Output
        // Enable, ALE, the Direction bit, and Chip Select have to be ready before
        // the Write Strobe is asserted.  Valid values are from 0 to 31.
        unsigned short writeStrobeSetupCycles;
    
        // Write Strobe Duration cycles.  Field value defines the number of MCLK
        // cycles for which the Write Strobe is held active when performing a
        // write access.  Valid values are from 1 to 63.
        unsigned short writeStrobeDurationCycles;
    
        // Write Strobe Hold cycles.  Field value defines the number of MCLK
        // cycles for which Data Bus/Pad Output Enable, ALE, the Direction bit,
        // and Chip Select are held after the Write Strobe is deasserted when
        // performing a write access.  Valid values are from 1 to 15.
        unsigned short writeStrobeHoldCycles;
    
        // Read Strobe Set-Up cycles.  When performing a read access, this field
        // defines the number of MCLK cycles that Data Bus/Pad Output Enable, ALE,
        // the Direction bit, and Chip Select have to be ready before the Read
        // Strobe is asserted.  Valid values are from 0 to 31.
        unsigned short readStrobeSetupCycles;
    
        // Read Strobe Duration cycles.  Field value defines the number of MCLK
        // cycles for which the Read Strobe is held active when performing a read
        // access.  Valid values are from 1 to 63.
        unsigned short readStrobeDurationCycles;
    
        // Read Strobe Hold cycles.  Field value defines the number of MCLK cycles
        // for which Data Bus/Pad Output Enable, ALE, the Direction bit, and Chip
        // Select are held after the Read Strobe is deasserted when performing a
        // read access.  Valid values are from 1 to 15.
        unsigned short readStrobeHoldCycles;
    
        // Field value defines the number of MCLK cycles between the end of one
        // device access and the start of another device access using the same
        // Chip Select unless the two accesses are both Reads.  In this case,
        // this delay is not incurred.  Valid vales are from 1 to 4.
        unsigned short delayCycles;
    } TLCDIDDTiming;
    
Returns
  • non-zero - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

CS1 is not available when operating in Sync MPU68 or Sync MPU80 modes.

TFTIntern_LIDDDMADisable

Prototype

unsigned short TFTIntern_LIDDDMADisable();

Description

When the LCD controller is operating in LCD Interface Display Driver mode, this function must be called after completion of a DMA transaction and before calling
TFTIntern_LIDDCommandWrite, TFTIntern_LIDDDataWrite, TFTIntern_LIDDStatusRead, TFTIntern_LIDDIndexedWrite, TFTIntern_LIDDIndexedRead or TFTIntern_LIDDDataRead to disable DMA mode and allow CPU-initiated transactions to the display.

Parameters

None.

Returns
  • 0 - if successful.
Requires

Nothing.

Notes

LIDD DMA mode is enabled automatically when TFTIntern_LIDDDMAWrite) is called.

TFTIntern_LIDDCommandWrite

Prototype

unsigned short TFTIntern_LIDDCommandWrite(unsigned long ui32CS, unsigned int ui16Cmd);

Description

This function writes a 16 bit command word to the display when the LCD controller is in LIDD mode. A command write occurs with the ALE signal active.

This function must not be called if the LIDD interface is currently configured to expect DMA transactions.
If DMA was previously used to write to the panel, TFTIntern_LIDDDMADisable must be called before this function can be used.

Parameters
  • ui32CS: specifies the chip select to use. Valid values are 0 and 1.
  • ui16Cmd: the 16 bit command word to write.
Returns
  • 1 - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

CS1 is not available when operating in Sync MPU68 or Sync MPU80 modes.

TFTIntern_LIDDDataWrite

Prototype

unsigned short TFTIntern_LIDDDataWrite(unsigned long ui32CS, unsigned int ui16Data);

Description

This function writes a 16 bit data word to the display when the LCD controller is in LIDD mode. A data write occurs with the ALE signal inactive.

This function must not be called if the LIDD interface is currently configured to expect DMA transactions.
If DMA was previously used to write to the panel, TFTIntern_LIDDDMADisable must be called before this function can be used.

Parameters
  • ui32CS: specifies the chip select to use. Valid values are 0 and 1.
  • ui16Cmd: the 16 bit data to write.
Returns
  • 1 - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

CS1 is not available when operating in Sync MPU68 or Sync MPU80 modes.

TFTIntern_LIDDIndexedWrite

Prototype

unsigned short TFTIntern_LIDDIndexedWrite(unsigned long ui32CS, unsigned int ui16Addr, unsigned int ui16Data);

Description

This function writes a 16 bit data word to a register in the display when the LCD controller is in LIDD mode and
configured to use either the Motorola or Intel modes which employ an external address latch.

When configured in Hitachi mode, this function should not be used.
In this case the functions TFTIntern_LIDDCommandWrite and TFTIntern_LIDDDataWrite may be used to transfer command and data bytes to the panel.

This function must not be called if the LIDD interface is currently configured to expect DMA transactions.
If DMA was previously used to write to the panel, TFTIntern_LIDDDMADisable must be called before this function can be used.

Parameters
  • ui32CS: specifies the chip select to use. Valid values are 0 and 1.
  • ui16Addr: address of the display register to write.
  • ui16Data: data to write.
Returns
  • 1 - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

CS1 is not available when operating in Sync MPU68 or Sync MPU80 modes.

TFTIntern_LIDDStatusRead

Prototype

unsigned int TFTIntern_LIDDStatusRead(unsigned long ui32CS);

Description

This function reads the 16 bit status word from the display when the LCD controller is in LIDD mode. A status read occurs with the ALE signal active.
If the interface is configured in Hitachi mode, this operation corresponds to a command mode read.

This function must not be called if the LIDD interface is currently configured to expect DMA transactions.
If DMA was previously used to write to the panel, TFTIntern_LIDDDMADisable must be called before this function can be used.

Parameters
  • ui32CS: specifies the chip select to use. Valid values are 0 and 1.
Returns

The status word read from the display panel.

Requires

Nothing.

Notes

CS1 is not available when operating in Sync MPU68 or Sync MPU80 modes.

TFTIntern_LIDDDataRead

Prototype

unsigned int TFTIntern_LIDDDataRead(unsigned long ui32CS);

Description

This function reads the 16 bit data word from the display when the LCD controller is in LIDD mode. A data read occurs with the ALE signal inactive.
If the interface is configured in Hitachi mode, this operation corresponds to a command mode read.

This function must not be called if the LIDD interface is currently configured to expect DMA transactions.
If DMA was previously used to write to the panel, TFTIntern_LIDDDMADisable must be called before this function can be used.

Parameters
  • ui32CS: specifies the chip select to use. Valid values are 0 and 1.
Returns

The data word read from the display panel.

Requires

Nothing.

Notes

CS1 is not available when operating in Sync MPU68 or Sync MPU80 modes.

TFTIntern_LIDDIndexedRead

Prototype

unsigned int TFTIntern_LIDDIndexedRead(unsigned long ui32CS, unsigned int ui16Addr);

Description

This function reads 16 bit word from a register in the display when the LCD controller is in LIDD mode
and configured to use either the Motorola or Intel modes which employ an external address latch.

When configured in Hitachi mode, this function should not be used.
In this case the functions TFTIntern_LIDDStatusRead and TFTIntern_LIDDDataRead may be used to read status and data bytes from the panel.

This function must not be called if the LIDD interface is currently configured to expect DMA transactions.
If DMA was previously used to write to the panel, TFTIntern_LIDDDMADisable must be called before this function can be used.

Parameters
  • ui32CS: specifies the chip select to use. Valid values are 0 and 1.
Returns
  • 1 - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

CS1 is not available when operating in Sync MPU68 or Sync MPU80 modes.

TFTIntern_LIDDDMAWrite

Prototype

unsigned short TFTIntern_LIDDDMAWrite(unsigned long ui32CS, const unsigned long *pui32Data, unsigned long ui32Count);

Description

This function writes a block of 16-bit data words to the display using DMA. It is only valid when the LCD controller is in LIDD mode.

When configured in Hitachi mode, this function should not be used.
In this case the functions TFTIntern_LIDDStatusRead and TFTIntern_LIDDDataRead may be used to read status and data bytes from the panel.

This function enables DMA mode prior to starting the transfer.
The caller is responsible for ensuring that any earlier DMA transfer has completed before initiating another transfer.

During the time that DMA is enabled, none of the other LCD LIDD data transfer functions may be called.
When the DMA transfer is complete and the application wishes to use the CPU to communicate with the display, TFTIntern_LIDDDMADisable must be called to disable DMA access prior to calling TFTIntern_LIDDCommandWrite, TFTIntern_LIDDDataWrite, TFTIntern_LIDDStatusRead, TFTIntern_LIDDIndexedWrite, TFTIntern_LIDDIndexedRead or TFTIntern_LIDDDataRead.

Parameters
  • ui32CS: specifies the chip select to use. Valid values are 0 and 1.
  • pui32Data: address of the first 16-bit word to write. This address must be aligned on a 32-bit word boundary.
  • ui32Count: number of 16-bit words to write. This value must be a multiple of 2.
Returns
  • non-zero - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

CS1 is not available when operating in Sync MPU68 or Sync MPU80 modes.

TFTIntern_RasterConfigSet

Prototype

unsigned short TFTIntern_RasterConfigSet(unsigned long ui32Config, unsigned short ui8PalLoadDelay);

Description

This function configures the basic operating mode of the raster interface and specifies the type of panel that the controller is to drive.

This function enables DMA mode prior to starting the transfer.
The caller is responsible for ensuring that any earlier DMA transfer has completed before initiating another transfer.

During the time that DMA is enabled, none of the other LCD LIDD data transfer functions may be called.
When the DMA transfer is complete and the application wishes to use the CPU to communicate with the display,
TFTIntern_LIDDDMADisable must be called to disable DMA access prior to calling TFTIntern_LIDDCommandWrite, TFTIntern_LIDDDataWrite, TFTIntern_LIDDStatusRead, TFTIntern_LIDDIndexedWrite, TFTIntern_LIDDIndexedRead or TFTIntern_LIDDDataRead.

Parameters
  • ui32Config: specifies properties of the raster interface and the attached display panel. Valid values :
    Value Description
    _RASTER_FMT_ACTIVE_24BPP_PACKED selects an active matrix display and uses a packed 24-bit per pixel packet frame buffer where 4 pixels are described within 3 consecutive 32-bit words.
    _RASTER_FMT_ACTIVE_24BPP_UNPACKED selects an active matrix display and uses an unpacked 24-bit per pixel packet frame buffer where each 32-bit word contains a single pixel and 8 bits of padding.
    _RASTER_FMT_ACTIVE_16BPP selects an active matrix display and uses a 16-bit per pixel frame buffer with 2 pixels in each 32-bit word.
    _RASTER_FMT_ACTIVE_PALETTIZED_12BIT selects an active matrix display and uses a 1, 2, 4 or 8bpp frame buffer with palette lookup. Output color data is described in 12-bit format using bits 11:0 of the data bus. The frame buffer pixel format is defined by the value passed in the ui32Type parameter to TFTIntern_RasterPaletteSet.
    _RASTER_FMT_ACTIVE_PALETTIZED_16BIT selects an active matrix display and uses a 1, 2, 4 or 8bpp frame buffer with palette lookup. Output color data is described in 16-bit 5:6:5 format. The frame buffer pixel format is defined by the value passed in the ui32Type parameter to TFTIntern_RasterPaletteSet.
    _RASTER_FMT_PASSIVE_MONO_4PIX selects a monochrome, passive matrix display which outputs 4 pixels on each pixel clock.
    _RASTER_FMT_PASSIVE_MONO_8PIX selects a monochrome, passive matrix display which outputs 8 pixels on each pixel clock.
    _RASTER_FMT_PASSIVE_COLOR_12BIT selects a passive matrix display and uses a 12bpp frame buffer. The palette is bypassed and 12-bit pixel data is sent to the grayscaler for the display.
    _RASTER_FMT_PASSIVE_COLOR_16BIT selects a passive matrix display and uses a 16bpp frame buffer with pixels in 5:6:5 format. Only the 4 significant bits of each color component are sent to the grayscaler for the display.

    Additionally, the following flags may be ORed with this parameter :
    Value Description
    RASTER_ACTVID_DURING_BLANK sets Actvid to toggle during vertical blanking.
    RASTER_NIBBLE_MODE_ENABLED enables nibble mode. This works with _RASTER_READ_ORDER_REVERSED to determine how 1, 2 and 4bpp pixels are extracted from words read from the frame buffer. If specified, words read from the frame buffer are byte swapped prior to individual pixels being parsed from them.
    RASTER_LOAD_DATA_ONLY Tells the controller to read only pixel data from the frame buffer and to use the last palette read. No palette load is performed.
    RASTER_LOAD_PALETTE_ONLY tells the controller to read only the palette data from the frame buffer.
    RASTER_READ_ORDER_REVERSED when using 1, 2, 4 and 8bpp frame buffers, this option reverses the order in which frame buffer words are parsed.
    When this option is specified, the leftmost pixel in a word is taken from the most significant bits.
    When absent, the leftmost pixel is parsed from the least significant bits.

  • ui8PalLoadDelay: specifies the number of system clocks to wait between each 16 halfword (16-bit) burst when loading the palette from SRAM into the internal palette RAM of the controller.
Returns
  • 1 - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

If the LCD controller's raster engine is enabled when this function is called, it is disabled as a side effect of the call.

TFTIntern_RasterTimingSet

Prototype

unsigned short TFTIntern_RasterTimingSet(const TLCDRasterTiming *pTiming);

Description

This function is used in raster mode to set the panel size and sync timing parameters.

Parameters
  • pTiming: points to a structure containing the desired timing parameters :
    typedef struct {
        // Flags configuring the polarity and active edges of the various signals
        // in the raster interface.  This field is comprised of a logical OR of
        // the labels with prefix  ``RASTER_TIMING_''.
        unsigned long config;
    
        // The number of pixels contained within each line on the LCD display.
        // Valid values are multiple of 16 less than or equal to 2048.
        unsigned int displayWidth;
    
        // The number of lines on the LCD display.  Valid values are from 1 to
        // 2048.
        unsigned int displayHeight;
    
        // A value from 1 to 1024 that specifies the number of pixel clock periods
        // to add to the beginning of a line transmission before the first set of
        // pixels is output to the display.
        unsigned int horizontalFrontPorch;
    
        // A value from 1 to 1024 that specifies the number of pixel clock periods
        // to add to the end of a line transmission before line clock is asserted.
        unsigned int horizontalBackPorch;
    
        // A value from 1 to 1024 that specifies the number of pixel clock periods
        // to pulse the line clock at the end of each line.
        unsigned int horizontalSyncWidth;
    
        // A value from 0 to 255 that specifies the number of line clock periods
        // to add to the beginning of a frame before the first set of pixels is
        // output to the display.
        unsigned short verticalFrontPorch;
    
        // A value from 0 to 255 that specifies the number of line clock periods
        // to add to the end of each frame.
        unsigned short verticalBackPorch;
    
        // In active mode, a value from 1 to 64 that specifies the number of
        // line clock periods to set the lcd_fp pin active at the end of each
        // frame after the vertical front porch period elapses.  The number of
        // The frame clock is used as the VSYNC signal in active mode.
        //
        // In passive mode, a value from 1 to 64 that specifies the number of
        // extra line clock periods to insert after the vertical front porch
        // period has elapsed.  Note that the width of lcd_fp is not affected by
        // this value in passive mode.
        unsigned short verticalSyncWidth;
    
        // A value from 0 to 255 that specifies the number of line clocks to
        // count before transitioning the AC Bias pin.  This pin is used to
        // periodically invert the polarity of the power supply to prevent DC
        // charge build-up within the display.
        unsigned short biasLineCount;
    } TLCDRasterTiming;
    
Returns
  • non-zero - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

None.

TFTIntern_RasterACBiasIntCountSet

Prototype

unsigned short TFTIntern_RasterACBiasIntCountSet(unsigned short ui8Count);

Description

This function is used to set the number of AC bias transitions between each AC bias count interrup.

Parameters
  • ui8Count: number of AC bias pin transitions to count before the AC bias count interrupt is asserted. Valid values are from 0 to 15.
    If zero, AC bias count interrupt is generated.
Returns
  • 1 - if an error occurred.
  • 0 - if successful.
Requires

Nothing.

Notes

None.

TFTIntern_RasterEnable

Prototype

unsigned short TFTIntern_RasterEnable();

Description

This function enables the LCD controller raster output and starts displaying the content of the current frame buffer on the attached panel.

Parameters

None.

Returns
  • 0 - if successful.
Requires

Prior to enabling the raster output, TFTIntern_ModeSet, TFTIntern_LIDDConfigSet, TFTIntern_RasterConfigSet, TFTIntern_RasterTimingSet, TFTIntern_RasterPaletteSet and TFTIntern_RasterFrameBufferSet must have been called.

Notes

None.

TFTIntern_RasterEnabled

Prototype

unsigned short TFTIntern_RasterEnabled();

Description

This function may be used to query whether or not the raster output is currently enabled.

Parameters

None.

Returns
  • 0 - if successful.
  • 1 - if an error occured.
Requires

Nothing.

Notes

None.

TFTIntern_RasterDisable

Prototype

unsigned short TFTIntern_RasterDisable();

Description

This function disables the LCD controller raster output and stops driving the attached display.

Parameters

None.

Returns
  • 0 - if successful.
Requires

Nothing.

Notes

Once disabled, the raster engine continues to scan data until the end of the current frame. If the display is to be re-enabled, this must not be done until after the final
_TFT_INTERN_INT_RASTER_FRAME_DONE has been received, indicating that the raster engine has stopped.

TFTIntern_RasterSubPanelConfigSet

Prototype

unsigned short TFTIntern_RasterSubPanelConfigSet(unsigned long ui32Flags, unsigned long ui32BottomLines, unsigned long ui32DefaultPixel);

Description

The LCD controller provides a feature which allows a portion of the display to be filled with a default color rather than image data from the frame buffer.
This may be used to reduce SRAM bandwidth requirements since no data is fetched for lines containing the default color.

This feature is only available when the LCD controller is in raster mode and configured to drive an active matrix display.

Parameters
  • ui32Flags: position of the sub panel. Valid values :
    Value Description
    _TFT_INTERN_SUBPANEL_AT_TOP Set subpanel area containing image data in the top portion of the display and default color in the bottom portion.
    _TFT_INTERN_SUBPANEL_AT_BOTTOM Set subpanel area containing image data in the bottom portion of the display and default color in the top portion.
  • ui32BottomLines: defines the number of lines comprising the bottom portion of the display. If _TFT_INTERN_SUBPANEL_AT_TOP is set in ui32Flags parameter,
    these lines contain the default pixel color when the subpanel is enabled, otherwise they contain image data.
  • ui32DefaultPixel: the 24-bit RGB color to show in the portion of the display not configured to show image data.
Returns
  • 0 - if successful.
  • non-zero - if an error occured.
Requires

Nothing.

Notes

The subpanel display mode is not enabled using this function. To enable the subpanel once it has been configured, call TFTIntern_RasterSubPanelEnable.

TFTIntern_RasterSubPanelEnable

Prototype

unsigned short TFTIntern_RasterSubPanelEnable();

Description

This function enables subpanel display mode and displays a default color rather than image data in the number of lines and at the position specified by a previous call to TFTIntern_RasterSubPanelConfigSet.

Parameters

None.

Returns
  • 0 - if successful.
Requires

Prior to calling this function, the frame buffer should have been reconfigured to match the desired subpanel size using a call to TFTIntern_RasterFrameBufferSet.

Notes

Subpanel display is only possible when the LCD controller is in raster mode and is configured to drive an active matrix display.

TFTIntern_RasterSubPanelDisable

Prototype

unsigned short TFTIntern_RasterSubPanelDisable();

Description

This function disables subpanel display mode and reverts to showing the entire frame buffer image on the display.
After the subpanel is disabled, the frame buffer size must be reconfigured to match the full dimensions of the display area by calling TFTIntern_RasterFrameBufferSet with an appropriate value for the ui32NumBytes parameter.

Parameters

None.

Returns
  • 0 - if successful.
Requires

Prior to calling this function, the frame buffer should have been reconfigured to match the desired subpanel size using a call to TFTIntern_RasterFrameBufferSet.

Notes

Subpanel display is only possible when the LCD controller is in raster mode and is configured to drive an active matrix display.

TFTIntern_DMAConfigSet

Prototype

unsigned short TFTIntern_DMAConfigSet(unsigned long ui32Config);

Description

This function is used to configure the DMA engine within the LCD controller. This engine is responsible for performing bulk data transfers to the display
when in LIDD mode or for transferring palette and pixel data from SRAM to the display panel when in raster mode.

Parameters
  • ui32Config: this parameter is a logical OR of various flags. It must contain one value from each of the following groups :

    DMA Priority

    Value DMA engine's bus priority with higher numbers representing higher priorities.
    _LCD_DMA_PRIORITY_0 Priority 0.
    _LCD_DMA_PRIORITY_1 Priority 1.
    _LCD_DMA_PRIORITY_2 Priority 2.
    _LCD_DMA_PRIORITY_3 Priority 3.
    _LCD_DMA_PRIORITY_4 Priority 4.
    _LCD_DMA_PRIORITY_5 Priority 5.
    _LCD_DMA_PRIORITY_6 Priority 6.
    _LCD_DMA_PRIORITY_7 Priority 7.

    FIFO Words

    Value The number of words that have to be in the FIFO before it signals that it is ready.
    LCD_DMA_FIFORDY_8_WORDS 8 words in FIFO.
    LCD_DMA_FIFORDY_16_WORDS 16 words in FIFO.
    LCD_DMA_FIFORDY_32_WORDS 32 words in FIFO.
    LCD_DMA_FIFORDY_64_WORDS 64 words in FIFO.
    LCD_DMA_FIFORDY_128_WORDS 128 words in FIFO.
    LCD_DMA_FIFORDY_256_WORDS 256 words in FIFO.
    LCD_DMA_FIFORDY_512_WORDS 512 words in FIFO.

    DMA Burst Words

    Value The number of 32-bit words in each DMA burst transfer.
    LCD_DMA_BURST_1 1 word in DMA burst transfer.
    LCD_DMA_BURST_2 2 words in DMA burst transfer.
    LCD_DMA_BURST_4 4 words in DMA burst transfer.
    LCD_DMA_BURST_8 8 words in DMA burst transfer.
    LCD_DMA_BURST_16 16 words in DMA burst transfer.

    Byte Order

    Value Set internal byte lane controls and allow byte swapping within the DMA engine.
    LCD_DMA_BYTE_ORDER_0123 0123 order.
    LCD_DMA_BYTE_ORDER_1023 1023 order.
    LCD_DMA_BYTE_ORDER_3210 3210 order.
    LCD_DMA_BYTE_ORDER_2301 2300 order.

    Additionally, _LCD_DMA_PING_PONG may be specified. This flag configures the controller to operate in double-buffered mode.
    When data is scanned out from the first frame buffer, the DMA engine immediately moves to the second frame buffer and scan from there before moving back to the first.

    If this flag is clear, the DMA engine uses a single frame buffer, restarting the scan from the beginning of the buffer each time it completes a frame.

Returns
  • 0 - if successful.
Requires

Nothing.

Notes

DMA burst sizes _LCD_DMA_BURST_1 and LCD_DMA_BURST_2 are only supported when the source data is in external, EPI-connected memory.
If used when the source is internal SRAM, the DMA operation does not complete correctly.

TFTIntern_RasterPaletteSet

Prototype

unsigned short TFTIntern_RasterPaletteSet(unsigned long ui32Type, unsigned long *pui32Addr, const unsigned long *pui32SrcColors, unsigned long ui32Start, unsigned long ui32Count);

Description

This function is used to initialize the color palette stored at the beginning of a frame buffer.
It writes the relevant pixel type into the first entry of the frame buffer and copies the requested number of colors from a source buffer into the palette starting at the required index,
optionally converting them from 24-bit color format into the 12-bit format used by the LCD controller

Parameters
  • ui32Type: specifies the type of pixel data to be held in the frame buffer and also the format of the source color values passed. It must must be set to one of the following values :
    Value DMA engine's bus priority with higher numbers representing higher priorities.
    _TFT_INTERN_PALETTE_TYPE_1BPP configures this as a 1 bit per pixel (monochrome) frame buffer. This format requires a 2 entry palette.
    _TFT_INTERN_PALETTE_TYPE_2BPP configures this as a 2 bit per pixel frame buffer. This format requires a 4 entry palette.
    _TFT_INTERN_PALETTE_TYPE_4BPP configures this as a 4 bit per pixel frame. This format requires a 16 entry palette.
    _TFT_INTERN_PALETTE_TYPE_8BPP configures this as an 8 bit per pixel frame buffer. This format requires a 256 entry palette.
    _TFT_INTERN_PALETTE_TYPE_DIRECT configures this as a direct color (12, 16 or 24 bit per pixel). The color palette is not used in these modes but the
    frame buffer type must still be initialized to ensure that the hardware uses the correct pixel type.

    When this value is used, the format of the pixels in the frame buffer is defined by the ui32Config parameter
    previously passed to TFTIntern_RasterConfigSet.

  • pui32Addr: points to the start of the frame buffer into which the palette information is to be written.
  • pui32SrcColors: points to the first color value which is to be written into the frame buffer palette
  • ui32Start: specifies the index of the first color in the palette to update.
  • ui32Count: pecifies the number of source colors to be copied into the frame buffer palette.

Optionally, the _TFT_INTERN_PALETTE_SRC_24BIT flag may be ORed into ui32Type to indicate that the supplied colors in the pui32SrcColors array
are in the 24-bit format as used by the TivaWare Graphics Library with one color stored in each 32-bit word.

In this case, the colors read from the source array are converted to the 12-bit format used by the LCD controller before being written into the frame buffer palette.

Returns
  • 0 - if successful.
  • non-zero - if an error occured.
Requires

Nothing.

Notes

If _TFT_INTERN_PALETTE_SRC_24BIT is not present, it is assumed that the pui32SrcColors array contains 12-bit colors in the format required by the LCD controller with 2 colors stored in each 32-bit word.
In this case the values are copied directly into the frame buffer palette without any reformatting.

TFTIntern_RasterFrameBufferSet

Prototype

unsigned short TFTIntern_RasterFrameBufferSet(unsigned short ui8Buffer, unsigned long *pui32Addr, unsigned long ui32NumBytes);

Description

This function is used to configure the position and size of one of the two supported frame buffers while in raster mode. The second frame buffer (configured when ui8Buffer is set to 1)
is only used if the controller is set to operate in ping-pong mode (by specifying the _LCD_DMA_PING_PONG configuration flag on a call to TFTIntern_LIDDConfigSet).

Parameters
  • ui8Buffer: specifies which frame buffer to configure. Valid values are 0 and 1.
  • ui32Addr: points to the first byte of the frame buffer. This pointer must be aligned on a 32-bit (word) boundary.
  • ui32NumBytes: specifies the size of the frame buffer in bytes. This value must be a multiple of 4.

The format of the frame buffer depends upon the image type in use and the current raster configuration settings.
If _RASTER_LOAD_DATA_ONLY was specified in a previous call to TFTIntern_RasterConfigSet the frame buffer contains only packed pixel data in the required bit depth and format.

In other cases, the frame buffer comprises a palette of either 8 or 128 32-bit words followed by the packed pixel data.
The palette size is 8 words (16 16-bit entries) for all pixel formats other than 8bpp which uses a palette of 128 words (256 16-bit entries).

Note that the 8 word palette is still present even for 12, 16 and 24-bit formats which do not use the lookup table.

The frame buffer size, specified using the ui32NumBytes parameter, must be the palette size (if any) plus the size of the image bitmap required for the currently configured display resolution :
ui32NumBytes = (Palette Size) + ((Width * Height) * BPP) / 8).

Returns
  • 0 - if successful.
  • non-zero - if an error occured.
Requires

Nothing.

Notes

If _RASTER_LOAD_DATA_ONLY is not specified, frame buffers passed to this function must be initialized using a call to TFTIntern_RasterPaletteSet prior to nabling the raster output.
If this is not done, the pixel format identifier and color table required by the hardware is not present and the results are unpredictable.

TFTIntern_IntEnable

Prototype

unsigned short TFTIntern_IntEnable(unsigned long ui32IntFlags);

Description

This function enables the indicated LCD controller interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
  • ui32IntFlags: the bit mask of the interrupt sources to be enabled; it is the logical OR of any of the following :
    Value Description.
    _TFT_INTERN_INT_DMA_DONE This interrupt indicates that a LIDD DMA transfer is complete.
    _TFT_INTERN_INT_RASTER_FRAME_DONE This interrupt indicates that a raster-mode frame is complete.
    _TFT_INTERN_INT_SYNC_LOST This interrupt indicates that frame synchronization was lost.
    _TFT_INTERN_INT_AC_BIAS_CNT This interrupt is valid for passive matrix panels only and indicates that that AC bias transition counter has decremented to zero.
    The counter, set by a call to TFTIntern_RasterACBiasIntCountSet, is reloaded but remains disabled until this interrupt is cleared.
    _TFT_INTERN_INT_UNDERFLOW This interrupt indicates that a data underflow occurred. The internal FIFO was empty when the output logic attempted to read data to send to the display.
    _TFT_INTERN_INT_PAL_LOAD This interrupt indicates that the color palette has been loaded.
    _TFT_INTERN_INT_EOF0 This interrupt indicates that the raw End-of-Frame 0 has been signaled.
    _TFT_INTERN_INT_EOF1 This interrupt indicates that the raw End-of-Frame 1 has been signaled.
Returns
  • 0 - if successful.
  • 1 - if an error occured.
Requires

Nothing.

Notes

None.

TFTIntern_IntDisable

Prototype

unsigned short TFTIntern_IntDisable(unsigned long ui32IntFlags);

Description

This function disables the indicated LCD controller interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
  • ui32IntFlags: the bit mask of the interrupt sources to be enabled; it is the logical OR of any of the following :
    Value Description.
    _TFT_INTERN_INT_DMA_DONE This interrupt indicates that a LIDD DMA transfer is complete.
    _TFT_INTERN_INT_RASTER_FRAME_DONE This interrupt indicates that a raster-mode frame is complete.
    _TFT_INTERN_INT_SYNC_LOST This interrupt indicates that frame synchronization was lost.
    _TFT_INTERN_INT_AC_BIAS_CNT This interrupt is valid for passive matrix panels only and indicates that that AC bias transition counter has decremented to zero.
    The counter, set by a call to TFTIntern_RasterACBiasIntCountSet, is reloaded but remains disabled until this interrupt is cleared.
    _TFT_INTERN_INT_UNDERFLOW This interrupt indicates that a data underflow occurred. The internal FIFO was empty when the output logic attempted to read data to send to the display.
    _TFT_INTERN_INT_PAL_LOAD This interrupt indicates that the color palette has been loaded.
    _TFT_INTERN_INT_EOF0 This interrupt indicates that the raw End-of-Frame 0 has been signaled.
    _TFT_INTERN_INT_EOF1 This interrupt indicates that the raw End-of-Frame 1 has been signaled.
Returns
  • 0 - if successful.
  • 1 - if an error occured.
Requires

Nothing.

Notes

None.

TFTIntern_IntStatus

Prototype

unsigned long TFTIntern_IntStatus(unsigned short bMasked);

Description

This function returns the interrupt status for the LCD controller. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

Parameters
  • bMasked: raw interrupt status (0) or masked interrupt status (1).
Returns

Returns the current interrupt status as the logical OR of any of the following :

Value Description.
_TFT_INTERN_INT_DMA_DONE This interrupt indicates that a LIDD DMA transfer is complete.
_TFT_INTERN_INT_RASTER_FRAME_DONE This interrupt indicates that a raster-mode frame is complete.
_TFT_INTERN_INT_SYNC_LOST This interrupt indicates that frame synchronization was lost.
_TFT_INTERN_INT_AC_BIAS_CNT This interrupt is valid for passive matrix panels only and indicates that that AC bias transition counter has decremented to zero.
The counter, set by a call to TFTIntern_RasterACBiasIntCountSet, is reloaded but remains disabled until this interrupt is cleared.
_TFT_INTERN_INT_UNDERFLOW This interrupt indicates that a data underflow occurred. The internal FIFO was empty when the output logic attempted to read data to send to the display.
_TFT_INTERN_INT_PAL_LOAD This interrupt indicates that the color palette has been loaded.
_TFT_INTERN_INT_EOF0 This interrupt indicates that the raw End-of-Frame 0 has been signaled.
_TFT_INTERN_INT_EOF1 This interrupt indicates that the raw End-of-Frame 1 has been signaled.
Requires

Nothing.

Notes

None.

TFTIntern_IntClear

Prototype

unsigned short TFTIntern_IntClear(unsigned long bMasked);

Description

The specified LCD controller interrupt sources are cleared so that they no longer assert.
This function must be called in the interrupt handler to keep the interrupt from being triggered again immediately upon exit.

Parameters
  • ui32IntFlags: e bit mask of the interrupt sources to be enabled; it is the logical OR of any of the following :
    Value Description.
    _TFT_INTERN_INT_DMA_DONE This interrupt indicates that a LIDD DMA transfer is complete.
    _TFT_INTERN_INT_RASTER_FRAME_DONE This interrupt indicates that a raster-mode frame is complete.
    _TFT_INTERN_INT_SYNC_LOST This interrupt indicates that frame synchronization was lost.
    _TFT_INTERN_INT_AC_BIAS_CNT This interrupt is valid for passive matrix panels only and indicates that that AC bias transition counter has decremented to zero.
    The counter, set by a call to TFTIntern_RasterACBiasIntCountSet, is reloaded but remains disabled until this interrupt is cleared.
    _TFT_INTERN_INT_UNDERFLOW This interrupt indicates that a data underflow occurred. The internal FIFO was empty when the output logic attempted to read data to send to the display.
    _TFT_INTERN_INT_PAL_LOAD This interrupt indicates that the color palette has been loaded.
    _TFT_INTERN_INT_EOF0 This interrupt indicates that the raw End-of-Frame 0 has been signaled.
    _TFT_INTERN_INT_EOF1 This interrupt indicates that the raw End-of-Frame 1 has been signaled.
Returns
  • 0 - if successful.
  • 1 - if an error occured.
Requires

Nothing.

Notes

Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared.
Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action)
to avoid returning from the interrupt handler before the interrupt source is actually cleared.

Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).

TFTIntern_SetMemoryStartAddr

Prototype

void TFTIntern_SetMemoryStartAddr(unsigned int *Aptr);

Description

This function sets the starting address of the graphic RAM.

Parameters
  • Aptr: pointer to the starting address of the graphic RAM.
Returns

Nothing.

Requires

Nothing.

Notes

None.

TFTIntern_Move_Cursor

Prototype

void TFTIntern_Move_Cursor(unsigned int x, unsigned int y);

Description

This function moves the cursor to the desired pixel in graphic RAM.

Parameters
  • x: x-axis position of the desired pixel in graphic RAM.
  • y: y-axis position of the desired pixel in graphic RAM.
Returns

Nothing

Requires

Nothing.

Notes

None.

TFTIntern_Get_Cursor

Prototype

void TFTIntern_Get_Cursor(unsigned int *_x, unsigned int *_y);

Description

This function retrieves the position of the cursor from the graphic RAM.

Parameters
  • _x: pointer to the x position.
  • _y: pointer to the y position.
Returns

Nothing

Requires

Nothing.

Notes

None.

TFTIntern_SetDefaultMode

Prototype

void TFTIntern_SetDefaultMode();

Description

This function sets the display in default mode (zero degrees rotation).

Parameters

None.

Returns

Nothing.

Requires

Nothing.

Notes

None.

TFTIntern_SetDisplaySize

Prototype

unsigned short TFTIntern_SetDisplaySize(unsigned int DispWidth, unsigned int DispHeight);

Description

This function sets the display size (width and height).

Parameters
  • DispWidth: display width (in pixels).
  • DispHeight: display height (in pixels).
Returns
  • 1 - if width is out of the range (greater than 2048, or zero).
  • 2 - if heght is out of the range (greater than 2048, or zero).
Requires

Nothing.

Notes

None.

TFTIntern_CurrentDisplayWidth

Prototype

unsigned int TFTIntern_CurrentDisplayWidth();

Description

This function gets the current display width.

Parameters

None.

Returns

Current display width.

Requires

Nothing.

Notes

None.

TFTIntern_CurrentDisplayHeight

Prototype

unsigned int TFTIntern_CurrentDisplayHeight();

Description

This function gets the current display height.

Parameters

None.

Returns

Current display height.

Requires

Nothing.

Notes

None.

TFTIntern_Rotate

Prototype

void TFTIntern_Rotate(char rotate);

Returns

Nothing.

Description

Rotates the TFT display.

Parameters :

  • rotate: parameter for rotating display. Valid values :
    Value Description.
    _TFT_INTERN_ROTATE_0 Rotate by 0 degrees.
    _TFT_INTERN_ROTATE_90 Rotate by 90 degrees.
    _TFT_INTERN_ROTATE_180 Rotate by 180 degrees.
    _TFT_INTERN_ROTATE_270 Rotate by 270 degrees.
Requires

Nothing.

Example
// Rotate TFT display for 180 degrees
TFTIntern_Rotate(_TFT_INTERN_ROTATE_180);

TFTIntern_Set_Ext_Buffer

Prototype

void TFTIntern_Set_Ext_Buffer(char* (*getExtDataPtr)(unsigned long offset, unsigned long count, unsigned long* num));

Returns

Nothing.

Description

Function sets pointer to the user function which manipulates the external resource.

Parameters :

  • offset - offset from the beginning of the resource from where the data is requested.
  • count - requested number of bytes.
  • num - variable for holding the returned number of bytes (less or equal to the number of acquired bytes).
Requires

Nothing.

Example
char *ReadExternalBuffer(unsigned long offset, unsigned int count, unsigned int *num){
  unsigned long start_sector;
  unsigned int pos;

  start_sector = Mmc_Get_File_Write_Sector() + offset/512;
  pos = (unsigned long)offset%512;

  if(start_sector == currentSector+1){
    Mmc_Multi_Read_Buffer(EXT_BUFFER);
    currentSector = start_sector;
  }else
    if(start_sector != currentSector){
      Mmc_Multi_Read_Stop();
      Mmc_Multi_Read_Start(start_sector);
      Mmc_Multi_Read_Buffer(EXT_BUFFER);
      currentSector = start_sector;
    }

  if(count>512-pos){
    *num = 512-pos;
  }
  else
    *num = count;

  return EXT_BUFFER+pos;
}

TFTIntern_Set_Ext_Buffer(ReadExternalBuffer);

TFTIntern_Set_Font

Prototype

void TFTIntern_Set_Font(const char *activeFont, unsigned int font_color, char font_orientation);

Returns

Nothing.

Description

Sets font, its color and font orientation.

Parameters :

  • activeFont: desired font. Currently, only TFTIntern_defaultFont (Tahoma14x16) is supported.
  • font_color: sets font color :

    Value Description
    CL_AQUA_Intern Aqua color
    CL_BLACK_Intern Black color
    CL_BLUE_Intern Blue color
    CL_FUCHSIA_Intern Fuchsia color
    CL_GRAY_Intern Gray color
    CL_GREEN_Intern Green color
    CL_LIME_Intern Lime color
    CL_MAROON_Intern Maroon color
    CL_NAVY_Intern Navy color
    CL_OLIVE_Intern Olive color
    CL_PURPLE_Intern Purple color
    CL_RED_Intern Red color
    CL_SILVER_Intern Silver color
    CL_TEAL_Intern Teal color
    CL_WHITE_Intern White color
    CL_YELLOW_Intern Yellow color

  • font_orientation: sets font orientation :

    Value Description
    FO_HORIZONTAL_Intern Horizontal orientation
    FO_VERTICAL_Intern Vertical orientation
    FO_VERTICAL_Intern Vertical column orientation

Requires

Nothing.

Example
TFTIntern_Set_Font(TFTIntern_defaultFont, CL_BLACK_Intern, FO_HORIZONTAL_Intern);

TFTIntern_Set_Ext_Font

Prototype

void TFTIntern_Set_Ext_Font(unsigned long activeFont, unsigned int font_color, char font_orientation);

Returns

Nothing.

Description

Sets font, its color and font orientation. Font is located in an external resource

Parameters :

  • activeFont: desired font. This parameter represents the address in the exteral resource from where the font data begins.
  • font_color: sets font color :

    Value Description
    CL_AQUA_Intern Aqua color
    CL_BLACK_Intern Black color
    CL_BLUE_Intern Blue color
    CL_FUCHSIA_Intern Fuchsia color
    CL_GRAY_Intern Gray color
    CL_GREEN_Intern Green color
    CL_LIME_Intern Lime color
    CL_MAROON_Intern Maroon color
    CL_NAVY_Intern Navy color
    CL_OLIVE_Intern Olive color
    CL_PURPLE_Intern Purple color
    CL_RED_Intern Red color
    CL_SILVER_Intern Silver color
    CL_TEAL_Intern Teal color
    CL_WHITE_Intern White color
    CL_YELLOW_Intern Yellow color

  • font_orientation: sets font orientation :

    Value Description
    FO_HORIZONTAL_Intern Horizontal orientation
    FO_VERTICAL_Intern Vertical orientation
    FO_VERTICAL_COLUMN_Intern Vertical column orientation

Requires

Nothing.

Example
TFTIntern_Set_Ext_Font(173296, CL_BLACK_Intern, FO_HORIZONTAL_Intern);

TFTIntern_Write_Char

Prototype

void TFTIntern_Write_Char(unsigned int c, unsigned int x, unsigned int y);

Returns

Nothing.

Description

Writes a char on the TFT at coordinates (x, y).

  • c: char to be written.
  • x: char position on x-axis.
  • y: char position on y-axis.
Requires

Nothing.

Example
TFTIntern_Write_Char('A',22,23);

TFTIntern_Write_Text

Prototype

void TFTIntern_Write_Text(unsigned char *text, unsigned int x, unsigned int y);

Returns

Nothing.

Description

Writes text on the TFT at coordinates (x, y).

Parameters :

  • text: text to be written.
  • x: text position on x-axis.
  • y: text position on y-axis.
Requires

Nothing.

Example
TFTIntern_Write_Text("TFT LIBRARY DEMO, WELCOME !", 0, 0);	

TFTIntern_Fill_Screen

Prototype

void TFTIntern_Fill_Screen(unsigned int color);

Returns

Nothing.

Description

Fills screen memory block with given color.

Parameters :

  • color: color to be filled :

    Value Description
    CL_AQUA_Intern Aqua color
    CL_BLACK_Intern Black color
    CL_BLUE_Intern Blue color
    CL_FUCHSIA_Intern Fuchsia color
    CL_GRAY_Intern Gray color
    CL_GREEN_Intern Green color
    CL_LIME_Intern Lime color
    CL_MAROON_Intern Maroon color
    CL_NAVY_Intern Navy color
    CL_OLIVE_Intern Olive color
    CL_PURPLE_Intern Purple color
    CL_RED_Intern Red color
    CL_SILVER_Intern Silver color
    CL_TEAL_Intern Teal color
    CL_WHITE_Intern White color
    CL_YELLOW_Intern Yellow color

Requires

Nothing.

Example
TFTIntern_Fill_Screen(CL_BLACK_Intern);

TFTIntern_Dot

Prototype

void TFTIntern_Dot(int x, int y, unsigned long color);

Returns

Nothing.

Description

Draws a dot on the TFT at coordinates (x, y).

Parameters :

  • x: dot position on x-axis.
  • y: dot position on y-axis.
  • color: color parameter. Valid values :

    Value Description
    CL_AQUA_Intern Aqua color
    CL_BLACK_Intern Black color
    CL_BLUE_Intern Blue color
    CL_FUCHSIA_Intern Fuchsia color
    CL_GRAY_Intern Gray color
    CL_GREEN_Intern Green color
    CL_LIME_Intern Lime color
    CL_MAROON_Intern Maroon color
    CL_NAVY_Intern Navy color
    CL_OLIVE_Intern Olive color
    CL_PURPLE_Intern Purple color
    CL_RED_Intern Red color
    CL_SILVER_Intern Silver color
    CL_TEAL_Intern Teal color
    CL_WHITE_Intern White color
    CL_YELLOW_Intern Yellow color

Requires

Nothing.

Example
TFTIntern_Dot(50, 50, CL_BLACK_Intern);

TFTIntern_Set_Pen

Prototype

void TFTIntern_Set_Pen(unsigned long pen_color, char pen_width);

Returns

Nothing.

Description

Sets color and thickness parameter for drawing line, circle and rectangle elements.

Parameters :

  • pen_color: Sets color.

    Value Description
    CL_AQUA_Intern Aqua color
    CL_BLACK_Intern Black color
    CL_BLUE_Intern Blue color
    CL_FUCHSIA_Intern Fuchsia color
    CL_GRAY_Intern Gray color
    CL_GREEN_Intern Green color
    CL_LIME_Intern Lime color
    CL_MAROON_Intern Maroon color
    CL_NAVY_Intern Navy color
    CL_OLIVE_Intern Olive color
    CL_PURPLE_Intern Purple color
    CL_RED_Intern Red color
    CL_SILVER_Intern Silver color
    CL_TEAL_Intern Teal color
    CL_WHITE_Intern White color
    CL_YELLOW_Intern Yellow color

  • pen_width: sets thickness.

Requires

Nothing.

Example
TFTIntern_Set_Pen(CL_BLACK_Intern, 10);

TFTIntern_Set_Brush

Prototype

void TFTIntern_Set_Brush(char brush_enabled, unsigned int brush_color, char gradient_enabled, char gradient_orientation, unsigned int gradient_color_from, unsigned int gradient_color_to);

Returns

Nothing.

Description

Sets color and gradient which will be used to fill circles or rectangles.

Parameters :

  • brush_enabled: enable brush fill.

    Value Description
    1 Enable brush fill.
    0 Disable brush fill.

  • brush_color: set brush fill color.

    Value Description
    CL_AQUA_Intern Aqua color
    CL_BLACK_Intern Black color
    CL_BLUE_Intern Blue color
    CL_FUCHSIA_Intern Fuchsia color
    CL_GRAY_Intern Gray color
    CL_GREEN_Intern Green color
    CL_LIME_Intern Lime color
    CL_MAROON_Intern Maroon color
    CL_NAVY_Intern Navy color
    CL_OLIVE_Intern Olive color
    CL_PURPLE_Intern Purple color
    CL_RED_Intern Red color
    CL_SILVER_Intern Silver color
    CL_TEAL_Intern Teal color
    CL_WHITE_Intern White color
    CL_YELLOW_Intern Yellow color

  • gradient_enabled: enable gradient

    Value Description
    1 Enable gradient.
    0 Disable gradient.

  • gradient_orientation: sets gradient orientation :

    Value Description
    _TFT_INTERN_LEFT_TO_RIGHT Left to right gradient orientation
    _TFT_INTERN_TOP_TO_BOTTOM Top to bottom gradient orientation

  • gradient_color_from: sets the starting gradient color.

    Value Description
    CL_AQUA_Intern Aqua color
    CL_BLACK_Intern Black color
    CL_BLUE_Intern Blue color
    CL_FUCHSIA_Intern Fuchsia color
    CL_GRAY_Intern Gray color
    CL_GREEN_Intern Green color
    CL_LIME_Intern Lime color
    CL_MAROON_Intern Maroon color
    CL_NAVY_Intern Navy color
    CL_OLIVE_Intern Olive color
    CL_PURPLE_Intern Purple color
    CL_RED_Intern Red color
    CL_SILVER_Intern Silver color
    CL_TEAL_Intern Teal color
    CL_WHITE_Intern White color
    CL_YELLOW_Intern Yellow color

  • gradient_color_to: sets the ending gradient color.

    Value Description
    CL_AQUA_Intern Aqua color
    CL_BLACK_Intern Black color
    CL_BLUE_Intern Blue color
    CL_FUCHSIA_Intern Fuchsia color
    CL_GRAY_Intern Gray color
    CL_GREEN_Intern Green color
    CL_LIME_Intern Lime color
    CL_MAROON_Intern Maroon color
    CL_NAVY_Intern Navy color
    CL_OLIVE_Intern Olive color
    CL_PURPLE_Intern Purple color
    CL_RED_Intern Red color
    CL_SILVER_Intern Silver color
    CL_TEAL_Intern Teal color
    CL_WHITE_Intern White color
    CL_YELLOW_Intern Yellow color

Requires

Nothing.

Example
// Enable gradient from black to white color, left-right orientation
TFTIntern_Set_Brush(0, 0, 1, _TFT_INTERN_LEFT_TO_RIGHT, CL_BLACK_Intern, CL_WHITE_Intern);

TFTIntern_Line

Prototype

void TFTIntern_Line(int x1, int y1, int x2, int y2);

Returns

Nothing.

Description

Draws a line from (x1, y1) to (x2, y2).

Parameters :

  • x1: x coordinate of the line start.
  • y1: y coordinate of the line end.
  • x2: x coordinate of the line start.
  • y2: y coordinate of the line end.

Requires

Nothing.

Example
TFTIntern_Line(0, 0, 239, 127);

TFTIntern_H_Line

Prototype

void TFTIntern_H_Line(int x_start, int x_end, int y_pos);

Returns

Nothing.

Description

Draws a horizontal line on TFT.

Parameters :

  • x_start: x coordinate of the line start.
  • x_end: x coordinate of the line end.
  • y_pos: y coordinate of horizontal line.

Requires

Nothing.

Example
// Draw a horizontal line between dots (10,20) and (50,20)
TFTIntern_H_Line(10, 50, 20);

TFTIntern_V_Line

Prototype

void TFTIntern_V_Line(int y_start, int y_end, int x_pos);

Returns

Nothing.

Description

Draws a vertical line on TFT.

Parameters :

  • y_start: y coordinate of the line start.
  • y_end: y coordinate of the line end.
  • x_pos: x coordinate of vertical line.

Requires

Nothing.

Example
// Draw a vertical line between dots (10,5) and (10,25)
TFTIntern_V_Line(5, 25, 10);

TFTIntern_Rectangle

Prototype

void TFTIntern_Rectangle(int x_upper_left, int y_upper_left, int x_bottom_right, int y_bottom_right);

Returns

Nothing.

Description

Draws a rectangle on TFT.

Parameters :

  • x_upper_left: x coordinate of the upper left rectangle corner.
  • y_upper_left: y coordinate of the upper left rectangle corner.
  • x_bottom_right: x coordinate of the lower right rectangle corner.
  • y_bottom_right: y coordinate of the lower right rectangle corner.

Requires

Nothing.

Example
TFTIntern_Rectangle(20, 20, 219, 107);

TFTIntern_Rectangle_Round_Edges

Prototype

void TFTIntern_Rectangle_Round_Edges(unsigned int x_upper_left, unsigned int y_upper_left, unsigned int x_bottom_right, unsigned int y_bottom_right, unsigned int round_radius);

Returns

Nothing.

Description

Draws a rounded edge rectangle on TFT.

Parameters :

  • x_upper_left: x coordinate of the upper left rectangle corner.
  • y_upper_left: y coordinate of the upper left rectangle corner.
  • x_bottom_right: x coordinate of the lower right rectangle corner.
  • y_bottom_right: y coordinate of the lower right rectangle corner.
  • round_radius: radius of the rounded edge.

Requires

Nothing.

Example
TFTIntern_Rectangle_Round_Edges(20, 20, 219, 107, 12);

TFTIntern_Circle

Prototype

void TFTIntern_Circle(int x_center, int y_center, int radius);

Returns

Nothing.

Description

Draws a circle on TFT.

Parameters :

  • x: x coordinate of the circle center.
  • y: y coordinate of the circle center.
  • r: radius size.

Requires

Nothing.

Example
TFTIntern_Circle(120, 64, 110);

TFTIntern_Image

Prototype

void TFTIntern_Image(unsigned int left, unsigned int top, code const unsigned short *image, unsigned short stretch);

Returns

Nothing.

Description

Displays an image on a desired location.

Parameters :

  • left: position of the image's left edge.
  • top:position of the image's top edge.
  • image: image to be displayed. Bitmap array is located in code memory.
  • stretch: stretches image by a given factor (if 2, it will double the image).
Requires

Nothing.

Example
TFTIntern_Image(0, 0, image, 1);

TFTIntern_Ext_Image

Prototype

void TFTIntern_Ext_Image(unsigned int left, unsigned int top, unsigned long image, unsigned short stretch);

Returns

Nothing.

Description

Displays an image from an external resource on a desired address.

Parameters :

  • left: position of the image's left edge.
  • top:position of the image's top edge.
  • image: image to be displayed. This parameter represents the address in the exteral resource from where the image data begins.
  • stretch: stretches image by a given factor (if 2, it will double the image).
Requires

Nothing.

Example
TFTIntern_Image(0, 0, 153608, 1);

TFTIntern_Partial_Image

Prototype

void TFTIntern_Partial_Image(unsigned int left, unsigned int top, unsigned int width, unsigned int height, code const unsigned short *image, unsigned short stretch);

Returns

Nothing.

Description

Displays a partial area of the image on a desired location.

Parameters :

  • left: left coordinate of the image.
  • top: top coordinate of the image.
  • width: desired image width.
  • height: desired image height.
  • image: image to be displayed. Bitmap array is located in code memory.
  • stretch: stretches image by a given factor (if 2, it will double the image).

Requires

Nothing.

Example
// Draws a 10x15 part of the image starting from the upper left corner on the coordinate (10,12)  
TFTIntern_Partial_Image(10, 12, 10, 15, image, 1);

TFTIntern_Ext_Partial_Image

Prototype

void TFTIntern_Ext_Partial_Image(unsigned int left, unsigned int top, unsigned int width, unsigned int height, unsigned long image, unsigned short stretch);

Returns

Nothing.

Description

Displays a partial area of the image, located on an external resource, on a desired location of the screen.

Parameters :

  • left: left coordinate of the image.
  • top: top coordinate of the image.
  • width: desired image width.
  • height: desired image height.
  • image: image to be displayed. This parameter represents the address in the exteral resource from where the image data begins.
  • stretch: stretches image by a given factor (if 2, it will double the image).

Requires

Nothing.

Example
TFTIntern_Ext_Partial_Image(159,0,160,120,image,1);

TFTIntern_Image_Jpeg

Prototype

char TFTIntern_Image_Jpeg(unsigned int left, unsigned int top, code const unsigned short *image);

Returns
  • 0 - if image is loaded and displayed successfully.
  • 1 - if error occured.
Description

Displays a JPEG image on a desired location.

Parameters :

  • left: left coordinate of the image.
  • top: top coordinate of the image.
  • image: image to be displayed. Bitmap array is located in code memory.
Requires

Nothing.

Example
TFTIntern_Image_Jpeg(0, 0, image);

TFTIntern_RGBToColor16bit

Prototype

unsigned int TFTIntern_RGBToColor16bit(char rgb_red, char rgb_green, char rgb_blue);

Returns

Returns a color value in the following bit-order : 5 bits red, 6 bits green and 5 bits blue color.

Description

Converts 5:6:5 RGB format into true color format.

Parameters :

  • rgb_red: red component of the image.
  • rgb_green: green component of the image.
  • rgb_blue: blue component of the image.
Requires

Nothing.

Example
color16 = TFTIntern_RGBToColor16bit(150, 193, 65);

TFTIntern_Color16bitToRGB

Prototype

void TFTIntern_Color16bitToRGB(unsigned int color, char *rgb_red, char *rgb_green, char *rgb_blue);

Returns

Nothing.

Description

Converts true color into 5:6:5 RGB format.

Parameters :

  • color: true color to be converted.
  • rgb_red: red component of the input color.
  • rgb_green: green component of the input color.
  • rgb_blue: blue component of the input color.
Requires

Nothing.

Example
TFTIntern_Color16bitToRGB(start_color, &red_start, &green_start, &blue_start);
Copyright (c) 2002-2019 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code