aboutsummaryrefslogtreecommitdiff
path: root/arch/casiowin/fxlib/include/fxlib/keyboard.h
blob: 036e128af25f6c2d700bf6939f9b1be0614ea1b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* ****************************************************************************
 * fxlib/keyboard.h -- fxlib's keyboard management.
 * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
 *
 * This file is part of the 'casiowin/fxlib' module,
 * in libcarrot, an experimental modular libc project.
 *
 * This file is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This file is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Lesser Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this file.  If not, see <http://www.gnu.org/licenses/>.
 * ************************************************************************* */
#include <fxlib/cdefs.h>
#include <keybios.h>
__BEGIN_NAMESPACE_FXLIB
__BEGIN_DECLS

/* ************************************************************************* */
/*  Configure the keyboard                                                   */
/* ************************************************************************* */
/* Repeat types */
#define KEYREP_NOEVENT              0
#define KEYREP_KEYEVENT             1
#define KEYREP_TIMEREVENT           2

/* Set the repeat time */
extern void Bkey_Set_RepeatTime _OF((long __FirstCount, long __NextCount))
	__THROW;
extern void Bkey_Set_RepeatTime_Default _OF((void)) __THROW;

/* Get the current repeat time */
extern __nonnull(1, __FirstCount) __nonnull(2, __NextCount)
void Bkey_Get_RepeatTime _OF((long *__FirstCount, long *__NextCount))
	__THROW;
/* ************************************************************************* */
/*  Get key presses, check key statuses                                      */
/* ************************************************************************* */
/* Waiting types */
#define KEYWAIT_HALTON_TIMEROFF     0
#define KEYWAIT_HALTOFF_TIMEROFF    1
#define KEYWAIT_HALTON_TIMERON      2

/* Get key presses */
extern int GetKey _OF((unsigned int *__keycode)) __THROW;
extern __nonnull(4, __keycode)
int GetKeyWait _OF((int __sel, int __time, int __menu,
	unsigned int *__keycode)) __THROW;

extern __nonnull(1, __column) __nonnull(2, __row) __nonnull(6, __keycode)
int GetKeyWait_OS _OF((int *__column, int *__row, int __waiting_type,
	int __timeout, int __menu, unsigned short *__keycode))
	__THROW;

/* Check key statuses */
extern __wur int IsKeyDown _OF((int __keycode)) __THROW;
extern __wur int IsKeyUp   _OF((int __keycode)) __THROW;
/* ************************************************************************* */
/*  Syscalls                                                                 */
/* ************************************************************************* */
#if __USE_FXLIB_UNOFFICIAL

/* Get key */
extern __nonnull(1, __column) __nonnull(2, __row) __nonnull(6, __keycode)
int Keyboard_GetKeyWait _OF((int *__column, int *__row,
	int __type_of_waiting, int __timeout_period, int __menu,
	unsigned short *__keycode)) __THROW;

extern __nonnull(1, __matrixcode)
int Keyboard_GetPressedKey _OF((short *__matrixcode)) __THROW;
extern __nonnull(1, __matrixcode)
int Keyboard_IsKeyPressed  _OF((short *__matrixcode)) __THROW;
extern __wur int Keyboard_KeyDown OF((void)) __THROW;

/* Put key */
extern int PutKey _OF((int __keycode, int __mode)) __THROW;
extern int Keyboard_PutKeycode _OF((int __x, int __y, int __keycode)) __THROW;
#endif

__END_DECLS
__END_NAMESPACE_FXLIB