Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout issue #208

Open
bitboy85 opened this issue Feb 25, 2020 · 1 comment
Open

Layout issue #208

bitboy85 opened this issue Feb 25, 2020 · 1 comment

Comments

@bitboy85
Copy link

bitboy85 commented Feb 25, 2020

I'm stuck how to use / change the keyboard layout. I want use use a german layout.

I'm trying to use the example given but
BootKeyboard.write(KEY_7|MOD_LEFT_SHIFT);
doesn't output / it outputs a dollar sign $

keyboard.println also outputs wrong characters. Umlauts for example.

Compiling works, but a lot of warnings are shown:
warnings.txt

Edit: It seems that the #ifndef HID_CUSTOM_LAYOUT in ImprovedKeylayout.h is not working for some reasons. If defining it manual in line 54 #define LAYOUT_GERMAN its working better.
BUT BootKeyboard.println still is nat able to output umlauts (and may some special chars) correctly.

@bitboy85
Copy link
Author

bitboy85 commented Feb 25, 2020

For the println issue i came up with this quirky solution:
Edit KeyboardAPI.hpp

Change Method KeyboardAPI::write(uint8_t k) to the following.
I bet there is a better solution, maybe a method override in case LAYOUT_GERMAN is defined but i don't know how to do it.

`size_t KeyboardAPI::write(uint8_t k)
{

uint8_t p;
switch (k)              // Befehle
{
	case 0xc2:              //stupid workaround
		return 1;
	
	case 0xc3:              //stupid workaround
		return 1;

	case 0xb6:              //ö
		p = write(KEY_OE);  
		return p;            

	case 0x96:              //Ö
		press(KEY_LEFT_SHIFT);
		p = write(KEY_OE);  
		release(KEY_LEFT_SHIFT);
		return p;

	case 0xa4:              //ä
		p = write(KEY_AE);  
		return p;  

	case 0x84:              //Ä
		press(KEY_LEFT_SHIFT);
		p = write(KEY_AE);  
		release(KEY_LEFT_SHIFT);
		return p;

	case 0xbc:              //ü
		p = write(KEY_UE);  
		return p;  

	case 0x9c:              //Ü
		press(KEY_LEFT_SHIFT);
		p = write(KEY_UE);  
		release(KEY_LEFT_SHIFT);
		return p;

	case 0x9f:              //ß
		p = write(KEY_SZ);  
		return p;

	case 0xa7:              // §
	    press(KEY_RIGHT_SHIFT);	
	    p = press(0x33);  	// 3
	    release(0x33);            
	    release(KEY_RIGHT_SHIFT);
	    return p;
	
	case 0xac:              // €
	    press(KEY_RIGHT_ALT);	
	    p = press(KEY_E);  	// 3
	    release(KEY_E);            
	    release(KEY_RIGHT_ALT);
		press(KEY_LEFT_CTRL);		// even more stupid workaraound
		release(KEY_LEFT_CTRL);		// after executing a pc behaves as if left control is still pressed
	    return p;
}


// Press and release key (if press was successfull)
auto ret = press(k);
if(ret){
	release(k);
}
return ret;

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant