Next you can define alt_mode_key_mask and the KEY_MASK? macros. The former, as static variable that can be set with a function kbd_set_alt_mode_key_mask(), is only required if you want the port to support a user-selectable "ALT" button (i.e. when you define CAM_ADJUSTABLE_ALT_BUTTON in include/camera.h and add the choices to gui_alt_mode_button_enum() in core/gui.h). Otherwise you can just make it a macro. For alt_mode_key_mask you should take the mask from keymap[] that corresponds to the button that should be used to enable the CHDK "ALT" mode (which should be KEY_PRINT to match the default CHDK configuration). The KEY_MASK? macros should be the or of all the masks of keys that correspond to the specific index (i.e. for KEY_MASK0 you should take the masks of keys that are represented in physw_status[0]).
physw_status[1] |= alt_mode_key_mask;
// deals with alt-mode switch and delay emulation if (key_pressed) { if (kbd_is_key_pressed(conf.alt_mode_button) || ((key_pressed >= CAM_EMUL_KEYPRESS_DELAY) && (key_pressed < CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION))) {
if (key_pressed) { blink_led(1); if (kbd_is_key_pressed(conf.alt_mode_button) || ((key_pressed >= CAM_EMUL_KEYPRESS_DELAY) && (key_pressed < CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION))) {blink_led(1); if (key_pressed <= CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION) key_pressed++; if (key_pressed == CAM_EMUL_KEYPRESS_DELAY) kbd_key_press(conf.alt_mode_button); else if (key_pressed == +CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION) kbd_key_release(conf.alt_mode_button); return 1; } else if (kbd_get_pressed_key() == 0) { if (key_pressed != 100 && (key_pressed < CAM_EMUL_KEYPRESS_DELAY)) { kbd_blocked = 1-kbd_blocked; if (kbd_blocked) gui_kbd_enter(); else gui_kbd_leave(); } key_pressed = 0; return 1; } return 1; }
Started by Microfunguy General Discussion and Assistance
Started by Howdy « 1 2 » RAW Shooting and Processing
Started by zephyr7 General Help and Assistance on using CHDK stable releases
Started by elektro255 « 1 2 » General Discussion and Assistance
Started by OhmEye General Discussion and Assistance