LCDEMLIB
Detailed 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 | 
| struct | LCD_FrameCountInit_TypeDef | 
| struct | LCD_Init_TypeDef | 
| Macros | |
| #define | LCD_DEFAULT_CONTRAST 15 | 
| #define | LCD_DEFAULT_FRAME_RATE_DIV 4 | 
| #define | LCD_INIT_DEFAULT | 
| Enumerations | |
| enum | LCD_AnimLogic_TypeDef
         
         { lcdAnimLogicAnd = LCD_BACTRL_ALOGSEL_AND, lcdAnimLogicOr = LCD_BACTRL_ALOGSEL_OR } | 
| enum | LCD_AnimShift_TypeDef
         
         { lcdAnimShiftNone = _LCD_BACTRL_AREGASC_NOSHIFT, lcdAnimShiftLeft = _LCD_BACTRL_AREGASC_SHIFTLEFT, lcdAnimShiftRight = _LCD_BACTRL_AREGASC_SHIFTRIGHT } | 
| 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_ConConf_TypeDef
         
         { lcdConConfVLCD = LCD_DISPCTRL_CONCONF_VLCD, lcdConConfGND = LCD_DISPCTRL_CONCONF_GND } | 
| 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_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_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_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_VLCDSel_TypeDef
         
         { lcdVLCDSelVDD = LCD_DISPCTRL_VLCDSEL_VDD, lcdVLCDSelVExtBoost = LCD_DISPCTRL_VLCDSEL_VEXTBOOST } | 
| enum | LCD_Wave_TypeDef
         
         { lcdWaveLowPower = LCD_DISPCTRL_WAVE_LOWPOWER, lcdWaveNormal = LCD_DISPCTRL_WAVE_NORMAL } | 
| Functions | |
| __STATIC_INLINE void | LCD_AnimEnable (bool enable) | 
| Enables or disables LCD Animation feature. | |
| void | LCD_AnimInit (const LCD_AnimInit_TypeDef *animInit) | 
| Configure the LCD controller Animation feature. | |
| __STATIC_INLINE int | LCD_AnimState (void) | 
| Returns current animation state. | |
| void | LCD_BiasComSet (int comLine, int biasLevel) | 
| Configure the bias level for a specific segment line. | |
| void | LCD_BiasSegmentSet (int segmentLine, int biasLevel) | 
| Configure the bias level for a specific segment line for Direct Segment Control. | |
| void | LCD_BiasSet ( LCD_Bias_TypeDef bias) | 
| Configure the bias level on the LCD panel. | |
| __STATIC_INLINE void | LCD_BlankEnable (bool enable) | 
| Disables all segments, while keeping segment state. | |
| __STATIC_INLINE void | LCD_BlinkEnable (bool enable) | 
| Enables or disables LCD blink. | |
| __STATIC_INLINE int | LCD_BlinkState (void) | 
| Returns current blink state. | |
| void | LCD_ContrastSet (int level) | 
| Configure the contrast level on the LCD panel. | |
| __STATIC_INLINE void | LCD_DSCEnable (bool enable) | 
| Enable or disable LCD Direct Segment Control. | |
| __STATIC_INLINE void | LCD_Enable (bool enable) | 
| Enable or disable LCD controller. | |
| __STATIC_INLINE void | LCD_FrameCountEnable (bool enable) | 
| Enables or disables LCD Frame Control. | |
| void | LCD_FrameCountInit (const LCD_FrameCountInit_TypeDef *fcInit) | 
| Initialize the LCD Frame Counter. | |
| __STATIC_INLINE void | LCD_FreezeEnable (bool enable) | 
| When set, LCD registers will not be updated until cleared. | |
| void | LCD_Init (const LCD_Init_TypeDef *lcdInit) | 
| Initialize the Liquid Crystal Display (LCD) controller. | |
| __STATIC_INLINE void | LCD_IntClear (uint32_t flags) | 
| Clear one or more interrupt flags. | |
| __STATIC_INLINE void | LCD_IntDisable (uint32_t flags) | 
| Disable LCD interrupts. | |
| __STATIC_INLINE void | LCD_IntEnable (uint32_t flags) | 
| Enable LCD interrupts. | |
| __STATIC_INLINE uint32_t | LCD_IntGet (void) | 
| Get pending LCD interrupt flags. | |
| __STATIC_INLINE uint32_t | LCD_IntGetEnabled (void) | 
| Get enabled and pending LCD interrupt flags. | |
| __STATIC_INLINE void | LCD_IntSet (uint32_t flags) | 
| Set one or more pending LCD interrupts from SW. | |
| 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_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_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. | |
| __STATIC_INLINE void | LCD_SyncBusyDelay (uint32_t flags) | 
| Polls LCD SYNCBUSY flags, until flag has been cleared. | |
| __STATIC_INLINE uint32_t | LCD_SyncBusyGet (void) | 
| Returns SYNCBUSY bits, indicating which registers have pending updates. | |
| void | LCD_UpdateCtrl ( LCD_UpdateCtrl_TypeDef ud) | 
| Configure Update Control. | |
| void | LCD_VBoostSet ( LCD_VBoostLevel_TypeDef vboost) | 
| Configure voltage booster. | |
| void | LCD_VLCDSelect ( LCD_VLCDSel_TypeDef vlcd) | 
| Select a source for VLCD. | |
Macro Definition Documentation
| #define LCD_INIT_DEFAULT | 
Default configuration for LCD initialization structure, enables 160 segments.
        Definition at line
        
         298
        
        of file
        
         em_lcd.h
        
        .
       
