EFM32 Giant Gecko Software Documentation  efm32gg-doc-4.2.1
tftamapped.c
Go to the documentation of this file.
1 /**************************************************************************/
17 #include <stdbool.h>
18 #include "em_device.h"
19 #include "em_gpio.h"
20 #include "em_ebi.h"
21 #include "bsp.h"
22 #include "tftamapped.h"
23 /* DMD init from dmd_ssd2119_direct.c */
24 #include "dmd/ssd2119/dmd_ssd2119.h"
25 #include "glib/glib.h"
26 
28 static bool runOnce = true;
29 
30 /**************************************************************************/
38 {
39  bool ret;
40  EMSTATUS status;
41  uint32_t i, freq;
42 
43  /* If we are in BC_UIF_AEM_EFM state, we can redraw graphics */
44  if (BSP_RegisterRead(&BC_REGISTER->UIF_AEM) == BC_UIF_AEM_EFM)
45  {
46  /* If we're not BC_ARB_CTRL_EBI state, we need to reconfigure display controller */
47  if ((BSP_RegisterRead(&BC_REGISTER->ARB_CTRL) != BC_ARB_CTRL_EBI) || runOnce)
48  {
49  /* Configure for EBI mode and reset display */
50  BSP_DisplayControl(BSP_Display_EBI);
51  BSP_DisplayControl(BSP_Display_ResetAssert);
52  BSP_DisplayControl(BSP_Display_PowerDisable);
53  /* Short reset delay */
54  freq = SystemCoreClockGet();
55  for (i = 0; i < (freq / 100); i++)
56  {
57  __NOP();
58  }
59  /* Configure display for Direct Drive + SPI mode */
60  BSP_DisplayControl(BSP_Display_Mode8080);
61  BSP_DisplayControl(BSP_Display_PowerEnable);
62  BSP_DisplayControl(BSP_Display_ResetRelease);
63 
64  /* Initialize graphics - abort on failure */
65  status = DMDIF_init(BC_SSD2119_BASE, BC_SSD2119_BASE + 2);
66  if (status == DMD_OK) status = DMD_init(0);
67  if ((status != DMD_OK) && (status != DMD_ERROR_DRIVER_ALREADY_INITIALIZED)) while (1) ;
68  /* Make sure display is configured with correct rotation */
69  if ((status == DMD_OK)) DMD_flipDisplay(1, 1);
70 
71  runOnce = false;
72  }
73  ret = true;
74  }
75  else
76  {
77  ret = false;
78  }
79  return ret;
80 }
uint32_t SystemCoreClockGet(void)
Get the current core clock frequency.
Board support package API definitions.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
#define BC_UIF_AEM_EFM
External Bus Iterface (EBI) peripheral API.
General Purpose IO (GPIO) peripheral API.
static bool runOnce
Definition: tftamapped.c:28
#define BC_ARB_CTRL_EBI
bool TFT_AddressMappedInit(void)
TFT initialize or reinitialize to Address Mapped Mode Assumes EBI has been configured correctly in BS...
Definition: tftamapped.c:37
#define BC_REGISTER
#define BC_SSD2119_BASE
EFM32GG_DK3750, TFT Initialization and setup for Adress Mapped mode.