LCD - Liquid Crystal Display

Description

Liquid Crystal Display (LCD) Peripheral API.

This module contains functions to control the LDC peripheral of Silicon Labs 32-bit MCUs and SoCs. The LCD driver can drive up to 8x36 segmented LCD directly. The animation feature makes it possible to have active animations without the CPU intervention.

Data Structures

struct LCD_AnimInit_TypeDef
LCD Animation Configuration.
struct LCD_FrameCountInit_TypeDef
LCD Frame Control Initialization.
struct LCD_Init_TypeDef
LCD Controller Initialization structure.

Functions

void LCD_Init (const LCD_Init_TypeDef *lcdInit)
Initialize the Liquid Crystal Display (LCD) controller.
void LCD_VLCDSelect ( LCD_VLCDSel_TypeDef vlcd)
Select a source for VLCD.
void LCD_UpdateCtrl ( LCD_UpdateCtrl_TypeDef ud)
Configure Update Control.
void LCD_FrameCountInit (const LCD_FrameCountInit_TypeDef *fcInit)
Initialize the LCD Frame Counter.
void LCD_AnimInit (const LCD_AnimInit_TypeDef *animInit)
Configure the LCD controller Animation feature.
void LCD_SegmentRangeEnable ( LCD_SegmentRange_TypeDef segmentRange, bool enable)
Enables updating this range of LCD segment lines.
void LCD_SegmentSet (int com, int bit, bool enable)
Turn on or clear a segment.
void LCD_SegmentSetLow (int com, uint32_t mask, uint32_t bits)
Update 0-31 lowest segments on a given COM-line in one operation according to the bit mask.
void LCD_SegmentSetHigh (int com, uint32_t mask, uint32_t bits)
Update the high (32-39) segments on a given COM-line in one operation.
void LCD_ContrastSet (int level)
Configure the contrast level on the LCD panel.
void LCD_BiasSet ( LCD_Bias_TypeDef bias)
Configure the bias level on the LCD panel.
void LCD_VBoostSet ( LCD_VBoostLevel_TypeDef vboost)
Configure voltage booster.
void LCD_BiasSegmentSet (int segmentLine, int biasLevel)
Configure the bias level for a specific segment line for Direct Segment Control.
void LCD_BiasComSet (int comLine, int biasLevel)
Configure the bias level for a specific segment line.
void LCD_Enable (bool enable)
Enable or disable LCD controller.
void LCD_AnimEnable (bool enable)
Enables or disables LCD Animation feature.
void LCD_BlinkEnable (bool enable)
Enables or disables LCD blink.
void LCD_BlankEnable (bool enable)
Disables all segments, while keeping segment state.
void LCD_FrameCountEnable (bool enable)
Enables or disables LCD Frame counter.
int LCD_AnimState (void)
Returns current animation state.
int LCD_BlinkState (void)
Returns current blink state.
void LCD_FreezeEnable (bool enable)
When set, LCD registers will not be updated until cleared.
uint32_t LCD_SyncBusyGet (void)
Returns SYNCBUSY bits, indicating which registers have pending updates.
void LCD_SyncBusyDelay (uint32_t flags)
Polls LCD SYNCBUSY flags, until flag has been cleared.
uint32_t LCD_IntGet (void)
Get pending LCD interrupt flags.
uint32_t LCD_IntGetEnabled (void)
Get enabled and pending LCD interrupt flags.
void LCD_IntSet (uint32_t flags)
Set one or more pending LCD interrupts from SW.
void LCD_IntEnable (uint32_t flags)
Enable LCD interrupts.
void LCD_IntDisable (uint32_t flags)
Disable LCD interrupts.
void LCD_IntClear (uint32_t flags)
Clear one or more interrupt flags.
void LCD_DSCEnable (bool enable)
Enable or disable LCD Direct Segment Control.

Macros

#define LCD_FRAME_COUNTER_VAL_MAX 64
#define LCD_DEFAULT_FRAME_RATE_DIV 4
Default LCD Frame Rate Divisor.
#define LCD_DEFAULT_CONTRAST 15
Default LCD Contrast.
#define LCD_INIT_DEFAULT
Default configuration for LCD initialization structure, enables 160 segments.

Enumerations

