14 #include "../include/tscope5/keyboard_internal.h"
15 #include "../include/tscope5/system_internal.h"
16 #include "../include/tscope5/timer_internal.h"
32 ts5_log(TS5_LOGLEVEL_6,
"%s: ts5_check_keyboard\n", calling_function);
35 ts5_fatal(
"%s: tscope5 not installed\n", calling_function);
38 if (_ts5_status.active_display == -1) {
39 ts5_fatal(
"%s: no active display available\n", calling_function);
64 ts5_log(TS5_LOGLEVEL_1,
"%s: Installing Tscope5 keyboard\n",
67 if (!al_install_keyboard()) {
68 ts5_fatal(
"%s: could not install tscope5 keyboard\n",
72 al_register_event_source(_ts5_data.timer.response_queue,
73 al_get_keyboard_event_source());
75 _ts5_status.timer.keyboard.num_buttons = TS5_KEY_MAX-1;
76 _ts5_status.timer.keyboard.num_defined_buttons = 0;
77 _ts5_status.timer.keyboard.num_active_buttons = 0;
79 _ts5_status.timer.keyboard.button_press_defined =
80 (
int *)al_malloc(
sizeof(
int)
81 * _ts5_status.timer.keyboard.num_buttons);
83 _ts5_status.timer.keyboard.button_press_active =
84 (
int *)al_malloc(
sizeof(
int)
85 * _ts5_status.timer.keyboard.num_buttons);
87 _ts5_status.timer.keyboard.button_release_defined =
88 (
int *)al_malloc(
sizeof(
int)
89 * _ts5_status.timer.keyboard.num_buttons);
91 _ts5_status.timer.keyboard.button_release_active =
92 (
int *)al_malloc(
sizeof(
int)
93 * _ts5_status.timer.keyboard.num_buttons);
96 for (i=0; i<_ts5_status.timer.keyboard.num_buttons; i++) {
97 _ts5_status.timer.keyboard.button_press_defined[i] = 0;
98 _ts5_status.timer.keyboard.button_press_active[i] = 0;
99 _ts5_status.timer.keyboard.button_release_defined[i] = 0;
100 _ts5_status.timer.keyboard.button_release_active[i] = 0;
117 ts5_log(TS5_LOGLEVEL_1,
"Uninstalling Tscope5 keyboard\n");
119 _ts5_status.timer.keyboard.num_buttons = 0;
120 _ts5_status.timer.keyboard.num_defined_buttons = 0;
121 _ts5_status.timer.keyboard.num_active_buttons = 0;
123 al_free(_ts5_status.timer.keyboard.button_press_defined);
124 _ts5_status.timer.keyboard.button_press_defined = NULL;
126 al_free(_ts5_status.timer.keyboard.button_press_active);
127 _ts5_status.timer.keyboard.button_press_active = NULL;
129 al_free(_ts5_status.timer.keyboard.button_release_defined);
130 _ts5_status.timer.keyboard.button_release_defined = NULL;
132 al_free(_ts5_status.timer.keyboard.button_release_active);
133 _ts5_status.timer.keyboard.button_release_active = NULL;
135 _ts5_status.timer.keyboard_is_response_device = 0;
137 al_unregister_event_source(_ts5_data.timer.response_queue,
138 al_get_keyboard_event_source());
140 al_uninstall_keyboard();