Enumeration Type Documentation
| enum LCD_Bias_TypeDef | 
| enum LCD_ConConf_TypeDef | 
| enum LCD_Mux_TypeDef | 
MUX setting.
        Definition at line
        
         67
        
        of file
        
         em_lcd.h
        
        .
       
Segment selection.
        Definition at line
        
         168
        
        of file
        
         em_lcd.h
        
        .
       
Voltage Boost Level - Data sheets document setting for each part number.
        Definition at line
        
         133
        
        of file
        
         em_lcd.h
        
        .
       
| enum LCD_VLCDSel_TypeDef | 
| enum LCD_Wave_TypeDef | 
Function Documentation
| __STATIC_INLINE void LCD_AnimEnable | ( | bool | 
            enable
            | ) | 
Enables or disables LCD Animation feature.
- Parameters
- 
         [in] enableBoolean true enables animation, false disables animation. 
        Definition at line
        
         382
        
        of file
        
         em_lcd.h
        
        .
       
Referenced by LCD_AnimInit() .
| void LCD_AnimInit | ( | const LCD_AnimInit_TypeDef * | 
            animInit
            | ) | 
Configure the LCD controller Animation feature.
- Parameters
- 
         [in] animInitA pointer to the LCD Animation initialization structure. 
        Definition at line
        
         200
        
        of file
        
         em_lcd.c
        
        .
       
References LCD_AnimInit_TypeDef::animLogic , LCD_AnimInit_TypeDef::AReg , LCD_AnimInit_TypeDef::AShift , LCD_AnimInit_TypeDef::BReg , LCD_AnimInit_TypeDef::BShift , LCD_AnimInit_TypeDef::enable , LCD_AnimEnable() , and LCD_AnimInit_TypeDef::startSeg .
| __STATIC_INLINE int LCD_AnimState | ( | void | 
            | ) | 
Returns current animation state.
- Returns
- Animation state, in range 0-15.
        Definition at line
        
         446
        
        of file
        
         em_lcd.h
        
        .
       
| 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] comLineA COM line number, 0-7. [in] biasLevelThe 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. 
        Definition at line
        
         763
        
        of file
        
         em_lcd.c
        
        .
       
| 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] segmentLineA segment line number. [in] biasLevelThe 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. 
        Definition at line
        
         659
        
        of file
        
         em_lcd.c
        
        .
       
| void LCD_BiasSet | ( | LCD_Bias_TypeDef | 
            bias
            | ) | 
Configure the bias level on the LCD panel.
- Parameters
- 
         [in] biasThe bias level. 
        Definition at line
        
         616
        
        of file
        
         em_lcd.c
        
        .
       
| __STATIC_INLINE void LCD_BlankEnable | ( | bool | 
            enable
            | ) | 
Disables all segments, while keeping segment state.
- Parameters
- 
         [in] enableBoolean true clears all segments, boolean false restores all segment lines. 
        Definition at line
        
         414
        
        of file
        
         em_lcd.h
        
        .
       
| __STATIC_INLINE void LCD_BlinkEnable | ( | bool | 
            enable
            | ) | 
