EFM32 Wonder Gecko Software Documentation  efm32wg-doc-5.1.2
tftdirect.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 "tftdirect.h"
23 /* DMD init from dmd_ssd2119_direct.c */
24 #include "glib/glib.h"
25 
27 static bool runOnce = true;
28 
29 /**************************************************************************/
33 {
34  /* EBI TFT DCLK/Dot Clock */
35  GPIO_PinModeSet(gpioPortA, 8, gpioModePushPull, 0);
36  /* EBI TFT DATAEN */
37  GPIO_PinModeSet(gpioPortA, 9, gpioModePushPull, 0);
38  /* EBI TFT VSYNC */
39  GPIO_PinModeSet(gpioPortA, 10, gpioModePushPull, 0);
40  /* EBI TFT HSYNC */
41  GPIO_PinModeSet(gpioPortA, 11, gpioModePushPull, 0);
42 }
43 
44 
45 /**************************************************************************/
54 bool TFT_DirectInit(const EBI_TFTInit_TypeDef *tftInit)
55 {
56  bool ret;
57  uint32_t i, freq;
58  EMSTATUS stat;
59 
60  /* If we are in BC_UIF_AEM_EFM state, we can redraw graphics */
62  {
63  /* If we're not BC_ARB_CTRL_EBI state, we need to reconfigure display controller */
64  if ((BSP_RegisterRead(&BC_REGISTER->ARB_CTRL) != BC_ARB_CTRL_EBI) || runOnce)
65  {
66  /* Enable SSD2119 Serial Port Interface */
68 
69  /* Enable EBI mode of operation on SSD2119 controller */
73  freq = SystemCoreClockGet();
74  for (i = 0; i < (freq / 100); i++)
75  {
76  __NOP();
77  }
78  /* Configure display for Direct Drive "Mode Generic" + 3-wire SPI mode */
82 
83  /* Configure GPIO for EBI and TFT */
85 
86  /* Initialize display */
87  stat = DMD_init(0);
88  if (DMD_OK == stat) stat = DMD_selectFramebuffer((void*)EBI_BankAddress(EBI_BANK2));
89  if (DMD_OK != stat) while (1) ;
90 
91  /* Configure EBI TFT direct drive */
92  EBI_TFTInit(tftInit);
93 
94  runOnce = false;
95  }
96  ret = true;
97  }
98  else
99  {
100  ret = false;
101  }
102 
103  return ret;
104 }
uint32_t SystemCoreClockGet(void)
Get the current core clock frequency.
Board support package API definitions.
uint32_t EBI_BankAddress(uint32_t bank)
Return base address of EBI bank.
Definition: em_ebi.c:330
static bool runOnce
Definition: tftdirect.c:27
Definition: bsp.h:132
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
bool TFT_DirectInit(const EBI_TFTInit_TypeDef *tftInit)
TFT initialize or reinitialize Assumes EBI has been configured correctly in BSP_Init(BSP_INIT_DK_EBI)...
Definition: tftdirect.c:54
void TFT_DirectGPIOConfig(void)
GPIO configuration for TFT direct drive.
Definition: tftdirect.c:32
uint16_t BSP_RegisterRead(volatile uint16_t *addr)
Read from a board controller register.
Definition: bsp_dk_3201.c:687
#define EBI_BANK2
Definition: em_ebi.h:77
#define BC_UIF_AEM_EFM
External Bus Iterface (EBI) peripheral API.
Silicon Labs Graphics Library.
void GPIO_PinModeSet(GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out)
Set the mode for a GPIO pin.
Definition: em_gpio.c:269
General Purpose IO (GPIO) peripheral API.
int BSP_PeripheralAccess(BSP_Peripheral_TypeDef perf, bool enable)
DK Peripheral Access Control Enable or disable access to on-board peripherals through switches and SP...
Definition: bsp_dk_3201.c:461
#define BC_ARB_CTRL_EBI
int BSP_DisplayControl(BSP_Display_TypeDef option)
Configure display control.
Definition: bsp_dk_3201.c:251
EFM32GG_DK3750, TFT Initialization and setup for Direct Drive mode.
#define BC_REGISTER
void EBI_TFTInit(const EBI_TFTInit_TypeDef *ebiTFTInit)
Configure and initialize TFT Direct Drive.
Definition: em_ebi.c:573