Rishka
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
keyboard.h
Go to the documentation of this file.
1/*
2 * This file is part of the Rishka distribution (https://github.com/nthnn/rishka).
3 * Copyright (c) 2024 Nathanne Isip.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
29#ifndef LIBRISHKA_DRIVERS_KEYBOARD_H
30#define LIBRISHKA_DRIVERS_KEYBOARD_H
31
32#include <librishka/devices.h>
33#include <librishka/types.h>
34
50class Keyboard final {
51public:
60 static string layout_name();
61
70 static string layout_desc();
71
81 static PS2Device device_type();
82
91 static bool is_num_lock();
92
101 static bool is_caps_lock();
102
111 static bool is_scroll_lock();
112
123 static void num_lock(bool state);
124
135 static void caps_lock(bool state);
136
147 static void scroll_lock(bool state);
148
161 static u32 next_scancode(i32 timeout, bool resend);
162
171 static void lock(i32 timeout);
172
178 static void unlock();
179
185 static void reset();
186};
187
188#endif
Provides access to keyboard-related functionalities in the Rishka VM SDK.
Definition: keyboard.h:50
static u32 next_scancode(i32 timeout, bool resend)
Get the next keyboard scan code.
Definition: librishka_drivers_keyboard.cpp:40
static void unlock()
Unlock the keyboard to allow input.
Definition: librishka_drivers_keyboard.cpp:48
static bool is_num_lock()
Check if the Num Lock key is currently active.
Definition: librishka_drivers_keyboard.cpp:16
static void num_lock(bool state)
Set the state of the Num Lock key.
Definition: librishka_drivers_keyboard.cpp:28
static void lock(i32 timeout)
Lock the keyboard to prevent input.
Definition: librishka_drivers_keyboard.cpp:44
static bool is_caps_lock()
Check if the Caps Lock key is currently active.
Definition: librishka_drivers_keyboard.cpp:20
static PS2Device device_type()
Get the type of the keyboard device.
Definition: librishka_drivers_keyboard.cpp:12
static void reset()
Reset the keyboard to its default state.
Definition: librishka_drivers_keyboard.cpp:52
static bool is_scroll_lock()
Check if the Scroll Lock key is currently active.
Definition: librishka_drivers_keyboard.cpp:24
static void scroll_lock(bool state)
Set the state of the Scroll Lock key.
Definition: librishka_drivers_keyboard.cpp:36
static string layout_name()
Get the name of the current keyboard layout.
Definition: librishka_drivers_keyboard.cpp:4
static string layout_desc()
Get the description of the current keyboard layout.
Definition: librishka_drivers_keyboard.cpp:8
static void caps_lock(bool state)
Set the state of the Caps Lock key.
Definition: librishka_drivers_keyboard.cpp:32
Definitions related to PS/2 devices for the Rishka Virtual Machine SDK.
PS2Device
Enumeration of PS/2 device types.
Definition: devices.h:44
Header file for common data types used in Rishka applications.
signed int i32
Alias for the signed 32-bit integer type.
Definition: types.h:58
unsigned int u32
Alias for the unsigned 32-bit integer type.
Definition: types.h:82