I was looking at the
in_inkey() library code, thinking about SYM and CAPS modifiers. The comments in the code don't say how it handles the modifiers, but the code seems to say it adds 40 to the ASCII value when CAPS is pressed, and 80 to the ASCII value when SYM is pressed. Maybe it's late, but that doesn't seem to make a whole lot of sense.
I wrote this:
Code: Select all
/*
* zcc +zx -vn -startup=5 -clib=sdcc_iy key_press.c -o key_press -create-app
*/
#include <input.h>
#include <input/input_zx.h>
#include <stdio.h>
#include <sys/ioctl.h>
void main(void)
{
ioctl(1, IOCTL_OTERM_PAUSE, 0);
while(1)
{
uint8_t i = in_inkey();
printf("0x%02X\n",i);
}
}
which shows it does work for CAPS: 0x61 for 'a', 0x41 for CAPS-'a'. But I'm not quite sure what the pattern is for the SYM-SHIFT modifier. Could someone spell it out for me?