EFM32 Wonder Gecko Software Documentation  efm32wg-doc-4.2.1

Liquid Crystal Display (LCD) Peripheral API

. More...

Data Structures

struct  LCD_AnimInit_TypeDef
 
struct  LCD_FrameCountInit_TypeDef
 
struct  LCD_Init_TypeDef
 

Macros

#define LCD_INIT_DEFAULT
 

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
}
 
enum  LCD_Bias_TypeDef {
  lcdBiasStatic = LCD_DISPCTRL_BIAS_STATIC,
  lcdBiasOneHalf = LCD_DISPCTRL_BIAS_ONEHALF,
  lcdBiasOneThird = LCD_DISPCTRL_BIAS_ONETHIRD,
  lcdBiasOneFourth = LCD_DISPCTRL_BIAS_ONEFOURTH
}
 
enum  LCD_Wave_TypeDef {
  lcdWaveLowPower = LCD_DISPCTRL_WAVE_LOWPOWER,
  lcdWaveNormal = LCD_DISPCTRL_WAVE_NORMAL
}
 
enum  LCD_VLCDSel_TypeDef {
  lcdVLCDSelVDD = LCD_DISPCTRL_VLCDSEL_VDD,
  lcdVLCDSelVExtBoost = LCD_DISPCTRL_VLCDSEL_VEXTBOOST
}
 
enum  LCD_ConConf_TypeDef {
  lcdConConfVLCD = LCD_DISPCTRL_CONCONF_VLCD,
  lcdConConfGND = LCD_DISPCTRL_CONCONF_GND
}
 
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
}
 
enum  LCD_FCPreScale_TypeDef {
  lcdFCPrescDiv1 = LCD_BACTRL_FCPRESC_DIV1,
  lcdFCPrescDiv2 = LCD_BACTRL_FCPRESC_DIV2,
  lcdFCPrescDiv4 = LCD_BACTRL_FCPRESC_DIV4,
  lcdFCPrescDiv8 = LCD_BACTRL_FCPRESC_DIV8
}
 
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)
}
 
enum  LCD_UpdateCtrl_TypeDef {
  lcdUpdateCtrlRegular = LCD_CTRL_UDCTRL_REGULAR,
  lcdUpdateCtrlFCEvent = LCD_CTRL_UDCTRL_FCEVENT,
  lcdUpdateCtrlFrameStart = LCD_CTRL_UDCTRL_FRAMESTART
}
 
enum  LCD_AnimShift_TypeDef {
  lcdAnimShiftNone = _LCD_BACTRL_AREGASC_NOSHIFT,
  lcdAnimShiftLeft = _LCD_BACTRL_AREGASC_SHIFTLEFT,
  lcdAnimShiftRight = _LCD_BACTRL_AREGASC_SHIFTRIGHT
}
 
enum  LCD_AnimLogic_TypeDef {
  lcdAnimLogicAnd = LCD_BACTRL_ALOGSEL_AND,
  lcdAnimLogicOr = LCD_BACTRL_ALOGSEL_OR
}
 

Functions

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

Detailed Description

Macro Definition Documentation

#define LCD_INIT_DEFAULT
Value:

Default config for LCD init structure, enables 160 segments

Definition at line 265 of file em_lcd.h.

Enumeration Type Documentation

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/6 Duty cycle (segments can be multiplexed with LCD_COM[0:5])

Definition at line 61 of file em_lcd.h.

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)

Definition at line 80 of file em_lcd.h.

Wave type

Enumerator
lcdWaveLowPower 

Low power optimized waveform output

lcdWaveNormal 

Regular waveform output

Definition at line 95 of file em_lcd.h.

VLCD Voltage Source

Enumerator
lcdVLCDSelVDD 

VLCD Powered by VDD

lcdVLCDSelVExtBoost 

VLCD Powered by external VDD / Voltage Boost

Definition at line 104 of file em_lcd.h.

Contrast Configuration

Enumerator
lcdConConfVLCD 

Contrast is adjusted relative to VDD (VLCD)

lcdConConfGND 

Contrast is adjusted relative to Ground

Definition at line 113 of file em_lcd.h.

Voltage Boost Level - Datasheets 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

Definition at line 122 of file em_lcd.h.

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

Definition at line 135 of file em_lcd.h.

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

lcdSegment24_27 

Select segment lines 24 to 27

lcdSegment28_31 

Select segment lines 28 to 31

lcdSegment32_35 

Select segment lines 32 to 35

lcdSegment36_39 

Select segment lines 36 to 39

lcdSegmentAll 

Select all segment lines

Definition at line 148 of file em_lcd.h.

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

Definition at line 180 of file em_lcd.h.

Animation Shift operation; none, left or right

Enumerator
lcdAnimShiftNone 

No shift

lcdAnimShiftLeft 

Shift segment bits left

lcdAnimShiftRight 

Shift segment bits right

Definition at line 191 of file em_lcd.h.

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)

Definition at line 202 of file em_lcd.h.

Function Documentation

void LCD_Init ( const LCD_Init_TypeDef lcdInit)

