MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
LCDC: LCD Controller Driver

Overview

The MCUXpresso SDK provides a Peripheral driver for the LCD controller (LCD) of MCUXpresso SDK devices.

The LCD driver supports TFT and STN panel. It also supports hardware cursor, which makes software easy.

Typical use case

Update framebuffer dynamically

The function LCDC_SetPanelAddr is used to set the new framebuffer address. After this function, the new framebuffer address is not loaded to current register until the vertical synchroization. When the address is loaded, the interrupt kLCDC_BaseAddrUpdateInterrupt occurs then upper layer could set the new framebuffer. In this example, there are two buffers. When the active buffer is displayed, upper layer could modify the inactive buffer.

#if (defined(__CC_ARM) || defined(__GNUC__))
__attribute__((aligned(8)))
#elif defined(__ICCARM__)
#pragma data_alignment = 8
#else
#error Toolchain not support.
#endif
static uint16_t s_frameBufs[2][IMG_HEIGHT][IMG_WIDTH];
/* The index of the inactive buffer. */
static volatile uint8_t s_inactiveBufsIdx;
/* The new frame address already loaded to the LCD controller. */
static volatile bool s_frameAddrUpdated = false;
void LCD_IRQHandler(void)
{
uint32_t intStatus = LCDC_GetEnabledInterruptsPendingStatus(LCD);
LCDC_ClearInterruptsStatus(LCD, intStatus);
{
s_frameAddrUpdated = true;
}
}
/* This function fills the framebuffer. */
static void APP_FillBuffer(void *buffer);
int main(void)
{
lcdc_config_t lcdConfig;
/* Setup the LCD input clock here. */
BOARD_InitHardware();
s_frameAddrUpdated = false;
/* s_frameBufs[0] is displayed first. */
s_inactiveBufsIdx = 1;
/* Fill the s_frameBufs[0]. */
APP_FillBuffer((void *)(s_frameBufs[0]));
LCDC_GetDefaultConfig(&lcdConfig);
lcdConfig.panelClock_Hz = LCD_PANEL_CLK;
lcdConfig.ppl = LCD_PPL;
lcdConfig.hsw = LCD_HSW;
lcdConfig.hfp = LCD_HFP;
lcdConfig.hbp = LCD_HBP;
lcdConfig.lpp = LCD_LPP;
lcdConfig.vsw = LCD_VSW;
lcdConfig.vfp = LCD_VFP;
lcdConfig.vbp = LCD_VBP;
lcdConfig.polarityFlags = LCD_POL_FLAGS;
lcdConfig.upperPanelAddr = (uint32_t)s_frameBufs[0];
lcdConfig.bpp = kLCDC_16BPP565;
lcdConfig.swapRedBlue = false;
LCDC_Init(LCD, &lcdConfig, LCD_INPUT_CLK_FREQ);
NVIC_EnableIRQ(LCD_IRQn);
LCDC_Start(LCD);
while (1)
{
/*
* Fill the inactive buffer.
*/
APP_FillBuffer((void *)s_frameBufs[s_inactiveBufsIdx]);
while (!s_frameAddrUpdated)
{
}
/*
* The buffer address has been loaded to the LCD controller, now
* set the inactive buffer to active buffer.
*/
LCDC_SetPanelAddr(LCD, kLCDC_UpperPanel, (uint32_t)(s_frameBufs[s_inactiveBufsIdx]));
s_frameAddrUpdated = false;
s_inactiveBufsIdx ^= 1U;
}
}

Hardware cursor

This example shows how to show a 32x32 pixel cursor and change its position.

lcdc_cursor_config_t cursorConfig;
int32_t cursorPosX = 0;
int32_t cursorPosY = 0;
/* Init the LCD here. */
// ....
/* Setup the Cursor. */
cursorConfig.size = kLCDC_CursorSize32;
cursorConfig.syncMode = kLCDC_CursorSync;
cursorConfig.image[0] = (uint32_t *)cursor32Img0;
LCDC_SetCursorConfig(LCD, &cursorConfig);
LCDC_EnableCursor(LCD, true);
while (1)
{
// Do something else here
// Update cursorPosX and cursorPosY
LCDC_SetCursorPosition(LCD, cursorPosX, cursorPosY);
}

Data Structures

struct  lcdc_config_t
 LCD configuration structure. More...
 
struct  lcdc_cursor_palette_t
 LCD hardware cursor palette. More...
 
