diff --git a/docs/annotated.html b/docs/annotated.html index 407faff..8de6c8c 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -97,9 +97,10 @@  CI2CClass for handling I2C operations in Rishka applications  CIntClass for handling interrupt operations in Rishka applications  CIOClass for handling input/output operations in Rishka applications - CMemoryClass for handling memory management operations in Rishka applications - CRuntimeUtilities for managing runtime operations - CSysClass for handling system utilities in Rishka applications + CKeyboardProvides access to keyboard-related functionalities in the Rishka VM SDK + CMemoryClass for handling memory management operations in Rishka applications + CRuntimeUtilities for managing runtime operations + CSysClass for handling system utilities in Rishka applications diff --git a/docs/annotated_dup.js b/docs/annotated_dup.js index e02371f..4c07fb3 100644 --- a/docs/annotated_dup.js +++ b/docs/annotated_dup.js @@ -7,6 +7,7 @@ var annotated_dup = [ "I2C", "d6/d81/classI2C.html", null ], [ "Int", "d8/d2f/classInt.html", null ], [ "IO", "d8/d66/classIO.html", null ], + [ "Keyboard", "dc/dd2/classKeyboard.html", null ], [ "Memory", "da/dc6/classMemory.html", null ], [ "Runtime", "d6/dd8/classRuntime.html", null ], [ "Sys", "d1/d61/classSys.html", null ] diff --git a/docs/classes.html b/docs/classes.html index dc0f191..4d6f108 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -88,7 +88,7 @@
Class Index
-
A | F | G | I | M | R | S
+
A | F | G | I | K | M | R | S
A
@@ -103,12 +103,15 @@
I
I2C
Int
IO
+
K
+
Keyboard
+
M
Memory
-
+
R
Runtime
-
+
S
Sys
diff --git a/docs/d6/da0/keyboard_8h.html b/docs/d6/da0/keyboard_8h.html new file mode 100644 index 0000000..d0bc8a8 --- /dev/null +++ b/docs/d6/da0/keyboard_8h.html @@ -0,0 +1,117 @@ + + + + + + + +Rishka: sdk/librishka/keyboard.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
Rishka +
+
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
keyboard.h File Reference
+
+
+ +

This header file defines the Keyboard class, providing access to keyboard-related functionalities in the Rishka VM SDK. +More...

+
#include <librishka/devices.h>
+#include <librishka/types.h>
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  Keyboard
 Provides access to keyboard-related functionalities in the Rishka VM SDK. More...
 
+

Detailed Description

+

This header file defines the Keyboard class, providing access to keyboard-related functionalities in the Rishka VM SDK.

+
Author
Nathanne Isip
+

The Keyboard class allows interaction with various keyboard-related functionalities in the Rishka VM SDK. It includes methods for retrieving information about the keyboard layout, checking the status of lock keys (Num Lock, Caps Lock, Scroll Lock), controlling the state of these lock keys, obtaining keyboard scan codes, and performing operations such as locking, unlocking, and resetting the keyboard.

+
+
+ \ No newline at end of file diff --git a/docs/d6/da0/keyboard_8h.js b/docs/d6/da0/keyboard_8h.js new file mode 100644 index 0000000..f2a59dc --- /dev/null +++ b/docs/d6/da0/keyboard_8h.js @@ -0,0 +1,4 @@ +var keyboard_8h = +[ + [ "Keyboard", "dc/dd2/classKeyboard.html", null ] +]; \ No newline at end of file diff --git a/docs/d6/da0/keyboard_8h_source.html b/docs/d6/da0/keyboard_8h_source.html new file mode 100644 index 0000000..83125c9 --- /dev/null +++ b/docs/d6/da0/keyboard_8h_source.html @@ -0,0 +1,169 @@ + + + + + + + +Rishka: sdk/librishka/keyboard.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
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_KEYBOARD_H
+
30#define LIBRISHKA_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_keyboard.cpp:40
+
static void unlock()
Unlock the keyboard to allow input.
Definition: librishka_keyboard.cpp:48
+
static bool is_num_lock()
Check if the Num Lock key is currently active.
Definition: librishka_keyboard.cpp:16
+
static void num_lock(bool state)
Set the state of the Num Lock key.
Definition: librishka_keyboard.cpp:28
+
static void lock(i32 timeout)
Lock the keyboard to prevent input.
Definition: librishka_keyboard.cpp:44
+
static bool is_caps_lock()
Check if the Caps Lock key is currently active.
Definition: librishka_keyboard.cpp:20
+
static PS2Device device_type()
Get the type of the keyboard device.
Definition: librishka_keyboard.cpp:12
+
static void reset()
Reset the keyboard to its default state.
Definition: librishka_keyboard.cpp:52
+
static bool is_scroll_lock()
Check if the Scroll Lock key is currently active.
Definition: librishka_keyboard.cpp:24
+
static void scroll_lock(bool state)
Set the state of the Scroll Lock key.
Definition: librishka_keyboard.cpp:36
+
static string layout_name()
Get the name of the current keyboard layout.
Definition: librishka_keyboard.cpp:4
+
static string layout_desc()
Get the description of the current keyboard layout.
Definition: librishka_keyboard.cpp:8
+
static void caps_lock(bool state)
Set the state of the Caps Lock key.
Definition: librishka_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
+
+
+ \ No newline at end of file diff --git a/docs/d6/de4/librishka_8h.html b/docs/d6/de4/librishka_8h.html index c7b9821..3f53fbf 100644 --- a/docs/d6/de4/librishka_8h.html +++ b/docs/d6/de4/librishka_8h.html @@ -92,11 +92,13 @@