enum LCD_Mux_TypeDef {
lcdMuxStatic = LCD_DISPCTRL_MUX_STATIC,
lcdMuxDuplex = LCD_DISPCTRL_MUX_DUPLEX,
lcdMuxTriplex = LCD_DISPCTRL_MUX_TRIPLEX,
lcdMuxQuadruplex = LCD_DISPCTRL_MUX_QUADRUPLEX,
lcdMuxSextaplex = LCD_DISPCTRL_MUXE_MUXE | LCD_DISPCTRL_MUX_DUPLEX,
lcdMuxOctaplex = LCD_DISPCTRL_MUXE_MUXE | LCD_DISPCTRL_MUX_QUADRUPLEX
}
MUX setting.
enum LCD_Wave_TypeDef {
lcdWaveLowPower = LCD_DISPCTRL_WAVE_LOWPOWER,
lcdWaveNormal = LCD_DISPCTRL_WAVE_NORMAL
}
Wave type.
enum LCD_Bias_TypeDef {
lcdBiasStatic = LCD_DISPCTRL_BIAS_STATIC,
lcdBiasOneHalf = LCD_DISPCTRL_BIAS_ONEHALF,
lcdBiasOneThird = LCD_DISPCTRL_BIAS_ONETHIRD,
lcdBiasOneFourth = LCD_DISPCTRL_BIAS_ONEFOURTH
}
Bias setting.
enum LCD_VLCDSel_TypeDef {
lcdVLCDSelVDD = LCD_DISPCTRL_VLCDSEL_VDD,
lcdVLCDSelVExtBoost = LCD_DISPCTRL_VLCDSEL_VEXTBOOST
}
VLCD Voltage Source.
enum LCD_ConConf_TypeDef {
lcdConConfVLCD = LCD_DISPCTRL_CONCONF_VLCD,
lcdConConfGND = LCD_DISPCTRL_CONCONF_GND
}
Contrast Configuration.
enum LCD_VBoostLevel_TypeDef {
lcdVBoostLevel0 = LCD_DISPCTRL_VBLEV_LEVEL0,
lcdVBoostLevel1 = LCD_DISPCTRL_VBLEV_LEVEL1,
lcdVBoostLevel2 = LCD_DISPCTRL_VBLEV_LEVEL2,
lcdVBoostLevel3 = LCD_DISPCTRL_VBLEV_LEVEL3,
lcdVBoostLevel4 = LCD_DISPCTRL_VBLEV_LEVEL4,
lcdVBoostLevel5 = LCD_DISPCTRL_VBLEV_LEVEL5,
lcdVBoostLevel6 = LCD_DISPCTRL_VBLEV_LEVEL6,
lcdVBoostLevel7 = LCD_DISPCTRL_VBLEV_LEVEL7
}
Voltage Boost Level - Data sheets document setting for each part number.
enum LCD_FCPreScale_TypeDef {
lcdFCPrescDiv1 = LCD_BACTRL_FCPRESC_DIV1,
lcdFCPrescDiv2 = LCD_BACTRL_FCPRESC_DIV2,
lcdFCPrescDiv4 = LCD_BACTRL_FCPRESC_DIV4,
lcdFCPrescDiv8 = LCD_BACTRL_FCPRESC_DIV8
}
Frame Counter Clock Prescaler, FC-CLK = FrameRate (Hz) / this factor.
enum LCD_SegmentRange_TypeDef {
lcdSegment0_3 = (1 << 0),
lcdSegment4_7 = (1 << 1),
lcdSegment8_11 = (1 << 2),
lcdSegment12_15 = (1 << 3),
lcdSegment16_19 = (1 << 4),
lcdSegment20_23 = (1 << 5),
lcdSegment24_27 = (1 << 6),
lcdSegment28_31 = (1 << 7),
lcdSegment32_35 = (1 << 8),
lcdSegment36_39 = (1 << 9),
lcdSegmentAll = (0x03ff)
}
Segment selection.
enum LCD_UpdateCtrl_TypeDef {
lcdUpdateCtrlRegular = LCD_CTRL_UDCTRL_REGULAR,
lcdUpdateCtrlFCEvent = LCD_CTRL_UDCTRL_FCEVENT,
lcdUpdateCtrlFrameStart = LCD_CTRL_UDCTRL_FRAMESTART
}
Update Data Control.
enum LCD_AnimShift_TypeDef {
lcdAnimShiftNone = _LCD_BACTRL_AREGASC_NOSHIFT,
lcdAnimShiftLeft = _LCD_BACTRL_AREGASC_SHIFTLEFT,
lcdAnimShiftRight = _LCD_BACTRL_AREGASC_SHIFTRIGHT
}
Animation Shift operation; none, left or right.
enum LCD_AnimLogic_TypeDef {
lcdAnimLogicAnd = LCD_BACTRL_ALOGSEL_AND,
lcdAnimLogicOr = LCD_BACTRL_ALOGSEL_OR
}
Animation Logic Control, how AReg and BReg should be combined.
enum LCD_AnimLoc_TypeDef {
lcdAnimLocSeg0To7 = LCD_BACTRL_ALOC_SEG0TO7,
lcdAnimLocSeg8To15 = LCD_BACTRL_ALOC_SEG8TO15
}
Animation Location, set the LCD segments which animation applies to.

Function Documentation

LCD_Init()

void LCD_Init ( const LCD_Init_TypeDef * lcdInit )

Initialize the Liquid Crystal Display (LCD) controller.

Configures the LCD controller. You must enable it afterwards, potentially configuring Frame Control and interrupts first according to requirements.

Parameters
[in] lcdInit A pointer to the initialization structure which configures the LCD controller.

LCD_VLCDSelect()

void LCD_VLCDSelect ( LCD_VLCDSel_TypeDef vlcd )

Select a source for VLCD.

Parameters
[in] vlcd Select a source for the VLCD voltage.

LCD_UpdateCtrl()

void LCD_UpdateCtrl ( LCD_UpdateCtrl_TypeDef ud )

Configure Update Control.

Parameters
[in] ud Configures the LCD update method.

LCD_FrameCountInit()

void LCD_FrameCountInit ( const LCD_FrameCountInit_TypeDef * fcInit )

Initialize the LCD Frame Counter.

Parameters
[in] fcInit A pointer to the Frame Counter initialization structure.

LCD_AnimInit()

void LCD_AnimInit ( const LCD_AnimInit_TypeDef * animInit )

Configure the LCD controller Animation feature.

Parameters
[in] animInit A pointer to the LCD Animation initialization structure.

LCD_SegmentRangeEnable()

void LCD_SegmentRangeEnable ( LCD_SegmentRange_TypeDef segmentRange,
bool enable
)

Enables updating this range of LCD segment lines.

Parameters
[in] segmentRange A range of 4 LCD segment lines