struct  lcdc_cursor_config_t
 LCD hardware cursor configuration structure. More...
 

Macros

#define LCDC_CURSOR_COUNT   4
 How many hardware cursors supports. More...
 
#define LCDC_CURSOR_IMG_BPP   2
 LCD cursor image bits per pixel. More...
 
#define LCDC_CURSOR_IMG_32X32_WORDS   (32 * 32 * LCDC_CURSOR_IMG_BPP / (8 * sizeof(uint32_t)))
 LCD 32x32 cursor image size in word(32-bit). More...
 
#define LCDC_CURSOR_IMG_64X64_WORDS   (64 * 64 * LCDC_CURSOR_IMG_BPP / (8 * sizeof(uint32_t)))
 LCD 64x64 cursor image size in word(32-bit). More...
 
#define LCDC_PALETTE_SIZE_WORDS   (ARRAY_SIZE(((LCD_Type *)0)->PAL))
 LCD palette size in words(32-bit). More...
 

Enumerations

enum  _lcdc_polarity_flags {
  kLCDC_InvertVsyncPolarity = LCD_POL_IVS_MASK,
  kLCDC_InvertHsyncPolarity = LCD_POL_IHS_MASK,
  kLCDC_InvertClkPolarity = LCD_POL_IPC_MASK,
  kLCDC_InvertDePolarity = LCD_POL_IOE_MASK
}
 LCD sigal polarity flags. More...
 
enum  lcdc_bpp_t {
  kLCDC_1BPP = 0U,
  kLCDC_2BPP = 1U,
  kLCDC_4BPP = 2U,
  kLCDC_8BPP = 3U,
  kLCDC_16BPP = 4U,
  kLCDC_24BPP = 5U,
  kLCDC_16BPP565 = 6U,
  kLCDC_12BPP = 7U
}
 LCD bits per pixel. More...
 
enum  lcdc_display_t {
  kLCDC_DisplayTFT = LCD_CTRL_LCDTFT_MASK,
  kLCDC_DisplaySingleMonoSTN4Bit = LCD_CTRL_LCDBW_MASK,
  kLCDC_DisplaySingleMonoSTN8Bit,
  kLCDC_DisplayDualMonoSTN4Bit,
  kLCDC_DisplayDualMonoSTN8Bit,
  kLCDC_DisplaySingleColorSTN8Bit = 0U,
  kLCDC_DisplayDualColorSTN8Bit = LCD_CTRL_LCDDUAL_MASK
}
 The types of display panel. More...
 
enum  lcdc_data_format_t {
  kLCDC_LittleEndian = 0U,
  kLCDC_BigEndian = LCD_CTRL_BEPO_MASK | LCD_CTRL_BEBO_MASK,
  kLCDC_WinCeMode = LCD_CTRL_BEPO_MASK
}
 LCD panel buffer data format. More...
 
enum  lcdc_vertical_compare_interrupt_mode_t {
  kLCDC_StartOfVsync,
  kLCDC_StartOfBackPorch,
  kLCDC_StartOfActiveVideo,
  kLCDC_StartOfFrontPorch
}
 LCD vertical compare interrupt mode. More...
 
enum  _lcdc_interrupts {
  kLCDC_CursorInterrupt = LCD_CRSR_INTMSK_CRSRIM_MASK,
  kLCDC_FifoUnderflowInterrupt = LCD_INTMSK_FUFIM_MASK,
  kLCDC_BaseAddrUpdateInterrupt = LCD_INTMSK_LNBUIM_MASK,
  kLCDC_VerticalCompareInterrupt = LCD_INTMSK_VCOMPIM_MASK,
  kLCDC_AhbErrorInterrupt = LCD_INTMSK_BERIM_MASK
}
 LCD interrupts. More...
 
enum  lcdc_panel_t {
  kLCDC_UpperPanel,
  kLCDC_LowerPanel
}
 LCD panel frame. More...
 
enum  lcdc_cursor_size_t {
  kLCDC_CursorSize32,
  kLCDC_CursorSize64
}
 LCD hardware cursor size. More...
 
enum  lcdc_cursor_sync_mode_t {
  kLCDC_CursorAsync,
  kLCDC_CursorSync
}
 LCD hardware cursor frame synchronization mode. More...
 

Variables

uint32_t lcdc_config_t::panelClock_Hz
 Panel clock in Hz. More...
 
