Oliver, does this line need replacing for u8_glib?
M2tk m2(&el_main_menu, m2_es_arduino, m2_eh_4bs, m2_gh_lc);
I have my program like this, and I downloaded the latest library for m2 with u8_glib, but I get an error
#include "M2tk.h"
#include "m2ghu8g.h"
#include "U8glib.h"
U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
//Adafruit_PCD8544 display = Adafruit_PCD8544(52, 51, 50, 48, 49);
uint8_t uiKeySelectPin = 10;
uint8_t uiKeyNextPin = 9;
uint8_t girl_color = 0;
uint8_t boy_color = 0;
uint8_t man_color = 0;
M2_EXTERN_GRIDLIST(el_main_menu);
M2tk m2(&el_main_menu, m2_es_arduino, m2_eh_4bs, m2_gh_u8g_bf);
void fn_ok(m2_el_fnarg_p fnarg) {
/* color changed, do something */
/* then jump back to the main menu */
m2.setRoot(&el_main_menu);
}
const char *fn_idx_to_color(uint8_t idx)
{
switch(idx)
{
case 0: return "brown";
case 1: return "blonde";
case 2: return "red";
}
return "";
}
/* boy submenu */
M2_LABEL(el_label1, NULL, "Boy:");
M2_COMBO(el_combo1, NULL, &boy_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok1, NULL, " ok ", fn_ok);
M2_LIST(list1) = {
&el_label1, &el_combo1,
&el_ok1
};
M2_GRIDLIST(el_grid1, "c2",list1);
/* girl submenu */
M2_LABEL(el_label2, NULL, "Girl:");
M2_COMBO(el_combo2, NULL, &girl_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok2, NULL, " ok ", fn_ok);
M2_LIST(list2) = {
&el_label2, &el_combo2,
&el_ok2
};
M2_GRIDLIST(el_grid2, "c2",list2);
/* man submenu */
M2_LABEL(el_label3, NULL, "Man:");
M2_COMBO(el_combo3, NULL, &man_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok3, NULL, " ok ", fn_ok);
M2_LIST(list3) = {
&el_label3, &el_combo3,
&el_ok3
};
M2_GRIDLIST(el_grid3, "c2",list3);
/* main menu */
M2_ROOT(el_boy_button, NULL, "Boy", &el_grid1);
M2_ROOT(el_girl_button, NULL, "Girl", &el_grid2);
M2_ROOT(el_man_button, NULL, "Man", &el_grid3);
M2_LIST(list_main_menu) = {
&el_boy_button,
&el_girl_button,
&el_man_button,
};
M2_GRIDLIST(el_main_menu, "c1",list_main_menu);
// Arduino setup procedure (called only once)
void setup() {
// Connect u8glib with m2tklib
m2_SetU8g(u8g.getU8g(), m2_u8g_box_icon);
// Assign u8g font to index 0
m2.setFont(0, u8g_font_7x13);
// Setup keys
m2.setPin(M2_KEY_SELECT, uiKeySelectPin);
m2.setPin(M2_KEY_NEXT, uiKeyDownPin);
}
// Arduino loop procedure
void loop() {
m2.checkKey();
if ( m2.handleKey() ) {
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
}
}
sketch_jul17a.cpp:2:21: error: m2ghu8g.h: No such file or directory
sketch_jul17a:14: error: 'm2_gh_u8g_bf' was not declared in this scope
sketch_jul17a.cpp: In function 'void setup()':
sketch_jul17a:78: error: 'm2_u8g_box_icon' was not declared in this scope
sketch_jul17a:78: error: 'm2_SetU8g' was not declared in this scope
sketch_jul17a:85: error: 'uiKeyDownPin' was not declared in this scope
sketch_jul17a.cpp: In function 'void loop()':
sketch_jul17a:94: error: 'draw' was not declared in this scope
i.e i dont think it can find the libraries?