Main header file for the Rishka SDK. More...

#include <librishka/args.h>
+#include <librishka/devices.h>
#include <librishka/fs.h>
#include <librishka/gpio.h>
#include <librishka/i2c.h>
#include <librishka/int.h>
#include <librishka/io.h>
+#include <librishka/keyboard.h>
#include <librishka/memory.h>
#include <librishka/runtime.h>
#include <librishka/sys.h>
diff --git a/docs/d6/de4/librishka_8h_source.html b/docs/d6/de4/librishka_8h_source.html index 83fcfa5..6c6c4f3 100644 --- a/docs/d6/de4/librishka_8h_source.html +++ b/docs/d6/de4/librishka_8h_source.html @@ -109,22 +109,26 @@
28#define LIBRISHKA_H
29
40#include <librishka/args.h>
-
41#include <librishka/fs.h>
-
42#include <librishka/gpio.h>
-
43#include <librishka/i2c.h>
-
44#include <librishka/int.h>
-
45#include <librishka/io.h>
-
46#include <librishka/memory.h>
-
47#include <librishka/runtime.h>
-
48#include <librishka/sys.h>
-
49#include <librishka/types.h>
-
51#endif /* LIBRISHKA_H */
+
41#include <librishka/devices.h>
+
42#include <librishka/fs.h>
+
43#include <librishka/gpio.h>
+
44#include <librishka/i2c.h>
+
45#include <librishka/int.h>
+
46#include <librishka/io.h>
+
47#include <librishka/keyboard.h>
+
48#include <librishka/memory.h>
+
49#include <librishka/runtime.h>
+
50#include <librishka/sys.h>
+
51#include <librishka/types.h>
+
53#endif /* LIBRISHKA_H */
Header file for handling command line arguments in Rishka applications.
+
Definitions related to PS/2 devices for the Rishka Virtual Machine SDK.
Header file for file system operations in Rishka applications.
Header file for GPIO operations in Rishka applications.
Header file for I2C (Inter-Integrated Circuit) operations in Rishka applications.
Header file for interrupt handling in Rishka applications.
Header file for input/output operations in Rishka applications.
+
This header file defines the Keyboard class, providing access to keyboard-related functionalities in ...
Header file for memory management in Rishka applications.
Provides utilities for managing runtime operations within Rishka applications.
Header file for system utilities in Rishka applications.
diff --git a/docs/d7/dde/devices_8h.html b/docs/d7/dde/devices_8h.html new file mode 100644 index 0000000..ecb05b9 --- /dev/null +++ b/docs/d7/dde/devices_8h.html @@ -0,0 +1,160 @@ + + + + + + + +Rishka: sdk/librishka/devices.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
Rishka +
+
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
devices.h File Reference
+
+
+ +

Definitions related to PS/2 devices for the Rishka Virtual Machine SDK. +More...

+ +

Go to the source code of this file.

+ + + + + +

+Enumerations

enum  PS2Device {
+  PS2_DEV_UNKNOWN +, PS2_DEV_OLD_ATKB +, PS2_DEV_MOUSE_STD +, PS2_DEV_MOUSE_WHEEL +,
+  PS2_DEV_MOUSE_5BTN +, PS2_DEV_MF2KB_TRANS +, PS2_DEV_MF2KB +
+ }
 Enumeration of PS/2 device types. More...
 
+

Detailed Description

+

Definitions related to PS/2 devices for the Rishka Virtual Machine SDK.

