Sharp Memory LCD library
Dependencies: Fonts Images BurstSPI
SharpLCD Class Reference
Sharp Memory LCD. More...
#include <SharpLCD.h>
Public Member Functions | |
void | set_font (const unsigned char *f) |
Sets external font usage, eg. | |
void | locate (int column, int row) |
Sets position of the next character or string print. | |
void | printf (const char *format,...) |
printf (from Stream). | |
void | enableDisplay (void) |
Enables (power) display. | |
void | disableDisplay (void) |
Dissables (power) display. | |
void | pixel (int x, int y, int colour) |
Set a pixel in the pixel buffer. | |
void | rect (int x0, int y0, int x1, int y1, int colour) |
Draw rectangle one pixel wide (wire frame) in the pixel buffer. | |
void | fillrect (int x0, int y0, int w, int h, int colour) |
Draw filled rectangle in the pixel buffer. | |
void | circle (int x, int y, int r, int colour) |
Draw Circle one pixel wide in the pixel buffer. | |
void | ellipse (int xc, int yc, int v, int h, unsigned int colour) |
Draw Ellipse or Circle one pixel wide in the pixel buffer. | |
void | fillellipse (int xc, int yc, int v, int h, unsigned int colour) |
Draw Filled Ellipse or Circle in the pixel buffer. | |
void | hline (int x0, int x1, int y, int colour) |
Draw a horizontal line one pixel wide in the pixel buffer. | |
void | vline (int x0, int y0, int y1, int colour) |
Draw a Vertical line one pixel wide in the pixel buffer. | |
void | line (int x0, int y0, int x1, int y1, int colour) |
Draw a Line in the pixel buffer. | |
void | toggle () |
Toggles the EXTCOM connection to the display if used. | |
void | update () |
Transfers pixel buffer to the display. | |
void | clearImmediate () |
Clear the display & set pixel buffer to zero. | |
void | showBMP (const uint8_t *bitmap, const uint32_t bmpWidth, const uint32_t bmpHeight, const uint32_t startX, const uint32_t startY) |
Move bitmap into pixel buffer. | |
void | character (int column, int row, int c) |
Output a character at the given position. | |
int | rows () |
return number if rows on TextDisplay | |
int | columns () |
return number if columns on TextDisplay |
Detailed Description
Sharp Memory LCD.
Supports 96x96, 128x128, 400x240 displays. Uses a Frame Buffer in RAM depending on resolution of display as follows: 96 Display - 1.7k, 128 Display - 2.6k, 400 Display - 12.4k
Example:
#include "mbed.h" #include "SharpLCD.h" //KL25 SharpLCD display(PTC6, NC, PTC5, PTC3, PTC4, NC); //mosi, miso(not used), sck, cs, enable, extcom int main() { display.enableDisplay(); while(1) { display.clearImmediate(); // draw ellipse (To draw circle, set the last two axis the same) for (int j=0; j<60; j++) { display.ellipse(64,64,j,60,Black); display.update(); //wait(.01); display.ellipse(64,64,j,50,White); // offset last axis here gives interesting effect! display.locate(5,6); display.printf("Sharp"); display.locate(2,8); display.printf("Draw Ellipse"); display.locate(4,10); display.printf("MemoryLCD"); display.update(); } // draw rectangle for (int j=0; j<128; j++) { display.rect(0,0,j,j,Black); display.update(); //wait(.01); display.rect(0,0,j,j,White); display.locate(5,6); display.printf("Sharp"); display.locate(1,8); display.printf("Draw Rectangle"); display.locate(4,10); display.printf("MemoryLCD"); display.update(); } for (int j=60; j>0; j--) { display.circle(64,64,j,Black); display.update(); wait(.01); display.circle(64,64,j,White); display.locate(5,6); display.printf("Sharp"); display.locate(2,8); display.printf("Draw Circle"); display.locate(4,10); display.printf("MemoryLCD"); display.update(); } } }
Definition at line 99 of file SharpLCD.h.
Member Function Documentation
void character | ( | int | column, |
int | row, | ||
int | c | ||
) |
Output a character at the given position.
- Parameters:
-
column column where charater must be written row where character must be written c the character to be written to the TextDisplay
Definition at line 257 of file SharpLCD.cpp.
void circle | ( | int | x, |
int | y, | ||
int | r, | ||
int | colour | ||
) |
Draw Circle one pixel wide in the pixel buffer.
- Parameters:
-
x0 X-Centre position. y0 Y-Centre position. r Radius. colour Colour to set pixel to. White or Black.
Definition at line 354 of file SharpLCD.cpp.
void clearImmediate | ( | ) |
Clear the display & set pixel buffer to zero.
Definition at line 144 of file SharpLCD.cpp.
int columns | ( | ) |
return number if columns on TextDisplay
- Returns:
- number of rows
Definition at line 565 of file SharpLCD.cpp.
void disableDisplay | ( | void | ) |
Dissables (power) display.
Definition at line 140 of file SharpLCD.cpp.
void ellipse | ( | int | xc, |
int | yc, | ||
int | v, | ||
int | h, | ||
unsigned int | colour | ||
) |
Draw Ellipse or Circle one pixel wide in the pixel buffer.
Set v & h to same values to produce a circle.
- Parameters:
-
xc X-Centre position. yc Y-Centre position. v Vertical radius. h Horizontal radius. colour Colour to set pixel to. White or Black.
Definition at line 374 of file SharpLCD.cpp.
void enableDisplay | ( | void | ) |
Enables (power) display.
Definition at line 136 of file SharpLCD.cpp.
void fillellipse | ( | int | xc, |
int | yc, | ||
int | v, | ||
int | h, | ||
unsigned int | colour | ||
) |
Draw Filled Ellipse or Circle in the pixel buffer.
Set v & h to same values to produce a circle.
- Parameters:
-
xc X-Centre position. yc Y-Centre position. v Vertical radius. h Horizontal radius. colour Colour to set pixel to. White or Black.
Definition at line 404 of file SharpLCD.cpp.
void fillrect | ( | int | x0, |
int | y0, | ||
int | w, | ||
int | h, | ||
int | colour | ||
) |
Draw filled rectangle in the pixel buffer.
- Parameters:
-
x0 X-Start position. y0 Y-Start position. w Width. h Height. colour Colour to fill rectangle to. White or Black.
Definition at line 336 of file SharpLCD.cpp.
void hline | ( | int | x0, |
int | x1, | ||
int | y, | ||
int | colour | ||
) |
Draw a horizontal line one pixel wide in the pixel buffer.
- Parameters:
-
x0 X-Start position. x1 X-End position. y Y-position. colour Colour to set pixel to. White or Black.
Definition at line 528 of file SharpLCD.cpp.
void line | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | colour | ||
) |
Draw a Line in the pixel buffer.
- Parameters:
-
x0 X-Start position. y0 Y-Start position. x1 X-End position. y1 Y-End position. colour Colour to fill rectangle to. White or Black.
Definition at line 465 of file SharpLCD.cpp.
void locate | ( | int | column, |
int | row | ||
) |
Sets position of the next character or string print.
External font, set pixel x(column),y(row) position. internal(default) font, set character column and row position
Definition at line 233 of file SharpLCD.cpp.
void pixel | ( | int | x, |
int | y, | ||
int | colour | ||
) |
Set a pixel in the pixel buffer.
- Parameters:
-
x X-Position. y Y-Position. colour Colour to set pixel to. White or Black.
Definition at line 193 of file SharpLCD.cpp.
void printf | ( | const char * | format, |
... | |||
) |
printf (from Stream).
Full printf funtionality only available with internal(default) font. CR and LF have no effect with external fonts.
Definition at line 244 of file SharpLCD.cpp.
void rect | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | colour | ||
) |
Draw rectangle one pixel wide (wire frame) in the pixel buffer.
- Parameters:
-
x0 X-Start position. y0 Y-Start position. x1 X-End position. y1 Y-End position. colour Colour to set pixel to. White or Black.
Definition at line 324 of file SharpLCD.cpp.
int rows | ( | ) |
return number if rows on TextDisplay
- Returns:
- number of rows
Definition at line 569 of file SharpLCD.cpp.
void set_font | ( | const unsigned char * | f ) |
Sets external font usage, eg.
dispaly.set_font(Arial12x12); This uses pixel positioning. display.set_font(NULL); returns to internal default font. void set_font(const unsigned char * f);
Definition at line 227 of file SharpLCD.cpp.
void showBMP | ( | const uint8_t * | bitmap, |
const uint32_t | bmpWidth, | ||
const uint32_t | bmpHeight, | ||
const uint32_t | startX, | ||
const uint32_t | startY | ||
) |
Move bitmap into pixel buffer.
- Parameters:
-
bitmap pointer to uint8 array containing horizontal pixel data bmpWidth width of the bitmap in pixels (must be byte multiple, eg 8,16,32,...) bmpHeight height of the bitmap in pixels (must be byte multiple, eg 8,16,32,...) startX starting position to apply bitmap in horizontal direction (0 = leftmost) (pixel resolution) startY starting position to apply bitmap in vertical direction (0 = topmost) (pixel resolution)
Definition at line 581 of file SharpLCD.cpp.
void toggle | ( | ) |
Toggles the EXTCOM connection to the display if used.
Call this function at 55 ~ 65 Hz to keep the display from losing contrast.
Definition at line 132 of file SharpLCD.cpp.
void update | ( | ) |
Transfers pixel buffer to the display.
Definition at line 158 of file SharpLCD.cpp.
void vline | ( | int | x0, |
int | y0, | ||
int | y1, | ||
int | colour | ||
) |
Draw a Vertical line one pixel wide in the pixel buffer.
- Parameters:
-
x0 X-Position. y0 Y-Start position. y1 Y-End position. colour Colour to set pixel to. White or Black.
Definition at line 538 of file SharpLCD.cpp.
Generated on Thu Jul 14 2022 01:39:26 by 1.7.2