EU1KY AA
LCD.c File Reference
#include "LCD.h"
#include "stm32f7xx_hal.h"
#include "stm32746g_discovery.h"
#include "stm32746g_discovery_lcd.h"
#include "libnsbmp.h"
#include "crash.h"
#include <math.h>
#include "font.h"

Macros

#define LCD_ArcPixel(x, y)   if ((xmin <= x) && (x <= xmax)) LCD_SetPixel(LCD_MakePoint(centerx + x, centery + y), color)
 
#define BYTES_PER_PIXEL   4
 
#define TRANSPARENT_COLOR   0xFFFFFFFF
 
#define LCD_BUF_STACK_DEPTH   4
 

Functions

static uint16_t _min (uint16_t a, uint16_t b)
 
static uint16_t _max (uint16_t a, uint16_t b)
 
static int _abs (int a)
 
uint16_t LCD_GetWidth (void)
 
uint16_t LCD_GetHeight (void)
 
void LCD_BacklightOn (void)
 Turn on LCD backlight. More...
 
void LCD_BacklightOff (void)
 Turn off LCD backlight. More...
 
void LCD_ShowActiveLayerOnly (void)
 
void LCD_Init (void)
 Initialize hardware, turn on and fill display with black. More...
 
void LCD_TurnOn (void)
 Turn on LCD and backlight. More...
 
void LCD_TurnOff (void)
 
uint32_t LCD_IsOff (void)
 
void LCD_WaitForRedraw (void)
 
void LCD_FillRect (LCDPoint p1, LCDPoint p2, LCDColor color)
 Fill rectangle with given corner points with given color. More...
 
void LCD_InvertRect (LCDPoint p1, LCDPoint p2)
 
void LCD_FillAll (LCDColor c)
 Fill the entire display with given color. More...
 
LCDColor LCD_MakeRGB (uint8_t r, uint8_t g, uint8_t b)
 
LCDPoint LCD_MakePoint (int x, int y)
 Make LCDPoint from x and y coordinates. More...
 
LCDColor LCD_ReadPixel (LCDPoint p)
 
void LCD_InvertPixel (LCDPoint p)
 Invert color of display pixel. More...
 
void LCD_SetPixel (LCDPoint p, LCDColor color)
 Sets pixel at given point to given color. More...
 
void LCD_Rectangle (LCDPoint a, LCDPoint b, LCDColor c)
 Draw lines forming a rectangle with given corner points with given color. More...
 
void LCD_Line (LCDPoint a, LCDPoint b, LCDColor color)
 Draw line between given points with given color. More...
 
void LCD_VLine (LCDPoint a, uint16_t lenght, LCDColor color)
 
void LCD_HLine (LCDPoint a, uint16_t lenght, LCDColor color)
 
void LCD_Circle (LCDPoint center, uint16_t r, LCDColor color)
 
void LCD_FillCircle (LCDPoint center, uint16_t r, LCDColor color)
 
static void LCD_DrawArcQuadrant (int32_t centerx, uint32_t centery, int32_t radius, uint32_t quadrant, int32_t xmin, int32_t xmax, LCDColor color)
 
void LCD_DrawArc (int32_t x, int32_t y, int32_t radius, float startDegrees, float endDegrees, LCDColor color)
 Draw arc using start and end in degrees (0 .. 360) More...
 
static voidbitmap_create (int width, int height, unsigned int state)
 
static unsigned char * bitmap_get_buffer (void *bitmap)
 
static size_t bitmap_get_bpp (void *bitmap)
 
static void bitmap_destroy (void *bitmap)
 
static void bitmap_putcolor (unsigned int color32, unsigned int x, unsigned int y)
 
void LCD_DrawBitmap (LCDPoint origin, const uint8_t *bmpData, uint32_t bmpDataSize)
 
static uint8_t __attribute__ ((section(".user_sdram")))
 
void LCD_Pop (void)
 Restore last saved LCD contents from the stack in SDRAM memory. More...
 
void PixPict (unsigned int x0, unsigned int y0, char *bmp)
 
void test (unsigned char x)
 
void test1 (unsigned char x)
 
void test32 (uint32_t x)
 
void testStr (char *x)
 
void testMon (uint8_t *adr)
 

Variables

static LCDPoint _bmpOrigin
 
static bmp_bitmap_callback_vt bitmap_callbacks
 

Macro Definition Documentation

#define BYTES_PER_PIXEL   4
#define LCD_ArcPixel (   x,
 
)    if ((xmin <= x) && (x <= xmax)) LCD_SetPixel(LCD_MakePoint(centerx + x, centery + y), color)
#define LCD_BUF_STACK_DEPTH   4
#define TRANSPARENT_COLOR   0xFFFFFFFF

