Page 1 of 1

USB Composite - Keyboard.press [Please help]

Posted: Mon Aug 03, 2020 12:15 pm
by innopeace
I am upgrading my keypad project from the Arduino Pro Micro to STM32F103.
However, I have a problem using LibMaple (Roger's repo).

Arduino Pro Micro (Atmega 32U) code

Code: Select all

#include "Keyboard.h"

void setup() {
	Keyboard.begin();
}

void loop(){
	Keyboard.press(KEY_F13);  //Arduino Built-in F13
	Keyboard.releaseAll();
	Keyboard.press(0xe1);  //Arduino non bulit-in Numpad 1 (HID usage table 0x59+0x88 =0xe1)
	Keyboard.releseAll();
}
STM32 code (Libmaple)

Code: Select all

#include <USBComposite.h>

USBHID HID;
HIDKeyboard Keyboard(HID);

void setup(){
	HID.begin(HID_KEYBOARD);
	Keyboard.begin();
}

void loop(){
	Keyboard.press(0xf0);  //F13 (0x68+0x88)
	Keyboard.releaseAll();
	Keyboard.press(0xe1);  //Numpad 1 (0x59+0x88)
	Keyboard.releaseAll();
}
In Arduino, either built-in keys or non built-in keys work well.
In STM32 (Libmaple), the built-in keys (say KEY_F12) work well.
However, it seems that non built-in keys do not work.

Thanks in advance for your help in this issue.

Regards,
InnoPeace