In V1.4.3 you can specify a "UserReports" file.
This is where you'd add the structure definitions for your reports.
ie- create a file "KeybdReports.bas" with the following:
Code: Select all
module UserReports
// TX report...
public structure TTXReport
Modifier As Byte
Reserved As Byte
KeyArray0 As Byte
KeyArray1 As Byte
KeyArray2 As Byte
KeyArray3 As Byte
KeyArray4 As Byte
KeyArray5 As Byte
end structure
// RX report...
public structure TRXReport
_byte As Byte
NumLock As _byte.0
CapsLock As _byte.1
ScrollLock As _byte.2
end structure
end module
Now, using the main_hid.bas as an example, add an #option that has the filename just created
Code: Select all
#option USER_CUSTOM_HID_REPORTS = "KeybdReports.bas"
in place of the following code (You'll have to comment out the "#option DEMO_EXAMPLE = 1") or just remove all the demo stuff
Code: Select all
//
//-----------------------------------------------------------------------------
// optional custom HID report structures for ReadReport()/WriteReport()
//-----------------------------------------------------------------------------
// if you want to use custom report structures see the instructions
// in USBHID.bas for creating your own report definitions file,
// and set '#option USER_CUSTOM_HID_REPORTS' to the name of your
// custom report file. otherwise, leave the option undefined.
// example files can be found in the UserHIDReports directory
//
// here we change the filename based on the selected demo example
#if (DEMO_EXAMPLE = 1)
#option USER_CUSTOM_HID_REPORTS = "UserReportsExample1.bas"
#elseif (DEMO_EXAMPLE = 2)
#option USER_CUSTOM_HID_REPORTS = "UserReportsExample2.bas"
#else
// no custom reports file req'd
#endif
In your main module add
Code: Select all
Public Dim KeyReport As HID.TXReport
Public Dim LedsReport As HID.RXReport
Public Sub Rd()
If HID.DataAvailable() Then
HID.ReadReport()
Cap = LedsReport.CapsLock
Scr = LedsReport.ScrollLock
Num = LedsReport.NumLock
EndIf
End Sub
See if that works. I'm a bit tied up at the moment to actually try it...