C4EV3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Macros | Typedefs | Enumerations | Functions
ev3_lcd.h File Reference

Functions and constants for controlling EV3 LCD. More...

#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <limits.h>
#include <errno.h>
#include <libgen.h>
#include "../include/ev3_constants.h"

Go to the source code of this file.

Data Structures

struct  LocationType
 

Macros

#define ev3_lcd_h
 
#define LCD_BYTE_WIDTH   ((LCD_WIDTH + 7) / 8)
 
#define LCD_BUFFER_SIZE   (LCD_BYTE_WIDTH * LCD_HEIGHT)
 
#define LCD_COLOR_BLACK   1
 
#define LCD_COLOR_WHITE   0
 

Typedefs

typedef uint8_t IMGDATA
 Image base type. More...
 
typedef IMGDATA * IP
 Instruction pointer type. More...
 
typedef LocationType * PLocationType
 

Enumerations

enum  ImageFormat {
  ifRAW_FB0, ifRAW_BUF, ifXBM, ifP1,
  ifP4, ifBMP, ifPNG
}
 

Functions

bool LcdInit ()
 
bool LcdExit ()
 
bool LcdInitialized ()
 
void LcdSetAutoRefresh (bool bOn)
 
bool LcdUpdate ()
 
bool LcdClean ()
 
bool LcdScroll (short Y)
 
bool LcdSelectFont (uint8_t FontType)
 
uint8_t * LcdGetDisplay ()
 
bool LcdText (char Color, short X, short Y, char *Text)
 
bool LcdIcon (char Color, short X, short Y, char IconType, char IconNum)
 
bool LcdBmpFile (char Color, short X, short Y, char *Name)
 
bool LcdPicture (char Color, short X, short Y, IP pBitmap)
 
bool LcdFillWindow (char Color, short Y, short Y1)
 
uint8_t * LcdGetFrameBuffer ()
 
void LcdWriteDisplayToFile (char *filename, ImageFormat fmt)
 
void LcdWriteFrameBufferToFile (char *filename, ImageFormat fmt)
 
char CircleOutEx (int x, int y, uint8_t radius, unsigned long options)
 
char LineOutEx (int x1, int y1, int x2, int y2, unsigned long options)
 
char PointOutEx (int x, int y, unsigned long options)
 
char RectOutEx (int x, int y, int width, int height, unsigned long options)
 
char EllipseOutEx (int x, int y, uint8_t radiusX, uint8_t radiusY, unsigned long options)
 
bool LcdTextf (char Color, short X, short Y, const char *fmt,...)
 
int LcdPrintf (char color, const char *fmt,...)
 
int LcdPrintln (char color, const char *fmt,...)
 
short LcdRowToY (int row)
 
void SetCursorX (short x)
 
void SetCursorY (short y)
 

Detailed Description

Functions and constants for controlling EV3 LCD.

ev3_lcd.h contains declarations for the EV3 C API LCD functions.

License:

The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Initial Developer of this code is John Hansen. Portions created by John Hansen are Copyright (C) 2009-2013 John Hansen. All Rights Reserved.


Author
John Hansen (bricxcc_at_comcast.net)
Date
2013-08-04
Version
1
Author
Ahmand Fatoum & Simón Rodriguez Perez(Hochschule Aschaffenburg)
Date
2015-02-28
Version
2
Note
printf function added

Macro Definition Documentation

#define ev3_lcd_h
#define LCD_BUFFER_SIZE   (LCD_BYTE_WIDTH * LCD_HEIGHT)
#define LCD_BYTE_WIDTH   ((LCD_WIDTH + 7) / 8)
#define LCD_COLOR_BLACK   1
#define LCD_COLOR_WHITE   0

Typedef Documentation

typedef uint8_t IMGDATA

Image base type.

typedef IMGDATA* IP

Instruction pointer type.

Enumeration Type Documentation

Enumerator
ifRAW_FB0 
ifRAW_BUF 
ifXBM 
ifP1 
ifP4 
ifBMP 
ifPNG 

Function Documentation

char CircleOutEx ( int  x,
int  y,
uint8_t  radius,
unsigned long  options 
)

Draw a circle. This function lets you draw a circle on the screen with its center at the specified x and y location, using the specified radius. Optionally specify drawing options. If this argument is not specified it defaults to DRAW_OPT_NORMAL. Valid display option constants are listed in the Drawing option constants group.