+
Author
Nathanne Isip
+

This header file contains definitions related to PS/2 devices for use with the Rishka Virtual Machine Software Development Kit (SDK). PS/2 devices include keyboards and mice, and this file provides enumerations for various types of PS/2 devices that can be connected to the Rishka VM.

+

Enumeration Type Documentation

+ +

◆ PS2Device

+ +
+
+ + + + +
enum PS2Device
+
+ +

Enumeration of PS/2 device types.

+

This enumeration defines symbolic names for different types of PS/2 devices that can be connected to the Rishka Virtual Machine.

+

PS/2 devices include keyboards and mice, and this enumeration provides identifiers for various types of keyboards and mice supported by the Rishka VM.

+ + + + + + + + +
Enumerator
PS2_DEV_UNKNOWN 

Unknown PS/2 device.

+
PS2_DEV_OLD_ATKB 

Old-style AT keyboard.

+
PS2_DEV_MOUSE_STD 

Standard PS/2 mouse.

+
PS2_DEV_MOUSE_WHEEL 

PS/2 mouse with wheel support.

+
PS2_DEV_MOUSE_5BTN 

PS/2 mouse with 5 buttons.

+
PS2_DEV_MF2KB_TRANS 

MF2 keyboard with translation support.

+
PS2_DEV_MF2KB 

MF2 keyboard.

