EFM32 Gecko Software Documentation  efm32g-doc-5.1.2
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 */
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  /* Resetting display while SPI_DEMUX is set to display does not work */
51  {
53  }
54  /* Configure for EBI mode and reset display */
58  /* Short reset delay */
59  freq = SystemCoreClockGet();
60  for (i = 0; i < (freq / 100); i++)
61  {
62  __NOP();
63  }
64  /* Configure display for Direct Drive + SPI mode */
68 
69  /* Initialize graphics - abort on failure */
70  status = DMDIF_init(BC_SSD2119_BASE, BC_SSD2119_BASE + 2);
71  if (status == DMD_OK) status = DMD_init(0);
72  if ((status != DMD_OK) && (status != DMD_ERROR_DRIVER_ALREADY_INITIALIZED)) while (1) ;
73  /* Make sure display is configured with correct rotation */
74  if ((status == DMD_OK)) DMD_flipDisplay(1, 1);
75 
76  runOnce = false;
77  }
78  ret = true;
79  }
80  else
81  {
82  ret = false;
83  }
84  return ret;
85 }
Board support package API definitions.
#define BC_SPI_DEMUX_SLAVE_AUDIO
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
uint32_t SystemCoreClockGet(void)
Get the current core clock frequency.
uint16_t BSP_RegisterRead(volatile uint16_t *addr)
Read from a board controller register.
Definition: bsp_dk_3201.c:687
#define BC_UIF_AEM_EFM
External Bus Iterface (EBI) peripheral API.
Silicon Labs Graphics Library.
General Purpose IO (GPIO) peripheral API.
static bool runOnce
Definition: tftamapped.c:28
int BSP_RegisterWrite(volatile uint16_t *addr, uint16_t data)
Write to a board controller register.
Definition: bsp_dk_3201.c:704
#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
int BSP_DisplayControl(BSP_Display_TypeDef option)
Configure display control.
Definition: bsp_dk_3201.c:251
#define BC_SPI_DEMUX_SLAVE_DISPLAY
#define BC_REGISTER
#define BC_SSD2119_BASE
EFM32GG_DK3750, TFT Initialization and setup for Adress Mapped mode.