Prototipe

Dependents:   LPC1768_Noritake_SC16IS752 LPC1768_Noritake_v5-2 08_SCT_menu

Revision:
1:1a088a2b53ec
Parent:
0:cbd2824917b1
--- a/query.cpp	Wed Aug 10 03:38:46 2016 +0000
+++ b/query.cpp	Fri Aug 12 04:36:36 2016 +0000
@@ -7,14 +7,10 @@
 Noritake_VFD_GU7000::Noritake_VFD_GU7000(PinName sda, PinName scl) : uart(sda, scl, SC16IS752_SA5, NC, SC16IS752::Channel_A)
 {
     if(!uart.init(38400))
-        dbg.printf(RED "IC is not init\r\n" DEF);
+        dbg.printf("IC is not init\r\n");
     else dbg.printf("IC is ready\r\n");
 }
 
-void Noritake_VFD_GU7000::writePort(uint8_t data)
-{
-    uart.put(data);
-}
 void Noritake_VFD_GU7000::hardReset()
 {
     uart.put(0x0c);
@@ -265,14 +261,23 @@
     command(c);
 }
 
+void Noritake_VFD_GU7000::print(uint8_t c) {
+    command(c);
+}
+
 void Noritake_VFD_GU7000::print(const char *str, ...) {
     while (*str)
-        writePort(*str++);
+        command(*str++);
+}
+
+void Noritake_VFD_GU7000::print(const uint8_t *buffer, size_t size) {
+     commandBlock(buffer, size);
 }
 
 void Noritake_VFD_GU7000::print(const char *buffer, size_t size) {
-    while (size--)
-        print(*buffer++);
+    //while (size--)
+        //print(*buffer++);
+    commandBlock(buffer, size);
 }
 
 void Noritake_VFD_GU7000::print(long number, uint8_t base) {
@@ -295,6 +300,16 @@
     print((unsigned long)number, base);
 }
 
+void Noritake_VFD_GU7000::printAt(unsigned baris, unsigned kolom, const char* str) {
+    unsigned x,y;
+    
+    x = (baris * 8) - 8;
+    y = (kolom * 8) - 8;
+    
+    GU7000_setCursor(x,y);
+    commandBlock(str, strlen(str));
+}
+
 void Noritake_VFD_GU7000::crlf() {
     GU7000_carriageReturn();
     GU7000_lineFeed();
@@ -337,7 +352,7 @@
     if (number/base)
         printNumber(number/base, base);
     number %= base;
-    print(number + (number < 10? '0': 'A' - 10));
+    //print(number + (number < 10? '0': 'A' - 10));
 }
 
 void Noritake_VFD_GU7000::GU7000_setBacklightColor(uint8_t r, uint8_t g, uint8_t b) {
@@ -355,11 +370,14 @@
 
 void Noritake_VFD_GU7000::GU7000_drawImage(unsigned width, uint8_t height, const uint8_t *data) {
     if (height > NORITAKE_VFD_HEIGHT) return;
-    us_command('f', 0x11);
+    us_command('f', 0x11); 
     command_xy(width, height);
     command((uint8_t) 1);
+    
     for (unsigned i = 0; i<(height/8)*width; i++)
         command(data[i]);
+    
+    //commandBlock((const char *)data, width*8);
 }
 
 void Noritake_VFD_GU7000::GU7000_drawFROMImage(unsigned long address, uint8_t srcHeight, unsigned width, uint8_t height) {
@@ -377,6 +395,11 @@
     #endif
 }
 
+void Noritake_VFD_GU7000::GU7000_drawImageAt(unsigned x, unsigned y, unsigned width, uint8_t height, const uint8_t *data) {
+    GU7000_setCursor(x, y);
+    GU7000_drawImage(width, height, data);
+}
+
 static unsigned min(unsigned x, unsigned y) { return x<y? x: y; }
 
 void Noritake_VFD_GU7000::GU7000_fillRect(unsigned x0, unsigned y0, unsigned x1, unsigned y1, bool on) {
@@ -406,7 +429,13 @@
 }
 
 void Noritake_VFD_GU7000::command(uint8_t data) {
-    writePort(data);
+    uart.put(data);
+}
+void Noritake_VFD_GU7000::commandBlock(const char * data, int len){
+    uart.wrblock(data, len);
+}
+void Noritake_VFD_GU7000::commandBlock(const uint8_t * data, int len){
+    uart.wrblock(data, len);
 }
 void Noritake_VFD_GU7000::command_xy(unsigned x, unsigned y) {
     command(x);
@@ -480,8 +509,10 @@
         command_xy1(x, y);
         command_xy1(width, height);
         command(0x01);
+        
         for (unsigned i = 0; i<(height/8)*width; i++)
             command(data[i]);
+        
     #endif
 }
 void Noritake_VFD_GU7000::GU7000_drawImage(unsigned x, uint8_t y, ImageMemoryArea area, unsigned long address, uint8_t srcHeight, unsigned width, uint8_t height, unsigned offsetx, unsigned offsety) {
@@ -509,7 +540,7 @@
 
 void Noritake_VFD_GU7000::print_p(const char *str) {
     while (pgm_read_byte(str))
-        writePort(pgm_read_byte(str++));
+        command(pgm_read_byte(str++));
 }
 void Noritake_VFD_GU7000::print_p(unsigned x, uint8_t y, const char *buffer, uint8_t len) {
     #if NORITAKE_VFD_GENERATION == 'B'
@@ -535,8 +566,11 @@
     us_command('f', 0x11);
     command_xy(width, height);
     command((uint8_t) 1);
+    /*
     for (unsigned i = 0; i<(height/8)*width; i++)
         command(pgm_read_byte(data+i));
+    */
+    commandBlock((const char *)data, width*8);
 }
 
 void Noritake_VFD_GU7000::GU7000_drawImage_p(unsigned x, uint8_t y, unsigned width, uint8_t height, const uint8_t *data) {