+
+ +
+
+
+
+ \ No newline at end of file diff --git a/docs/d7/dde/devices_8h.js b/docs/d7/dde/devices_8h.js new file mode 100644 index 0000000..24c344a --- /dev/null +++ b/docs/d7/dde/devices_8h.js @@ -0,0 +1,12 @@ +var devices_8h = +[ + [ "PS2Device", "d7/dde/devices_8h.html#aa32bfd3732098892fc798e735dca1ed5", [ + [ "PS2_DEV_UNKNOWN", "d7/dde/devices_8h.html#aa32bfd3732098892fc798e735dca1ed5a0003d38b5de2d690c1dfa0646e60bfa2", null ], + [ "PS2_DEV_OLD_ATKB", "d7/dde/devices_8h.html#aa32bfd3732098892fc798e735dca1ed5afd335beb866fcfc8baf710cc327c5e46", null ], + [ "PS2_DEV_MOUSE_STD", "d7/dde/devices_8h.html#aa32bfd3732098892fc798e735dca1ed5a17318e41129873c4e01f99b0bf9ef72c", null ], + [ "PS2_DEV_MOUSE_WHEEL", "d7/dde/devices_8h.html#aa32bfd3732098892fc798e735dca1ed5a3f8c2d57b3da92ae0c98386488af1d31", null ], + [ "PS2_DEV_MOUSE_5BTN", "d7/dde/devices_8h.html#aa32bfd3732098892fc798e735dca1ed5a6f2021a62545485658f410168bfd47dd", null ], + [ "PS2_DEV_MF2KB_TRANS", "d7/dde/devices_8h.html#aa32bfd3732098892fc798e735dca1ed5a4fd3e38fb7253b6dfbd732e08c14583c", null ], + [ "PS2_DEV_MF2KB", "d7/dde/devices_8h.html#aa32bfd3732098892fc798e735dca1ed5afe3288db6d8a16b0ac23c2adc0ae19a4", null ] + ] ] +]; \ No newline at end of file diff --git a/docs/d7/dde/devices_8h_source.html b/docs/d7/dde/devices_8h_source.html new file mode 100644 index 0000000..3b65a58 --- /dev/null +++ b/docs/d7/dde/devices_8h_source.html @@ -0,0 +1,136 @@ + + + + + + + +Rishka: sdk/librishka/devices.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
Rishka +
+
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
devices.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
+
28#ifndef LIBRISHKA_DEVICES_H
+
29#define LIBRISHKA_DEVICES_H
+
30
+
44typedef enum {
+ + + + + + + + +
53
+
54#endif
+
PS2Device
Enumeration of PS/2 device types.
Definition: devices.h:44
+
@ PS2_DEV_UNKNOWN
Definition: devices.h:45
+
@ PS2_DEV_MOUSE_STD
Definition: devices.h:47
+
@ PS2_DEV_MOUSE_WHEEL
Definition: devices.h:48
+
@ PS2_DEV_MF2KB_TRANS
Definition: devices.h:50
+
@ PS2_DEV_MOUSE_5BTN
Definition: devices.h:49
+
@ PS2_DEV_OLD_ATKB
Definition: devices.h:46
+
@ PS2_DEV_MF2KB
Definition: devices.h:51
+
+
+ \ No newline at end of file diff --git a/docs/d8/d88/classKeyboard-members.html b/docs/d8/d88/classKeyboard-members.html new file mode 100644 index 0000000..dcf3911 --- /dev/null +++ b/docs/d8/d88/classKeyboard-members.html @@ -0,0 +1,113 @@ + + + + + + + +Rishka: Member List + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
Rishka +
+
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
Keyboard Member List
+
+
+ +

This is the complete list of members for Keyboard, including all inherited members.

+ + + + + + + + + + + + + + +
caps_lock(bool state)Keyboardstatic
device_type()Keyboardstatic
is_caps_lock()Keyboardstatic
is_num_lock()Keyboardstatic
is_scroll_lock()Keyboardstatic
layout_desc()Keyboardstatic
layout_name()Keyboardstatic
lock(i32 timeout)Keyboardstatic
next_scancode(i32 timeout, bool resend)Keyboardstatic
num_lock(bool state)Keyboardstatic
reset()Keyboardstatic
scroll_lock(bool state)Keyboardstatic
unlock()Keyboardstatic
+
+ \ No newline at end of file diff --git a/docs/dc/da5/librishka__impl_8hpp_source.html b/docs/dc/da5/librishka__impl_8hpp_source.html index 1824faf..27ed362 100644 --- a/docs/dc/da5/librishka__impl_8hpp_source.html +++ b/docs/dc/da5/librishka__impl_8hpp_source.html @@ -207,93 +207,110 @@
117 RISHKA_SC_I2C_PINS,
118 RISHKA_SC_I2C_BUFSIZE,
119
-
120 RISHKA_SC_RT_STRPASS,
-
121 RISHKA_SC_RT_YIELD,
-
122 RISHKA_SC_RT_FORK_STREAM
-
123};
-
124
-
125static inline long long int double_to_long(double d) {
-
126 union {
-
127 double input;
-
128 long long int output;
-
129 } data;
-
130
-
131 data.input = d;
-
132 return data.output;
-
133}
-
134
-
135static inline double long_to_float(long long int l) {
-
136 union {
-
137 double output;
-
138 long long int input;
-
139 } data;
-
140
-
141 data.input = l;
-
142 return data.output;
-
143}
-
144
-
145static inline i64 rishka_sc_0(i32 scallid) {
-
146 register i64 a0 asm("a0") = 0;
-
147 register i64 scid asm("a7") = scallid;
-
148
-
149 asm volatile ("scall" : "+r"(a0) : "r"(scid));
-
150 return a0;
-
151}
-
152
-
153static inline i64 rishka_sc_1(i32 scallid, i64 arg0) {
-
154 register i64 a0 asm("a0") = arg0;
-
155 register i64 scid asm("a7") = scallid;
-
156
-
157 asm volatile ("scall" : "+r"(a0) : "r"(scid));
-
158 return a0;
-
159}
-
160
-
161static inline i64 rishka_sc_2(i32 scallid, i64 arg0, i64 arg1) {
-
162 register i64 a0 asm("a0") = arg0;
-
163 register i64 a1 asm("a1") = arg1;
+
120 RISHKA_SC_KB_LAYOUT_NAME,
+
121 RISHKA_SC_KB_LAYOUT_DESC,
+
122 RISHKA_SC_KB_LED_GET_NUM,
+
123 RISHKA_SC_KB_LED_GET_CAPS,
+
124 RISHKA_SC_KB_LED_GET_SCROLL,
+
125 RISHKA_SC_KB_LED_SET_NUM,
+
126 RISHKA_SC_KB_LED_SET_CAPS,
+
127 RISHKA_SC_KB_LED_SET_SCROLL,
+
128 RISHKA_SC_KB_NEXT_SCAN_CODE,
+
129 RISHKA_SC_KB_DEVICE_TYPE,
+
130 RISHKA_SC_KB_AVAILABLE_VK,
+
131 RISHKA_SC_KB_IS_AVAILABLE,
+
132 RISHKA_SC_KB_IS_VK_DOWN,
+
133 RISHKA_SC_KB_LOCK,
+
134 RISHKA_SC_KB_UNLOCK,
+
135 RISHKA_SC_KB_RESET,
+
136
+
137 RISHKA_SC_RT_STRPASS,
+
138 RISHKA_SC_RT_YIELD,
+
139 RISHKA_SC_RT_FORK_STREAM
+
140};
+
141
+
142static inline long long int double_to_long(double d) {
+
143 union {
+
144 double input;
+
145 long long int output;
+
146 } data;
+
147
+
148 data.input = d;
+
149 return data.output;
+
150}
+
151
+
152static inline double long_to_float(long long int l) {
+
153 union {
+
154 double output;
+
155 long long int input;
+
156 } data;
+
157
+
158 data.input = l;
+
159 return data.output;
+
160}
+
161
+
162static inline i64 rishka_sc_0(i32 scallid) {
+
163 register i64 a0 asm("a0") = 0;
164 register i64 scid asm("a7") = scallid;
165
-
166 asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(scid));
+
166 asm volatile ("scall" : "+r"(a0) : "r"(scid));
167 return a0;
168}
169
-
170static inline i64 rishka_sc_3(i32 scallid, i64 arg0, i64 arg1, i64 arg2) {
+
170static inline i64 rishka_sc_1(i32 scallid, i64 arg0) {
171 register i64 a0 asm("a0") = arg0;
-
172 register i64 a1 asm("a1") = arg1;
-
173 register i64 a2 asm("a2") = arg2;
-
174 register i64 scid asm("a7") = scallid;
-
175
-
176 asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(scid));
-
177 return a0;
-
178}
-
179
-
180static inline i64 rishka_sc_4(i32 scallid, i64 arg0, i64 arg1, i64 arg2, i64 arg3) {
-
181 register i64 a0 asm("a0") = arg0;
-
182 register i64 a1 asm("a1") = arg1;
-
183 register i64 a2 asm("a2") = arg2;
-
184 register i64 a3 asm("a3") = arg3;
-
185 register i64 scid asm("a7") = scallid;
+
172 register i64 scid asm("a7") = scallid;
+
173
+
174 asm volatile ("scall" : "+r"(a0) : "r"(scid));
+
175 return a0;
+
176}
+
177
+
178static inline i64 rishka_sc_2(i32 scallid, i64 arg0, i64 arg1) {
+
179 register i64 a0 asm("a0") = arg0;
+
180 register i64 a1 asm("a1") = arg1;
+
181 register i64 scid asm("a7") = scallid;
+
182
+
183 asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(scid));
+
184 return a0;
+
185}
186
-
187 asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(scid));
-
188 return a0;
-
189}
-
190
-
191static inline rune rt_strpass() {
-
192 return (rune) rishka_sc_0(RISHKA_SC_RT_STRPASS);
-
193}
-
194
-
195static inline string get_rt_string(u32 len) {
-
196 string str;
-
197 Memory::set(str, 0, len + 1);
-
198
-
199 for(u32 i = 0; i < len; i++)
-
200 str[i] = rt_strpass();
-
201
-
202 str[len] = '\0';
-
203 return str;
-
204}
-
205
-
206#endif
+
187static inline i64 rishka_sc_3(i32 scallid, i64 arg0, i64 arg1, i64 arg2) {
+
188 register i64 a0 asm("a0") = arg0;
+
189 register i64 a1 asm("a1") = arg1;
+
190 register i64 a2 asm("a2") = arg2;
+
191 register i64 scid asm("a7") = scallid;
+
192
+
193 asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(scid));
+
194 return a0;
+
195}
+
196
+
197static inline i64 rishka_sc_4(i32 scallid, i64 arg0, i64 arg1, i64 arg2, i64 arg3) {
+
198 register i64 a0 asm("a0") = arg0;
+
199 register i64 a1 asm("a1") = arg1;
+
200 register i64 a2 asm("a2") = arg2;
+
201 register i64 a3 asm("a3") = arg3;
+
202 register i64 scid asm("a7") = scallid;
+
203
+
204 asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(scid));
+
205 return a0;
+
206}
+
207
+
208static inline rune rt_strpass() {
+
209 return (rune) rishka_sc_0(RISHKA_SC_RT_STRPASS);
+
210}
+
211
+
212static inline string get_rt_string(u32 len) {
+
213 string str;
+
214 Memory::set(str, 0, len + 1);
+
215
+
216 for(u32 i = 0; i < len; i++)
+
217 str[i] = rt_strpass();
+
218
+
219 str[len] = '\0';
+
220 return str;
+
221}
+
222
+
223#endif
static any set(any dest, i32 c, usize n)
Set memory values.
Definition: librishka_mem.cpp:37
Main header file for the Rishka SDK.
signed int i32
Alias for the signed 32-bit integer type.
Definition: types.h:58
diff --git a/docs/dc/dac/io_8h_source.html b/docs/dc/dac/io_8h_source.html index a8ad845..cd809db 100644 --- a/docs/dc/dac/io_8h_source.html +++ b/docs/dc/dac/io_8h_source.html @@ -190,15 +190,15 @@
298
299#endif /* LIBRISHKA_IO_H */
Class for handling input/output operations in Rishka applications.
Definition: io.h:134
-
static i32 available()
Check if there is data available to read from the input stream.
Definition: librishka_io.cpp:72
-
static bool find(string target, usize size)
Search for a target string in the input stream.
Definition: librishka_io.cpp:80
-
static void println()
Prints a new line to the output stream.
Definition: librishka_io.cpp:60
-
static bool find_until(string target, string terminator)
Search for a target string in the input stream until a terminator is encountered.
Definition: librishka_io.cpp:84
-
static string readline()
Read a line of text from the input stream.
Definition: librishka_io.cpp:68
-
static u64 get_timeout()
Get the current timeout for input operations.
Definition: librishka_io.cpp:92
-
static i32 peek()
Peek at the next character in the input stream.
Definition: librishka_io.cpp:76
-
static rune readch()
Read a Unicode character from the input stream.
Definition: librishka_io.cpp:64
-
static void set_timeout(u64 timeout)
Set the timeout for input operations.
Definition: librishka_io.cpp:88
+
static i32 available()
Check if there is data available to read from the input stream.
Definition: librishka_io.cpp:75
+
static bool find(string target, usize size)
Search for a target string in the input stream.
Definition: librishka_io.cpp:83
+
static void println()
Prints a new line to the output stream.
Definition: librishka_io.cpp:63
+
static bool find_until(string target, string terminator)
Search for a target string in the input stream until a terminator is encountered.
Definition: librishka_io.cpp:87
+
static string readline()
Read a line of text from the input stream.
Definition: librishka_io.cpp:71
+
static u64 get_timeout()
Get the current timeout for input operations.
Definition: librishka_io.cpp:95
+
static i32 peek()
Peek at the next character in the input stream.
Definition: librishka_io.cpp:79
+
static rune readch()
Read a Unicode character from the input stream.
Definition: librishka_io.cpp:67
+
static void set_timeout(u64 timeout)
Set the timeout for input operations.
Definition: librishka_io.cpp:91
static void print(const string text)
Print text to the output stream.
Definition: librishka_io.cpp:21
#define TERM_STYLE_NORMAL
Normal text style.
Definition: io.h:113
#define TERM_BG_BLACK
Black background color.
Definition: io.h:75
diff --git a/docs/dc/dd2/classKeyboard.html b/docs/dc/dd2/classKeyboard.html new file mode 100644 index 0000000..8445700 --- /dev/null +++ b/docs/dc/dd2/classKeyboard.html @@ -0,0 +1,573 @@ + + + + + + + +Rishka: Keyboard Class Reference + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
Rishka +
+
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
Keyboard Class Referencefinal
+
+
+ +

