EE445M RTOS
Taken at the University of Texas Spring 2015
graphics2d.c
Go to the documentation of this file.
1 #ifdef __COMPILE_TO_MICRO__
2 #include "rit128x96x4.h"
3 #endif
4 #include "graphics2d.h"
5 
6 #define NDEBUG
7 
8 #ifndef NDEBUG
9 #include <stdio.h>
10 #endif
11 
22 
23 unsigned char* G2ConvertFBToRITFormat(framebuffer fb) {
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 }
48 
49 void G2Draw(framebuffer fb) {
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 RIT_FB_WIDTH
Definition: defines.h:110
#define OLED_WIDTH
Definition: defines.h:107
char ** framebuffer
Definition: framebuffer.h:12
unsigned char g_PackedDeviceBuffer[RIT_FB_WIDTH *RIT_FB_HEIGHT]
The One Buffer To Rule Them All (TM)
Definition: graphics2d.c:21
void G2Draw(framebuffer fb)
Definition: graphics2d.c:49
#define RIT_FB_HEIGHT
Definition: defines.h:109