C4EV3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
ev3_lcd.h
Go to the documentation of this file.
1 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #ifndef ev3_lcd_h
41 #define ev3_lcd_h
42 
43 #ifdef __GNUC__
44 #pragma GCC system_header
45 #endif
46 
47 #include <stdio.h>
48 #include <fcntl.h>
49 #include <stdlib.h>
50 #include <unistd.h>
51 #include <string.h>
52 #include <signal.h>
53 #include <sys/mman.h>
54 #include <sys/stat.h>
55 #include <stdbool.h>
56 #include <limits.h>
57 #include <errno.h>
58 #include <libgen.h>
59 
60 #include "../include/ev3_constants.h"
61 
62 #define LCD_BYTE_WIDTH ((LCD_WIDTH + 7) / 8)
63 #define LCD_BUFFER_SIZE (LCD_BYTE_WIDTH * LCD_HEIGHT)
64 
65 typedef uint8_t IMGDATA;
66 typedef IMGDATA* IP;
67 
68 typedef struct {
69  int X;
70  int Y;
71 } LocationType;
72 
74 
75 typedef enum {
83 } ImageFormat;
84 
85 bool LcdInit();
86 bool LcdExit();
87 bool LcdInitialized();
88 
89 void LcdSetAutoRefresh(bool bOn);
90 bool LcdUpdate();
91 bool LcdClean();
92 bool LcdScroll(short Y);
93 
94 
95 bool LcdSelectFont(uint8_t FontType);
96 uint8_t* LcdGetDisplay();
97 bool LcdText(char Color, short X, short Y, char* Text);
98 bool LcdIcon(char Color, short X, short Y, char IconType, char IconNum);
99 bool LcdBmpFile(char Color, short X, short Y, char* Name);
100 bool LcdPicture(char Color, short X, short Y, IP pBitmap);
101 bool LcdFillWindow(char Color, short Y, short Y1);
102 uint8_t* LcdGetFrameBuffer();
103 void LcdWriteDisplayToFile(char* filename, ImageFormat fmt);
104 void LcdWriteFrameBufferToFile(char* filename, ImageFormat fmt);
105 
120 char CircleOutEx(int x, int y, uint8_t radius, unsigned long options);
121 char static inline CircleOut(int x, int y, int r) {
122  return CircleOutEx(x, y, r, DRAW_OPT_NORMAL);
123 }
124 
140 char LineOutEx(int x1, int y1, int x2, int y2, unsigned long options);
141 char static inline LineOut(int x1, int y1, int x2, int y2) {
142  return LineOutEx(x1, y1, x2, y2, DRAW_OPT_NORMAL);
143 }
144 
158 char PointOutEx(int x, int y, unsigned long options);
159 char static inline PointOut(int x, int y) {
160  return PointOutEx(x, y, DRAW_OPT_NORMAL);
161 }
162 
179 char RectOutEx(int x, int y, int width, int height, unsigned long options);
180 char static inline RectOut(int x, int y, int w, int h) {
181  return RectOutEx(x, y, w, h, DRAW_OPT_NORMAL);
182 }
183 
184 
202 char EllipseOutEx(int x, int y, uint8_t radiusX, uint8_t radiusY, unsigned long options);
203 char static inline EllipseOut(int x, int y, int rx, int ry) {
204  return EllipseOutEx(x, y, rx, ry, DRAW_OPT_NORMAL);
205 }
206 
207 #define LCD_COLOR_BLACK 1
208 #define LCD_COLOR_WHITE 0
209 
210 
220 bool LcdTextf(char Color, short X, short Y, const char *fmt, ...);
221 
229 int LcdPrintf(char color, const char * fmt, ...);
230 
238 int LcdPrintln(char color, const char * fmt, ...);
239 
240 
241 #ifdef __ASPRINTF
242 #include <stdarg.h>
243 int asprintf(char **, const char *, ...);
244 int vasprintf(char **, const char *, va_list)
245 #endif
246 
252 short LcdRowToY(int row);
253 
258 void SetCursorX(short x);
259 
264 void SetCursorY(short y);
265 
266 #endif // ev3_lcd_h
267 
268 #ifdef __cplusplus
269 }
270 #endif
bool LcdIcon(char Color, short X, short Y, char IconType, char IconNum)
IMGDATA * IP
Instruction pointer type.
Definition: ev3_lcd.h:66
bool LcdTextf(char Color, short X, short Y, const char *fmt,...)
void SetCursorY(short y)
char EllipseOutEx(int x, int y, uint8_t radiusX, uint8_t radiusY, unsigned long options)
Definition: ev3_lcd.h:77
bool LcdScroll(short Y)
Definition: ev3_lcd.h:80
ImageFormat
Definition: ev3_lcd.h:75
Definition: ev3_lcd.h:79
bool LcdInitialized()
void SetCursorX(short x)
char RectOutEx(int x, int y, int width, int height, unsigned long options)
Definition: ev3_lcd.h:68
short LcdRowToY(int row)
char LineOutEx(int x1, int y1, int x2, int y2, unsigned long options)
uint8_t * LcdGetFrameBuffer()
void LcdSetAutoRefresh(bool bOn)
char CircleOutEx(int x, int y, uint8_t radius, unsigned long options)
uint8_t * LcdGetDisplay()
bool LcdSelectFont(uint8_t FontType)
Definition: ev3_lcd.h:76
int LcdPrintln(char color, const char *fmt,...)
bool LcdExit()
int X
Definition: ev3_lcd.h:69
#define DRAW_OPT_NORMAL
Definition: ev3_constants.h:578
Definition: ev3_lcd.h:81
bool LcdText(char Color, short X, short Y, char *Text)
uint8_t IMGDATA
Image base type.
Definition: ev3_lcd.h:65
Definition: ev3_lcd.h:82
bool LcdBmpFile(char Color, short X, short Y, char *Name)
char PointOutEx(int x, int y, unsigned long options)
bool LcdClean()
Definition: ev3_lcd.h:78
bool LcdFillWindow(char Color, short Y, short Y1)
int Y
Definition: ev3_lcd.h:70
Color
Definition: ev3_color.h:13
int LcdPrintf(char color, const char *fmt,...)
LocationType * PLocationType
Definition: ev3_lcd.h:73
bool LcdPicture(char Color, short X, short Y, IP pBitmap)
void LcdWriteDisplayToFile(char *filename, ImageFormat fmt)
bool LcdInit()
void LcdWriteFrameBufferToFile(char *filename, ImageFormat fmt)
bool LcdUpdate()