Function Documentation

static uint8_t __attribute__ ( (section(".user_sdram"))  )
static
static int _abs ( int  a)
inlinestatic
static uint16_t _max ( uint16_t  a,
uint16_t  b 
)
inlinestatic
static uint16_t _min ( uint16_t  a,
uint16_t  b 
)
inlinestatic
static void* bitmap_create ( int  width,
int  height,
unsigned int  state 
)
static
static void bitmap_destroy ( void bitmap)
static
static size_t bitmap_get_bpp ( void bitmap)
static
static unsigned char* bitmap_get_buffer ( void bitmap)
static
static void bitmap_putcolor ( unsigned int  color32,
unsigned int  x,
unsigned int  y 
)
static
void LCD_BacklightOff ( void  )

Turn off LCD backlight.

void LCD_BacklightOn ( void  )

Turn on LCD backlight.

void LCD_Circle ( LCDPoint  center,
uint16_t  r,
LCDColor  color 
)
void LCD_DrawArc ( int32_t  x,
int32_t  y,
int32_t  radius,
float  startDegrees,
float  endDegrees,
LCDColor  color 
)

Draw arc using start and end in degrees (0 .. 360)

static void LCD_DrawArcQuadrant ( int32_t  centerx,
uint32_t  centery,
int32_t  radius,
uint32_t  quadrant,
int32_t  xmin,
int32_t  xmax,
LCDColor  color 
)
static
void LCD_DrawBitmap ( LCDPoint  origin,
const uint8_t *  bmpData,
uint32_t  bmpDataSize 
)
void LCD_FillAll ( LCDColor  c)

Fill the entire display with given color.

void LCD_FillCircle ( LCDPoint  center,
uint16_t  r,
LCDColor  color 
)
void LCD_FillRect ( LCDPoint  p1,
LCDPoint  p2,
LCDColor  color 
)

Fill rectangle with given corner points with given color.

uint16_t LCD_GetHeight ( void  )
uint16_t LCD_GetWidth ( void  )
void LCD_HLine ( LCDPoint  a,
uint16_t  lenght,
LCDColor  color 
)
void LCD_Init ( void  )

Initialize hardware, turn on and fill display with black.

void LCD_InvertPixel ( LCDPoint  p)

Invert color of display pixel.

void LCD_InvertRect ( LCDPoint  p1,
LCDPoint  p2 
)
uint32_t LCD_IsOff ( void  )
void LCD_Line ( LCDPoint  a,
LCDPoint  b,
LCDColor  color 
)

Draw line between given points with given color.

LCDPoint LCD_MakePoint ( int  x,
int  y 
)

Make LCDPoint from x and y coordinates.

LCDColor LCD_MakeRGB ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Make LCDColor from R, G and B components with function. See also LCD_RGB macro that does the same at compile time.

void LCD_Pop ( void  )

Restore last saved LCD contents from the stack in SDRAM memory.

LCDColor LCD_ReadPixel ( LCDPoint  p)
void LCD_Rectangle ( LCDPoint  a,
LCDPoint  b,
LCDColor  c 
)

Draw lines forming a rectangle with given corner points with given color.

void LCD_SetPixel ( LCDPoint  p,
LCDColor  color 
)

Sets pixel at given point to given color.

void LCD_ShowActiveLayerOnly ( void  )
void LCD_TurnOff ( void  )

Turn off backlight and switch LCD to power saving mode (but draving to its memory remains available)

void LCD_TurnOn ( void  )

Turn on LCD and backlight.

void LCD_VLine ( LCDPoint  a,
uint16_t  lenght,
LCDColor  color 
)
void LCD_WaitForRedraw ( void  )
void PixPict ( unsigned int  x0,
unsigned int  y0,
char *  bmp 
)
void test ( unsigned char  x)
void test1 ( unsigned char  x)
void test32 ( uint32_t  x)
void testMon ( uint8_t *  adr)
void testStr ( char *  x)

Variable Documentation

LCDPoint _bmpOrigin
static
bmp_bitmap_callback_vt bitmap_callbacks
static
Initial value:
=
{
}
static void bitmap_destroy(void *bitmap)
Definition: LCD.c:365
static size_t bitmap_get_bpp(void *bitmap)
Definition: LCD.c:359
static void * bitmap_create(int width, int height, unsigned int state)
Definition: LCD.c:348
static void bitmap_putcolor(unsigned int color32, unsigned int x, unsigned int y)
Definition: LCD.c:371
static unsigned char * bitmap_get_buffer(void *bitmap)
Definition: LCD.c:354