ra8-firmware
0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_input.c
Go to the documentation of this file.
1
14
15
#include "
board_input.h
"
16
17
#include <stdint.h>
18
20
typedef
enum : uint32_t {
21
k_key_ring_cap
= 64U,
22
}
board_input_cfg_t
;
23
24
static
char
s_ring
[
k_key_ring_cap
];
25
static
uint32_t
s_head
;
26
static
uint32_t
s_tail
;
27
28
void
board_input_push_key
(
char
ch)
29
{
30
const
uint32_t next = (
s_tail
+ 1U) % (uint32_t)
k_key_ring_cap
;
31
if
(next !=
s_head
) {
32
s_ring
[
s_tail
] = ch;
33
s_tail
= next;
34
}
35
}
36
37
bool
board_input_pop_key
(
char
* out)
38
{
39
if
((out ==
nullptr
) || (
s_head
==
s_tail
)) {
40
return
false
;
41
}
42
*out =
s_ring
[
s_head
];
43
s_head
= (
s_head
+ 1U) % (uint32_t)
k_key_ring_cap
;
44
return
true
;
45
}
board_input_push_key
void board_input_push_key(char ch)
Push one keystroke byte into the input FIFO.
Definition
board_input.c:28
board_input_cfg_t
board_input_cfg_t
Keystroke ring geometry.
Definition
board_input.c:20
k_key_ring_cap
@ k_key_ring_cap
Ring capacity (one slot is the full/empty guard).
Definition
board_input.c:21
s_ring
static char s_ring[k_key_ring_cap]
Keystroke ring storage.
Definition
board_input.c:24
s_tail
static uint32_t s_tail
Write cursor (next free).
Definition
board_input.c:26
board_input_pop_key
bool board_input_pop_key(char *out)
Pop the oldest buffered keystroke, if any.
Definition
board_input.c:37
s_head
static uint32_t s_head
Read cursor (oldest byte).
Definition
board_input.c:25
board_input.h
Host-side keystroke FIFO: window / CLI key source -> UART RX sink.
tools
ra8_emulator
src
io
board_input.c
Generated by
1.16.1