Lightweight proportional text library for C12832 LCD. Easy to modify, fast, robust and compact. Nice font, good for text driven menus, messages, etc. Fell free to use and modify in any projects.
Documentation will be here later.
Usage sample:
Import programapp-board-lcd128
Sample usage of lightweight C12832 LCD library
lcd128menu.h@6:5cd32671a837, 2014-10-07 (annotated)
- Committer:
- medvdv
- Date:
- Tue Oct 07 20:50:41 2014 +0000
- Revision:
- 6:5cd32671a837
Experimental menu driven interface
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
medvdv | 6:5cd32671a837 | 1 | // |
medvdv | 6:5cd32671a837 | 2 | // MBED Application Board |
medvdv | 6:5cd32671a837 | 3 | // Lightweight Menu-driven Interface |
medvdv | 6:5cd32671a837 | 4 | // 2014, Alexander Medvedev, @medvdv |
medvdv | 6:5cd32671a837 | 5 | // |
medvdv | 6:5cd32671a837 | 6 | |
medvdv | 6:5cd32671a837 | 7 | // |
medvdv | 6:5cd32671a837 | 8 | // Menu entry types |
medvdv | 6:5cd32671a837 | 9 | // |
medvdv | 6:5cd32671a837 | 10 | |
medvdv | 6:5cd32671a837 | 11 | #define APPMENU_NONE 0 // Empty row |
medvdv | 6:5cd32671a837 | 12 | #define APPMENU_ACTION 1 // Standart item - Text + action, returns id |
medvdv | 6:5cd32671a837 | 13 | #define APPMENU_BREAK 2 // Break line "----" |
medvdv | 6:5cd32671a837 | 14 | #define APPMENU_SUBMENU 3 // Enter to other menu |
medvdv | 6:5cd32671a837 | 15 | #define APPMENU_COMMENT 4 // Text comment, not active |
medvdv | 6:5cd32671a837 | 16 | #define APPMENU_CHECK 5 // ->bool Check box, changes to true / false |
medvdv | 6:5cd32671a837 | 17 | #define APPMENU_RADIO 6 // ->int Radio button selection, changes to selected id |
medvdv | 6:5cd32671a837 | 18 | #define APPMENU_NUMBER 7 // ->int Changes number +/- as [minimum +step +2step ... maximum] |
medvdv | 6:5cd32671a837 | 19 | #define APPMENU_BAR 8 // ->float Progress bar level [0.0 .. 1.0] |
medvdv | 6:5cd32671a837 | 20 | |
medvdv | 6:5cd32671a837 | 21 | // Padding from border in px |
medvdv | 6:5cd32671a837 | 22 | |
medvdv | 6:5cd32671a837 | 23 | #define APPMENU_TAB 5 |
medvdv | 6:5cd32671a837 | 24 | |
medvdv | 6:5cd32671a837 | 25 | // Break entry line bits |
medvdv | 6:5cd32671a837 | 26 | |
medvdv | 6:5cd32671a837 | 27 | #define APPMENU_DELIMITER 0x08 |
medvdv | 6:5cd32671a837 | 28 | |
medvdv | 6:5cd32671a837 | 29 | // |
medvdv | 6:5cd32671a837 | 30 | // One menu entry: |
medvdv | 6:5cd32671a837 | 31 | // |
medvdv | 6:5cd32671a837 | 32 | |
medvdv | 6:5cd32671a837 | 33 | typedef struct { |
medvdv | 6:5cd32671a837 | 34 | unsigned char type; // APPMENU_* type |
medvdv | 6:5cd32671a837 | 35 | int id; // integer id for action, or radio button |
medvdv | 6:5cd32671a837 | 36 | char * name; // text name |
medvdv | 6:5cd32671a837 | 37 | bool bold; // draw it bold |
medvdv | 6:5cd32671a837 | 38 | bool underline; // underline it |
medvdv | 6:5cd32671a837 | 39 | int minimum; // minimum value for integer or progress |
medvdv | 6:5cd32671a837 | 40 | int maximum; // maximum value for integer or progress |
medvdv | 6:5cd32671a837 | 41 | int step; // step for integer |
medvdv | 6:5cd32671a837 | 42 | void * parameter; // points to: int for progress, |
medvdv | 6:5cd32671a837 | 43 | // int for radio button and integer number, |
medvdv | 6:5cd32671a837 | 44 | // bool for checkbox, appMenuEntry for sub menu |
medvdv | 6:5cd32671a837 | 45 | } lcd128entry; |
medvdv | 6:5cd32671a837 | 46 | |
medvdv | 6:5cd32671a837 | 47 | // Menu interface - give it pointer to first entry from array and N of entrys |
medvdv | 6:5cd32671a837 | 48 | // Returns id of action |
medvdv | 6:5cd32671a837 | 49 | // Changes parameters of integer / progress entrys |
medvdv | 6:5cd32671a837 | 50 | // Selects checkboxes and radiobuttons |
medvdv | 6:5cd32671a837 | 51 | // Reopens other pointed menus |
medvdv | 6:5cd32671a837 | 52 | // Default pins assigment - for mbed application board joystick |
medvdv | 6:5cd32671a837 | 53 | |
medvdv | 6:5cd32671a837 | 54 | int lcd128menu(lcd128 * lcd, lcd128entry * FirstEntry, int N, bool LastRow = true, |
medvdv | 6:5cd32671a837 | 55 | PinName pUp = p15, PinName pDown = p12, PinName pLeft = p13, PinName pRight = p16, |
medvdv | 6:5cd32671a837 | 56 | PinName pFire = p14); |