Provides access to keyboard-related functionalities in the Rishka VM SDK. + More...

+ +

#include <keyboard.h>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Static Public Member Functions

static string layout_name ()
 Get the name of the current keyboard layout. More...
 
static string layout_desc ()
 Get the description of the current keyboard layout. More...
 
static PS2Device device_type ()
 Get the type of the keyboard device. More...
 
static bool is_num_lock ()
 Check if the Num Lock key is currently active. More...
 
static bool is_caps_lock ()
 Check if the Caps Lock key is currently active. More...
 
static bool is_scroll_lock ()
 Check if the Scroll Lock key is currently active. More...
 
static void num_lock (bool state)
 Set the state of the Num Lock key. More...
 
static void caps_lock (bool state)
 Set the state of the Caps Lock key. More...
 
static void scroll_lock (bool state)
 Set the state of the Scroll Lock key. More...
 
static u32 next_scancode (i32 timeout, bool resend)
 Get the next keyboard scan code. More...
 
static void lock (i32 timeout)
 Lock the keyboard to prevent input. More...
 
static void unlock ()
 Unlock the keyboard to allow input. More...
 
static void reset ()
 Reset the keyboard to its default state. More...
 
+

Detailed Description

+

Provides access to keyboard-related functionalities in the Rishka VM SDK.