uint16_t lcdc_config_t::ppl
 Pixels per line, it must could be divided by 16. More...
 
uint8_t lcdc_config_t::hsw
 HSYNC pulse width. More...
 
uint8_t lcdc_config_t::hfp
 Horizontal front porch. More...
 
uint8_t lcdc_config_t::hbp
 Horizontal back porch. More...
 
uint16_t lcdc_config_t::lpp
 Lines per panal. More...
 
uint8_t lcdc_config_t::vsw
 VSYNC pulse width. More...
 
uint8_t lcdc_config_t::vfp
 Vrtical front porch. More...
 
uint8_t lcdc_config_t::vbp
 Vertical back porch. More...
 
uint8_t lcdc_config_t::acBiasFreq
 The number of line clocks between AC bias pin toggling. More...
 
uint16_t lcdc_config_t::polarityFlags
 OR'ed value of _lcdc_polarity_flags, used to contol the signal polarity. More...
 
bool lcdc_config_t::enableLineEnd
 Enable line end or not, the line end is a positive pulse with 4 panel clock. More...
 
uint8_t lcdc_config_t::lineEndDelay
 The panel clocks between the last pixel of line and the start of line end. More...
 
uint32_t lcdc_config_t::upperPanelAddr
 LCD upper panel base address, must be double-word(64-bit) align. More...
 
uint32_t lcdc_config_t::lowerPanelAddr
 LCD lower panel base address, must be double-word(64-bit) align. More...
 
lcdc_bpp_t lcdc_config_t::bpp
 LCD bits per pixel. More...
 
lcdc_data_format_t lcdc_config_t::dataFormat
 Data format. More...
 
bool lcdc_config_t::swapRedBlue
 Set true to use BGR format, set false to choose RGB format. More...
 
lcdc_display_t lcdc_config_t::display
 The display type. More...
 
uint8_t lcdc_cursor_palette_t::red
 Red color component. More...
 
uint8_t lcdc_cursor_palette_t::green
 Red color component. More...
 
uint8_t lcdc_cursor_palette_t::blue
 Red color component. More...
 
lcdc_cursor_size_t lcdc_cursor_config_t::size
 Cursor size. More...
 
lcdc_cursor_sync_mode_t lcdc_cursor_config_t::syncMode
 Cursor synchronization mode. More...
 
lcdc_cursor_palette_t lcdc_cursor_config_t::palette0
 Cursor palette 0. More...
 
lcdc_cursor_palette_t lcdc_cursor_config_t::palette1
 Cursor palette 1. More...
 
uint32_t * lcdc_cursor_config_t::image [LCDC_CURSOR_COUNT]
 Pointer to cursor image data. More...
 

Driver version

#define LPC_LCDC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 LCDC driver version 2.0.0. More...
 

Initialization and Deinitialization

status_t LCDC_Init (LCD_Type *base, const lcdc_config_t *config, uint32_t srcClock_Hz)
 Initialize the LCD module. More...
 
void LCDC_Deinit (LCD_Type *base)
 Deinitialize the LCD module. More...
 
void LCDC_GetDefaultConfig (lcdc_config_t *config)
 Gets default pre-defined settings for initial configuration. More...
 

Start and stop

static void LCDC_Start (LCD_Type *base)
 Start to output LCD timing signal. More...
 
static void LCDC_Stop (LCD_Type *base)
 Stop the LCD timing signal. More...
 
static void LCDC_PowerUp (LCD_Type *base)
 Power up the LCD and output the pixel signal. More...
 
static void LCDC_PowerDown (LCD_Type *base)
 Power down the LCD and disable the output pixel signal. More...
 

LCD control

void LCDC_SetPanelAddr (LCD_Type *base, lcdc_panel_t panel, uint32_t addr)
 Sets panel frame base address. More...
 
void LCDC_SetPalette (LCD_Type *base, const uint32_t *palette, uint8_t count_words)
 Sets palette. More...
 

Interrupts

static void LCDC_SetVerticalInterruptMode (LCD_Type *base, lcdc_vertical_compare_interrupt_mode_t mode)
 Sets the vertical compare interrupt mode. More...
 
void LCDC_EnableInterrupts (LCD_Type *base, uint32_t mask)
 Enable LCD interrupts. More...
 
void LCDC_DisableInterrupts (LCD_Type *base, uint32_t mask)
 Disable LCD interrupts. More...
 