This function call will only configure the LCD controller. You must enable it afterwards, potentially configuring Frame Control and interrupts first according to requirements.

Parameters
[in]lcdInitPointer to initialization structure which configures LCD controller.

Definition at line 62 of file em_lcd.c.

References _LCD_DISPCTRL_BIAS_MASK, _LCD_DISPCTRL_CONCONF_MASK, _LCD_DISPCTRL_MUX_MASK, _LCD_DISPCTRL_MUXE_MASK, _LCD_DISPCTRL_VLCDSEL_MASK, _LCD_DISPCTRL_WAVE_MASK, LCD_Init_TypeDef::bias, LCD_Init_TypeDef::contrast, LCD_Init_TypeDef::enable, LCD, LCD_Enable(), LCD_Init_TypeDef::mux, LCD_Init_TypeDef::vlcd, and LCD_Init_TypeDef::wave.

Referenced by SegmentLCD_Init().

void LCD_VLCDSelect ( LCD_VLCDSel_TypeDef  vlcd)
Parameters
[in]vlcdSelect source for VLD voltage

Definition at line 107 of file em_lcd.c.

References _LCD_DISPCTRL_VLCDSEL_MASK, LCD, LCD_DISPCTRL_VLCDSEL_VDD, LCD_DISPCTRL_VLCDSEL_VEXTBOOST, lcdVLCDSelVDD, and lcdVLCDSelVExtBoost.

Referenced by SegmentLCD_Init().

void LCD_UpdateCtrl ( LCD_UpdateCtrl_TypeDef  ud)
Parameters
[in]udConfigures LCD update method

Definition at line 136 of file em_lcd.c.

References _LCD_CTRL_UDCTRL_MASK, and LCD.

void LCD_FrameCountInit ( const LCD_FrameCountInit_TypeDef fcInit)
void LCD_SegmentRangeEnable ( LCD_SegmentRange_TypeDef  segmentRange,
bool  enable 
)
Parameters
[in]segmentRangeRange of 4 LCD segments lines to enable or disable, for all enabled COM lines
[in]enableBool true to enable segment updates, false to disable updates

Definition at line 229 of file em_lcd.c.

References LCD.

void LCD_SegmentSet ( int  com,
int  bit,
bool  enable 
)
Note
On Gecko Family, max configuration is (COM-lines x Segment-Lines) 4x40 On Tiny Family, max configuration is 8x20 or 4x24 On Giant Family, max configuration is 8x36 or 4x40
Parameters
[in]comCOM line to change
[in]bitBit index of which field to change
[in]enableWhen true will set segment, when false will clear segment

Definition at line 260 of file em_lcd.c.

References BUS_RegBitWrite(), and LCD.

Referenced by SegmentLCD_ARing(), SegmentLCD_Battery(), SegmentLCD_EnergyMode(), SegmentLCD_Number(), SegmentLCD_Symbol(), SegmentLCD_UnsignedHex(), and SegmentLCD_Write().

void LCD_SegmentSetLow ( int  com,
uint32_t  mask,
uint32_t  bits 
)
Parameters
[in]comWhich COM line to update
[in]maskBit mask for segments 0-31
[in]bitsBit pattern for segments 0-31

Definition at line 414 of file em_lcd.c.

References LCD.

void LCD_SegmentSetHigh ( int  com,
uint32_t  mask,
uint32_t  bits 
)
Parameters
[in]comWhich COM line to update
[in]maskBit mask for segments 32-39
[in]bitsBit pattern for segments 32-39

Definition at line 505 of file em_lcd.c.

References LCD.

void LCD_ContrastSet ( int  level)
Parameters
[in]levelContrast level in the range 0-31

Definition at line 587 of file em_lcd.c.

References _LCD_DISPCTRL_CONLEV_MASK, _LCD_DISPCTRL_CONLEV_SHIFT, and LCD.

void LCD_VBoostSet ( LCD_VBoostLevel_TypeDef  vboost)

The resulting voltage level is described in each part number's data sheet

Parameters
[in]vboostVoltage boost level

Definition at line 605 of file em_lcd.c.

References _LCD_DISPCTRL_VBLEV_MASK, and LCD.

Referenced by SegmentLCD_Init().

void LCD_BiasSegmentSet ( int  segmentLine,
int  biasLevel 
)
Note
When DSC is active, each configuration takes up 4 bits in the Segment Registers (SEGD0L/SEGD1H) which defines bias level. For optimal use of this feature, the entire SEGD-registers should be set at once in a optimized routine, so this function is mainly here to demonstrate how to correctly configure the bias levels, and should be used with care.
Parameters
[in]segmentLineSegment line number
[in]biasLevelBias configuration level, 0-4. This value must be within the constraint defined by the LCD_DISPCTRL bias setting, see Reference Manual/Datasheet

Definition at line 632 of file em_lcd.c.

References LCD.

void LCD_BiasComSet ( int  comLine,
int  biasLevel 
)
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, so this function is mainly here to demonstrate how to correctly configure the bias levels, and should be used with care.
Parameters
[in]comLineCOM line number, 0-7
[in]biasLevelBias configuration level, 0-4. This value must be within the constraint defined by the LCD_DISPCTRL bias setting, see Reference Manual/Datasheet

