USB Composite - Keyboard.press [Please help]

Post here all questions related to LibMaple core if you can't find a relevant section!
Post Reply
innopeace
Posts: 1
Joined: Sun Aug 02, 2020 2:54 pm

USB Composite - Keyboard.press [Please help]

Post 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

Post Reply

Return to “General discussion”