uint32_t LCDC_GetInterruptsPendingStatus (LCD_Type *base)
 Get LCD interrupt pending status. More...
 
uint32_t LCDC_GetEnabledInterruptsPendingStatus (LCD_Type *base)
 Get LCD enabled interrupt pending status. More...
 
void LCDC_ClearInterruptsStatus (LCD_Type *base, uint32_t mask)
 Clear LCD interrupts pending status. More...
 

Hardware cursor

void LCDC_SetCursorConfig (LCD_Type *base, const lcdc_cursor_config_t *config)
 Set the hardware cursor configuration. More...
 
void LCDC_CursorGetDefaultConfig (lcdc_cursor_config_t *config)
 Get the hardware cursor default configuration. More...
 
static void LCDC_EnableCursor (LCD_Type *base, bool enable)
 Enable or disable the cursor. More...
 
static void LCDC_ChooseCursor (LCD_Type *base, uint8_t index)
 Choose which cursor to display. More...
 
void LCDC_SetCursorPosition (LCD_Type *base, int32_t positionX, int32_t positionY)
 Set the position of cursor. More...
 
void LCDC_SetCursorImage (LCD_Type *base, lcdc_cursor_size_t size, uint8_t index, const uint32_t *image)
 Set the cursor image. More...
 

Data Structure Documentation

struct lcdc_config_t

Data Fields

uint32_t panelClock_Hz
 Panel clock in Hz. More...
 
uint16_t ppl
 Pixels per line, it must could be divided by 16. More...
 
uint8_t hsw
 HSYNC pulse width. More...
 
uint8_t hfp
 Horizontal front porch. More...
 
uint8_t hbp
 Horizontal back porch. More...
 
uint16_t lpp
 Lines per panal. More...
 
uint8_t vsw
 VSYNC pulse width. More...
 
uint8_t vfp
 Vrtical front porch. More...
 
uint8_t vbp
 Vertical back porch. More...
 
uint8_t acBiasFreq
 The number of line clocks between AC bias pin toggling. More...
 
uint16_t polarityFlags
 OR'ed value of _lcdc_polarity_flags, used to contol the signal polarity. More...
 
bool enableLineEnd
 Enable line end or not, the line end is a positive pulse with 4 panel clock. More...
 
uint8_t lineEndDelay
 The panel clocks between the last pixel of line and the start of line end. More...
 
uint32_t upperPanelAddr
 LCD upper panel base address, must be double-word(64-bit) align. More...
 
uint32_t lowerPanelAddr
 LCD lower panel base address, must be double-word(64-bit) align. More...
 
lcdc_bpp_t bpp
 LCD bits per pixel. More...
 
lcdc_data_format_t dataFormat
 Data format. More...
 
bool swapRedBlue
 Set true to use BGR format, set false to choose RGB format. More...
 
lcdc_display_t display
 The display type. More...
 
struct lcdc_cursor_palette_t

Data Fields

uint8_t red
 Red color component. More...
 
uint8_t green
 Red color component. More...
 
uint8_t blue
 Red color component. More...
 
struct lcdc_cursor_config_t

Data Fields

lcdc_cursor_size_t size
 Cursor size. More...
 
lcdc_cursor_sync_mode_t syncMode
 Cursor synchronization mode. More...
 
lcdc_cursor_palette_t palette0
 Cursor palette 0. More...
 
lcdc_cursor_palette_t palette1
 Cursor palette 1. More...
 
uint32_t * image [LCDC_CURSOR_COUNT]
 Pointer to cursor image data. More...
 

Macro Definition Documentation

#define LPC_LCDC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
#define LCDC_CURSOR_COUNT   4
#define LCDC_CURSOR_IMG_BPP   2
#define LCDC_CURSOR_IMG_32X32_WORDS   (32 * 32 * LCDC_CURSOR_IMG_BPP / (8 * sizeof(uint32_t)))
#define LCDC_CURSOR_IMG_64X64_WORDS   (64 * 64 * LCDC_CURSOR_IMG_BPP / (8 * sizeof(uint32_t)))
#define LCDC_PALETTE_SIZE_WORDS   (ARRAY_SIZE(((LCD_Type *)0)->PAL))

Enumeration Type Documentation

Enumerator
kLCDC_InvertVsyncPolarity 

Invert the VSYNC polarity, set to active low.

