EFM32 Wonder Gecko Software Documentation  efm32wg-doc-5.1.2
segmentlcd.c
Go to the documentation of this file.
1 /**************************************************************************/
17 #include <stdio.h>
18 #include <string.h>
19 #include <stdlib.h>
20 #include <stdbool.h>
21 #include "em_device.h"
22 #include "em_cmu.h"
23 #include "em_gpio.h"
24 
25 #include "segmentlcd.h"
26 
27 /**************************************************************************/
49 typedef struct
50 {
51  uint8_t com[14];
52  uint8_t bit[14];
53 } CHAR_TypeDef;
54 
55 /**************************************************************************/
58 typedef struct
59 {
60  uint8_t com[7];
61  uint8_t bit[7];
63 
64 /**************************************************************************/
67 typedef struct
68 {
69  uint8_t com[5];
70  uint8_t bit[5];
71 } EM_TypeDef;
72 
73 /**************************************************************************/
76 typedef struct
77 {
78  uint8_t com[8];
79  uint8_t bit[8];
81 
82 /**************************************************************************/
85 typedef struct
86 {
87  uint8_t com[4];
88  uint8_t bit[4];
90 
91 /**************************************************************************/
130 typedef struct
131 {
132  uint8_t com[8];
133  uint8_t bit[8];
134 } Block_TypeDef;
135 
136 /**************************************************************************/
139 typedef struct
140 {
141  CHAR_TypeDef Text[7];
142  NUMBER_TypeDef Number[4];
146  Block_TypeDef TopBlocks[7];
147  Block_TypeDef BotBlocks[7];
149 } MCU_DISPLAY;
150 
151 /**************************************************************************/
154 static const MCU_DISPLAY EFM_Display = EFM_DISPLAY_DEF;
155 
156 
157 /**************************************************************************/
160 static void displayBlock(
161  SegmentLCD_BlockMode_TypeDef topMode[SEGMENT_LCD_NUM_BLOCK_COLUMNS],
162  SegmentLCD_BlockMode_TypeDef botMode[SEGMENT_LCD_NUM_BLOCK_COLUMNS]);
163 
164 /**************************************************************************/
170 static const uint16_t EFM_Alphabet[] = {
171  0x0000, /* space */
172  0x1100, /* ! */
173  0x0280, /* " */
174  0x0000, /* # */
175  0x0000, /* $ */
176  0x0602, /* % */
177  0x0000, /* & */
178  0x0020, /* ' */
179  0x0039, /* ( */
180  0x000f, /* ) */
181  0x0000, /* * */
182  0x1540, /* + */
183  0x2000, /* , */
184  0x0440, /* - */
185  0x1000, /* . */
186  0x2200, /* / */
187 
188  0x003f, /* 0 */
189  0x0006, /* 1 */
190  0x045b, /* 2 */
191  0x044f, /* 3 */
192  0x0466, /* 4 */
193  0x046d, /* 5 */
194  0x047d, /* 6 */
195  0x0007, /* 7 */
196  0x047f, /* 8 */
197  0x046f, /* 9 */
198 
199  0x0000, /* : */
200  0x0000, /* ; */
201  0x0a00, /* < */
202  0x0000, /* = */
203  0x2080, /* > */
204  0x0000, /* ? */
205  0xffff, /* @ */
206 
207  0x0477, /* A */
208  0x0a79, /* B */
209  0x0039, /* C */
210  0x20b0, /* D */
211  0x0079, /* E */
212  0x0071, /* F */
213  0x047d, /* G */
214  0x0476, /* H */
215  0x0006, /* I */
216  0x000e, /* J */
217  0x0a70, /* K */
218  0x0038, /* L */
219  0x02b6, /* M */
220  0x08b6, /* N */
221  0x003f, /* O */
222  0x0473, /* P */
223  0x083f, /* Q */
224  0x0c73, /* R */
225  0x046d, /* S */
226  0x1101, /* T */
227  0x003e, /* U */
228  0x2230, /* V */
229  0x2836, /* W */
230  0x2a80, /* X */
231  0x046e, /* Y */
232  0x2209, /* Z */
233 
234  0x0039, /* [ */
235  0x0880, /* backslash */
236  0x000f, /* ] */
237  0x0001, /* ^ */
238  0x0008, /* _ */
239  0x0100, /* ` */
240 
241  0x1058, /* a */
242  0x047c, /* b */
243  0x0058, /* c */
244  0x045e, /* d */
245  0x2058, /* e */
246  0x0471, /* f */
247  0x0c0c, /* g */
248  0x0474, /* h */
249  0x0004, /* i */
250  0x000e, /* j */
251  0x0c70, /* k */
252  0x0038, /* l */
253  0x1454, /* m */
254  0x0454, /* n */
255  0x045c, /* o */
256  0x0473, /* p */
257  0x0467, /* q */
258  0x0450, /* r */
259  0x0c08, /* s */
260  0x0078, /* t */
261  0x001c, /* u */
262  0x2010, /* v */
263  0x2814, /* w */
264  0x2a80, /* x */
265  0x080c, /* y */
266  0x2048, /* z */
267 
268  0x0000,
269 };
270 
271 /**************************************************************************/
276 static const uint16_t EFM_Numbers[] = {
277  0x003f, /* 0 */
278  0x0006, /* 1 */
279  0x005b, /* 2 */
280  0x004f, /* 3 */
281  0x0066, /* 4 */
282  0x006d, /* 5 */
283  0x007d, /* 6 */
284  0x0007, /* 7 */
285  0x007f, /* 8 */
286  0x006f, /* 9 */
287  0x0077, /* A */
288  0x007c, /* b */
289  0x0039, /* C */
290  0x005e, /* d */
291  0x0079, /* E */
292  0x0071, /* F */
293  0x0040 /* - */
294 };
295 
296 /**************************************************************************/
300 static const uint16_t Blocks[] = {
301  0x0000, /* blank */
302  0x00E0, /* inner */
303  0x001F, /* outer */
304  0x00FF /* full */
305 };
306 
308 /* sign is last element of the table */
309 static const uint16_t signIndex = sizeof(EFM_Numbers)/sizeof(uint16_t) - 1 ;
310 
311 static const LCD_Init_TypeDef lcdInit = LCD_INIT_DEF;
315 /**************************************************************************/
319 {
320  /* Turn on low segments */
321  LCD_ALL_SEGMENTS_OFF();
322 }
323 
324 
325 /**************************************************************************/
329 {
330  LCD_ALL_SEGMENTS_ON();
331 }
332 
333 
334 /**************************************************************************/
338 {
339  LCD_ALPHA_NUMBER_OFF();
340  return;
341 }
342 
343 
344 /**************************************************************************/
349 void SegmentLCD_ARing(int anum, int on)
350 {
351  uint32_t com, bit;
352 
353  com = EFM_Display.ARing.com[anum];
354  bit = EFM_Display.ARing.bit[anum];
355 
356  if (on)
357  {
358  LCD_SegmentSet(com, bit, true);
359  }
360  else
361  {
362  LCD_SegmentSet(com, bit, false);
363  }
364 }
365 
366 
367 /**************************************************************************/
371 void SegmentLCD_Battery(int batteryLevel)
372 {
373  uint32_t com, bit;
374  int i, on;
375 
376  for (i = 0; i < 4; i++)
377  {
378  if (i < batteryLevel)
379  {
380  on = 1;
381  }
382  else
383  {
384  on = 0;
385  }
386  com = EFM_Display.Battery.com[i];
387  bit = EFM_Display.Battery.bit[i];
388 
389  if (on)
390  {
391  LCD_SegmentSet(com, bit, true);
392  }
393  else
394  {
395  LCD_SegmentSet(com, bit, false);
396  }
397  }
398 }
399 
400 
401 /******************************************************************************
402  * @brief Display blocks on LCD display: blank, fill, outline, outline & fill
403  * @param topMode array of block modes for the top row with element zero
404  * representing the left-most column and element six representing the
405  * right-most column
406  * @param botMode array of block modes for the bottom row with element zero
407  * representing the left-most column and element six representing the
408  * right-most column
409  ******************************************************************************/
410 void SegmentLCD_Block(
411  SegmentLCD_BlockMode_TypeDef topMode[SEGMENT_LCD_NUM_BLOCK_COLUMNS],
412  SegmentLCD_BlockMode_TypeDef botMode[SEGMENT_LCD_NUM_BLOCK_COLUMNS])
413 {
414  /* If an update is in progress we must block, or there might be tearing */
415  LCD_SyncBusyDelay(0xFFFFFFFF);
416 
417  /* Freeze LCD to avoid partial updates */
418  LCD_FreezeEnable(true);
419 
420  /* Turn all segments off */
422 
423  displayBlock(topMode, botMode);
424 
425  /* Enable update */
426  LCD_FreezeEnable(false);
427 }
428 
429 
430 /**************************************************************************/
434 {
435  /* Disable LCD */
436  LCD_Enable(false);
437 
438  /* Make sure CTRL register has been updated */
440 
441  /* Turn off LCD clock */
443 
444  /* Turn off voltage boost if enabled */
445  CMU->LCDCTRL = 0;
446 }
447 
448 
449 /**************************************************************************/
454 void SegmentLCD_EnergyMode(int em, int on)
455 {
456  uint32_t com, bit;
457 
458  com = EFM_Display.EMode.com[em];
459  bit = EFM_Display.EMode.bit[em];
460 
461  if (on)
462  {
463  LCD_SegmentSet(com, bit, true);
464  }
465  else
466  {
467  LCD_SegmentSet(com, bit, false);
468  }
469 }
470 
471 
472 /**************************************************************************/
476 void SegmentLCD_Init(bool useBoost)
477 {
478 
479  /* Ensure LE modules are accessible */
480  CMU_ClockEnable(cmuClock_CORELE, true);
481 
482  /* Enable LFRCO as LFACLK in CMU (will also enable oscillator if not enabled) */
484 
485  /* LCD Controller Prescaler */
486  CMU_ClockDivSet(cmuClock_LCDpre, LCD_CMU_CLK_PRE);
487 
488  /* Frame Rate */
489  CMU_LCDClkFDIVSet(LCD_CMU_CLK_DIV);
490 
491  /* Enable clock to LCD module */
493 
494  LCD_DISPLAY_ENABLE();
495 
496  /* Disable interrupts */
497  LCD_IntDisable(0xFFFFFFFF);
498 
499  /* Initialize and enable LCD controller */
500  LCD_Init(&lcdInit);
501 
502  /* Enable all display segments */
503  LCD_SEGMENTS_ENABLE();
504 
505  /* Enable boost if necessary */
506  if (useBoost)
507  {
508  LCD_VBoostSet(LCD_BOOST_LEVEL);
510  CMU->LCDCTRL |= CMU_LCDCTRL_VBOOSTEN;
511  }
512 
513  /* Turn all segments off */
515 
516  LCD_SyncBusyDelay(0xFFFFFFFF);
517 }
518 
519 
520 /**************************************************************************/
526 void SegmentLCD_LowerHex( uint32_t num )
527 {
528  int i;
529  char str[7];
530  uint32_t nibble;
531 
532  SegmentLCD_Symbol(LCD_SYMBOL_MINUS, 0);
533 
534  for ( i=6; i>=0; i-- )
535  {
536  nibble = num & 0xF;
537 
538  if ( nibble < 10 )
539  str[i] = nibble + '0';
540  else if ( nibble == 11 )
541  str[i] = 'b';
542  else if ( nibble == 13 )
543  str[i] = 'd';
544  else
545  str[i] = (nibble - 10) + 'A';
546 
547  num >>= 4;
548  }
549 
550  SegmentLCD_Write(str);
551 }
552 
553 /**************************************************************************/
557 void SegmentLCD_LowerNumber( int num )
558 {
559  int i;
560  char str[7];
561 
562  SegmentLCD_Symbol(LCD_SYMBOL_MINUS, 0);
563 
564  if ( ( num > 9999999 ) || ( num < -9999999 ) )
565  {
566  SegmentLCD_Write("Ovrflow");
567  return;
568  }
569 
570  if ( num < 0 )
571  {
572  SegmentLCD_Symbol(LCD_SYMBOL_MINUS, 1);
573  num = -num;
574  }
575 
576  for ( i=6; i>=0; i-- )
577  {
578  if ( ( i < 6 ) && ( num == 0 ) )
579  {
580  str[i] = ' ';
581  }
582  else
583  {
584  str[i] = (num % 10) + '0';
585  num /= 10;
586  }
587  }
588 
589  SegmentLCD_Write(str);
590 }
591 
592 
593 /**************************************************************************/
597 void SegmentLCD_Number(int value)
598 {
599  int i, com, bit, digit, div, neg;
600  uint16_t bitpattern;
601  uint16_t num;
602 
603  /* Parameter consistancy check */
604  if (value >= 9999)
605  {
606  value = 9999;
607  }
608  if (value <= -1000)
609  {
610  value = -999;
611  }
612  if (value < 0)
613  {
614  value = abs(value);
615  neg = 1;
616  }
617  else
618  {
619  neg = 0;
620  }
621 
622  /* If an update is in progress we must block, or there might be tearing */
623  LCD_SyncBusyDelay(0xFFFFFFFF);
624 
625  /* Freeze updates to avoid partial refresh of display */
626  LCD_FreezeEnable(true);
627 
628  /* Turn off all number LCD segments */
630 
631  /* Extract useful digits */
632  div = 1;
633  for (digit = 0; digit < 4; digit++)
634  {
635  num = (value / div) % 10;
636  if ((neg == 1) && (digit == 3)) num = signIndex;
637  /* Get number layout of display */
638  bitpattern = EFM_Numbers[num];
639  for (i = 0; i < 7; i++)
640  {
641  bit = EFM_Display.Number[digit].bit[i];
642  com = EFM_Display.Number[digit].com[i];
643  if (bitpattern & (1 << i))
644  {
645  LCD_SegmentSet(com, bit, true);
646  }
647  }
648  div = div * 10;
649  }
650  /* Sync LCD registers to LE domain */
651  LCD_FreezeEnable(false);
652 }
653 
654 
655 /**************************************************************************/
659 {
660  /* Turn off all number segments */
661  LCD_NUMBER_OFF();
662  return;
663 }
664 
665 
666 /**************************************************************************/
671 void SegmentLCD_Symbol(lcdSymbol s, int on)
672 {
673  int com = 0;
674  int bit = 0;
675 
676  switch (s)
677  {
678  case LCD_SYMBOL_GECKO:
679  com = LCD_SYMBOL_GECKO_COM;
680  bit = LCD_SYMBOL_GECKO_SEG;
681  break;
682  case LCD_SYMBOL_ANT:
683  com = LCD_SYMBOL_ANT_COM;
684  bit = LCD_SYMBOL_ANT_SEG;
685  break;
686  case LCD_SYMBOL_PAD0:
687  com = LCD_SYMBOL_PAD0_COM;
688  bit = LCD_SYMBOL_PAD0_SEG;
689  break;
690  case LCD_SYMBOL_PAD1:
691  com = LCD_SYMBOL_PAD1_COM;
692  bit = LCD_SYMBOL_PAD1_SEG;
693  break;
694  case LCD_SYMBOL_EFM32:
695  com = LCD_SYMBOL_EFM32_COM;
696  bit = LCD_SYMBOL_EFM32_SEG;
697  break;
698  case LCD_SYMBOL_MINUS:
699  com = LCD_SYMBOL_MINUS_COM;
700  bit = LCD_SYMBOL_MINUS_SEG;
701  break;
702  case LCD_SYMBOL_COL3:
703  com = LCD_SYMBOL_COL3_COM;
704  bit = LCD_SYMBOL_COL3_SEG;
705  break;
706  case LCD_SYMBOL_COL5:
707  com = LCD_SYMBOL_COL5_COM;
708  bit = LCD_SYMBOL_COL5_SEG;
709  break;
710  case LCD_SYMBOL_COL10:
711  com = LCD_SYMBOL_COL10_COM;
712  bit = LCD_SYMBOL_COL10_SEG;
713  break;
714 #ifdef LCD_SYMBOL_DEGC_SEG
715  case LCD_SYMBOL_DEGC:
716  com = LCD_SYMBOL_DEGC_COM;
717  bit = LCD_SYMBOL_DEGC_SEG;
718  break;
719 #endif
720 #ifdef LCD_SYMBOL_DEGF_SEG
721  case LCD_SYMBOL_DEGF:
722  com = LCD_SYMBOL_DEGF_COM;
723  bit = LCD_SYMBOL_DEGF_SEG;
724  break;
725 #endif
726 #ifdef LCD_SYMBOL_DP2_SEG
727  case LCD_SYMBOL_DP2:
728  com = LCD_SYMBOL_DP2_COM;
729  bit = LCD_SYMBOL_DP2_SEG;
730  break;
731 #endif
732 #ifdef LCD_SYMBOL_DP3_SEG
733  case LCD_SYMBOL_DP3:
734  com = LCD_SYMBOL_DP3_COM;
735  bit = LCD_SYMBOL_DP3_SEG;
736  break;
737 #endif
738 #ifdef LCD_SYMBOL_DP4_SEG
739  case LCD_SYMBOL_DP4:
740  com = LCD_SYMBOL_DP4_COM;
741  bit = LCD_SYMBOL_DP4_SEG;
742  break;
743 #endif
744 #ifdef LCD_SYMBOL_DP5_SEG
745  case LCD_SYMBOL_DP5:
746  com = LCD_SYMBOL_DP5_COM;
747  bit = LCD_SYMBOL_DP5_SEG;
748  break;
749 #endif
750  case LCD_SYMBOL_DP6:
751  com = LCD_SYMBOL_DP6_COM;
752  bit = LCD_SYMBOL_DP6_SEG;
753  break;
754  case LCD_SYMBOL_DP10:
755  com = LCD_SYMBOL_DP10_COM;
756  bit = LCD_SYMBOL_DP10_SEG;
757  break;
758 #ifdef LCD_SYMBOL_AM_SEG
759  case LCD_SYMBOL_AM:
760  com = LCD_SYMBOL_AM_COM;
761  bit = LCD_SYMBOL_AM_SEG;
762  break;
763 #endif
764 #ifdef LCD_SYMBOL_PM_SEG
765  case LCD_SYMBOL_PM:
766  com = LCD_SYMBOL_PM_COM;
767  bit = LCD_SYMBOL_PM_SEG;
768  break;
769 #endif
770 #ifdef LCD_SYMBOL_MICROAMP_SEG
771  case LCD_SYMBOL_MICROAMP:
772  com = LCD_SYMBOL_MICROAMP_COM;
773  bit = LCD_SYMBOL_MICROAMP_SEG;
774  break;
775 #endif
776 #ifdef LCD_SYMBOL_MILLIAMP_SEG
777  case LCD_SYMBOL_MILLIAMP:
778  com = LCD_SYMBOL_MILLIAMP_COM;
779  bit = LCD_SYMBOL_MILLIAMP_SEG;
780  break;
781 #endif
782 
783  }
784  if (on)
785  {
786  LCD_SegmentSet(com, bit, true);
787  }
788  else
789  {
790  LCD_SegmentSet(com, bit, false);
791  }
792 }
793 
794 
795 /**************************************************************************/
799 void SegmentLCD_UnsignedHex(uint16_t value)
800 {
801  int num, i, com, bit, digit;
802  uint16_t bitpattern;
803 
804  /* Parameter consistancy check */
805  if (value >= 0xffff)
806  {
807  value = 0xffff;
808  }
809 
810  /* If an update is in progress we must block, or there might be tearing */
811  LCD_SyncBusyDelay(0xFFFFFFFF);
812 
813  /* Freeze updates to avoid partial refresh of display */
814  LCD_FreezeEnable(true);
815 
816  /* Turn off all number LCD segments */
818 
819  for (digit = 0; digit < 4; digit++)
820  {
821  num = (value >> (4 * digit)) & 0x0f;
822  bitpattern = EFM_Numbers[num];
823  for (i = 0; i < 7; i++)
824  {
825  bit = EFM_Display.Number[digit].bit[i];
826  com = EFM_Display.Number[digit].com[i];
827  if (bitpattern & (1 << i))
828  {
829  LCD_SegmentSet(com, bit, true);
830  }
831  }
832  }
833 
834  /* Sync LCD registers to LE domain */
835  LCD_FreezeEnable(false);
836 }
837 
838 
839 /**************************************************************************/
843 void SegmentLCD_Write(const char *string)
844 {
845  int data, length, index;
846  uint16_t bitfield;
847  uint32_t com, bit;
848  int i;
849 
850  length = strlen(string);
851  index = 0;
852 
853  /* If an update is in progress we must block, or there might be tearing */
854  LCD_SyncBusyDelay(0xFFFFFFFF);
855 
856  /* Freeze LCD to avoid partial updates */
857  LCD_FreezeEnable(true);
858 
859  /* Turn all segments off */
861 
862  /* Fill out all characters on display */
863  for (index = 0; index < 7; index++)
864  {
865  if (index < length)
866  {
867  data = (int) *string;
868  }
869  else /* Padding with space */
870  {
871  data = 0x20; /* SPACE */
872  }
873  /* Defined letters currently starts at "SPACE" - ASCII 0x20; */
874  data = data - 0x20;
875  /* Get font for this letter */
876  bitfield = EFM_Alphabet[data];
877 
878  for (i = 0; i < 14; i++)
879  {
880  bit = EFM_Display.Text[index].bit[i];
881  com = EFM_Display.Text[index].com[i];
882 
883  if (bitfield & (1 << i))
884  {
885  /* Turn on segment */
886  LCD_SegmentSet(com, bit, true);
887  }
888  }
889  string++;
890  }
891  /* Enable update */
892  LCD_FreezeEnable(false);
893 }
894 
895 /******************************************************************************
896  * @brief Display blocks on LCD display: blank, fill, outline, outline & fill
897  * @param topMode array of block modes for the top row with element zero
898  * representing the left-most column and element six representing the
899  * right-most column
900  * @param botMode array of block modes for the bottom row with element zero
901  * representing the left-most column and element six representing the
902  * right-most column
903  ******************************************************************************/
904 static void displayBlock(
905  SegmentLCD_BlockMode_TypeDef topMode[SEGMENT_LCD_NUM_BLOCK_COLUMNS],
906  SegmentLCD_BlockMode_TypeDef botMode[SEGMENT_LCD_NUM_BLOCK_COLUMNS])
907 {
908  int index;
909  int mode;
910  uint16_t bitfield;
911  uint32_t com, bit;
912  int i;
913 
914  /* Fill out all blocks in the top row of the display */
915  for (index = 0; index < SEGMENT_LCD_NUM_BLOCK_COLUMNS; index++)
916  {
917  mode = topMode[index];
918 
919  /* Get segment bitmap for this block position */
920  bitfield = Blocks[mode];
921 
922  for (i = 0; i < 8; i++)
923  {
924  if (bitfield & (1 << i))
925  {
926  bit = EFM_Display.TopBlocks[index].bit[i];
927  com = EFM_Display.TopBlocks[index].com[i];
928 
929  // Turn on segment
930  LCD_SegmentSet(com, bit, true);
931  }
932  }
933  }
934  /* Fill out all blocks in the bottom row of the display */
935  for (index = 0; index < SEGMENT_LCD_NUM_BLOCK_COLUMNS; index++)
936  {
937  mode = botMode[index];
938 
939  /* Get segment bitmap for this block position */
940  bitfield = Blocks[mode];
941 
942  for (i = 0; i < 8; i++)
943  {
944  if (bitfield & (1 << i))
945  {
946  bit = EFM_Display.BotBlocks[index].bit[i];
947  com = EFM_Display.BotBlocks[index].com[i];
948 
949  // Turn on segment
950  LCD_SegmentSet(com, bit, true);
951  }
952  }
953  }
954 }
955 
EM_TypeDef EMode
Definition: segmentlcd.c:143
Clock management unit (CMU) API.
void CMU_ClockSelectSet(CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
Select reference clock/oscillator used for a clock branch.
Definition: em_cmu.c:2521
Defines prototype for all segments in display.
Definition: segmentlcd.c:139
static const uint16_t EFM_Alphabet[]
Defines higlighted segments for the alphabet, starting from "blank" (SPACE) Uses bit pattern as defin...
Definition: segmentlcd.c:170
static const uint16_t Blocks[]
Defines highlighted segments for the block display.
Definition: segmentlcd.c:300
void SegmentLCD_LowerNumber(int num)
Write number on lower alphanumeric part of Segment LCD display.
Definition: segmentlcd.c:557
void LCD_VBoostSet(LCD_VBoostLevel_TypeDef vboost)
Configure voltage booster.
Definition: em_lcd.c:610
Defines segment COM and BIT fields numeric display.
Definition: segmentlcd.c:58
Defines segment COM and BIT fields for Energy Modes on display.
Definition: segmentlcd.c:67
static const MCU_DISPLAY EFM_Display
Working instance of LCD display.
Definition: segmentlcd.c:154
Defines each text symbol's segment in terms of COM and BIT numbers, in a way that we can enumerate ea...
Definition: segmentlcd.c:49
#define CMU
uint8_t bit[8]
Definition: segmentlcd.c:133
void SegmentLCD_Write(const char *string)
Write text on LCD display.
Definition: segmentlcd.c:843
uint8_t bit[7]
Definition: segmentlcd.c:61
SegmentLCD_BlockMode_TypeDef
Definition: segmentlcd.h:51
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
void SegmentLCD_Symbol(lcdSymbol s, int on)
Light up or shut off various symbols on Segment LCD.
Definition: segmentlcd.c:671
void SegmentLCD_NumberOff(void)
Turn all segments on numeric digits in display off.
Definition: segmentlcd.c:658
void LCD_SegmentSet(int com, int bit, bool enable)
Turn on or clear a segment.
Definition: em_lcd.c:265
void LCD_VLCDSelect(LCD_VLCDSel_TypeDef vlcd)
Select source for VLCD.
Definition: em_lcd.c:112
void SegmentLCD_AllOff(void)
Disable all segments.
Definition: segmentlcd.c:318
EFM32 Segment LCD Display driver, header file.
void SegmentLCD_AllOn(void)
Enable all segments.
Definition: segmentlcd.c:328
uint8_t com[7]
Definition: segmentlcd.c:60
#define CMU_LCDCTRL_VBOOSTEN
Definition: efm32wg_cmu.h:1184
void SegmentLCD_EnergyMode(int em, int on)
Light up or shut off Energy Mode indicator.
Definition: segmentlcd.c:454
General Purpose IO (GPIO) peripheral API.
#define LCD_SYNCBUSY_CTRL
Definition: efm32wg_lcd.h:432
uint8_t bit[4]
Definition: segmentlcd.c:88
void SegmentLCD_ARing(int anum, int on)
Light up or shut off Ring of Indicators.
Definition: segmentlcd.c:349
void SegmentLCD_AlphaNumberOff(void)
Turn all segments on alpha characters in display off.
Definition: segmentlcd.c:337
uint8_t com[8]
Definition: segmentlcd.c:78
void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable)
Enable/disable a clock.
Definition: em_cmu.c:1453
void CMU_LCDClkFDIVSet(uint32_t div)
Set the LCD framerate divisor (FDIV) setting.
Definition: em_cmu.c:3502
BATTERY_TypeDef Battery
Definition: segmentlcd.c:145
uint8_t bit[5]
Definition: segmentlcd.c:70
void SegmentLCD_LowerHex(uint32_t num)
Write a hexadecimal number on lower alphanumeric part of Segment LCD display.
Definition: segmentlcd.c:526
Defines segment COM and BIT fields for top and bottom row blocks. The bit pattern shown above for cha...
Definition: segmentlcd.c:130
static const uint16_t EFM_Numbers[]
Defines higlighted segments for the numeric display.
Definition: segmentlcd.c:276
uint8_t bit[8]
Definition: segmentlcd.c:79
__STATIC_INLINE void LCD_FreezeEnable(bool enable)
When set, LCD registers will not be updated until cleared,.
Definition: em_lcd.h:435
Defines segment COM and BIT fields for Battery (suited for Anim)
Definition: segmentlcd.c:85
void SegmentLCD_Battery(int batteryLevel)
Light up or shut off Battery Indicator.
Definition: segmentlcd.c:371
void SegmentLCD_Number(int value)
Write number on numeric part on Segment LCD display.
Definition: segmentlcd.c:597
Block_TypeDef BotBlocks[7]
Definition: segmentlcd.c:147
uint8_t com[4]
Definition: segmentlcd.c:87
void SegmentLCD_Init(bool useBoost)
Segment LCD Initialization routine for EFM32 STK display.
Definition: segmentlcd.c:476
ARING_TypeDef ARing
Definition: segmentlcd.c:144
uint8_t com[5]
Definition: segmentlcd.c:69
Block_TypeDef TopBlocks[7]
Definition: segmentlcd.c:146
uint8_t bit[14]
Definition: segmentlcd.c:52
void SegmentLCD_UnsignedHex(uint16_t value)
Write hexadecimal number on numeric part on Segment LCD display.
Definition: segmentlcd.c:799
__STATIC_INLINE void LCD_SyncBusyDelay(uint32_t flags)
Polls LCD SYNCBUSY flags, until flag has been cleared.
Definition: em_lcd.h:468
uint8_t com[8]
Definition: segmentlcd.c:132
__STATIC_INLINE void LCD_IntDisable(uint32_t flags)
Disable LCD interrupts.
Definition: em_lcd.h:559
CHAR_TypeDef Text[7]
Definition: segmentlcd.c:141
static void displayBlock(SegmentLCD_BlockMode_TypeDef topMode[SEGMENT_LCD_NUM_BLOCK_COLUMNS], SegmentLCD_BlockMode_TypeDef botMode[SEGMENT_LCD_NUM_BLOCK_COLUMNS])
Working instance of LCD display.
Definition: segmentlcd.c:904
void SegmentLCD_Disable(void)
Disables LCD controller.
Definition: segmentlcd.c:433
__STATIC_INLINE void LCD_Enable(bool enable)
Enable or disable LCD controller.
Definition: em_lcd.h:308
void LCD_Init(const LCD_Init_TypeDef *lcdInit)
Initalize Liquid Crystal Display (LCD) controller.
Definition: em_lcd.c:67
void CMU_ClockDivSet(CMU_Clock_TypeDef clock, CMU_ClkDiv_TypeDef div)
Set clock divisor/prescaler.
Definition: em_cmu.c:1244
uint8_t com[14]
Definition: segmentlcd.c:51
NUMBER_TypeDef Number[4]
Definition: segmentlcd.c:142
Defines segment COM and BIT fields for A-wheel (suited for Anim)
Definition: segmentlcd.c:76