See Also
SysDrawCircle, DrawCircleType
Parameters
xThe x value for the center of the circle.
yThe y value for the center of the circle.
radiusThe radius of the circle.
optionsThe drawing options.
Returns
The result of the drawing operation.
char EllipseOutEx ( int  x,
int  y,
uint8_t  radiusX,
uint8_t  radiusY,
unsigned long  options 
)

Draw an ellipse. This function lets you draw an ellipse on the screen with its center at the specified x and y location, using the specified radii. Optionally specify drawing options. If this argument is not specified it defaults to DRAW_OPT_NORMAL. Valid display option constants are listed in the Drawing option constants group.

See Also
SysDrawEllipse, DrawEllipseType
Warning
This function requires the enhanced NBC/NXC firmware version 1.28+.
Parameters
xThe x value for the center of the ellipse.
yThe y value for the center of the ellipse.
radiusXThe x axis radius.
radiusYThe y axis radius.
optionsThe drawing options.
Returns
The result of the drawing operation.
bool LcdBmpFile ( char  Color,
short  X,
short  Y,
char *  Name 
)
bool LcdClean ( )
bool LcdExit ( )
bool LcdFillWindow ( char  Color,
short  Y,
short  Y1 
)
uint8_t* LcdGetDisplay ( )
uint8_t* LcdGetFrameBuffer ( )
bool LcdIcon ( char  Color,
short  X,
short  Y,
char  IconType,
char  IconNum 
)
bool LcdInit ( )
bool LcdInitialized ( )
bool LcdPicture ( char  Color,
short  X,
short  Y,
IP  pBitmap 
)
int LcdPrintf ( char  color,
const char *  fmt,
  ... 
)

Prints the formatted text on the next line of the previous wrote by this function.

Parameters
color
fmt
...
Returns
int LcdPrintln ( char  color,
const char *  fmt,
  ... 
)

Same as LcdPrintf, but automatically adds a new at the end of the string

Parameters
color
fmt
...
Returns
short LcdRowToY ( int  row)

Computes the y coordinate from which the specified row starts (using the current font)

Parameters
row
Returns
bool LcdScroll ( short  Y)
bool LcdSelectFont ( uint8_t  FontType)
void LcdSetAutoRefresh ( bool  bOn)
bool LcdText ( char  Color,
short  X,
short  Y,
char *  Text 
)
bool LcdTextf ( char  Color,
short  X,
short  Y,
const char *  fmt,
  ... 
)

Prints the formatted text on the screen at the specified position

Parameters
Color
X
Y
fmt
...
Returns
bool LcdUpdate ( )
void LcdWriteDisplayToFile ( char *  filename,
ImageFormat  fmt 
)
void LcdWriteFrameBufferToFile ( char *  filename,
ImageFormat  fmt 
)
char LineOutEx ( int  x1,
int  y1,
int  x2,
int  y2,
unsigned long  options 
)

Draw a line. This function lets you draw a line on the screen from x1, y1 to x2, y2. Optionally specify drawing options. If this argument is not specified it defaults to DRAW_OPT_NORMAL. Valid display option constants are listed in the Drawing option constants group.

See Also
SysDrawLine, DrawLineType
Parameters
x1The x value for the start of the line.
y1The y value for the start of the line.
x2The x value for the end of the line.
y2The y value for the end of the line.
optionsThe drawing options.
Returns
The result of the drawing operation.
char PointOutEx ( int  x,
int  y,
unsigned long  options 
)

Draw a point. This function lets you draw a point on the screen at x, y. Optionally specify drawing options. If this argument is not specified it defaults to DRAW_OPT_NORMAL. Valid display option constants are listed in the Drawing option constants group.

See Also
SysDrawPoint, DrawPointType
Parameters
xThe x value for the point.
yThe y value for the point.
optionsThe drawing options.
Returns
The result of the drawing operation.
char RectOutEx ( int  x,
int  y,
int  width,
int  height,
unsigned long  options 
)

Draw a rectangle. This function lets you draw a rectangle on the screen at x, y with the specified width and height. Optionally specify drawing options. If this argument is not specified it defaults to DRAW_OPT_NORMAL. Valid display option constants are listed in the Drawing option constants group.

See Also
SysDrawRect, DrawRectType
Parameters
xThe x value for the top left corner of the rectangle.
yThe y value for the top left corner of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
optionsThe drawing options.
Returns
The result of the drawing operation.
void SetCursorX ( short  x)

Set cursor position for TermPrint*, LcdPrint* and Ev3Print*

Parameters
x
void SetCursorY ( short  y)

Set cursor position for TermPrint*, LcdPrint* and Ev3Print*

Parameters
y