kLCDC_InvertHsyncPolarity 

Invert the HSYNC polarity, set to active low.

kLCDC_InvertClkPolarity 

Invert the panel clock polarity, set to drive data on falling edge.

kLCDC_InvertDePolarity 

Invert the data enable (DE) polarity, set to active low.

enum lcdc_bpp_t
Enumerator
kLCDC_1BPP 

1 bpp.

kLCDC_2BPP 

2 bpp.

kLCDC_4BPP 

4 bpp.

kLCDC_8BPP 

8 bpp.

kLCDC_16BPP 

16 bpp.

kLCDC_24BPP 

24 bpp, TFT panel only.

kLCDC_16BPP565 

16 bpp, 5:6:5 mode.

kLCDC_12BPP 

12 bpp, 4:4:4 mode.

Enumerator
kLCDC_DisplayTFT 

Active matrix TFT panels with up to 24-bit bus interface.

kLCDC_DisplaySingleMonoSTN4Bit 

Single-panel monochrome STN (4-bit bus interface).

kLCDC_DisplaySingleMonoSTN8Bit 

Single-panel monochrome STN (8-bit bus interface).

kLCDC_DisplayDualMonoSTN4Bit 

Dual-panel monochrome STN (4-bit bus interface).

kLCDC_DisplayDualMonoSTN8Bit 

Dual-panel monochrome STN (8-bit bus interface).

kLCDC_DisplaySingleColorSTN8Bit 

Single-panel color STN (8-bit bus interface).

kLCDC_DisplayDualColorSTN8Bit 

Dual-panel coor STN (8-bit bus interface).

Enumerator
kLCDC_LittleEndian 

Little endian byte, little endian pixel.

kLCDC_BigEndian 

Big endian byte, big endian pixel.

kLCDC_WinCeMode 

little-endian byte, big-endian pixel for Windows CE mode.

Enumerator
kLCDC_StartOfVsync 

Generate vertical compare interrupt at start of VSYNC.

kLCDC_StartOfBackPorch 

Generate vertical compare interrupt at start of back porch.

kLCDC_StartOfActiveVideo 

Generate vertical compare interrupt at start of active video.

kLCDC_StartOfFrontPorch 

Generate vertical compare interrupt at start of front porch.

Enumerator
kLCDC_CursorInterrupt 

Cursor image read finished interrupt.

kLCDC_FifoUnderflowInterrupt 

FIFO underflow interrupt.

kLCDC_BaseAddrUpdateInterrupt 

Panel frame base address update interrupt.

kLCDC_VerticalCompareInterrupt 

Vertical compare interrupt.

kLCDC_AhbErrorInterrupt 

AHB master error interrupt.

Enumerator
kLCDC_UpperPanel 

Upper panel frame.

kLCDC_LowerPanel 

Lower panel frame.

Enumerator
kLCDC_CursorSize32 

32x32 pixel cursor.

kLCDC_CursorSize64 

64x64 pixel cursor.

Enumerator
kLCDC_CursorAsync 

Cursor change will be displayed immediately.

kLCDC_CursorSync 

Cursor change will be displayed in next frame.

Function Documentation

status_t LCDC_Init ( LCD_Type *  base,
const lcdc_config_t config,
uint32_t  srcClock_Hz 
)
Parameters
baseLCD peripheral base address.
configPointer to configuration structure, see to lcdc_config_t.
srcClock_HzThe LCD input clock (LCDCLK) frequency in Hz.
Return values
kStatus_SuccessLCD is initialized successfully.
kStatus_InvalidArgumentInitlialize failed because of invalid argument.
void LCDC_Deinit ( LCD_Type *  base)
Parameters
baseLCD peripheral base address.
void LCDC_GetDefaultConfig ( lcdc_config_t config)

This function initializes the configuration structure. The default values are:

config->panelClock_Hz = 0U;
config->ppl = 0U;
config->hsw = 0U;
config->hfp = 0U;
config->hbp = 0U;
config->lpp = 0U;
config->vsw = 0U;
config->vfp = 0U;
config->vbp = 0U;
config->acBiasFreq = 1U;
config->polarityFlags = 0U;
config->enableLineEnd = false;
config->lineEndDelay = 0U;
config->upperPanelAddr = 0U;
config->lowerPanelAddr = 0U;
config->bpp = kLCDC_1BPP;
config->dataFormat = kLCDC_LittleEndian;
config->swapRedBlue = false;
config->display = kLCDC_DisplayTFT;
Parameters
configPointer to configuration structure.
static void LCDC_Start ( LCD_Type *  base)
inlinestatic

