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();
int _ts5_is_tscope5_installed
Is Tscope5 installed?
int _ts5_is_timer_installed
Is the timer subsystem installed?
void ts5_install_timer(char *calling_function)
Install the timer subsystem.
void ts5_log(const unsigned int level, const char *format,...)
Send info to a logging window.
void ts5_check_keyboard(char *calling_function)
Do some checks at the start of each keyboard function.
void ts5_install_keyboard(char *calling_function)
Install the keyboard subsystem.
void ts5_fatal(const char *format,...)
Exit safely with an error message.
int _ts5_is_keyboard_installed
Is the keyboard subsystem installed?
void ts5_uninstall_keyboard()
Uninstall the keyboard subsystem.