+

The Keyboard class allows interaction with keyboard-related functionalities in the Rishka VM SDK. It provides methods to retrieve information about the keyboard layout, check the status of lock keys (Num Lock, Caps Lock, Scroll Lock), control the state of these lock keys, obtain keyboard scan codes, and perform operations such as locking, unlocking, and resetting the keyboard.

+

Member Function Documentation

+ +

◆ caps_lock()

+ +
+
+ + + + + +
+ + + + + + + + +
void Keyboard::caps_lock (bool state)
+
+static
+
+ +

Set the state of the Caps Lock key.

+

This method allows setting the state of the Caps Lock key.

+
Parameters
+ + +
stateThe desired state of the Caps Lock key (true for active, false for inactive).
+
+
+ +
+
+ +

◆ device_type()

+ +
+
+ + + + + +
+ + + + + + + +
PS2Device Keyboard::device_type ()
+
+static
+
+ +

Get the type of the keyboard device.

+

This method retrieves the type of the connected keyboard device.

+
Returns
The type of the keyboard device as a PS2Device enumeration value.
+ +
+
+ +

◆ is_caps_lock()

+ +
+
+ + + + + +
+ + + + + + + +
bool Keyboard::is_caps_lock ()
+
+static
+
+ +

Check if the Caps Lock key is currently active.