The LCD power up sequence should be:

  1. Apply power to LCD, here all output signals are held low.
  2. When LCD power stablized, call LCDC_Start to output the timing signals.
  3. Apply contrast voltage to LCD panel. Delay if the display requires.
  4. Call LCDC_PowerUp.
Parameters
baseLCD peripheral base address.
static void LCDC_Stop ( LCD_Type *  base)
inlinestatic

The LCD power down sequence should be:

  1. Call LCDC_PowerDown.
  2. Delay if the display requires. Disable contrast voltage to LCD panel.
  3. Call LCDC_Stop to disable the timing signals.
  4. Disable power to LCD.
Parameters
baseLCD peripheral base address.
static void LCDC_PowerUp ( LCD_Type *  base)
inlinestatic
Parameters
baseLCD peripheral base address.
static void LCDC_PowerDown ( LCD_Type *  base)
inlinestatic
Parameters
baseLCD peripheral base address.
void LCDC_SetPanelAddr ( LCD_Type *  base,
lcdc_panel_t  panel,
uint32_t  addr 
)
Parameters
baseLCD peripheral base address.
panelWhich panel to set.
addrFrame base address, must be doubleword(64-bit) aligned.
void LCDC_SetPalette ( LCD_Type *  base,
const uint32_t *  palette,
uint8_t  count_words 
)
Parameters
baseLCD peripheral base address.
palettePointer to the palette array.
count_wordsLength of the palette array to set (how many words), it should not be larger than LCDC_PALETTE_SIZE_WORDS.
static void LCDC_SetVerticalInterruptMode ( LCD_Type *  base,
lcdc_vertical_compare_interrupt_mode_t  mode 
)
inlinestatic
Parameters
baseLCD peripheral base address.
modeThe vertical compare interrupt mode.
void LCDC_EnableInterrupts ( LCD_Type *  base,
uint32_t  mask 
)

Example to enable LCD base address update interrupt and vertical compare interrupt:

Parameters
baseLCD peripheral base address.
maskInterrupts to enable, it is OR'ed value of _lcdc_interrupts.
void LCDC_DisableInterrupts ( LCD_Type *  base,
uint32_t  mask 
)

Example to disable LCD base address update interrupt and vertical compare interrupt:

Parameters
baseLCD peripheral base address.
maskInterrupts to disable, it is OR'ed value of _lcdc_interrupts.
uint32_t LCDC_GetInterruptsPendingStatus ( LCD_Type *  base)

Example:

uint32_t status;
{
// LCD base address update interrupt occurred.
}
{
// LCD vertical compare interrupt occurred.
}
Parameters
baseLCD peripheral base address.
Returns
Interrupts pending status, it is OR'ed value of _lcdc_interrupts.
uint32_t LCDC_GetEnabledInterruptsPendingStatus ( LCD_Type *  base)

This function is similar with LCDC_GetInterruptsPendingStatus, the only difference is, this function only returns the pending status of the interrupts that have been enabled using LCDC_EnableInterrupts.

Parameters
baseLCD peripheral base address.
Returns
Interrupts pending status, it is OR'ed value of _lcdc_interrupts.
void LCDC_ClearInterruptsStatus ( LCD_Type *  base,
uint32_t  mask 
)

Example to clear LCD base address update interrupt and vertical compare interrupt pending status:

Parameters
baseLCD peripheral base address.
maskInterrupts to disable, it is OR'ed value of _lcdc_interrupts.
void LCDC_SetCursorConfig ( LCD_Type *  base,
const lcdc_cursor_config_t config 
)

This function should be called before enabling the hardware cursor. It supports initializing multiple cursor images at a time when using 32x32 pixels cursor.

For example:

uint32_t cursor0Img[LCDC_CURSOR_IMG_32X32_WORDS] = {...};
uint32_t cursor2Img[LCDC_CURSOR_IMG_32X32_WORDS] = {...};
lcdc_cursor_config_t cursorConfig;
cursorConfig.image[0] = cursor0Img;
cursorConfig.image[2] = cursor2Img;
LCDC_SetCursorConfig(LCD, &cursorConfig);

