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 by
Diff: C12832.cpp
- Revision:
- 16:7de323fa46fe
- Parent:
- 15:67dfa5550b73
- Child:
- 17:597e1b2fb5d2
--- a/C12832.cpp Thu Jan 30 17:16:04 2014 +0000
+++ b/C12832.cpp Wed Feb 05 14:25:16 2014 +0000
@@ -28,7 +28,7 @@
#define BPP 1 // Bits per pixel
-C12832_LCD::C12832_LCD(PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs, const char* name)
+C12832::C12832(PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs, const char* name)
: _spi(mosi,NC,sck),_reset(reset),_A0(a0),_CS(ncs),GraphicsDisplay(name)
{
orientation = 1;
@@ -38,59 +38,34 @@
}
-int C12832_LCD::width()
+int C12832::width()
{
if (orientation == 0 || orientation == 2) return 32;
else return 128;
}
-int C12832_LCD::height()
+int C12832::height()
{
if (orientation == 0 || orientation == 2) return 128;
else return 32;
}
-/*void C12832_LCD::set_orientation(unsigned int o)
-{
- orientation = o;
- switch (o) {
- case (0):
- wr_cmd(0xA0);
- wr_cmd(0xC0);
- break;
- case (1):
- wr_cmd(0xA0);
- wr_cmd(0xC8);
- break;
- case (2):
- wr_cmd(0xA1);
- wr_cmd(0xC8);
- break;
- case (3):
- wr_cmd(0xA1);
- wr_cmd(0xC0);
- break;
- }
-}
-
-*/
-
-void C12832_LCD::invert(unsigned int o)
+void C12832::invert(unsigned int o)
{
if(o == 0) wr_cmd(0xA6);
else wr_cmd(0xA7);
}
-void C12832_LCD::set_contrast(unsigned int o)
+void C12832::set_contrast(unsigned int o)
{
contrast = o;
wr_cmd(0x81); // set volume
wr_cmd(o & 0x3F);
}
-unsigned int C12832_LCD::get_contrast(void)
+unsigned int C12832::get_contrast(void)
{
return(contrast);
}
@@ -98,7 +73,7 @@
// write command to lcd controller
-void C12832_LCD::wr_cmd(unsigned char cmd)
+void C12832::wr_cmd(unsigned char cmd)
{
_A0 = 0;
_CS = 0;
@@ -108,7 +83,7 @@
// write data to lcd controller
-void C12832_LCD::wr_dat(unsigned char dat)
+void C12832::wr_dat(unsigned char dat)
{
_A0 = 1;
_CS = 0;
@@ -118,7 +93,7 @@
// reset and init the lcd controller
-void C12832_LCD::lcd_reset()
+void C12832::lcd_reset()
{
_spi.format(8,3); // 8 bit spi mode 3
@@ -162,7 +137,7 @@
// set one pixel in buffer
-void C12832_LCD::pixel(int x, int y, int color)
+void C12832::pixel(int x, int y, int color)
{
// first check parameter
if(x > 128 || y > 32 || x < 0 || y < 0) return;
@@ -180,7 +155,7 @@
// update lcd
-void C12832_LCD::copy_to_lcd(void)
+void C12832::copy_to_lcd(void)
{
int i=0;
@@ -226,14 +201,14 @@
}
-void C12832_LCD::cls(void)
+void C12832::cls(void)
{
memset(buffer,0x00,512); // clear display buffer
copy_to_lcd();
}
-void C12832_LCD::line(int x0, int y0, int x1, int y1, int color)
+void C12832::line(int x0, int y0, int x1, int y1, int color)
{
int dx = 0, dy = 0;
int dx_sym = 0, dy_sym = 0;
@@ -303,7 +278,7 @@
if(auto_up) copy_to_lcd();
}
-void C12832_LCD::rect(int x0, int y0, int x1, int y1, int color)
+void C12832::rect(int x0, int y0, int x1, int y1, int color)
{
if (x1 > x0) line(x0,y0,x1,y0,color);
@@ -321,7 +296,7 @@
if(auto_up) copy_to_lcd();
}
-void C12832_LCD::fillrect(int x0, int y0, int x1, int y1, int color)
+void C12832::fillrect(int x0, int y0, int x1, int y1, int color)
{
int l,c,i;
if(x0 > x1) {
@@ -346,7 +321,7 @@
-void C12832_LCD::circle(int x0, int y0, int r, int color)
+void C12832::circle(int x0, int y0, int r, int color)
{
int draw_x0, draw_y0;
@@ -454,7 +429,7 @@
if(auto_up) copy_to_lcd();
}
-void C12832_LCD::fillcircle(int x, int y, int r, int color)
+void C12832::fillcircle(int x, int y, int r, int color)
{
int i,up;
up = auto_up;
@@ -465,12 +440,12 @@
if(auto_up) copy_to_lcd();
}
-void C12832_LCD::setmode(int mode)
+void C12832::setmode(int mode)
{
draw_mode = mode;
}
-void C12832_LCD::locate(int x, int y)
+void C12832::locate(int x, int y)
{
char_x = x;
char_y = y;
@@ -478,21 +453,21 @@
-int C12832_LCD::columns()
+int C12832::columns()
{
return width() / font[1];
}
-int C12832_LCD::rows()
+int C12832::rows()
{
return height() / font[2];
}
-int C12832_LCD::_putc(int value)
+int C12832::_putc(int value)
{
if (value == '\n') { // new line
char_x = 0;
@@ -507,7 +482,7 @@
return value;
}
-void C12832_LCD::character(int x, int y, int c)
+void C12832::character(int x, int y, int c)
{
unsigned int hor,vert,offset,bpl,j,i,b;
unsigned char* zeichen;
@@ -549,23 +524,23 @@
}
-void C12832_LCD::set_font(unsigned char* f)
+void C12832::set_font(unsigned char* f)
{
font = f;
}
-void C12832_LCD::set_auto_up(unsigned int up)
+void C12832::set_auto_up(unsigned int up)
{
if(up ) auto_up = 1;
else auto_up = 0;
}
-unsigned int C12832_LCD::get_auto_up(void)
+unsigned int C12832::get_auto_up(void)
{
return (auto_up);
}
-void C12832_LCD::print_bm(Bitmap bm, int x, int y)
+void C12832::print_bm(Bitmap bm, int x, int y)
{
int h,v,b;
char d;
