EE445M RTOS
Taken at the University of Texas Spring 2015
graphics2d.c File Reference
#include "graphics2d.h"
Include dependency graph for graphics2d.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

unsigned char * G2ConvertFBToRITFormat (framebuffer fb)
 
void G2Draw (framebuffer fb)
 

Variables

unsigned char g_PackedDeviceBuffer [RIT_FB_WIDTH *RIT_FB_HEIGHT] = {0}
 The One Buffer To Rule Them All (TM) More...
 

Macro Definition Documentation

#define NDEBUG

Definition at line 6 of file graphics2d.c.

Function Documentation

unsigned char* G2ConvertFBToRITFormat ( framebuffer  )

Unpack fb into in the format understood by RIT functions.

Parameters
fbFramebuffer to convert into a char*
Returns
fb in RITFormat (unpacked char* array)

Definition at line 23 of file graphics2d.c.

References g_PackedDeviceBuffer, OLED_HEIGHT, OLED_WIDTH, and RIT_FB_WIDTH.

Referenced by demonstrateClock(), demonstrateDrawShapes(), demonstrateDrawString(), G2Draw(), and main().

23  {
24 
25  /* i is x, j is y */
26  unsigned char i, j;
27  unsigned char a, b;
28 
29 #ifndef NDEBUG
30  printf("%s Unpacking framebuffer...", __FUNCTION__);
31 #endif
32 
33  for(j=0; j<OLED_HEIGHT; ++j) {
34  for(i=0; i<OLED_WIDTH; i+=2) {
35  a = fb[i][j];
36  b = fb[i+1][j];
37 
38  g_PackedDeviceBuffer[(i/2)+j*RIT_FB_WIDTH] = (a<<4) | (b&0xF);
39  }
40  }
41 
42 #ifndef NDEBUG
43  printf("%s Done unpacking framebuffer...", __FUNCTION__);
44 #endif
45 
46  return g_PackedDeviceBuffer;
47 }
#define OLED_HEIGHT
Definition: defines.h:106
#define RIT_FB_WIDTH
Definition: defines.h:110
#define OLED_WIDTH
Definition: defines.h:107
unsigned char g_PackedDeviceBuffer[RIT_FB_WIDTH *RIT_FB_HEIGHT]
The One Buffer To Rule Them All (TM)
Definition: graphics2d.c:21

Here is the caller graph for this function:

void G2Draw ( framebuffer  )

Draw (unpacked) fb on the OLED.

Parameters
fbFramebuffer type (char**)
Returns
void

Definition at line 49 of file graphics2d.c.

References G2ConvertFBToRITFormat(), g_PackedDeviceBuffer, OLED_HEIGHT, and OLED_WIDTH.

49  {
50 
52 #ifndef __GNUC__
53  RIT128x96x4ImageDraw(g_PackedDeviceBuffer, 0, 0, OLED_WIDTH, OLED_HEIGHT);
54 #endif
55 }
unsigned char * G2ConvertFBToRITFormat(framebuffer fb)
Definition: graphics2d.c:23
#define OLED_HEIGHT
Definition: defines.h:106
#define OLED_WIDTH
Definition: defines.h:107
unsigned char g_PackedDeviceBuffer[RIT_FB_WIDTH *RIT_FB_HEIGHT]
The One Buffer To Rule Them All (TM)
Definition: graphics2d.c:21

Here is the call graph for this function:

Variable Documentation

g_PackedDeviceBuffer = {0}

The One Buffer To Rule Them All (TM)

This buffer is what we will use to write to the display. It is created here so that it can be easily passed around to those who need it and it doesn't need to keep being malloc'd all the time.

Definition at line 21 of file graphics2d.c.

Referenced by G2ConvertFBToRITFormat(), and G2Draw().