In this example, cursor 0 and cursor 2 image data are initialized, but cursor 1 and cursor 3 image data are not initialized because image[1] and image[2] are all NULL. With this, application could initializes all cursor images it will use at the beginning and call LCDC_SetCursorImage directly to display the one which it needs.

Parameters
baseLCD peripheral base address.
configPointer to the hardware cursor configuration structure.
void LCDC_CursorGetDefaultConfig ( lcdc_cursor_config_t config)

The default configuration values are:

config->size = kLCDC_CursorSize32;
config->syncMode = kLCDC_CursorAsync;
config->palette0.red = 0U;
config->palette0.green = 0U;
config->palette0.blue = 0U;
config->palette1.red = 255U;
config->palette1.green = 255U;
config->palette1.blue = 255U;
config->image[0] = (uint32_t *)0;
config->image[1] = (uint32_t *)0;
config->image[2] = (uint32_t *)0;
config->image[3] = (uint32_t *)0;
Parameters
configPointer to the hardware cursor configuration structure.
static void LCDC_EnableCursor ( LCD_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseLCD peripheral base address.
enableTrue to enable, false to disable.
static void LCDC_ChooseCursor ( LCD_Type *  base,
uint8_t  index 
)
inlinestatic

When using 32x32 cursor, the number of cursors supports is LCDC_CURSOR_COUNT. When using 64x64 cursor, the LCD only supports one cursor. This function selects which cursor to display when using 32x32 cursor. When synchronization mode is kLCDC_CursorSync, the change effects in the next frame. When synchronization mode is * kLCDC_CursorAsync, change effects immediately.

Parameters
baseLCD peripheral base address.
indexIndex of the cursor to display.
Note
The function LCDC_SetCursorPosition must be called after this function to show the new cursor.
void LCDC_SetCursorPosition ( LCD_Type *  base,
int32_t  positionX,
int32_t  positionY 
)

When synchronization mode is kLCDC_CursorSync, position change effects in the next frame. When synchronization mode is kLCDC_CursorAsync, position change effects immediately.

Parameters
baseLCD peripheral base address.
positionXX ordinate of the cursor top-left measured in pixels
positionYY ordinate of the cursor top-left measured in pixels
void LCDC_SetCursorImage ( LCD_Type *  base,
lcdc_cursor_size_t  size,
uint8_t  index,
const uint32_t *  image 
)

The interrupt kLCDC_CursorInterrupt indicates that last cursor pixel is displayed. When the hardware cursor is enabled,

Parameters
baseLCD peripheral base address.
sizeThe cursor size.
indexIndex of the cursor to set when using 32x32 cursor.
imagePointer to the cursor image. When using 32x32 cursor, the image size should be LCDC_CURSOR_IMG_32X32_WORDS. When using 64x64 cursor, the image size should be LCDC_CURSOR_IMG_64X64_WORDS.

Variable Documentation

uint32_t lcdc_config_t::panelClock_Hz
uint16_t lcdc_config_t::ppl
uint8_t lcdc_config_t::hsw
uint8_t lcdc_config_t::hfp
uint8_t lcdc_config_t::hbp
uint16_t lcdc_config_t::lpp
uint8_t lcdc_config_t::vsw
uint8_t lcdc_config_t::vfp
uint8_t lcdc_config_t::vbp
uint8_t lcdc_config_t::acBiasFreq

Only used for STN display.

uint16_t lcdc_config_t::polarityFlags
bool lcdc_config_t::enableLineEnd
uint8_t lcdc_config_t::lineEndDelay
uint32_t lcdc_config_t::upperPanelAddr
uint32_t lcdc_config_t::lowerPanelAddr
lcdc_bpp_t lcdc_config_t::bpp
lcdc_data_format_t lcdc_config_t::dataFormat
bool lcdc_config_t::swapRedBlue
lcdc_display_t lcdc_config_t::display
uint8_t lcdc_cursor_palette_t::red
uint8_t lcdc_cursor_palette_t::green
uint8_t lcdc_cursor_palette_t::blue
lcdc_cursor_size_t lcdc_cursor_config_t::size
lcdc_cursor_sync_mode_t lcdc_cursor_config_t::syncMode
lcdc_cursor_palette_t lcdc_cursor_config_t::palette0
lcdc_cursor_palette_t lcdc_cursor_config_t::palette1
uint32_t* lcdc_cursor_config_t::image[LCDC_CURSOR_COUNT]