Definition at line 750 of file em_lcd.c.

References LCD.

__STATIC_INLINE void LCD_Enable ( bool  enable)
Parameters
[in]enableIf true, enables LCD controller with current configuration, if false disables LCD controller. CMU clock for LCD must be enabled for correct operation.

Definition at line 308 of file em_lcd.h.

References LCD, and LCD_CTRL_EN.

Referenced by LCD_Init(), and SegmentLCD_Disable().

__STATIC_INLINE void LCD_AnimEnable ( bool  enable)
Parameters
[in]enableBoolean true enables animation, false disables animation

Definition at line 328 of file em_lcd.h.

References LCD, and LCD_BACTRL_AEN.

Referenced by LCD_AnimInit().

__STATIC_INLINE void LCD_BlinkEnable ( bool  enable)
Parameters
[in]enableBoolean true enables blink, false disables blink

Definition at line 348 of file em_lcd.h.

References LCD, and LCD_BACTRL_BLINKEN.

__STATIC_INLINE void LCD_BlankEnable ( bool  enable)
Parameters
[in]enableBoolean true clears all segments, boolean false restores all segment lines

Definition at line 368 of file em_lcd.h.

References LCD, and LCD_BACTRL_BLANK.

__STATIC_INLINE void LCD_FrameCountEnable ( bool  enable)
Parameters
[in]enableBoolean true enables frame counter, false disables frame counter

Definition at line 388 of file em_lcd.h.

References LCD, and LCD_BACTRL_FCEN.

Referenced by LCD_FrameCountInit().

__STATIC_INLINE int LCD_AnimState ( void  )
Returns
Animation state, in range 0-15

Definition at line 408 of file em_lcd.h.

References _LCD_STATUS_ASTATE_MASK, _LCD_STATUS_ASTATE_SHIFT, and LCD.

__STATIC_INLINE int LCD_BlinkState ( void  )
Returns
Return value is 1 if segments are enabled, 0 if disabled

Definition at line 421 of file em_lcd.h.

References _LCD_STATUS_BLINK_MASK, _LCD_STATUS_BLINK_SHIFT, and LCD.

__STATIC_INLINE void LCD_FreezeEnable ( bool  enable)
Parameters
[in]enableWhen enable is true, update is stopped, when false all registers are updated

Definition at line 435 of file em_lcd.h.

References LCD, LCD_FREEZE_REGFREEZE_FREEZE, and LCD_FREEZE_REGFREEZE_UPDATE.

Referenced by SegmentLCD_Number(), SegmentLCD_UnsignedHex(), and SegmentLCD_Write().

__STATIC_INLINE uint32_t LCD_SyncBusyGet ( void  )
Returns
Bit fields for LCD registers which have pending updates

Definition at line 455 of file em_lcd.h.

References LCD.

__STATIC_INLINE void LCD_SyncBusyDelay ( uint32_t  flags)
Parameters
[in]flagsBit fields for LCD registers that shall be updated before we continue

Definition at line 468 of file em_lcd.h.

References LCD.

Referenced by SegmentLCD_Disable(), SegmentLCD_Init(), SegmentLCD_Number(), SegmentLCD_UnsignedHex(), and SegmentLCD_Write().

__STATIC_INLINE uint32_t LCD_IntGet ( void  )
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).

Definition at line 483 of file em_lcd.h.

References LCD.

__STATIC_INLINE uint32_t LCD_IntGetEnabled ( void  )

Useful for handling more interrupt sources in the same interrupt handler.

Note
The event bits are not cleared by the use of this function.
Returns
Pending and enabled LCD interrupt sources. The 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 the LCD module (LCD_IF_nnn).

Definition at line 507 of file em_lcd.h.

References LCD.

__STATIC_INLINE void LCD_IntSet ( uint32_t  flags)
Parameters
[in]flagsLCD 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).

Definition at line 529 of file em_lcd.h.

References LCD.

__STATIC_INLINE void LCD_IntEnable ( uint32_t  flags)
Parameters
[in]flagsLCD interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for the LCD module (LCD_IFS_nnn).

Definition at line 544 of file em_lcd.h.

References LCD.

__STATIC_INLINE void LCD_IntDisable ( uint32_t  flags)
Parameters
[in]flagsLCD interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources for the LCD module (LCD_IFS_nnn).

Definition at line 559 of file em_lcd.h.

References LCD.

Referenced by SegmentLCD_Init().

__STATIC_INLINE void LCD_IntClear ( uint32_t  flags)
Parameters
[in]flagsLCD interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources for the LCD module (LCD_IFS_nnn).

Definition at line 574 of file em_lcd.h.

References LCD.

__STATIC_INLINE void LCD_DSCEnable ( bool  enable)
Parameters
[in]enableIf true, enables LCD controller Direct Segment Control Segment and COM line bias levels needs to be set explicitly with the LCD_BiasSegmentSet() and LCD_BiasComSet() function calls.

Definition at line 590 of file em_lcd.h.

References LCD, and LCD_CTRL_DSC.