LCD - Liquid Crystal Display#
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.
Modules#
Enumerations#
MUX setting.
Wave type.
Bias setting.
VLCD Voltage Source.
Contrast Configuration.
Voltage Boost Level - Data sheets document setting for each part number.
Frame Counter Clock Prescaler, FC-CLK = FrameRate (Hz) / this factor.
Segment selection.
Update Data Control.
Animation Shift operation; none, left or right.
Animation Logic Control, how AReg and BReg should be combined.
Functions#
Initialize the Liquid Crystal Display (LCD) controller.
Select a source for VLCD.
Configure Update Control.
Initialize the LCD Frame Counter.
Configure the LCD controller Animation feature.
Enables updating this range of LCD segment lines.
Turn on or clear a segment.
Update 0-31 lowest segments on a given COM-line in one operation according to the bit mask.
Configure the contrast level on the LCD panel.
Configure the bias level on the LCD panel.
Configure voltage booster.
Configure the bias level for a specific segment line for Direct Segment Control.
Configure the bias level for a specific segment line.
Enable or disable LCD controller.
Enable or disable LCD Animation feature.
Enable or disable the LCD blink.
Disable all segments while keeping segment state.
Enable or disable LCD Frame counter.
Return the current animation state.
Return the current blink state.
When set, LCD registers will not be updated until cleared.
Return SYNCBUSY bits, indicating which registers have pending updates.
Poll LCD SYNCBUSY flags until the flag has been cleared.
Get pending LCD interrupt flags.
Get enabled and pending LCD interrupt flags.
Set one or more pending LCD interrupts from SW.
Enable LCD interrupts.
Disable LCD interrupts.
Clear one or more interrupt flags.
Enable or disable LCD Direct Segment Control.
Macros#
Default Clock Prescaler.
Default LCD Frame Rate Divisor.
Default LCD Contrast.
Default configuration for LCD initialization structure, enables 160 segments.
Frame counter uses a maximum of 5 bits (FCTOP[5:0]).
Enumeration Documentation#
LCD_Mux_TypeDef#
LCD_Mux_TypeDef
MUX setting.
Enumerator | |
---|---|
lcdMuxStatic | Static (segments can be multiplexed with LCD_COM[0]). |
lcdMuxDuplex | Duplex / 1/2 Duty cycle (segments can be multiplexed with LCD_COM[0:1]). |
lcdMuxTriplex | Triplex / 1/3 Duty cycle (segments can be multiplexed with LCD_COM[0:2]). |
lcdMuxQuadruplex | Quadruplex / 1/4 Duty cycle (segments can be multiplexed with LCD_COM[0:3]). |
lcdMuxSextaplex | Sextaplex / 1/6 Duty cycle (segments can be multiplexed with LCD_COM[0:5]). |
lcdMuxOctaplex | Octaplex / 1/8 Duty cycle (segments can be multiplexed with LCD_COM[0:7]). |
76
of file platform/emlib/inc/em_lcd.h
LCD_Wave_TypeDef#
LCD_Wave_TypeDef
Wave type.
Enumerator | |
---|---|
lcdWaveLowPower | Low power optimized waveform output. |
lcdWaveNormal | Regular waveform output. |
99
of file platform/emlib/inc/em_lcd.h
LCD_Bias_TypeDef#
LCD_Bias_TypeDef
Bias setting.
Enumerator | |
---|---|
lcdBiasStatic | Static (2 levels). |
lcdBiasOneHalf | 1/2 Bias (3 levels). |
lcdBiasOneThird | 1/3 Bias (4 levels). |
lcdBiasOneFourth | 1/4 Bias (5 levels). |
114
of file platform/emlib/inc/em_lcd.h
LCD_VLCDSel_TypeDef#
LCD_VLCDSel_TypeDef
VLCD Voltage Source.
Enumerator | |
---|---|
lcdVLCDSelVDD | VLCD Powered by VDD. |
lcdVLCDSelVExtBoost | VLCD Powered by external VDD / Voltage Boost. |
129
of file platform/emlib/inc/em_lcd.h
LCD_ConConf_TypeDef#
LCD_ConConf_TypeDef
Contrast Configuration.
Enumerator | |
---|---|
lcdConConfVLCD | Contrast is adjusted relative to VDD (VLCD). |
lcdConConfGND | Contrast is adjusted relative to Ground. |
139
of file platform/emlib/inc/em_lcd.h
LCD_VBoostLevel_TypeDef#
LCD_VBoostLevel_TypeDef
Voltage Boost Level - Data sheets document setting for each part number.
Enumerator | |
---|---|
lcdVBoostLevel0 | Voltage boost LEVEL0. |
lcdVBoostLevel1 | Voltage boost LEVEL1. |
lcdVBoostLevel2 | Voltage boost LEVEL2. |
lcdVBoostLevel3 | Voltage boost LEVEL3. |
lcdVBoostLevel4 | Voltage boost LEVEL4. |
lcdVBoostLevel5 | Voltage boost LEVEL5. |
lcdVBoostLevel6 | Voltage boost LEVEL6. |
lcdVBoostLevel7 | Voltage boost LEVEL7. |
149
of file platform/emlib/inc/em_lcd.h
LCD_FCPreScale_TypeDef#
LCD_FCPreScale_TypeDef
Frame Counter Clock Prescaler, FC-CLK = FrameRate (Hz) / this factor.
Enumerator | |
---|---|
lcdFCPrescDiv1 | Prescale Div 1. |
lcdFCPrescDiv2 | Prescale Div 2. |
lcdFCPrescDiv4 | Prescale Div 4. |
lcdFCPrescDiv8 | Prescale Div 8. |
176
of file platform/emlib/inc/em_lcd.h
LCD_SegmentRange_TypeDef#
LCD_SegmentRange_TypeDef
Segment selection.
Enumerator | |
---|---|
lcdSegment0_3 | Select segment lines 0 to 3. |
lcdSegment4_7 | Select segment lines 4 to 7. |
lcdSegment8_11 | Select segment lines 8 to 11. |
lcdSegment12_15 | Select segment lines 12 to 15. |
lcdSegment16_19 | Select segment lines 16 to 19. |
lcdSegment20_23 | Select segment lines 20 to 23. |
lcdSegmentAll | Select all segment lines. |
200
of file platform/emlib/inc/em_lcd.h
LCD_UpdateCtrl_TypeDef#
LCD_UpdateCtrl_TypeDef
Update Data Control.
Enumerator | |
---|---|
lcdUpdateCtrlRegular | Regular update, data transfer done immediately. |
lcdUpdateCtrlFCEvent | Data transfer done at Frame Counter event. |
lcdUpdateCtrlFrameStart | Data transfer done at Frame Start. |
232
of file platform/emlib/inc/em_lcd.h
LCD_AnimShift_TypeDef#
LCD_AnimShift_TypeDef
Animation Shift operation; none, left or right.
Enumerator | |
---|---|
lcdAnimShiftNone | No shift. |
lcdAnimShiftLeft | Shift segment bits left. |
lcdAnimShiftRight | Shift segment bits right. |
284
of file platform/emlib/inc/em_lcd.h
LCD_AnimLogic_TypeDef#
LCD_AnimLogic_TypeDef
Animation Logic Control, how AReg and BReg should be combined.
Enumerator | |
---|---|
lcdAnimLogicAnd | Use bitwise logic AND to mix animation register A (AREGA) and B (AREGB). |
lcdAnimLogicOr | Use bitwise logic OR to mix animation register A (AREGA) and B (AREGB). |
294
of file platform/emlib/inc/em_lcd.h
Function Documentation#
LCD_Init#
void LCD_Init (const LCD_Init_TypeDef * lcdInit)
Initialize the Liquid Crystal Display (LCD) controller.
[in] | lcdInit | A pointer to the initialization structure which configures the LCD controller. |
Configures the LCD controller. You must enable it afterwards, potentially configuring Frame Control and interrupts first according to requirements.
66
of file platform/emlib/src/em_lcd.c
LCD_VLCDSelect#
void LCD_VLCDSelect (LCD_VLCDSel_TypeDef vlcd)
Select a source for VLCD.
[in] | vlcd | Select a source for the VLCD voltage. |
144
of file platform/emlib/src/em_lcd.c
LCD_UpdateCtrl#
void LCD_UpdateCtrl (LCD_UpdateCtrl_TypeDef ud)
Configure Update Control.
[in] | ud | Configures the LCD update method. |
172
of file platform/emlib/src/em_lcd.c
LCD_FrameCountInit#
void LCD_FrameCountInit (const LCD_FrameCountInit_TypeDef * fcInit)
Initialize the LCD Frame Counter.
[in] | fcInit | A pointer to the Frame Counter initialization structure. |
191
of file platform/emlib/src/em_lcd.c
LCD_AnimInit#
void LCD_AnimInit (const LCD_AnimInit_TypeDef * animInit)
Configure the LCD controller Animation feature.
[in] | animInit | A pointer to the LCD Animation initialization structure. |
235
of file platform/emlib/src/em_lcd.c
LCD_SegmentRangeEnable#
void LCD_SegmentRangeEnable (LCD_SegmentRange_TypeDef segmentRange, bool enable)
Enables updating this range of LCD segment lines.
[in] | segmentRange | A range of 4 LCD segment lines to enable or disable for all enabled COM lines. |
[in] | enable | Boolean true to enable segment updates, false to disable updates. |
280
of file platform/emlib/src/em_lcd.c
LCD_SegmentSet#
void LCD_SegmentSet (int com, int bit, bool enable)
Turn on or clear a segment.
[in] | com | A COM line to change. |
[in] | bit | A bit index indicating which field to change. |
[in] | enable | True will set segment, false will clear segment. |
Note
For the Gecko Family, the maximum configuration is (COM-lines x Segment-Lines) 4x40. For the Tiny Gecko Family, the maximum configuration is 8x20 or 4x24. For the Giant Gecko Family, the maximum configuration is 8x36 or 4x40. For the Series 2 Family, the maximum configuration is 4x20. For the Series 2 xG28, the maximum configuration is 8x24 or 4x28.
420
of file platform/emlib/src/em_lcd.c
LCD_SegmentSetLow#
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.
[in] | com | Indicates a COM line to update. |
[in] | mask | A bit mask for segments 0-31. |
[in] | bits | A bit pattern for segments 0-31. |
684
of file platform/emlib/src/em_lcd.c
LCD_ContrastSet#
void LCD_ContrastSet (int level)
Configure the contrast level on the LCD panel.
[in] | level | The contrast level in range 0-63. |
936
of file platform/emlib/src/em_lcd.c
LCD_BiasSet#
void LCD_BiasSet (LCD_Bias_TypeDef bias)
Configure the bias level on the LCD panel.
[in] | bias | The bias level. |
964
of file platform/emlib/src/em_lcd.c
LCD_VBoostSet#
void LCD_VBoostSet (LCD_VBoostLevel_TypeDef vboost)
Configure voltage booster.
[in] | vboost | Voltage boost level |
The resulting voltage level is described in each part number's data sheet
988
of file platform/emlib/src/em_lcd.c
LCD_BiasSegmentSet#
void LCD_BiasSegmentSet (int segmentLine, int biasLevel)
Configure the bias level for a specific segment line for Direct Segment Control.
[in] | segmentLine | A segment line number. |
[in] | biasLevel | The bias configuration level. This value must be within the constraints defined by the LCD_DISPCTRL bias settings. For more information, see the applicable Reference Manual and data sheet. |
Note
When DSC is active, each configuration takes up 4 bits in the corresponding Segment Registers (SEGD0L/SEGD1H for Series 0 and 1, SEGDx/SEGDxH for Series 2) which defines the bias level. For optimal use of this feature, the entire SEGD-registers should be set at once in an optimized routine. Therefore, this function shows how to correctly configure the bias levels and should be used with care.
1016
of file platform/emlib/src/em_lcd.c
LCD_BiasComSet#
void LCD_BiasComSet (int comLine, int biasLevel)
Configure the bias level for a specific segment line.
[in] | comLine | A COM line number, between 0 and 7 for Series 0 and 1. For Series 2, max is LCD_COM_NUM, defined in device-specific headers. |
[in] | biasLevel | The bias configuration level. This value must be within the constraints defined by the LCD_DISPCTRL bias settings. For more information, see the appropriate Reference Manual and data sheet. |
Note
When DSC is active, each configuration takes up 4 bits in the corresponding Segment Registers (SEGD4L/SEGD4H for Series 0 and 1, AREGA/AREGB for Series 2) which defines bias level. For optimal use of this feature, the entire register set should be set at once in a optimized routine. Therefore, this function shows how to correctly configure the bias levels and should be used with care.
1205
of file platform/emlib/src/em_lcd.c
LCD_Enable#
void LCD_Enable (bool enable)
Enable or disable LCD controller.
[in] | enable | If true, enables LCD controller with current configuration. If false, disables LCD controller. Enable CMU clock for LCD for correct operation. |
522
of file platform/emlib/inc/em_lcd.h
LCD_AnimEnable#
void LCD_AnimEnable (bool enable)
Enable or disable LCD Animation feature.
[in] | enable | Boolean true enables animation, false disables animation. |
576
of file platform/emlib/inc/em_lcd.h
LCD_BlinkEnable#
void LCD_BlinkEnable (bool enable)
Enable or disable the LCD blink.
[in] | enable | Boolean true enables blink, false disables blink. |
600
of file platform/emlib/inc/em_lcd.h
LCD_BlankEnable#
void LCD_BlankEnable (bool enable)
Disable all segments while keeping segment state.
[in] | enable | Boolean true clears all segments, boolean false restores all segment lines. |
624
of file platform/emlib/inc/em_lcd.h
LCD_FrameCountEnable#
void LCD_FrameCountEnable (bool enable)
Enable or disable LCD Frame counter.
[in] | enable | Boolean true enables frame counter, false disables frame counter. |
648
of file platform/emlib/inc/em_lcd.h
LCD_AnimState#
int LCD_AnimState (void )
Return the current animation state.
N/A |
Returns
Animation state, in range 0-15.
698
of file platform/emlib/inc/em_lcd.h
LCD_BlinkState#
int LCD_BlinkState (void )
Return the current blink state.
N/A |
Returns
Return value is 1 if segments are enabled, 0 if disabled.
710
of file platform/emlib/inc/em_lcd.h
LCD_FreezeEnable#
void LCD_FreezeEnable (bool enable)
When set, LCD registers will not be updated until cleared.
[in] | enable | When enable is true, update is stopped; when false, all registers are updated. |
724
of file platform/emlib/inc/em_lcd.h
LCD_SyncBusyGet#
uint32_t LCD_SyncBusyGet (void )
Return SYNCBUSY bits, indicating which registers have pending updates.
N/A |
Returns
Bit fields for LCD registers that have pending updates.
742
of file platform/emlib/inc/em_lcd.h
LCD_SyncBusyDelay#
void LCD_SyncBusyDelay (uint32_t flags)
Poll LCD SYNCBUSY flags until the flag has been cleared.
[in] | flags | Bit fields for LCD registers that will be updated before we continue. |
756
of file platform/emlib/inc/em_lcd.h
LCD_IntGet#
uint32_t LCD_IntGet (void )
Get pending LCD interrupt flags.
N/A |
Returns
Pending LCD interrupt sources. Returns a set of interrupt flags OR-ed together for multiple interrupt sources in the LCD module (LCD_IFS_nnn).
827
of file platform/emlib/inc/em_lcd.h
LCD_IntGetEnabled#
uint32_t LCD_IntGetEnabled (void )
Get enabled and pending LCD interrupt flags.
N/A |
Useful for handling more interrupt sources in the same interrupt handler.
Note
Event bits are not cleared by the use of this function.
Returns
Pending and enabled LCD interrupt sources. Return value is the bitwise AND combination of
the OR combination of enabled interrupt sources in LCD_IEN_nnn register (LCD_IEN_nnn) and
the bitwise OR combination of valid interrupt flags of LCD module (LCD_IF_nnn).
850
of file platform/emlib/inc/em_lcd.h
LCD_IntSet#
void LCD_IntSet (uint32_t flags)
Set one or more pending LCD interrupts from SW.
[in] | flags | LCD interrupt sources to set to pending. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for the LCD module (LCD_IFS_nnn). |
871
of file platform/emlib/inc/em_lcd.h
LCD_IntEnable#
void LCD_IntEnable (uint32_t flags)
Enable LCD interrupts.
[in] | flags | LCD interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for LCD module (LCD_IFS_nnn). |
893
of file platform/emlib/inc/em_lcd.h
LCD_IntDisable#
void LCD_IntDisable (uint32_t flags)
Disable LCD interrupts.
[in] | flags | LCD interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources for LCD module (LCD_IFS_nnn). |
911
of file platform/emlib/inc/em_lcd.h
LCD_IntClear#
void LCD_IntClear (uint32_t flags)
Clear one or more interrupt flags.
[in] | flags | LCD interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources for LCD module (LCD_IFS_nnn). |
929
of file platform/emlib/inc/em_lcd.h
LCD_DSCEnable#
void LCD_DSCEnable (bool enable)
Enable or disable LCD Direct Segment Control.
[in] | enable | If true, enables LCD controller Direct Segment Control Segment and COM line bias levels need to be set explicitly with LCD_BiasSegmentSet() and LCD_BiasComSet() function calls respectively. |
952
of file platform/emlib/inc/em_lcd.h
Macro Definition Documentation#
LCD_DEFAULT_CLOCK_PRESCALER#
#define LCD_DEFAULT_CLOCK_PRESCALERValue:
64
Default Clock Prescaler.
54
of file platform/emlib/inc/em_lcd.h
LCD_DEFAULT_FRAME_RATE_DIV#
#define LCD_DEFAULT_FRAME_RATE_DIVValue:
4
Default LCD Frame Rate Divisor.
56
of file platform/emlib/inc/em_lcd.h
LCD_DEFAULT_CONTRAST#
#define LCD_DEFAULT_CONTRASTValue:
15
Default LCD Contrast.
58
of file platform/emlib/inc/em_lcd.h
LCD_INIT_DEFAULT#
#define LCD_INIT_DEFAULTValue:
Default configuration for LCD initialization structure, enables 160 segments.
404
of file platform/emlib/inc/em_lcd.h
LCD_FRAME_COUNTER_VAL_MAX#
#define LCD_FRAME_COUNTER_VAL_MAXValue:
64
Frame counter uses a maximum of 5 bits (FCTOP[5:0]).
51
of file platform/emlib/src/em_lcd.c