Re: in IDE dependency tree / definition lookup - for porting
Posted: Sun Mar 21, 2021 4:28 pm
Iteresting read here @ag123 -> https://damogranlabs.com/2018/02/stm32- ... -keyboard/
Everything relating to using STM32 boards with the Arduino IDE and alternatives
https://www.stm32duino.com/
Code: Select all
#include "usbd_hid_composite_if.h"
void setup() {
// put your setup code here, to run once:
#define PRESS_REPORT_SIZE 8
pinMode(LED_BUILTIN, OUTPUT);
pinMode(PB6, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
uint8_t press_report[PRESS_REPORT_SIZE] = {0};
if(digitalRead(PB6) == true){
digitalWrite(LED_BUILTIN, LOW);
press_report[2] = 0xe2; // send 'alt'
press_report[3] = 0x2b; // send 'tab'
HID_Composite_keyboard_sendReport(press_report, PRESS_REPORT_SIZE);
HAL_Delay(50);
press_report[2] = 0;
press_report[3] = 0;
HID_Composite_keyboard_sendReport(press_report, PRESS_REPORT_SIZE);
HAL_Delay(200);
digitalWrite(LED_BUILTIN, HIGH);
}
}
Code: Select all
Evtype C Callback
URBtype Ci Control input
URBstatus 0
Interval 0
StartFrame 0
ErrorCount 0
issetup false
Setup:bmtype 0
S:bmty:Dir 0
S:bmty:Typ 0
S:bmty:Recipient 0
Setup:request 0
Setup:wValue 0
Setup:wIndex 0
Setup:wLength 0
dataLen 59
dataTag =
Words 09023b00 020100a0 fa090400 00010301 01000921 10010001 22360007 05810308 000a0904 01000103 00000009 21100100 01223200 07058203 03000a ;
Linked True
PrevReq GET_DESCRIPTOR
Decode Desc type:CONFIGURATION ,Desc idx:0
Configuration Descriptor
bLength 9
bDescriptorType 2 DEVICE
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 160 SelfPwr:0 ,RemoteWake:1
bMaxPower 250
Interface Descriptor
bLength 9
bDescriptorType 4 INTERFACE
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 HID (Human Interface Device)
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
Endpoint Descriptor
bLength 7
bDescriptorType 5 ENDPOINT
bEndpointAddress 81 Addr: 1, Dir:1 IN
bmAttributes 3 Xfer: 3Interrupt,Sync: 0No_Sync,Usage: 0Data
wMaxPacketSize 8
bInterval 10
Interface Descriptor
bLength 9
bDescriptorType 4 INTERFACE
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 HID (Human Interface Device)
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor
bLength 7
bDescriptorType 5 ENDPOINT
bEndpointAddress 82 Addr: 1, Dir:1 IN
bmAttributes 3 Xfer: 3Interrupt,Sync: 0No_Sync,Usage: 0Data
wMaxPacketSize 3
Code: Select all
Evtype C Callback
URBtype Ci Control input
URBstatus 0
Interval 0
StartFrame 0
ErrorCount 0
issetup false
Setup:bmtype 0
S:bmty:Dir 0
S:bmty:Typ 0
S:bmty:Recipient 0
Setup:request 0
Setup:wValue 0
Setup:wIndex 0
Setup:wLength 0
dataLen 50
dataTag =
Words 050c0901 a1018501 19002a3c 02150026 3c029501 75108100 c0050109 80a10185 02198129 83250175 01950381 02950581 01c0 ...
Linked True
PrevReq GET_DESCRIPTOR
Decode Desc type:Report ,Desc idx:0
Report descrptor
bLength 50
bDescriptorType 22 Report
Decode 0x05, 0x0c, // Usage Page (Consumer)
0x09, 0x01, // Usage (Consumer Control)
0xa1, 0x01, // Collection (Usage Modifier)
0x85, 0x01, // Report ID (1)
0x19, 0x00, // Usage Minimum (0)
0x2a, 0x3c, 0x02, // Usage Maximum (572)
0x15, 0x00, // Logical Minimum (0)
0x26, 0x3c, 0x02, // Logical Maximum (572)
0x95, 0x01, // Report Count (1)
0x75, 0x10, // Report Size (16)
0x81, 0x00, // Input (Data, Array, Absolute, No Wrap, Linear, Preferred state, No null position, Bit fields)
0xc0, // End Collection ()
0x05, 0x01, // Usage Page (Generic Desktop Controls)
0x09, 0x80, // Usage (System Control)
0xa1, 0x01, // Collection (Usage Modifier)
0x85, 0x02, // Report ID (2)
0x19, 0x81, // Usage Minimum (129)
0x29, 0x83, // Usage Maximum (131)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x03, // Report Count (3)
0x81, 0x02, // Input (Data, Variable, Absolute, No Wrap, Linear, Preferred state, No null position, Bit fields)
0x95, 0x05, // Report Count (5)
0x81, 0x01, // Input (Const, Array, Absolute, No Wrap, Linear, Preferred state, No null position, Bit fields)
0xc0, // End Collection ()
// 50 bytes