VSF Documented
Macros | Functions
GLCD_V2M-MPS2.c File Reference
#include <stddef.h>
#include "SMM_MPS2.h"
#include "GLCD_Config.h"
#include "Board_GLCD.h"

Macros

#define UNUSED(x)   (void)(x) /* macro to get rid of 'unused parameter' warning */
 
#define MPS2_FPGAIO_PORT   MPS2_FPGAIO
 
#define MPS2_SSP_PORT   MPS2_SSP0
 
#define PIN_CS   (1ul << 0)
 
#define TFE   0x01
 
#define RNE   0x04
 
#define BSY   0x10
 
#define LCD_CS(x)   ((x) ? (MPS2_FPGAIO_PORT->MISC |= PIN_CS) : (MPS2_FPGAIO->MISC &= ~PIN_CS))
 
#define SPI_START   (0x70) /* Start byte for SPI transfer */
 
#define SPI_RD   (0x01) /* WR bit 1 within start */
 
#define SPI_WR   (0x00) /* WR bit 0 within start */
 
#define SPI_DATA   (0x02) /* RS bit 1 within start byte */
 
#define SPI_INDEX   (0x00) /* RS bit 0 within start byte */
 

Functions

int32_t GLCD_Initialize (void)
 Initialize Graphic LCD (HX8347-D LCD Controller)
 
int32_t GLCD_Uninitialize (void)
 De-initialize Graphic LCD.
 
int32_t GLCD_SetForegroundColor (uint32_t color)
 Set foreground color.
 
int32_t GLCD_SetBackgroundColor (uint32_t color)
 Set background color.
 
int32_t GLCD_ClearScreen (void)
 Clear screen (with active background color)
 
int32_t GLCD_SetFont (GLCD_FONT *font)
 Set active font.
 
int32_t GLCD_DrawPixel (uint32_t x, uint32_t y)
 Draw pixel (in active foreground color)
 
int32_t GLCD_DrawHLine (uint32_t x, uint32_t y, uint32_t length)
 Draw horizontal line (in active foreground color)
 
int32_t GLCD_DrawVLine (uint32_t x, uint32_t y, uint32_t length)
 Draw vertical line (in active foreground color)
 
