diff --git a/include/gint/drivers/keydev.h b/include/gint/drivers/keydev.h index 9725e1d..4d9b956 100644 --- a/include/gint/drivers/keydev.h +++ b/include/gint/drivers/keydev.h @@ -158,7 +158,7 @@ typedef struct { int8_t queue_next; int8_t queue_end; /* Number of events lost because of missing queue space */ - uint events_lost; + uint16_t events_lost; /* Event transforms */ keydev_transform_t tr; @@ -183,9 +183,9 @@ typedef struct { // /* Candidate key for repeats (or 0 if no key is candidate yet) */ - int rep_key; + int16_t rep_key; /* Number of repeats already sent */ - int rep_count; + int16_t rep_count; /* Time since key was first pressed (us) */ int rep_time; /* Delay until next repeat, set by the repeat planner (us) */ diff --git a/src/kernel/start.c b/src/kernel/start.c index bebc8da..4421cc8 100644 --- a/src/kernel/start.c +++ b/src/kernel/start.c @@ -40,19 +40,19 @@ extern void (*bdtors)(void), (*edtors)(void); int main(int isappli, int optnum); /* Whether to restart main through the OS menu rather than returning */ -int gint_restart = 0; +int8_t gint_restart = 0; /* gint_setrestart(): Set whether to restart the add-in after exiting */ void gint_setrestart(int restart) { - gint_restart = restart; + gint_restart = !!restart; } +/* Return value of main() */ +static int8_t gint_exitcode; /* Jumping there will properly unwind and leave the add-in (CASIOWIN does not have an exit syscall and simply wants you to return from main()) */ jmp_buf gint_exitbuf; -/* Return value of main() */ -static int gint_exitcode; /* regcpy(): Copy a memory region using symbol information @l Source pointer (load address) diff --git a/src/keysc/keysc.c b/src/keysc/keysc.c index 46b3bdb..0625812 100644 --- a/src/keysc/keysc.c +++ b/src/keysc/keysc.c @@ -17,18 +17,18 @@ #include #include +/* Keyboard input device for this Key Scan Interface */ +static keydev_t keysc_dev; +/* Keyboard scanner timer */ +int16_t keysc_tid = -1; + /* Keyboard scan frequency in Hertz. Start with 128 Hz, this frequency *must be high* for the keyboard to work! Reading at low frequencies produces a lot of artifacts. See https://www.casiopeia.net/forum/viewtopic.php?p=20592. */ -int keysc_scan_Hz = 128; +int16_t keysc_scan_Hz = 128; /* Approximation in microseconds, used by the timer and repeat delays */ uint32_t keysc_scan_us = 7812; /* 1000000 / keysc_scan_Hz */ -/* Keyboard scanner timer */ -int keysc_tid = -1; -/* Keyboard input device for this Key Scan Interface */ -static keydev_t keysc_dev; - /* keydev_std(): Standard keyboard input device */ keydev_t *keydev_std(void) {