void myButtonPressedCallback(enum mtouch_button_names button) { printf("The button %d is pressed.\r\n", button); } void myButtonReleasedCallback(enum mtouch_button_names button) { printf("The button %d is released.\r\n", button); } main() { ... MTOUCH_Button_SetPressedCallback(myButtonPressedCallback); MTOUCH_Button_SetNotPressedCallback(myButtonReleasedCallback); ... while(1) { MTOUCH_Service_Mainloop(); } }