int32_t GLCD_DrawRectangle (uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 Draw rectangle (in active foreground color)
 
int32_t GLCD_DrawChar (uint32_t x, uint32_t y, int32_t ch)
 Draw character (in active foreground color)
 
int32_t GLCD_DrawString (uint32_t x, uint32_t y, const char *str)
 Draw string (in active foreground color)
 
int32_t GLCD_DrawBargraph (uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t val)
 Draw bargraph (in active foreground color)
 
int32_t GLCD_DrawBitmap (uint32_t x, uint32_t y, uint32_t width, uint32_t height, const uint8_t *bitmap)
 Draw bitmap (bitmap from BMP file without header)
 
int32_t GLCD_VScroll (uint32_t dy)
 Scroll picture on display vertically.
 
int32_t GLCD_FrameBufferAccess (bool enable)
 Enable or disable direct access to FrameBuffer.
 
uint32_t GLCD_FrameBufferAddress (void)
 Retrieve FrameBuffer address.
 

Macro Definition Documentation

◆ UNUSED

#define UNUSED (   x)    (void)(x) /* macro to get rid of 'unused parameter' warning */

◆ MPS2_FPGAIO_PORT

#define MPS2_FPGAIO_PORT   MPS2_FPGAIO

◆ MPS2_SSP_PORT

#define MPS2_SSP_PORT   MPS2_SSP0

◆ PIN_CS

#define PIN_CS   (1ul << 0)

◆ TFE

#define TFE   0x01

◆ RNE

#define RNE   0x04

◆ BSY

#define BSY   0x10

◆ LCD_CS

#define LCD_CS (   x)    ((x) ? (MPS2_FPGAIO_PORT->MISC |= PIN_CS) : (MPS2_FPGAIO->MISC &= ~PIN_CS))

◆ SPI_START

#define SPI_START   (0x70) /* Start byte for SPI transfer */

◆ SPI_RD

#define SPI_RD   (0x01) /* WR bit 1 within start */

◆ SPI_WR

#define SPI_WR   (0x00) /* WR bit 0 within start */

◆ SPI_DATA

#define SPI_DATA   (0x02) /* RS bit 1 within start byte */

◆ SPI_INDEX

#define SPI_INDEX   (0x00) /* RS bit 0 within start byte */

Function Documentation

◆ GLCD_Initialize()

int32_t GLCD_Initialize ( void  )

Initialize Graphic LCD (HX8347-D LCD Controller)

Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_Uninitialize()

int32_t GLCD_Uninitialize ( void  )

De-initialize Graphic LCD.

Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_SetForegroundColor()

int32_t GLCD_SetForegroundColor ( uint32_t  color)

Set foreground color.

Parameters
[in]colorColor value
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_SetBackgroundColor()

int32_t GLCD_SetBackgroundColor ( uint32_t  color)

Set background color.

Parameters
[in]colorColor value
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_ClearScreen()

int32_t GLCD_ClearScreen ( void  )

Clear screen (with active background color)

Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_SetFont()

int32_t GLCD_SetFont ( GLCD_FONT *  font)

Set active font.

Parameters
[in]fontPointer to font structure
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_DrawPixel()

int32_t GLCD_DrawPixel ( uint32_t  x,
uint32_t  y 
)

Draw pixel (in active foreground color)

Parameters
[in]xx position in pixels (0 = left corner)
[in]yy position in pixels (0 = upper corner)
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_DrawHLine()

int32_t GLCD_DrawHLine ( uint32_t  x,
uint32_t  y,
uint32_t  length 
)

Draw horizontal line (in active foreground color)

Parameters
[in]xStart x position in pixels (0 = left corner)
[in]yStart y position in pixels (0 = upper corner)
[in]lengthLine length
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_DrawVLine()

int32_t GLCD_DrawVLine ( uint32_t  x,
uint32_t  y,
uint32_t  length 
)

Draw vertical line (in active foreground color)

Parameters
[in]xStart x position in pixels (0 = left corner)
[in]yStart y position in pixels (0 = upper corner)
[in]lengthLine length in pixels
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_DrawRectangle()

int32_t GLCD_DrawRectangle ( uint32_t  x,
uint32_t  y,
uint32_t  width,
uint32_t  height 
)

Draw rectangle (in active foreground color)

Parameters
[in]xStart x position in pixels (0 = left corner)
[in]yStart y position in pixels (0 = upper corner)
[in]widthRectangle width in pixels
[in]heightRectangle height in pixels
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_DrawChar()

int32_t GLCD_DrawChar ( uint32_t  x,
uint32_t  y,
int32_t  ch 
)

Draw character (in active foreground color)

Parameters
[in]xx position in pixels (0 = left corner)
[in]yy position in pixels (0 = upper corner)
[in]chCharacter
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_DrawString()

int32_t GLCD_DrawString ( uint32_t  x,
uint32_t  y,
const char *  str 
)

Draw string (in active foreground color)

Parameters
[in]xx position in pixels (0 = left corner)
[in]yy position in pixels (0 = upper corner)
[in]strNull-terminated String
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_DrawBargraph()

int32_t GLCD_DrawBargraph ( uint32_t  x,
uint32_t  y,
uint32_t  width,
uint32_t  height,
uint32_t  val 
)

Draw bargraph (in active foreground color)

Parameters
[in]xStart x position in pixels (0 = left corner)
[in]yStart y position in pixels (0 = upper corner)
[in]widthFull bargraph width in pixels
[in]heightFull bargraph height in pixels
[in]valActive bargraph value (maximum value is 100)
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_DrawBitmap()

int32_t GLCD_DrawBitmap ( uint32_t  x,
uint32_t  y,
uint32_t  width,
uint32_t  height,
const uint8_t bitmap 
)

Draw bitmap (bitmap from BMP file without header)

Parameters
[in]xStart x position in pixels (0 = left corner)
[in]yStart y position in pixels (0 = upper corner)
[in]widthBitmap width in pixels
[in]heightBitmap height in pixels
[in]bitmapBitmap data
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_VScroll()

int32_t GLCD_VScroll ( uint32_t  dy)

Scroll picture on display vertically.

Parameters
[in]dyScroll size in pixels
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_FrameBufferAccess()

int32_t GLCD_FrameBufferAccess ( bool  enable)

Enable or disable direct access to FrameBuffer.

Parameters
[in]enableEnable or disable request
Returns
  • 0: function succeeded
  • -1: function failed

◆ GLCD_FrameBufferAddress()

uint32_t GLCD_FrameBufferAddress ( void  )

Retrieve FrameBuffer address.

Returns
FrameBuffer address