Enables or disables LCD blink.
- Parameters
- 
         [in] enableBoolean true enables blink, false disables blink. 
        Definition at line
        
         398
        
        of file
        
         em_lcd.h
        
        .
       
| __STATIC_INLINE int LCD_BlinkState | ( | void | 
            | ) | 
Returns current blink state.
- Returns
- Return value is 1 if segments are enabled, 0 if disabled.
        Definition at line
        
         458
        
        of file
        
         em_lcd.h
        
        .
       
| void LCD_ContrastSet | ( | int | 
            level
            | ) | 
Configure the contrast level on the LCD panel.
- Parameters
- 
         [in] levelThe contrast level in range 0-31. 
        Definition at line
        
         583
        
        of file
        
         em_lcd.c
        
        .
       
Referenced by LCD_Init() .
| __STATIC_INLINE void LCD_DSCEnable | ( | bool | 
            enable
            | ) | 
Enable or disable LCD Direct Segment Control.
- Parameters
- 
         [in] enableIf 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. 
        Definition at line
        
         614
        
        of file
        
         em_lcd.h
        
        .
       
| __STATIC_INLINE void LCD_Enable | ( | bool | 
            enable
            | ) | 
Enable or disable LCD controller.
- Parameters
- 
         [in] enableIf true, enables LCD controller with current configuration. If false, disables LCD controller. Enable CMU clock for LCD for correct operation. 
        Definition at line
        
         366
        
        of file
        
         em_lcd.h
        
        .
       
Referenced by LCD_Init() , and SegmentLCD_Disable() .
| __STATIC_INLINE void LCD_FrameCountEnable | ( | bool | 
            enable
            | ) | 
Enables or disables LCD Frame Control.
- Parameters
- 
         [in] enableBoolean true enables frame counter, false disables frame counter. 
        Definition at line
        
         430
        
        of file
        
         em_lcd.h
        
        .
       
Referenced by LCD_FrameCountInit() .
| void LCD_FrameCountInit | ( | const LCD_FrameCountInit_TypeDef * | 
            fcInit
            | ) | 
Initialize the LCD Frame Counter.
- Parameters
- 
         [in] fcInitA pointer to the Frame Counter initialization structure. 
        Definition at line
        
         172
        
        of file
        
         em_lcd.c
        
        .
       
References LCD_FrameCountInit_TypeDef::enable , LCD_FrameCountEnable() , LCD_FrameCountInit_TypeDef::prescale , and LCD_FrameCountInit_TypeDef::top .
| __STATIC_INLINE void LCD_FreezeEnable | ( | bool | 
            enable
            | ) | 
When set, LCD registers will not be updated until cleared.
- Parameters
- 
         [in] enableWhen enable is true, update is stopped; when false, all registers are updated. 
        Definition at line
        
         471
        
        of file
        
         em_lcd.h
        
        .
       
Referenced by SegmentLCD_Number() , SegmentLCD_UnsignedHex() , and SegmentLCD_Write() .
| 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] lcdInitA pointer to the initialization structure which configures the LCD controller. 
        Definition at line
        
         66
        
        of file
        
         em_lcd.c
        
        .
       
References LCD_Init_TypeDef::bias , LCD_Init_TypeDef::contrast , LCD_Init_TypeDef::enable , LCD_ContrastSet() , LCD_Enable() , LCD_Init_TypeDef::mux , LCD_Init_TypeDef::vlcd , and LCD_Init_TypeDef::wave .
Referenced by SegmentLCD_Init() .
| __STATIC_INLINE void LCD_IntClear | ( | uint32_t | 
            flags
            | ) | 
Clear one or more interrupt flags.
- Parameters
- 
         [in] flagsLCD interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources for LCD module (LCD_IFS_nnn). 
        Definition at line
        
         599
        
        of file
        
         em_lcd.h
        
        .
       
| __STATIC_INLINE void LCD_IntDisable | ( | uint32_t | 
            flags
            | ) | 
Disable LCD interrupts.
- Parameters
- 
         [in] flagsLCD interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources for LCD module (LCD_IFS_nnn). 
        Definition at line
        
         585
        
        of file
        
         em_lcd.h
        
        .
       
Referenced by SegmentLCD_Init() .
| __STATIC_INLINE void LCD_IntEnable | ( | uint32_t | 
            flags
            | ) | 
