|
499
|
Using Arduino / Displays / Re: U8glib
|
on: April 19, 2012, 02:30:30 pm
|
Hi Bill Is there drawChar() api function smiley-wink
Good point. It does not exist on the Arduino C++ interface, but it is there on the C-level interface. It should be added. The other tricky thing is that the font either needs to be a fixed width or the variable width characters need to be rendered centered within a fixed width. Additionally the are two different "a" out there. Reference to Wikipedia ( http://en.wikipedia.org/wiki/A):  I am not sure, why there is a need to overstrike two glyphs. I would expect, that all common glyphs are inside unifont. Oliver
|
|
|
|
|
500
|
Using Arduino / Displays / Re: U8glib
|
on: April 19, 2012, 07:34:58 am
|
Hi Overstrike of two chars is no problam. Simply draw the char at the same location u8g.drawChar(10,10, "K"); u8g.drawChar(10,10, "a"); Of course you need to use a font with latin "a" and "K" glyphs. Oliver
|
|
|
|
|
504
|
Using Arduino / Displays / Re: M2TKLIB - A User-Interface-Toolkit for the Arduino Hardware
|
on: April 15, 2012, 04:08:59 pm
|
Hi All Topic 1:  I have released M2tklib ( http://code.google.com/p/m2tklib/) for U8glib ( http://code.google.com/p/u8glib/). M2tklib builds menus and dialog windows on top of an existing graphics or character library. Currently, M2tklib supports the following libraries: - Graphic LCDs:
GLCDv3 dogm128 lib U8glib
- Character LCDs:
LiquidCrystal DogLcd lib (send PM)
Other character LCD libraries could be added on request. Dialog elements include: Radio Buttons, Toggle Button, Combo Box, Text Entry, Number Entry, Push Buttons, Dynamic length menues, Scrollbar (also for character LCDs), Container Widgets (Grid, XY-List, ...)  With U8glib as graphics subsystem, M2tklib can be used on a large number of displays ( http://code.google.com/p/u8glib/wiki/device). This includes Adafruit and DFRobot displays. Topic 2: M2tklib for character LCDs Related to the current discussion on character menues: I recently developed a small menu for a user in the international part of this forum: http://arduino.cc/forum/index.php/topic,99105.0.htmlHere are some screenshots of the character version of M2tklib: Main menu with four entries, focus on the first:  A single selection menu with scrollbar (the scrollbar is composed of 4 user defined characters with pixel exact resolution):  A simple number entry dialog, focus on the number:  Same dialog, focus on the ok button:  The source code for these dialog entry screens is very simple and portable betwen graphics and character LCDs. Oliver
|
|
|
|
|
506
|
Using Arduino / Displays / Re: U8glib
|
on: April 14, 2012, 01:13:02 am
|
Hi Chris I am not sure what you mean by "ASCII print". A chart of ASCII glyphs can be produced in this way: void u8g_ascii_1() { char s[2] = " "; uint8_t x, y; u8g.drawStr( 0, 0, "ASCII page 1"); for( y = 0; y < 6; y++ ) { for( x = 0; x < 16; x++ ) { s[0] = y*16 + x + 32; u8g.drawStr(x*7, y*10+10, s); } } }
As shown in the second tutorial ( http://code.google.com/p/u8glib/wiki/thelloworld) there is no clear screen command. Instead, as soon as you enter the picture loop, the screen gets cleared. See also the background article here: http://code.google.com/p/u8glib/wiki/tpictureloopIn order to display a screen, wait some time and than display another screen, you may use the code and ideas from "GraphicsText.pde" (attached to this post, but also part of the Arduino examples). Oliver
|
|
|
|
|
507
|
Using Arduino / Displays / Re: U8glib
|
on: April 13, 2012, 05:14:34 pm
|
|
I checked v1.03 with my DOGXL160 display. HW SPI and SW SPI are fine. I do not see any issues here.
Oliver
|
|
|
|
|
509
|
Using Arduino / Displays / Re: U8glib
|
on: April 13, 2012, 07:14:18 am
|
|
Hi
I recently added the 2X driver. Can you please check the single buffer constructor (without 2X). I also do not own a Mega Board, so i have to rely on whatever the Arduino.h file has defined for the Hardware Pins. If these hardware pins require some special settings, than these settings are not known to me.
But in any case, the SW SPI should work.
Your observation might also be caused by the connected hardware. How do you do the level transition? Is it a HC4050 level translator for the signals? Resistor networks might work, but you might observe other voltage ranges.
Oliver
|
|
|
|
|
510
|
Using Arduino / Displays / Re: MENWIZ: yet another character lcd menu wizard library
|
on: April 08, 2012, 12:56:07 am
|
The code needed to implememt the example Olikraus suggested is as following. So, here is the M2tklib version. You will see, that the menu is defined outside any procedure. It is placed directly in the data area (PROGMEM) of the controller. The other difference is the "choice" variable. In M2tklib, buttons only call a sub-procedure. The result must be assigned manually in this case. In the MENWIZ example, it seems that choice is automatically connected to the line number. Regarding the discussion about LiquidCrystal variants: M2tklib uses a message based interface to an "output handler". This is " m2_gh_lc" for LiquidCrystal (see below). Replacing this with "m2_gh_glcd", will render the output for GLCD v3. By writing such a handler, any character or graphical output device could be used. Oliver // Menu.pde // http://arduino.cc/forum/index.php/topic,99693.15.html
#include <LiquidCrystal.h> #include "M2tk.h" #include "utility/m2ghlc.h"
//========================================================= // fotward declaration extern M2tk m2;
//========================================================= // keys uint8_t uiKeySelectPin = 10; uint8_t uiKeyNextPin = 9;
//========================================================= // global variable: selected line uint8_t choice = 0;
//========================================================= // display result M2_U8NUM(result_menu, NULL, 0, 255, &choice);
//========================================================= // line selection
// callbacks for the buttons void fn_line1(m2_el_fnarg_p fnarg) { choice = 0; m2.setRoot(&result_menu); } void fn_line2(m2_el_fnarg_p fnarg) { choice = 1; m2.setRoot(&result_menu); } void fn_line3(m2_el_fnarg_p fnarg) { choice = 2; m2.setRoot(&result_menu); } void fn_line4(m2_el_fnarg_p fnarg) { choice = 3; m2.setRoot(&result_menu); }
// layout of the menu M2_BUTTON(el_line1, NULL, "Line 1", fn_line1); M2_BUTTON(el_line2, NULL, "Line 2", fn_line2); M2_BUTTON(el_line3, NULL, "Line 3", fn_line3); M2_BUTTON(el_line4, NULL, "Line 4", fn_line4); M2_LIST(list_lines) = { &el_line1, &el_line2, &el_line3, &el_line4 }; M2_VLIST(line_menu, NULL, list_lines);
//========================================================= // lcd setup LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//========================================================= // M2tklib setup // m2_es_arduino: Arduino event source // m2_eh_2bs: Two button handler // m2_gh_lc: Character subsystem M2tk m2(&line_menu, m2_es_arduino, m2_eh_2bs, m2_gh_lc);
//========================================================= // Arduino setup() void setup() { // Connect M2tklib to LCD m2_SetLiquidCrystal(&lcd, 16, 4); // Apply keys m2.setPin(M2_KEY_SELECT, uiKeySelectPin); m2.setPin(M2_KEY_NEXT, uiKeyNextPin); }
//========================================================= // Arduino loop() void loop() { m2.checkKey(); if ( m2.handleKey() ) m2.draw(); m2.checkKey(); }
|
|
|
|
|