+

This method checks whether the Caps Lock key is currently active.

+
Returns
True if the Caps Lock key is active, false otherwise.
+ +
+
+ +

◆ is_num_lock()

+ +
+
+ + + + + +
+ + + + + + + +
bool Keyboard::is_num_lock ()
+
+static
+
+ +

Check if the Num Lock key is currently active.

+

This method checks whether the Num Lock key is currently active.

+
Returns
True if the Num Lock key is active, false otherwise.
+ +
+
+ +

◆ is_scroll_lock()

+ +
+
+ + + + + +
+ + + + + + + +
bool Keyboard::is_scroll_lock ()
+
+static
+
+ +

Check if the Scroll Lock key is currently active.

+

This method checks whether the Scroll Lock key is currently active.

+
Returns
True if the Scroll Lock key is active, false otherwise.
+ +
+
+ +

◆ layout_desc()

+ +
+
+ + + + + +
+ + + + + + + +
string Keyboard::layout_desc ()
+
+static
+
+ +

Get the description of the current keyboard layout.

+

This method retrieves the description of the currently selected keyboard layout.

+
Returns
String representing the description of the keyboard layout.
+ +
+
+ +

◆ layout_name()

+ +
+
+ + + + + +
+ + + + + + + +
string Keyboard::layout_name ()
+
+static
+
+ +

Get the name of the current keyboard layout.

+

This method retrieves the name of the currently selected keyboard layout.

+
Returns
A string representing the name of the keyboard layout.
+ +
+
+ +

◆ lock()

+ +
+
+ + + + + +
+ + + + + + + + +
void Keyboard::lock (i32 timeout)
+
+static
+
+ +

Lock the keyboard to prevent input.

+

This method locks the keyboard to prevent input.

+
Parameters
+ + +
timeoutThe duration for which to lock the keyboard (in milliseconds).
+
+
+ +
+
+ +

◆ next_scancode()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
u32 Keyboard::next_scancode (i32 timeout,
bool resend 
)
+
+static
+
+ +

Get the next keyboard scan code.

+

This method retrieves the next keyboard scan code.

+
Parameters
+ + + +
timeoutThe maximum time to wait for a scan code (in milliseconds).
resendFlag indicating whether to resend previous scan codes.
+
+
+
Returns
The next keyboard scan code as an unsigned 32-bit integer.
+ +
+
+ +

◆ num_lock()

+ +
+
+ + + + + +
+ + + + + + + + +
void Keyboard::num_lock (bool state)
+
+static
+
+ +

Set the state of the Num Lock key.

+

This method allows setting the state of the Num Lock key.

+
Parameters
+ + +
stateThe desired state of the Num Lock key (true for active, false for inactive).
+
+
+ +
+
+ +

◆ reset()

+ +
+
+ + + + + +
+ + + + + + + +
void Keyboard::reset ()
+
+static
+
+ +

Reset the keyboard to its default state.

+

This method resets the keyboard to its default state.

+ +
+
+ +

◆ scroll_lock()

+ +
+
+ + + + + +
+ + + + + + + + +
void Keyboard::scroll_lock (bool state)
+
+static
+
+ +

Set the state of the Scroll Lock key.

+

This method allows setting the state of the Scroll Lock key.

+
Parameters
+ + +
stateThe desired state of the Scroll Lock key (true for active, false for inactive).
+
+
+ +
+
+ +

◆ unlock()

+ +
+
+ + + + + +
+ + + + + + + +
void Keyboard::unlock ()
+
+static
+
+ +

Unlock the keyboard to allow input.

+

This method unlocks the keyboard to allow input.