Enable LCD interrupts.
- Parameters
- 
         [in] flagsLCD interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for LCD module (LCD_IFS_nnn). 
        Definition at line
        
         571
        
        of file
        
         em_lcd.h
        
        .
       
| __STATIC_INLINE uint32_t LCD_IntGet | ( | void | 
            | ) | 
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).
        Definition at line
        
         513
        
        of file
        
         em_lcd.h
        
        .
       
| __STATIC_INLINE uint32_t LCD_IntGetEnabled | ( | void | 
            | ) | 
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).
 
        Definition at line
        
         536
        
        of file
        
         em_lcd.h
        
        .
       
| __STATIC_INLINE void LCD_IntSet | ( | uint32_t | 
            flags
            | ) | 
Set one or more pending LCD interrupts from SW.
- 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
        
         557
        
        of file
        
         em_lcd.h
        
        .
       
| void LCD_SegmentRangeEnable | ( | LCD_SegmentRange_TypeDef | 
            segmentRange,
            | 
| bool | 
            enable
            | ||
| ) | 
Enables updating this range of LCD segment lines.
- Parameters
- 
         [in] segmentRangeA range of 4 LCD segment lines to enable or disable for all enabled COM lines. [in] enableBoolean true to enable segment updates, false to disable updates. 
        Definition at line
        
         248
        
        of file
        
         em_lcd.c
        
        .
       
| 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] comA COM line to change. [in] bitA bit index indicating which field to change. [in] enableTrue will set segment, false will clear segment. 
        Definition at line
        
         276
        
        of file
        
         em_lcd.c
        
        .
       
References BUS_RegBitWrite() .
Referenced by displayBlock() , SegmentLCD_ARing() , SegmentLCD_Battery() , SegmentLCD_EnergyMode() , SegmentLCD_Number() , SegmentLCD_Symbol() , SegmentLCD_UnsignedHex() , and SegmentLCD_Write() .
| 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] comIndicates a COM line to update. [in] maskA bit mask for segments 32-39. [in] bitsA bit pattern for segments 32-39. 
        Definition at line
        
         501
        
        of file
        
         em_lcd.c
        
        .
       
| 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] comIndicates a COM line to update. [in] maskA bit mask for segments 0-31. [in] bitsA bit pattern for segments 0-31. 
        Definition at line
        
         412
        
        of file
        
         em_lcd.c
        
        .
       
| __STATIC_INLINE void LCD_SyncBusyDelay | ( | uint32_t | 
            flags
            | ) | 
Polls LCD SYNCBUSY flags, until flag has been cleared.
- Parameters
- 
         [in] flagsBit fields for LCD registers that will be updated before we continue. 
        Definition at line
        
         499
        
        of file
        
         em_lcd.h
        
        .
       
Referenced by SegmentLCD_Disable() , SegmentLCD_Init() , SegmentLCD_Number() , SegmentLCD_UnsignedHex() , and SegmentLCD_Write() .
| __STATIC_INLINE uint32_t LCD_SyncBusyGet | ( | void | 
            | ) | 
Returns SYNCBUSY bits, indicating which registers have pending updates.
- Returns
- Bit fields for LCD registers that have pending updates.
        Definition at line
        
         487
        
        of file
        
         em_lcd.h
        
        .
       
| void LCD_UpdateCtrl | ( | LCD_UpdateCtrl_TypeDef | 
            ud
            | ) | 
Configure Update Control.
- Parameters
- 
         [in] udConfigures the LCD update method. 
        Definition at line
        
         160
        
        of file
        
         em_lcd.c
        
        .
       
| void LCD_VBoostSet | ( | LCD_VBoostLevel_TypeDef | 
            vboost
            | ) | 
Configure voltage booster.
The resulting voltage level is described in each part number's data sheet
- Parameters
- 
         [in] vboostVoltage boost level 
        Definition at line
        
         631
        
        of file
        
         em_lcd.c
        
        .
       
Referenced by SegmentLCD_Init() .
| void LCD_VLCDSelect | ( | LCD_VLCDSel_TypeDef | 
            vlcd
            | ) | 
Select a source for VLCD.
- Parameters
- 
         [in] vlcdSelect a source for the VLCD voltage. 
        Definition at line
        
         132
        
        of file
        
         em_lcd.c
        
        .
       
References lcdVLCDSelVDD , and lcdVLCDSelVExtBoost .
Referenced by SegmentLCD_Init() .