Go Down

Topic: M2TKLIB - A User-Interface-Toolkit for the Arduino Hardware (Read 9868 times) previous topic - next topic

olikraus

Jul 04, 2011, 07:11 pm Last Edit: Jul 04, 2011, 07:17 pm by olikraus Reason: 1
Hi All

I have released a first version of M2TKLIB, a graphical and character user interface library for the Arduino Environment.
M2TKLIB is portable und uses existing libraries to build menues and dialog boxes. Supported libraries are

  • LiquidCrystal (so M2TKLIB should work with any Character LCD which is supported by the LiquidCrystal library),

  • GLCDv3 Library,

  • DOGM128 Library.



Project URL: http://code.google.com/p/m2tklib/

Please let us know

  • which output devices are working and not working,

  • what is missing (elements, output devices, touchpanel, docs, tutorials, examples, ...).



Oliver


bperrybap

Oliver,
I added a link to your library on the main glcd-arduino code page (it's there now) and I've also updated
the glcd library's included html documentation to include a link to it as well in a new "resources" section.
It will show up in the next glcd library release.


--- bill

olikraus

Thanks,
A link to glcd-arduino is part if the install instructions (http://code.google.com/p/m2tklib/wiki/install)
Oliver

olikraus

Created v1.01 for GLCD.
Includes "read-only" option for fields and a frequency generator (http://arduino.cc/forum/index.php/topic,66088.0.html)

Oliver

liudr


MikeSmith

Oliver,

Thanks for killing another one of my projects (no, really... I can get on with what I need to do rather than write yet another semi-custom form handler).

One thing that seems to be missing is a way to send input events to M2TLKLIB from e.g. an interrupt handler connected to a rotary encoder or a custom keypad matrix.

Here are a couple of tiny diffs that add an event source message that soft-presses any of the keys, so that platform-specific input handling code can be used instead of hard buttons.  I've only added support for the message to the Arduino eventsource, but I'm sure it would be portable.

= Mike

Code: [Select]

--- ../orig/m2tklib/src/m2.h 2011-07-09 20:09:56.000000000 -0700
+++ m2tklib/src/m2.h 2011-07-09 20:01:03.000000000 -0700
@@ -712,6 +712,8 @@
/* first call to the event source handler is this message */
#define M2_ES_MSG_INIT 1

+/* events in this range are a request to soft-press M2_KEY_* (event - M2_ES_MSG_SET_KEY) */
+#define M2_ES_MSG_SET_KEY 100

/*==============================================================*/
uint8_t m2_nav_user_up(m2_nav_p nav) M2_NOINLINE; /* m2usrupdn.c */
--- ../orig/m2tklib/dev/arduino/m2esarduino.c 2011-07-09 20:09:56.000000000 -0700
+++ m2tklib/src/m2esarduino.c 2011-07-09 20:08:57.000000000 -0700
@@ -32,6 +32,8 @@
static uint8_t m2_arduino_check_key(uint8_t key) M2_NOINLINE;
static uint8_t m2_arduino_get_key(void) M2_NOINLINE;

+static uint8_t m2_arduino_soft_keys;
+
static void m2_arduino_setup_key(uint8_t key)
{
   uint8_t pin;
@@ -65,10 +67,20 @@

static uint8_t m2_arduino_get_key(void)
{
+  uint8_t key;
+
   if ( m2_arduino_check_key(M2_KEY_SELECT) ) return M2_KEY_SELECT;
   if ( m2_arduino_check_key(M2_KEY_EXIT) ) return M2_KEY_EXIT;
   if ( m2_arduino_check_key(M2_KEY_NEXT) ) return M2_KEY_NEXT;
   if ( m2_arduino_check_key(M2_KEY_PREV) ) return M2_KEY_PREV;
+
+  for (key = 0; key <= M2_KEY_CNT; key++) {
+    if (m2_arduino_soft_keys & (1<<key)) {
+      m2_arduino_soft_keys &= ~(1<<key);
+      return M2_KEY_EVENT(key);
+    }
+  }
+
   return M2_KEY_NONE;
}

@@ -83,6 +95,13 @@
       m2_arduino_setup();
       return 0;
   }
+  if (msg >= M2_ES_MSG_SET_KEY) {
+    msg -= M2_ES_MSG_SET_KEY;
+    if (msg <= M2_KEY_CNT) {
+      m2_arduino_soft_keys |= (1<<msg);
+    }
+  }
+
   return 0;
}


olikraus

Hi All

Version 1.02 has been released.
http://code.google.com/p/m2tklib/


  • New GLCD graphics handler with setFont() support

  • Bugfix for KEY_PREV

  • Display "." with M2_U32NUM

  • Documentation completed and updated

  • Read-only option (v1.01)



Thanks to MikeSmith for the bug reports and enhancement requests.

Oliver

olikraus


New release v1.03 of M2tklib is available:
http://code.google.com/p/m2tklib/

It contains two new elements (widgets) and a scrollbar:

The new INFO and INFOP elements show a string (RAM or PROGMEM) with up to 254 lines. The scrollbar is also available:


The STRLIST element allows the selection of one line out of up to 254 lines:


The library is available for the dogm128 library, for the GLCDv3 library and the LiquidCrystal library. For the LiquidCrystal library, M2tklib redefines up to 4 characters to display a scrollbar:


Oliver


liudr

Hahaha! Good work! I had the info as text_area to align with Java names and I had scroll bar too. Both elements were big pains to debug for me I bet the same for you!

Here is my recent work: a serial LCD keypad panel



It also has a full size 20X4 cousin. They're both sold on inmojo.com

blog:

http://liudr.wordpress.com/gadget/phi-panel/

Arduino forum thread:

http://arduino.cc/forum/index.php/topic,72206.0.html

olikraus

Ahh, yes, after a lot of debugging, i decided to write a SDL interface for the graphics output. So now i can debug most of the M2TKLIB code with classical unix tools (gdb and friends). Still the remaining (hardware dependent) software parts make me trouble enough: it took me some hours to make the character redefinition correct  :~

Oliver

liudr


Ahh, yes, after a lot of debugging, i decided to write a SDL interface for the graphics output. So now i can debug most of the M2TKLIB code with classical unix tools (gdb and friends). Still the remaining (hardware dependent) software parts make me trouble enough: it took me some hours to make the character redefinition correct  :~

Oliver



My biggest headache was integer math in the calculations. I realized that I was never used to it. Maybe should have taken a discrete math in college but too busy with other stuff and didn't taken any class from CSCI.

olikraus

Hi

M2tklib has been updated to v1.05.

  • Arduino 1.0 compatible

  • New elements: LABELFN, U8NUMFN, U32NUMFN

  • Support for embedded graphics http://code.google.com/p/m2tklib/wiki/t06glcd



Project Home: http://code.google.com/p/m2tklib/

At the moment, I have uploaded the GLCD version only. Please let me know, if there is need for the LiquidCrystal or dogm128 release.

Oliver


olikraus

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.html
Here 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

liudr

Great work! I posted some features of my library in the products forum. These are the features that need programming, other than just calling library functions.

http://arduino.cc/forum/index.php/topic,101503.0.html

solo_joe

Hello, I'm starting with this.
I'm testing the library and it seems to work great with GLCD

But I find the following difficulties.

M2_COMBO want the number of elements is dynamic from another variable to change at any time. For example from a configuration menu.
U8NUM (32) is the same with min and max value.

I miss an item type M2_DUMMY , that does not perform visual nothing but only to call a function.

That improvements could be made?

Thanks

Go Up