Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of C12832_lcd by
Revision 14:a68c1c6d125a, committed 2016-07-16
- Comitter:
- Sateg
- Date:
- Sat Jul 16 19:06:00 2016 +0000
- Parent:
- 13:2742c45bc9bc
- Child:
- 15:2e1423772e77
- Commit message:
- Fixed class name.
Changed in this revision
| DOGL128.cpp | Show annotated file Show diff for this revision Revisions of this file |
| DOGL128.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/DOGL128.cpp Sat Jul 16 18:59:43 2016 +0000
+++ b/DOGL128.cpp Sat Jul 16 19:06:00 2016 +0000
@@ -26,7 +26,7 @@
#define BPP 1 // Bits per pixel
-DOGL128_LCD::DOGL128_LCD(const char* name)
+DOGL128::DOGL128(const char* name)
: GraphicsDisplay(name), _spi(SPI_MOSI, NC, SPI_SCK), _reset(D7), _A0(D9), _CS(D8)
{
orientation = 1;
@@ -36,20 +36,20 @@
lcd_reset();
}
-int DOGL128_LCD::width()
+int DOGL128::width()
{
if (orientation == 0 || orientation == 2) return 64;
else return 128;
}
-int DOGL128_LCD::height()
+int DOGL128::height()
{
if (orientation == 0 || orientation == 2) return 128;
else return 64;
}
-/*void DOGL128_LCD::set_orientation(unsigned int o)
+/*void DOGL128::set_orientation(unsigned int o)
{
orientation = o;
switch (o) {
@@ -74,21 +74,21 @@
*/
-void DOGL128_LCD::invert(unsigned int o)
+void DOGL128::invert(unsigned int o)
{
if(o == 0) wr_cmd(0xA6);
else wr_cmd(0xA7);
}
-void DOGL128_LCD::set_contrast(unsigned int o)
+void DOGL128::set_contrast(unsigned int o)
{
contrast = o;
wr_cmd(0x81); // set volume
wr_cmd(o & 0x3F);
}
-unsigned int DOGL128_LCD::get_contrast(void)
+unsigned int DOGL128::get_contrast(void)
{
return(contrast);
}
@@ -96,7 +96,7 @@
// write command to lcd controller
-void DOGL128_LCD::wr_cmd(unsigned char cmd)
+void DOGL128::wr_cmd(unsigned char cmd)
{
_A0 = 0;
_CS = 0;
@@ -106,7 +106,7 @@
// write data to lcd controller
-void DOGL128_LCD::wr_dat(unsigned char dat)
+void DOGL128::wr_dat(unsigned char dat)
{
_A0 = 1;
_CS = 0;
@@ -116,7 +116,7 @@
// reset and init the lcd controller
-void DOGL128_LCD::lcd_reset()
+void DOGL128::lcd_reset()
{
_spi.format(8,3); // 8 bit spi mode 3
@@ -159,7 +159,7 @@
// set one pixel in buffer
-void DOGL128_LCD::pixel(int x, int y, int color)
+void DOGL128::pixel(int x, int y, int color)
{
// first check parameter
if(x > 128 || y > 64 || x < 0 || y < 0) return;
@@ -177,7 +177,7 @@
// update lcd
-void DOGL128_LCD::copy_to_lcd(void)
+void DOGL128::copy_to_lcd(void)
{
int i;
@@ -222,14 +222,14 @@
}
}
-void DOGL128_LCD::cls(void)
+void DOGL128::cls(void)
{
memset(buffer,0x00,1024); // clear display buffer
copy_to_lcd();
}
-void DOGL128_LCD::line(int x0, int y0, int x1, int y1, int color)
+void DOGL128::line(int x0, int y0, int x1, int y1, int color)
{
int dx = 0, dy = 0;
int dx_sym = 0, dy_sym = 0;
@@ -299,7 +299,7 @@
if(auto_up) copy_to_lcd();
}
-void DOGL128_LCD::rect(int x0, int y0, int x1, int y1, int color)
+void DOGL128::rect(int x0, int y0, int x1, int y1, int color)
{
if (x1 > x0) line(x0,y0,x1,y0,color);
@@ -317,7 +317,7 @@
if(auto_up) copy_to_lcd();
}
-void DOGL128_LCD::fillrect(int x0, int y0, int x1, int y1, int color)
+void DOGL128::fillrect(int x0, int y0, int x1, int y1, int color)
{
int l,c,i;
if(x0 > x1) {
@@ -342,7 +342,7 @@
-void DOGL128_LCD::circle(int x0, int y0, int r, int color)
+void DOGL128::circle(int x0, int y0, int r, int color)
{
int draw_x0, draw_y0;
@@ -450,7 +450,7 @@
if(auto_up) copy_to_lcd();
}
-void DOGL128_LCD::fillcircle(int x, int y, int r, int color)
+void DOGL128::fillcircle(int x, int y, int r, int color)
{
int i,up;
up = auto_up;
@@ -461,12 +461,12 @@
if(auto_up) copy_to_lcd();
}
-void DOGL128_LCD::setmode(int mode)
+void DOGL128::setmode(int mode)
{
draw_mode = mode;
}
-void DOGL128_LCD::locate(int x, int y)
+void DOGL128::locate(int x, int y)
{
char_x = x;
char_y = y;
@@ -474,21 +474,21 @@
-int DOGL128_LCD::columns()
+int DOGL128::columns()
{
return width() / font[1];
}
-int DOGL128_LCD::rows()
+int DOGL128::rows()
{
return height() / font[2];
}
-int DOGL128_LCD::_putc(int value)
+int DOGL128::_putc(int value)
{
if (value == '\n') { // new line
char_x = 0;
@@ -503,7 +503,7 @@
return value;
}
-void DOGL128_LCD::character(int x, int y, int c)
+void DOGL128::character(int x, int y, int c)
{
unsigned int hor,vert,offset,bpl,j,i,b;
unsigned char* zeichen;
@@ -545,23 +545,23 @@
}
-void DOGL128_LCD::set_font(unsigned char* f)
+void DOGL128::set_font(unsigned char* f)
{
font = f;
}
-void DOGL128_LCD::set_auto_up(unsigned int up)
+void DOGL128::set_auto_up(unsigned int up)
{
if(up ) auto_up = 1;
else auto_up = 0;
}
-unsigned int DOGL128_LCD::get_auto_up(void)
+unsigned int DOGL128::get_auto_up(void)
{
return (auto_up);
}
-void DOGL128_LCD::print_bm(Bitmap bm, int x, int y)
+void DOGL128::print_bm(Bitmap bm, int x, int y)
{
int h,v,b;
char d;
--- a/DOGL128.h Sat Jul 16 18:59:43 2016 +0000
+++ b/DOGL128.h Sat Jul 16 19:06:00 2016 +0000
@@ -49,14 +49,14 @@
char* data;
};
-class DOGL128_LCD : public GraphicsDisplay
+class DOGL128 : public GraphicsDisplay
{
public:
- /** Create a DOGL128_LCD object connected to SPI1
+ /** Create a DOGL128 object connected to SPI1
*
*/
- DOGL128_LCD(const char* name = "LCD");
+ DOGL128(const char* name = "LCD");
/** Get the width of the screen in pixel
*
