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_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_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_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_ModeSet ( LCD_Mode_Typedef mode) |
Configure the mode for the LCD panel.
|
|
void | LCD_ChargeRedistributionCyclesSet (uint8_t cycles) |
Configure the charge redistribution cycles for the LCD panel.
|
|
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 Control.
|
|
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_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_MUX_SEXTAPLEX, lcdMuxOctaplex = LCD_DISPCTRL_MUX_OCTAPLEX } |
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_Mode_Typedef
{
lcdModeNoExtCap = LCD_DISPCTRL_MODE_NOEXTCAP, lcdModeStepDown = LCD_DISPCTRL_MODE_STEPDOWN, lcdModeCpIntOsc = LCD_DISPCTRL_MODE_CPINTOSC } |
Contrast Configuration.
|
|
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_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_ChargeRedistribution_TypeDef
{
lcdChargeRedistributionDisable = LCD_DISPCTRL_CHGRDST_DISABLE, lcdChargeRedistributionEnable = LCD_DISPCTRL_CHGRDST_ONE } |
Charge redistribution control.
|
|
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_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_SegmentSet()
void LCD_SegmentSet | ( | int |
com,
|
int |
bit,
|
||
bool |
enable
|
||
) |
Turn on or clear a 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.
- Parameters
-
[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.
◆ 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.
- Parameters
-
[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.
◆ LCD_SegmentSetHigh()
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.
- Parameters
-
[in] com
Indicates a COM line to update. [in] mask
A bit mask for segments 32-39. [in] bits
A bit pattern for segments 32-39.
◆ LCD_ContrastSet()
void LCD_ContrastSet | ( | int |
level
|
) |
Configure the contrast level on the LCD panel.
- Parameters
-
[in] level
The contrast level in range 0-63.
◆ LCD_BiasSet()
void LCD_BiasSet | ( | LCD_Bias_TypeDef |
bias
|
) |
Configure the bias level on the LCD panel.
- Parameters
-
[in] bias
The bias level.
◆ LCD_BiasSegmentSet()
void LCD_BiasSegmentSet | ( | int |
segmentLine,
|
int |
biasLevel
|
||
) |
Configure the bias level for a specific segment line for Direct Segment Control.
- Note
- When DSC is active, each configuration takes up 4 bits in the Segment Registers (SEGD0L/SEGD1H) 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.
- Parameters
-
[in] segmentLine
A segment line number. [in] biasLevel
The bias configuration level, 0-4. 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.
◆ LCD_BiasComSet()
void LCD_BiasComSet | ( | int |
comLine,
|
int |
biasLevel
|
||
) |
Configure the bias level for a specific segment line.
- Note
- When DSC is active, each configuration takes up 4 bits in the Segment Registers (SEGD4L/SEGD4H) which defines bias level. For optimal use of this feature, the entire SEGD-registers 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.
- Parameters
-
[in] comLine
A COM line number, 0-7. [in] biasLevel
The bias configuration level, 0-4. 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.
◆ LCD_ModeSet()
void LCD_ModeSet | ( | LCD_Mode_Typedef |
mode
|
) |
Configure the mode for the LCD panel.
- Parameters
-
[in] mode
A mode.
◆ LCD_ChargeRedistributionCyclesSet()
void LCD_ChargeRedistributionCyclesSet | ( | uint8_t |
cycles
|
) |
Configure the charge redistribution cycles for the LCD panel.
- Parameters
-
[in] cycles
Charge redistribution cycles, range 0-4.
◆ LCD_Enable()
|
inline |
Enable or disable LCD controller.
- Parameters
-
[in] enable
If true, enables LCD controller with current configuration. If false, disables LCD controller. Enable CMU clock for LCD for correct operation.
◆ LCD_AnimEnable()
|
inline |
Enables or disables LCD Animation feature.
- Parameters
-
[in] enable
Boolean true enables animation, false disables animation.
◆ LCD_BlinkEnable()
|
inline |
Enables or disables LCD blink.
- Parameters
-
[in] enable
Boolean true enables blink, false disables blink.
◆ LCD_BlankEnable()
|
inline |
Disables all segments, while keeping segment state.
- Parameters
-
[in] enable
Boolean true clears all segments, boolean false restores all segment lines.
◆ LCD_FrameCountEnable()
|
inline |
Enables or disables LCD Frame Control.
- Parameters
-
[in] enable
Boolean true enables frame counter, false disables frame counter.
◆ LCD_AnimState()
|
inline |
Returns current animation state.
- Returns
- Animation state, in range 0-15.
◆ LCD_BlinkState()
|
inline |
Returns current blink state.
- Returns
- Return value is 1 if segments are enabled, 0 if disabled.
◆ LCD_FreezeEnable()
|
inline |
When set, LCD registers will not be updated until cleared.
- Parameters
-
[in] enable
When enable is true, update is stopped; when false, all registers are updated.
◆ LCD_SyncBusyGet()
|
inline |
Returns SYNCBUSY bits, indicating which registers have pending updates.
- Returns
- Bit fields for LCD registers that have pending updates.
◆ LCD_SyncBusyDelay()
|
inline |
Polls LCD SYNCBUSY flags, until flag has been cleared.
- Parameters
-
[in] flags
Bit fields for LCD registers that will be updated before we continue.
◆ LCD_IntGet()
|
inline |
Get pending LCD interrupt flags.
- 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).
◆ LCD_IntGetEnabled()
|
inline |
Get enabled and pending LCD interrupt flags.
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).
◆ LCD_IntSet()
|
inline |
Set one or more pending LCD interrupts from SW.
- Parameters
-
[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).
◆ LCD_IntEnable()
|
inline |
Enable LCD interrupts.
- Parameters
-
[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).
◆ LCD_IntDisable()
|
inline |
Disable LCD interrupts.
- Parameters
-
[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).
◆ LCD_IntClear()
|
inline |
Clear one or more interrupt flags.
- Parameters
-
[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).
◆ LCD_DSCEnable()
|
inline |
Enable or disable LCD Direct Segment Control.
- Parameters
-
[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.
Macro Definition Documentation
◆ LCD_DEFAULT_FRAME_RATE_DIV
#define LCD_DEFAULT_FRAME_RATE_DIV 4 |
Default LCD Frame Rate Divisor.
◆ LCD_DEFAULT_CONTRAST
#define LCD_DEFAULT_CONTRAST 15 |
Default LCD Contrast.
◆ LCD_INIT_DEFAULT
#define LCD_INIT_DEFAULT |
Default configuration for LCD initialization structure, enables 160 segments.
Enumeration Type Documentation
◆ LCD_Mux_TypeDef
enum LCD_Mux_TypeDef |
MUX setting.
◆ LCD_Wave_TypeDef
enum LCD_Wave_TypeDef |
◆ LCD_Bias_TypeDef
enum LCD_Bias_TypeDef |
◆ LCD_Mode_Typedef
enum LCD_Mode_Typedef |