34 #if defined(LCD_COUNT) && (LCD_COUNT > 0)
67 void LCD_Init(
const LCD_Init_TypeDef *lcdInit)
69 uint32_t dispCtrl = LCD->DISPCTRL;
71 EFM_ASSERT(lcdInit != (
void *) 0);
78 #if defined(LCD_DISPCTRL_MUXE)
79 | _LCD_DISPCTRL_MUXE_MASK
81 | _LCD_DISPCTRL_MUX_MASK
82 | _LCD_DISPCTRL_BIAS_MASK
83 | _LCD_DISPCTRL_WAVE_MASK
84 | _LCD_DISPCTRL_VLCDSEL_MASK
85 | _LCD_DISPCTRL_CONCONF_MASK);
88 dispCtrl |= lcdInit->mux;
89 dispCtrl |= lcdInit->bias;
90 dispCtrl |= lcdInit->wave;
91 dispCtrl |= lcdInit->vlcd;
92 dispCtrl |= lcdInit->contrast;
95 LCD->DISPCTRL = dispCtrl;
112 void LCD_VLCDSelect(LCD_VLCDSel_TypeDef vlcd)
114 uint32_t dispctrl = LCD->DISPCTRL;
117 dispctrl &= ~_LCD_DISPCTRL_VLCDSEL_MASK;
120 case lcdVLCDSelVExtBoost:
121 dispctrl |= LCD_DISPCTRL_VLCDSEL_VEXTBOOST;
124 dispctrl |= LCD_DISPCTRL_VLCDSEL_VDD;
130 LCD->DISPCTRL = dispctrl;
141 void LCD_UpdateCtrl(LCD_UpdateCtrl_TypeDef ud)
143 LCD->CTRL = (LCD->CTRL & ~_LCD_CTRL_UDCTRL_MASK) | ud;
154 void LCD_FrameCountInit(
const LCD_FrameCountInit_TypeDef *fcInit)
156 uint32_t bactrl = LCD->BACTRL;
158 EFM_ASSERT(fcInit != (
void *) 0);
161 EFM_ASSERT(fcInit->top < 64);
164 bactrl &= ~(_LCD_BACTRL_FCTOP_MASK
165 | _LCD_BACTRL_FCPRESC_MASK);
166 bactrl |= (fcInit->top << _LCD_BACTRL_FCTOP_SHIFT);
167 bactrl |= fcInit->prescale;
170 LCD->BACTRL = bactrl;
172 LCD_FrameCountEnable(fcInit->enable);
183 void LCD_AnimInit(
const LCD_AnimInit_TypeDef *animInit)
185 uint32_t bactrl = LCD->BACTRL;
187 EFM_ASSERT(animInit != (
void *) 0);
190 LCD->AREGA = animInit->AReg;
191 LCD->AREGB = animInit->BReg;
194 bactrl &= ~(_LCD_BACTRL_AREGASC_MASK
195 | _LCD_BACTRL_AREGBSC_MASK
196 | _LCD_BACTRL_ALOGSEL_MASK);
198 bactrl |= (animInit->AShift << _LCD_BACTRL_AREGASC_SHIFT);
199 bactrl |= (animInit->BShift << _LCD_BACTRL_AREGBSC_SHIFT);
200 bactrl |= animInit->animLogic;
202 #if defined(LCD_BACTRL_ALOC)
203 bactrl &= ~(_LCD_BACTRL_ALOC_MASK);
205 if(animInit->startSeg == 0)
207 bactrl |= LCD_BACTRL_ALOC_SEG0TO7;
209 else if(animInit->startSeg == 8)
211 bactrl |= LCD_BACTRL_ALOC_SEG8TO15;
216 LCD->BACTRL = bactrl;
219 LCD_AnimEnable(animInit->enable);
234 void LCD_SegmentRangeEnable(LCD_SegmentRange_TypeDef segmentRange,
bool enable)
238 LCD->SEGEN |= segmentRange;
242 LCD->SEGEN &= ~((uint32_t)segmentRange);
265 void LCD_SegmentSet(
int com,
int bit,
bool enable)
267 #if defined(_LCD_SEGD7L_MASK)
275 #if defined(_LCD_SEGD0H_MASK)
276 EFM_ASSERT(bit < 40);
279 EFM_ASSERT(bit < 32);
290 #if defined(_LCD_SEGD0H_MASK)
303 #if defined(_LCD_SEGD1H_MASK)
316 #if defined(_LCD_SEGD2H_MASK)
329 #if defined(_LCD_SEGD3H_MASK)
337 #if defined(_LCD_SEGD4L_MASK)
343 #if defined(_LCD_SEGD4H_MASK)
352 #if defined(_LCD_SEGD5L_MASK)
358 #if defined(_LCD_SEGD5H_MASK)
368 #if defined(_LCD_SEGD6L_MASK)
373 #if defined(_LCD_SEGD6H_MASK)
382 #if defined(_LCD_SEGD7L_MASK)
388 #if defined(_LCD_SEGD7H_MASK)
419 void LCD_SegmentSetLow(
int com, uint32_t mask, uint32_t bits)
424 #if defined(_LCD_SEGD7L_MASK)
434 segData = LCD->SEGD0L;
436 segData |= (mask & bits);
437 LCD->SEGD0L = segData;
440 segData = LCD->SEGD1L;
442 segData |= (mask & bits);
443 LCD->SEGD1L = segData;
446 segData = LCD->SEGD2L;
448 segData |= (mask & bits);
449 LCD->SEGD2L = segData;
452 segData = LCD->SEGD3L;
454 segData |= (mask & bits);
455 LCD->SEGD3L = segData;
457 #if defined(_LCD_SEGD4L_MASK)
459 segData = LCD->SEGD4L;
461 segData |= (mask & bits);
462 LCD->SEGD4L = segData;
465 #if defined(_LCD_SEGD5L_MASK)
467 segData = LCD->SEGD5L;
469 segData |= (mask & bits);
470 LCD->SEGD5L = segData;
473 #if defined(_LCD_SEGD6L_MASK)
475 segData = LCD->SEGD6L;
477 segData |= (mask & bits);
478 LCD->SEGD6L = segData;
481 #if defined(_LCD_SEGD7L_MASK)
483 segData = LCD->SEGD7L;
485 segData |= (mask & bits);
486 LCD->SEGD7L = segData;
496 #if defined(_LCD_SEGD0H_MASK)
510 void LCD_SegmentSetHigh(
int com, uint32_t mask, uint32_t bits)
514 #if defined(_LCD_SEGD7H_MASK)
524 segData = LCD->SEGD0H;
526 segData |= (mask & bits);
527 LCD->SEGD0H = segData;
530 segData = LCD->SEGD1H;
532 segData |= (mask & bits);
533 LCD->SEGD1H = segData;
536 segData = LCD->SEGD2H;
538 segData |= (mask & bits);
539 LCD->SEGD2H = segData;
542 segData = LCD->SEGD3H;
544 segData |= (mask & bits);
545 LCD->SEGD3H = segData;
547 #if defined(_LCD_SEGD4H_MASK)
549 segData = LCD->SEGD4H;
551 segData |= (mask & bits);
552 LCD->SEGD4H = segData;
555 #if defined(_LCD_SEGD5H_MASK)
557 segData = LCD->SEGD5H;
559 segData |= (mask & bits);
560 LCD->SEGD5H = segData;
563 #if defined(_LCD_SEGD6H_MASK)
565 segData = LCD->SEGD6H;
567 segData |= (mask & bits);
568 LCD->SEGD6H = segData;
571 #if defined(_LCD_SEGD7H_MASK)
573 segData = LCD->SEGD7H;
575 segData |= (mask & bits);
576 LCD->SEGD7H = segData;
592 void LCD_ContrastSet(
int level)
594 EFM_ASSERT(level < 32);
596 LCD->DISPCTRL = (LCD->DISPCTRL & ~_LCD_DISPCTRL_CONLEV_MASK)
597 | (level << _LCD_DISPCTRL_CONLEV_SHIFT);
610 void LCD_VBoostSet(LCD_VBoostLevel_TypeDef vboost)
613 LCD->DISPCTRL = (LCD->DISPCTRL & ~_LCD_DISPCTRL_VBLEV_MASK) | vboost;
617 #if defined(LCD_CTRL_DSC)
637 void LCD_BiasSegmentSet(
int segmentLine,
int biasLevel)
641 volatile uint32_t *segmentRegister;
643 #if !defined(_LCD_SEGD0H_MASK)
644 EFM_ASSERT(segmentLine < 20);
647 biasRegister = segmentLine / 8;
648 bitShift = (segmentLine % 8) * 4;
650 switch (biasRegister)
653 segmentRegister = &LCD->SEGD0L;
656 segmentRegister = &LCD->SEGD1L;
659 segmentRegister = &LCD->SEGD2L;
662 segmentRegister = &LCD->SEGD3L;
665 segmentRegister = (uint32_t *)0x00000000;
670 EFM_ASSERT(segmentLine < 40);
673 biasRegister = segmentLine / 10;
674 bitShift = (segmentLine % 10) * 4;
676 switch (biasRegister)
681 segmentRegister = &LCD->SEGD0L;
685 segmentRegister = &LCD->SEGD0H;
692 segmentRegister = &LCD->SEGD1L;
696 segmentRegister = &LCD->SEGD1H;
703 segmentRegister = &LCD->SEGD2L;
707 segmentRegister = &LCD->SEGD1H;
714 segmentRegister = &LCD->SEGD3L;
718 segmentRegister = &LCD->SEGD3H;
723 segmentRegister = (uint32_t *)0x00000000;
730 *segmentRegister = (*segmentRegister & ~(0xF << bitShift)) | (biasLevel << bitShift);
735 #if defined(LCD_CTRL_DSC)
755 void LCD_BiasComSet(
int comLine,
int biasLevel)
758 EFM_ASSERT(comLine < 8);
760 bitShift = comLine * 4;
761 LCD->SEGD4L = (LCD->SEGD4L & ~(0xF << bitShift)) | (biasLevel << bitShift);
Emlib peripheral API "assert" implementation.
RAM and peripheral bit-field set and clear API.
Liquid Crystal Display (LCD) peripheral API.
__STATIC_INLINE void BUS_RegBitWrite(volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.