+ +
+
+
The documentation for this class was generated from the following files:
    +
  • sdk/librishka/keyboard.h
  • +
  • sdk/librishka_keyboard.cpp
  • +
+
+
+ \ No newline at end of file diff --git a/docs/dir_6e8afc538eccbcb491711fd0cc7b9703.html b/docs/dir_6e8afc538eccbcb491711fd0cc7b9703.html index 845cc42..28f42b3 100644 --- a/docs/dir_6e8afc538eccbcb491711fd0cc7b9703.html +++ b/docs/dir_6e8afc538eccbcb491711fd0cc7b9703.html @@ -94,6 +94,9 @@ file  args.h [code]  Header file for handling command line arguments in Rishka applications.
  +file  devices.h [code] + Definitions related to PS/2 devices for the Rishka Virtual Machine SDK.
+  file  fs.h [code]  Header file for file system operations in Rishka applications.
  @@ -109,6 +112,9 @@ file  io.h [code]  Header file for input/output operations in Rishka applications.
  +file  keyboard.h [code] + This header file defines the Keyboard class, providing access to keyboard-related functionalities in the Rishka VM SDK.
+  file  memory.h [code]  Header file for memory management in Rishka applications.
  diff --git a/docs/dir_6e8afc538eccbcb491711fd0cc7b9703.js b/docs/dir_6e8afc538eccbcb491711fd0cc7b9703.js index 2b430c1..515a7f1 100644 --- a/docs/dir_6e8afc538eccbcb491711fd0cc7b9703.js +++ b/docs/dir_6e8afc538eccbcb491711fd0cc7b9703.js @@ -1,11 +1,13 @@ var dir_6e8afc538eccbcb491711fd0cc7b9703 = [ [ "args.h", "db/d77/args_8h.html", "db/d77/args_8h" ], + [ "devices.h", "d7/dde/devices_8h.html", "d7/dde/devices_8h" ], [ "fs.h", "df/d26/fs_8h.html", "df/d26/fs_8h" ], [ "gpio.h", "d6/d7c/gpio_8h.html", "d6/d7c/gpio_8h" ], [ "i2c.h", "d5/daf/i2c_8h.html", "d5/daf/i2c_8h" ], [ "int.h", "d3/d7e/int_8h.html", "d3/d7e/int_8h" ], [ "io.h", "dc/dac/io_8h.html", "dc/dac/io_8h" ], + [ "keyboard.h", "d6/da0/keyboard_8h.html", "d6/da0/keyboard_8h" ], [ "memory.h", "dc/d18/memory_8h.html", "dc/d18/memory_8h" ], [ "runtime.h", "d3/d51/runtime_8h.html", "d3/d51/runtime_8h" ], [ "sys.h", "d9/d87/sys_8h.html", "d9/d87/sys_8h" ], diff --git a/docs/files.html b/docs/files.html index e92d61f..667f245 100644 --- a/docs/files.html +++ b/docs/files.html @@ -93,15 +93,17 @@   sdk   librishka  args.hHeader file for handling command line arguments in Rishka applications - fs.hHeader file for file system operations in Rishka applications - gpio.hHeader file for GPIO operations in Rishka applications - i2c.hHeader file for I2C (Inter-Integrated Circuit) operations in Rishka applications - int.hHeader file for interrupt handling in Rishka applications - io.hHeader file for input/output operations in Rishka applications - memory.hHeader file for memory management in Rishka applications - runtime.hProvides utilities for managing runtime operations within Rishka applications - sys.hHeader file for system utilities in Rishka applications - types.hHeader file for common data types used in Rishka applications + devices.hDefinitions related to PS/2 devices for the Rishka Virtual Machine SDK + fs.hHeader file for file system operations in Rishka applications + gpio.hHeader file for GPIO operations in Rishka applications + i2c.hHeader file for I2C (Inter-Integrated Circuit) operations in Rishka applications + int.hHeader file for interrupt handling in Rishka applications + io.hHeader file for input/output operations in Rishka applications + keyboard.hThis header file defines the Keyboard class, providing access to keyboard-related functionalities in the Rishka VM SDK + memory.hHeader file for memory management in Rishka applications + runtime.hProvides utilities for managing runtime operations within Rishka applications + sys.hHeader file for system utilities in Rishka applications + types.hHeader file for common data types used in Rishka applications  librishka.hMain header file for the Rishka SDK  librishka_impl.hpp diff --git a/docs/functions.html b/docs/functions.html index 3ac931b..3a2f47f 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -105,6 +105,7 @@

- b -