├── .gitattributes ├── .gitignore ├── DT ├── BatSys.upg ├── Dt.exe ├── PwrDev.upg ├── RHID.h ├── RHID.hid ├── RHID2.h ├── RHID2.hid ├── Tparse.dll ├── Tparse.lib ├── VESACmnd.upg ├── VESAVC.upg ├── andisp.upg ├── button.upg ├── consume.upg ├── delimit.hid ├── desktop.upg ├── digit.hid ├── digit.upg ├── display.hid ├── dt.ini ├── gaming.upg ├── joystk.hid ├── kbd.upg ├── keybrd.hid ├── leds.upg ├── mon_enum.upg ├── monitor.hid ├── monitor.upg ├── mouse.hid ├── ordinal.upg ├── pwr.hid ├── readme.txt ├── remote.hid ├── sim.upg ├── sports.upg ├── tele.hid ├── tele.upg ├── unicode.upg ├── vendor1.upg └── vr.upg ├── HIDSTM32.exe ├── README.md ├── RHIDDemo.PNG ├── RHIDDemo.png ├── USB HID Demonstrator ├── readme.txt ├── src │ ├── DesrciptorView.cpp │ ├── DesrciptorView.h │ ├── FeatureView.cpp │ ├── FeatureView.h │ ├── GraphicConfig.ico │ ├── GraphicConfigView.cpp │ ├── GraphicConfigView.h │ ├── GraphicView.cpp │ ├── GraphicView.h │ ├── GraphicView.ico │ ├── HID Capabilities.ico │ ├── HexEdit.cpp │ ├── HexEdit.h │ ├── IconButton.cpp │ ├── IconButton.h │ ├── Inc │ │ ├── HIDSDI.H │ │ ├── Hid.h │ │ ├── Hidpi++.h │ │ ├── Hidsdi++.h │ │ ├── Hidusage.h │ │ ├── SETUPAPI.H │ │ └── USB100.H │ ├── Ini.cpp │ ├── Ini.h │ ├── LedOff.ico │ ├── LedOn.ico │ ├── Lib │ │ ├── SETUPAPI.LIB │ │ └── hid.lib │ ├── ReportView.cpp │ ├── ReportView.h │ ├── StdAfx.cpp │ ├── StdAfx.h │ ├── Transfere.ico │ ├── USB_Blue.ico │ ├── UsbHidDemonstrator.cpp │ ├── UsbHidDemonstrator.dep │ ├── UsbHidDemonstrator.dsp │ ├── UsbHidDemonstrator.dsw │ ├── UsbHidDemonstrator.h │ ├── UsbHidDemonstrator.rc │ ├── UsbHidDemonstrator.sln │ ├── UsbHidDemonstrator.vcproj │ ├── UsbHidDemonstratorDlg.cpp │ ├── UsbHidDemonstratorDlg.h │ ├── hexeditctrl.cpp │ ├── hexeditctrl.h │ ├── res │ │ └── UsbHidDemonstrator.rc2 │ └── resource.h └── version.txt ├── USBHIDDemo.png ├── USBHIDDemoConfig.png └── tstHID-STM32F103 ├── RHID.hid ├── Src ├── hw_config.c ├── main.c ├── stm32_it.c ├── usb_desc.c ├── usb_endp.c ├── usb_istr.c ├── usb_prop.c └── usb_pwr.c ├── Svd └── STM32F103xx.svd ├── USB-FS ├── Release_Notes.html ├── inc │ ├── usb_core.h │ ├── usb_def.h │ ├── usb_init.h │ ├── usb_int.h │ ├── usb_lib.h │ ├── usb_mem.h │ ├── usb_regs.h │ ├── usb_sil.h │ └── usb_type.h └── src │ ├── usb_core.c │ ├── usb_init.c │ ├── usb_int.c │ ├── usb_mem.c │ ├── usb_regs.c │ └── usb_sil.c ├── cmsis ├── core_cm3.h ├── core_cmFunc.h └── core_cmInstr.h ├── cmsis_boot ├── startup │ ├── startup_stm32f10x_hd.S │ └── startup_stm32f10x_md.S ├── stm32f10x.h ├── stm32f10x_conf.h ├── system_stm32f10x.c └── system_stm32f10x.h ├── gcc_arm.ld ├── inc ├── hw_config.h ├── platform_config.h ├── stm32_it.h ├── usb_conf.h ├── usb_desc.h ├── usb_istr.h ├── usb_prop.h └── usb_pwr.h ├── readme.txt ├── stm_lib ├── inc │ ├── misc.h │ ├── stm32f10x_adc.h │ ├── stm32f10x_bkp.h │ ├── stm32f10x_can.h │ ├── stm32f10x_cec.h │ ├── stm32f10x_crc.h │ ├── stm32f10x_dac.h │ ├── stm32f10x_dbgmcu.h │ ├── stm32f10x_dma.h │ ├── stm32f10x_exti.h │ ├── stm32f10x_flash.h │ ├── stm32f10x_fsmc.h │ ├── stm32f10x_gpio.h │ ├── stm32f10x_i2c.h │ ├── stm32f10x_iwdg.h │ ├── stm32f10x_pwr.h │ ├── stm32f10x_rcc.h │ ├── stm32f10x_rtc.h │ ├── stm32f10x_sdio.h │ ├── stm32f10x_spi.h │ ├── stm32f10x_tim.h │ ├── stm32f10x_usart.h │ └── stm32f10x_wwdg.h └── src │ ├── misc.c │ ├── stm32f10x_adc.c │ ├── stm32f10x_bkp.c │ ├── stm32f10x_can.c │ ├── stm32f10x_cec.c │ ├── stm32f10x_crc.c │ ├── stm32f10x_dac.c │ ├── stm32f10x_dbgmcu.c │ ├── stm32f10x_dma.c │ ├── stm32f10x_exti.c │ ├── stm32f10x_flash.c │ ├── stm32f10x_fsmc.c │ ├── stm32f10x_gpio.c │ ├── stm32f10x_i2c.c │ ├── stm32f10x_iwdg.c │ ├── stm32f10x_pwr.c │ ├── stm32f10x_rcc.c │ ├── stm32f10x_rtc.c │ ├── stm32f10x_sdio.c │ ├── stm32f10x_spi.c │ ├── stm32f10x_tim.c │ ├── stm32f10x_usart.c │ └── stm32f10x_wwdg.c ├── tstHID-STM32F103.depend ├── tstHID-STM32F103.ebp └── tstHID-STM32F103.elay /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /DT/BatSys.upg: -------------------------------------------------------------------------------- 1 | Battery System 2 | NORMAL 3 | 00 Undefined 4 | 01 SMBBatteryMode 5 | 02 SMBBatteryStatus 6 | 03 SMBAlarmWarning 7 | 04 SMBChargerMode 8 | 05 SMBChargerStatus 9 | 06 SMBChargerSpecInfo 10 | 07 SMBSelectorState 11 | 08 SMBSelectorPreset 12 | 09 SMBSelectorInfo 13 | 0A-0F Reserved 14 | 10 OptionalMfgFunction1 15 | 11 OptionalMfgFunction2 16 | 12 OptionalMfgFunction3 17 | 13 OptionalMfgFunction4 18 | 14 OptionalMfgFunction5 19 | 15 ConnectionToSMBus 20 | 16 OutputConnection 21 | 17 ChargerConnection 22 | 18 BatteryInsertion 23 | 19 Usenext 24 | 1A OKToUse 25 | 1B-27 Reserved 26 | 28 ManufacturerAccess 27 | 29 RemainingCapacityLimit 28 | 2A RemainingTimeLimit 29 | 2B AtRate 30 | 2C CapacityMode 31 | 2D BroadcastToCharger 32 | 2E PrimaryBattery 33 | 2F ChargeController 34 | 30-3F Reserved 35 | 40 TerminateCharge 36 | 41 TermminateDischarge 37 | 42 BelowRemainingCapacityLimit 38 | 43 RemainingTimeLimitExpired 39 | 44 Charging 40 | 45 Discharging 41 | 46 FullyCharged 42 | 47 FullyDischarged 43 | 48 ConditionningFlag 44 | 49 AtRateOK 45 | 4A SMBErrorCode 46 | 4B NeedReplacement 47 | 4C-5F Reserved 48 | 60 AtRateTimeToFull 49 | 61 AtRateTimeToEmpty 50 | 62 AverageCurrent 51 | 63 Maxerror 52 | 64 RelativeStateOfCharge 53 | 65 AbsoluteStateOfCharge 54 | 66 RemainingCapacity 55 | 67 FullChargeCapacity 56 | 68 RunTimeToEmpty 57 | 69 AverageTimeToEmpty 58 | 6A AverageTimeToFull 59 | 6B CycleCount 60 | 6C-7F Reserved 61 | 80 BattPackModelLevel 62 | 81 InternalChargeController 63 | 82 PrimaryBatterySupport 64 | 83 DesignCapacity 65 | 84 SpecificationInfo 66 | 85 ManufacturerDate 67 | 86 SerialNumber 68 | 87 iManufacturerName 69 | 88 iDevicename 70 | 89 iDeviceChemistery 71 | 8A iManufacturerData 72 | 8B Rechargeable 73 | 8C WarningCapacityLimit 74 | 8D CapacityGranularity1 75 | 8E CapacityGranularity2 76 | 8F-AF Reserved 77 | B0-BF Reserved 78 | C0 InhibitCharge 79 | C1 EnablePolling 80 | C2 ResetToZero 81 | C3-CF Reserved 82 | D0 ACPresent 83 | D1 BatteryPresent 84 | D2 PowerFail 85 | D3 AlarmInhibited 86 | D4 ThermistorUnderRange 87 | D5 ThermistorHot 88 | D6 ThermistorCold 89 | D7 ThermistorOverRange 90 | D8 VoltageOutOfRange 91 | D9 CurrentOutOfRange 92 | DA CurrentNotRegulated 93 | DB VoltageNotRegulated 94 | DC MasterMode 95 | DD ChargerBattery/HostControlled 96 | DE-EF Reserved 97 | F0 ChargerSpecInfo 98 | F1 ChargerSpecRef 99 | F2 Level2 100 | F3 Level3 101 | F2-FF Reserved 102 | -------------------------------------------------------------------------------- /DT/Dt.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/Dt.exe -------------------------------------------------------------------------------- /DT/PwrDev.upg: -------------------------------------------------------------------------------- 1 | Power Device 2 | NORMAL 3 | 00 Undefined 4 | 01 iName 5 | 02 PresentStatus 6 | 03 ChangedStatus 7 | 04 UPS 8 | 05 PowerSupply 9 | 06-0F Reserved 10 | 10 BatterySystem 11 | 11 BatterySystemID 12 | 12 Battery 13 | 13 BatteryID 14 | 14 Charger 15 | 15 ChargerID 16 | 16 PowerConverter 17 | 17 PowerConverterID 18 | 18 OutletSystem 19 | 19 OutletSystemID 20 | 1A Input 21 | 1B InputID 22 | 1C Output 23 | 1D OutputID 24 | 1E Flow 25 | 1F FlowID 26 | 20 Outlet 27 | 21 OutletID 28 | 22 Gang 29 | 23 GangID 30 | 24 Sink 31 | 25 SinkID 32 | 26-2F Reserved 33 | 30 Voltage 34 | 31 Current 35 | 32 Frequency 36 | 33 ApparentPower 37 | 34 ActivePower 38 | 35 PercentLoad 39 | 36 Temperature 40 | 37 Humidity 41 | 38-3F Reserved 42 | 40 ConfigVoltage 43 | 41 ConfigCurrent 44 | 42 ConfigFrequency 45 | 43 ConfigApparentPower 46 | 44 ConfigActivePower 47 | 45 ConfigPercentLoad 48 | 46 ConfigTemperature 49 | 47 ConfigHumidity 50 | 48-4F Reserved 51 | 50 SwitchOnControl 52 | 51 SwitchOffControl 53 | 52 ToggleControl 54 | 53 LowVoltageTransfer 55 | 54 HighVoltageTransfer 56 | 55 DelayBeforeReboot 57 | 56 DelayBeforeStartup 58 | 57 DelayBeforeShutdown 59 | 58 Test 60 | 59 Vendorspecificcommand 61 | 5A-5F Reserved 62 | 60 Present 63 | 61 Good 64 | 62 InternalFailure 65 | 63 VoltageOutOfRange 66 | 64 FrequencyOutOfRange 67 | 65 Overload 68 | 66 OverCharged 69 | 67 OverTemperature 70 | 68 ShutdownRequested 71 | 69 ShutdownImminent 72 | 6A VendorSpecificAnswerValid 73 | 6B SwitchOn/Off 74 | 6C Switcheble 75 | 6D Used 76 | 6E Boost 77 | 6F Buck 78 | 70 Initialized 79 | 71 Tested 80 | 71-FF Reserved 81 | -------------------------------------------------------------------------------- /DT/RHID.h: -------------------------------------------------------------------------------- 1 | // D:\Devel\RC\Soft\DT\RHID.h 2 | 3 | 4 | char ReportDescriptor[79] = { 5 | 0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop) 6 | 0x09, 0x01, // USAGE (Vendor Usage 1) 7 | 0xa1, 0x01, // COLLECTION (Application) 8 | 0x85, 0x01, // REPORT_ID (1) 9 | 0x09, 0x01, // USAGE (Vendor Usage 1) 10 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 11 | 0x25, 0x01, // LOGICAL_MAXIMUM (1) 12 | 0x75, 0x08, // REPORT_SIZE (8) 13 | 0x95, 0x01, // REPORT_COUNT (1) 14 | 0xb1, 0x82, // FEATURE (Data,Var,Abs,Vol) 15 | 0x85, 0x01, // REPORT_ID (1) 16 | 0x09, 0x01, // USAGE (Vendor Usage 1) 17 | 0x91, 0x82, // OUTPUT (Data,Var,Abs,Vol) 18 | 0x85, 0x02, // REPORT_ID (2) 19 | 0x09, 0x02, // USAGE (Vendor Usage 2) 20 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 21 | 0x25, 0x01, // LOGICAL_MAXIMUM (1) 22 | 0x75, 0x08, // REPORT_SIZE (8) 23 | 0x95, 0x01, // REPORT_COUNT (1) 24 | 0xb1, 0x82, // FEATURE (Data,Var,Abs,Vol) 25 | 0x85, 0x02, // REPORT_ID (2) 26 | 0x09, 0x02, // USAGE (Vendor Usage 2) 27 | 0x91, 0x82, // OUTPUT (Data,Var,Abs,Vol) 28 | 0x85, 0x03, // REPORT_ID (3) 29 | 0x09, 0x03, // USAGE (Vendor Usage 3) 30 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 31 | 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 32 | 0x75, 0x08, // REPORT_SIZE (8) 33 | 0x95, 0x08, // REPORT_COUNT (8) 34 | 0xb1, 0x82, // FEATURE (Data,Var,Abs,Vol) 35 | 0x85, 0x03, // REPORT_ID (3) 36 | 0x09, 0x03, // USAGE (Vendor Usage 3) 37 | 0x91, 0x82, // OUTPUT (Data,Var,Abs,Vol) 38 | 0x85, 0x04, // REPORT_ID (4) 39 | 0x09, 0x04, // USAGE (Vendor Usage 4) 40 | 0x75, 0x08, // REPORT_SIZE (8) 41 | 0x95, 0x02, // REPORT_COUNT (2) 42 | 0x81, 0x82, // INPUT (Data,Var,Abs,Vol) 43 | 0xc0 // END_COLLECTION 44 | }; 45 | 46 | -------------------------------------------------------------------------------- /DT/RHID.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/RHID.hid -------------------------------------------------------------------------------- /DT/RHID2.h: -------------------------------------------------------------------------------- 1 | // D:\Devel\RC\Soft\DT\RHID2.h 2 | 3 | 4 | char ReportDescriptor[125] = { 5 | 0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1) 6 | 0x09, 0x01, // USAGE (Vendor Usage 1) 7 | 0xa1, 0x01, // COLLECTION (Application) 8 | 0x85, 0x01, // REPORT_ID (1) 9 | 0x09, 0x01, // USAGE (Vendor Usage 1) 10 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 11 | 0x25, 0x01, // LOGICAL_MAXIMUM (1) 12 | 0x75, 0x08, // REPORT_SIZE (8) 13 | 0x95, 0x01, // REPORT_COUNT (1) 14 | 0xb1, 0x82, // FEATURE (Data,Var,Abs,Vol) 15 | 0x85, 0x01, // REPORT_ID (1) 16 | 0x09, 0x01, // USAGE (Vendor Usage 1) 17 | 0x91, 0x82, // OUTPUT (Data,Var,Abs,Vol) 18 | 0x85, 0x02, // REPORT_ID (2) 19 | 0x09, 0x02, // USAGE (Vendor Usage 2) 20 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 21 | 0x25, 0x01, // LOGICAL_MAXIMUM (1) 22 | 0x75, 0x08, // REPORT_SIZE (8) 23 | 0x95, 0x01, // REPORT_COUNT (1) 24 | 0xb1, 0x82, // FEATURE (Data,Var,Abs,Vol) 25 | 0x85, 0x02, // REPORT_ID (2) 26 | 0x09, 0x02, // USAGE (Vendor Usage 2) 27 | 0x91, 0x82, // OUTPUT (Data,Var,Abs,Vol) 28 | 0x85, 0x03, // REPORT_ID (3) 29 | 0x09, 0x03, // USAGE (Vendor Usage 3) 30 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 31 | 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 32 | 0x75, 0x08, // REPORT_SIZE (8) 33 | 0x95, 0x08, // REPORT_COUNT (8) 34 | 0xb1, 0x82, // FEATURE (Data,Var,Abs,Vol) 35 | 0x85, 0x03, // REPORT_ID (3) 36 | 0x09, 0x03, // USAGE (Vendor Usage 3) 37 | 0x91, 0x82, // OUTPUT (Data,Var,Abs,Vol) 38 | 0x85, 0x05, // REPORT_ID (5) 39 | 0x09, 0x05, // USAGE (Vendor Usage 5) 40 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 41 | 0x25, 0x01, // LOGICAL_MAXIMUM (1) 42 | 0x75, 0x01, // REPORT_SIZE (1) 43 | 0x81, 0x82, // INPUT (Data,Var,Abs,Vol) 44 | 0x09, 0x05, // USAGE (Vendor Usage 5) 45 | 0x75, 0x01, // REPORT_SIZE (1) 46 | 0xb1, 0x82, // FEATURE (Data,Var,Abs,Vol) 47 | 0x75, 0x07, // REPORT_SIZE (7) 48 | 0x81, 0x83, // INPUT (Cnst,Var,Abs,Vol) 49 | 0x85, 0x05, // REPORT_ID (5) 50 | 0x75, 0x07, // REPORT_SIZE (7) 51 | 0xb1, 0x83, // FEATURE (Cnst,Var,Abs,Vol) 52 | 0x85, 0x06, // REPORT_ID (6) 53 | 0x09, 0x06, // USAGE (Vendor Usage 6) 54 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 55 | 0x25, 0x01, // LOGICAL_MAXIMUM (1) 56 | 0x75, 0x01, // REPORT_SIZE (1) 57 | 0x81, 0x82, // INPUT (Data,Var,Abs,Vol) 58 | 0x09, 0x06, // USAGE (Vendor Usage 6) 59 | 0x75, 0x01, // REPORT_SIZE (1) 60 | 0xb1, 0x82, // FEATURE (Data,Var,Abs,Vol) 61 | 0x75, 0x07, // REPORT_SIZE (7) 62 | 0x81, 0x83, // INPUT (Cnst,Var,Abs,Vol) 63 | 0x85, 0x06, // REPORT_ID (6) 64 | 0x75, 0x07, // REPORT_SIZE (7) 65 | 0xb1, 0x83, // FEATURE (Cnst,Var,Abs,Vol) 66 | 0xc0 // END_COLLECTION 67 | }; 68 | 69 | -------------------------------------------------------------------------------- /DT/RHID2.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/RHID2.hid -------------------------------------------------------------------------------- /DT/Tparse.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/Tparse.dll -------------------------------------------------------------------------------- /DT/Tparse.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/Tparse.lib -------------------------------------------------------------------------------- /DT/VESACmnd.upg: -------------------------------------------------------------------------------- 1 | VESA Command 2 | NORMAL 3 | 00 Undefined 4 | 01 Settings 5 | 02 Degauss 6 | 03-FFFF Reserved 7 | -------------------------------------------------------------------------------- /DT/VESAVC.upg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/VESAVC.upg -------------------------------------------------------------------------------- /DT/andisp.upg: -------------------------------------------------------------------------------- 1 | Alphnumeric Display 2 | NORMAL 3 | 00 Undefined 4 | 01 Alphanumeric Display 5 | 02-1F Reserved 6 | 20 Display Attributes Report 7 | 21 ASCII Character Set 8 | 22 Data Read Back 9 | 23 Font Read Back 10 | 24 Display Control Report 11 | 25 Clear Display 12 | 26 Display Enable 13 | 27 Screen Saver Delay 14 | 28 Screen Saver Enable 15 | 29 Vertical Scroll 16 | 2A Horizontal Scroll 17 | 2B Character Report 18 | 2C Display Data 19 | 2D Display Status 20 | 2E Stat Not Ready 21 | 2F Stat Ready 22 | 30 Err Not a loadable character 23 | 31 Err Font data cannot be read 24 | 32 Cursor Position Report 25 | 33 Row 26 | 34 Column 27 | 35 Rows 28 | 36 Columns 29 | 37 Cursor Pixel Positioning 30 | 38 Cursor Mode 31 | 39 Cursor Enable 32 | 3A Cursor Blink 33 | 3B Font Report 34 | 3C Font Data 35 | 3D Character Width 36 | 3E Character Height 37 | 3F Character Spacing Horizontal 38 | 40 Character Spacing Vertical 39 | 41 Unicode Character Set 40 | 42-FFFF Reserved 41 | -------------------------------------------------------------------------------- /DT/button.upg: -------------------------------------------------------------------------------- 1 | Button 2 | REPEATING 3 | 00 No Buttons Pressed 4 | 01 Button 5 | -------------------------------------------------------------------------------- /DT/consume.upg: -------------------------------------------------------------------------------- 1 | Consumer Devices 2 | NORMAL 3 | 00 Unassigned 4 | 01 Consumer Control 5 | 02 Numeric Key Pad 6 | 04-1F Reserved 7 | 20 +10 8 | 21 +100 9 | 22 AM/PM 10 | 23-3F Reserved 11 | 30 Power 12 | 31 Reset 13 | 32 Sleep 14 | 33 Sleep After 15 | 34 Sleep Mode 16 | 35 Illumination 17 | 36 Function Buttons 18 | 37-3F Reserved 19 | 40 Menu 20 | 41 Menu Pick 21 | 42 Menu Up 22 | 43 Menu Down 23 | 44 Menu Left 24 | 45 Menu Right 25 | 46 Menu Escape 26 | 47 Menu Value Increase 27 | 48 Menu Value Decrease 28 | 49-5F Reserved 29 | 60 Data On Screen 30 | 61 Closed Caption 31 | 62 Closed Caption Select 32 | 63 VCR/TV 33 | 64 Broadcast Mode 34 | 65 Snapshot 35 | 66 Still 36 | 67-7F Reserved 37 | 80 Selection 38 | 81 Assign Selection 39 | 82 Mode Step 40 | 83 Recall Last 41 | 84 Enter Channel 42 | 85 Order Movie 43 | 86 Channel 44 | 87 Media Selection 45 | 88 Media Select Computer 46 | 89 Media Select TV 47 | 8A Media Select WWW 48 | 8B Media Select DVD 49 | 8C Media Select Telephone 50 | 8D Media Select Program Guide 51 | 8E Media Select Video Phone 52 | 8F Media Select Games 53 | 90 Media Select Messages 54 | 91 Media Select CD 55 | 92 Media Select VCR 56 | 93 Media Select Tuner 57 | 94 Quit 58 | 95 Help 59 | 96 Media Select Tape 60 | 97 Media Select Cable 61 | 98 Media Select Satellite 62 | 99 Media Select Security 63 | 9A Media Select Home 64 | 9B Media Select Call 65 | 9C Channel Increment 66 | 9D Channel Decrement 67 | 9E-9F Reserved 68 | A0 VCR Plus 69 | A1 Once 70 | A2 Daily 71 | A3 Weekly 72 | A4 Monthly 73 | A5-AF Reserved 74 | B0 Play 75 | B1 Pause 76 | B2 Record 77 | B3 Fast Forward 78 | B4 Rewind 79 | B5 Scan Next Track 80 | B6 Scan Previous Track 81 | B7 Stop 82 | B8 Eject 83 | B9 Random Play 84 | BA Select Disc 85 | BB Enter Disc 86 | BC Repeat 87 | BD Tracking 88 | BE Track Normal 89 | BF Slow Tracking 90 | C0 Frame Forward 91 | C1 Frame Back 92 | C2 Mark 93 | C3 Clear Mark 94 | C4 Repeat From Mark 95 | C5 Return To Mark 96 | C6 Search Mark Forward 97 | C7 Search Mark Backwards 98 | C8 Counter Reset 99 | C9 Show Counter 100 | CA Tracking Increment 101 | CB Tracking Decrement 102 | CC-DF Reserved 103 | E0 Volume 104 | E1 Balance 105 | E2 Mute 106 | E3 Bass 107 | E4 Treble 108 | E5 Bass Boost 109 | E6 Surround Mode 110 | E7 Loudness 111 | E8 MPX 112 | E9 Volume Up 113 | EA Volume Down 114 | EB-EF Reserved 115 | F0 Speed Select 116 | F1 Playback Speed 117 | F2 Standard Play 118 | F3 Long Play 119 | F4 Extended Play 120 | F5 Slow 121 | F6-FF Reserved 122 | 100 Fan Enable 123 | 101 Fan Speed 124 | 102 Light 125 | 103 Light Illumination Level 126 | 104 Climate Control Enable 127 | 105 Room Temperature 128 | 106 Security Enable 129 | 107 Fire Alarm 130 | 108 Police Alarm 131 | 109-FFFF Reserved 132 | -------------------------------------------------------------------------------- /DT/delimit.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/delimit.hid -------------------------------------------------------------------------------- /DT/desktop.upg: -------------------------------------------------------------------------------- 1 | Generic Desktop 2 | NORMAL 3 | 00 Undefined 4 | 01 Pointer 5 | 02 Mouse 6 | 03 Reserved 7 | 04 Joystick 8 | 05 Game Pad 9 | 06 Keyboard 10 | 07 Keypad 11 | 08-2F Reserved 12 | 30 X 13 | 31 Y 14 | 32 Z 15 | 33 Rx 16 | 34 Ry 17 | 35 Rz 18 | 36 Slider 19 | 37 Dial 20 | 38 Wheel 21 | 39 Hat switch 22 | 3A Counted Buffer 23 | 3B Byte Count 24 | 3C Motion Wakeup 25 | 3D-3F Reserved 26 | 40 Vx 27 | 41 Vy 28 | 42 Vz 29 | 43 Vbrx 30 | 44 Vbry 31 | 45 Vbrx 32 | 46 Vno 33 | 47-7F Reserved 34 | 80 System Control 35 | 81 System Power Down 36 | 82 System Sleep 37 | 83 System Wake Up 38 | 84 System Context Menu 39 | 85 System Main Menu 40 | 86 System App Menu 41 | 87 System Help Menu 42 | 88 System Menu Exit 43 | 89 System Menu Select 44 | 8A System Menu Right 45 | 8B System Menu Left 46 | 8C System Menu Up 47 | 8D System Menu Down 48 | 8E-FFFF Reserved 49 | -------------------------------------------------------------------------------- /DT/digit.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/digit.hid -------------------------------------------------------------------------------- /DT/digit.upg: -------------------------------------------------------------------------------- 1 | Digitizers 2 | NORMAL 3 | 00 Undefined 4 | 01 Digitizer 5 | 02 Pen 6 | 03 Light Pen 7 | 04 Touch Screen 8 | 05 Touch Pad 9 | 06 White Board 10 | 07 Coordinate Measuring Machine 11 | 08 3-D Digitizer 12 | 09 Stereo Plotter 13 | 0A Articulated Arm 14 | 0B Armature 15 | 0C Multiple Point Digitizer 16 | 0D Free Space Wand 17 | 0E-1F Reserved 18 | 20 Stylus 19 | 21 Puck 20 | 22 Finger 21 | 23-2F Reserved 22 | 30 Tip Pressure 23 | 31 Barrel Pressure 24 | 32 In Range 25 | 33 Touch 26 | 34 Untouch 27 | 35 Tap 28 | 36 Quality 29 | 37 Data Valid 30 | 38 Transducer Index 31 | 39 Tablet Function Keys 32 | 3A Program Change Keys 33 | 3B Battery Strength 34 | 3C Invert 35 | 3D X Tilt 36 | 3E Y Tilt 37 | 3F Azimuth 38 | 40 Altitude 39 | 41 Twist 40 | 42 Tip Switch 41 | 43 Secondary Tip Switch 42 | 44 Barrel Switch 43 | 45 Eraser 44 | 46 Tablet Pick 45 | 47-FFFF Reserved -------------------------------------------------------------------------------- /DT/display.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/display.hid -------------------------------------------------------------------------------- /DT/dt.ini: -------------------------------------------------------------------------------- 1 | [UsagePages] 2 | Count=21 3 | UP0=01,Generic Desktop,desktop.upg 4 | UP1=02,Simulation Controls,sim.upg 5 | UP2=03,VR Controls,vr.upg 6 | UP3=04,Sports Controls,sports.upg 7 | UP4=05,Gaming Controls,gaming.upg 8 | UP5=07,Keyboard,kbd.upg 9 | UP6=08,LEDs,leds.upg 10 | UP7=09,Button,button.upg 11 | UP8=10,Ordinals,ordinal.upg 12 | UP9=11,Telephony Devices,tele.upg 13 | UP10=12,Consumer Devices,consume.upg 14 | UP11=13,Digitizers,digit.upg 15 | UP12=16,Unicode,unicode.upg 16 | UP13=20,Alphnumeric Display,andisp.upg 17 | UP14=128,Monitor,monitor.upg 18 | UP15=129,Monitor Enumerated Values,mon_enum.upg 19 | UP16=130,VESA Virtual Controls,VESAVC.upg 20 | UP17=131,VESA Command,VESACmnd.upg 21 | UP18=132,Power Device,pwrdev.upg 22 | UP19=133,Battery System,batsys.upg 23 | UP20=65280,Vendor Defined Page 1,vendor1.upg 24 | 25 | 26 | -------------------------------------------------------------------------------- /DT/gaming.upg: -------------------------------------------------------------------------------- 1 | Gaming Controls 2 | NORMAL 3 | 00 Undefined 4 | 01 3D Game Controller 5 | 02 Pinball Device 6 | 03 Gun Device 7 | 04-1F Reserved 8 | 20 Point of View 9 | 21 Turn Right/Left 10 | 22 Pitch Right/Left 11 | 23 Roll Forward/Backward 12 | 24 Move Right/Left 13 | 25 Move Forward/Backward 14 | 26 Move Up/Down 15 | 27 Lean Right/Left 16 | 28 Lean Forward/Backward 17 | 29 Height of POV 18 | 2A Flipper 19 | 2B Secondary Flipper 20 | 2C Bump 21 | 2D New Game 22 | 2E Shoot Ball 23 | 2F Player 24 | 30 Gun Bolt 25 | 31 Gun Clip 26 | 32 Gun Selector 27 | 33 Gun Single Shot 28 | 34 Gun Burst 29 | 35 Gun Automatic 30 | 36 Gun Safety 31 | 37-FFFF reserved -------------------------------------------------------------------------------- /DT/joystk.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/joystk.hid -------------------------------------------------------------------------------- /DT/kbd.upg: -------------------------------------------------------------------------------- 1 | Keyboard 2 | NORMAL 3 | 00 Reserved (no event indicated) 4 | 01 Keyboard ErrorRollOver 5 | 02 Keyboard POSTFail 6 | 03 Keyboard ErrorUndefine 7 | 04 Keyboard a and A 8 | 05 Keyboard b and B 9 | 06 Keyboard c and C 10 | 07 Keyboard d and D 11 | 08 Keyboard e and E 12 | 09 Keyboard f and F 13 | 0A Keyboard g and G 14 | 0B Keyboard h and H 15 | 0C Keyboard i and I 16 | 0D Keyboard j and J 17 | 0E Keyboard k and K 18 | 0F Keyboard l and L 19 | 10 Keyboard m and M 20 | 11 Keyboard n and N 21 | 12 Keyboard o and O 22 | 13 Keyboard p and P 23 | 14 Keyboard q and Q 24 | 15 Keyboard r and R 25 | 16 Keyboard s and S 26 | 17 Keyboard t and T 27 | 18 Keyboard u and U 28 | 19 Keyboard v and V 29 | 1A Keyboard w and W 30 | 1B Keyboard x and X 31 | 1C Keyboard y and Y 32 | 1D Keyboard z and Z 33 | 1E Keyboard 1 and ! 34 | 1F Keyboard 2 and @ 35 | 20 Keyboard 3 and # 36 | 21 Keyboard 4 and $ 37 | 22 Keyboard 5 and % 38 | 23 Keyboard 6 and ^ 39 | 24 Keyboard 7 and & 40 | 25 Keyboard 8 and * 41 | 26 Keyboard 9 and ( 42 | 27 Keyboard 0 and ) 43 | 28 Keyboard Return (ENTER) 44 | 29 Keyboard ESCAPE 45 | 2A Keyboard DELETE (Backspace) 46 | 2B Keyboard Tab 47 | 2C Keyboard Spacebar 48 | 2D Keyboard - and (underscore) 49 | 2E Keyboard = and + 50 | 2F Keyboard [ and { 51 | 30 Keyboard ] and } 52 | 31 Keyboard \ and | 53 | 32 Keyboard Non-US # and ~ 54 | 33 Keyboard ; and : 55 | 34 Keyboard ' and " 56 | 35 Keyboard Grave Accent and Tilde 57 | 36 Keyboard, and < 58 | 37 Keyboard . and > 59 | 38 Keyboard / and ? 60 | 39 Keyboard Caps Lock 61 | 3A Keyboard F1 62 | 3B Keyboard F2 63 | 3C Keyboard F3 64 | 3D Keyboard F4 65 | 3E Keyboard F5 66 | 3F Keyboard F6 67 | 40 Keyboard F7 68 | 41 Keyboard F8 69 | 42 Keyboard F9 70 | 43 Keyboard F10 71 | 44 Keyboard F11 72 | 45 Keyboard F12 73 | 46 Keyboard PrintScreen 74 | 47 Keyboard Scroll Lock 75 | 48 Keyboard Pause 76 | 49 Keyboard Insert 77 | 4A Keyboard Home 78 | 4B Keyboard PageUp 79 | 4C Keyboard Delete Forward 80 | 4D Keyboard End 81 | 4E Keyboard PageDown 82 | 4F Keyboard RightArrow 83 | 50 Keyboard LeftArrow 84 | 51 Keyboard DownArrow 85 | 52 Keyboard UpArrow 86 | 53 Keypad Num Lock and Clear 87 | 54 Keypad / 88 | 55 Keypad * 89 | 56 Keypad - 90 | 57 Keypad + 91 | 58 Keypad ENTER 92 | 59 Keypad 1 and End 93 | 5A Keypad 2 and Down Arrow 94 | 5B Keypad 3 and PageDn 95 | 5C Keypad 4 and Left Arrow 96 | 5D Keypad 5 97 | 5E Keypad 6 and Right Arrow 98 | 5F Keypad 7 and Home 99 | 60 Keypad 8 and Up Arrow 100 | 61 Keypad 9 and PageUp 101 | 62 Keypad 0 and Insert 102 | 63 Keypad . and Delete 103 | 64 Keyboard Non-US \ and | 104 | 65 Keyboard Application 105 | 66 Keyboard Power 106 | 67 Keypad = 107 | 68 Keyboard F13 108 | 69 Keyboard F14 109 | 6A Keyboard F15 110 | 6B Keyboard F16 111 | 6C Keyboard F17 112 | 6D Keyboard F18 113 | 6E Keyboard F19 114 | 6F Keyboard F20 115 | 70 Keyboard F21 116 | 71 Keyboard F22 117 | 72 Keyboard F23 118 | 73 Keyboard F24 119 | 74 Keyboard Execute 120 | 75 Keyboard Help 121 | 76 Keyboard Menu 122 | 77 Keyboard Select 123 | 78 Keyboard Stop 124 | 79 Keyboard Again 125 | 7A Keyboard Undo 126 | 7B Keyboard Cut 127 | 7C Keyboard Copy 128 | 7D Keyboard Paste 129 | 7E Keyboard Find 130 | 7F Keyboard Mute 131 | 80 Keyboard Volume Up 132 | 81 Keyboard Volume Down 133 | 82 Keyboard Locking Caps Lock 134 | 83 Keyboard Locking Num Lock 135 | 84 Keyboard Locking Scroll Lock 136 | 85 Keypad Comma 137 | 86 Keypad Equal Sign 138 | 87 Keyboard Kanji1 139 | 88 Keyboard Kanji2 140 | 89 Keyboard Kanji3 141 | 8A Keyboard Kanji4 142 | 8B Keyboard Kanji5 143 | 8C Keyboard Kanji6 144 | 8D Keyboard Kanji7 145 | 8E Keyboard Kanji8 146 | 8F Keyboard Kanji9 147 | 90 Keyboard LANG1 148 | 91 Keyboard LANG2 149 | 92 Keyboard LANG3 150 | 93 Keyboard LANG4 151 | 94 Keyboard LANG5 152 | 95 Keyboard LANG6 153 | 96 Keyboard LANG7 154 | 97 Keyboard LANG8 155 | 98 Keyboard LANG9 156 | 99 Keyboard Alternate Erase 157 | 9A Keyboard SysReq/Attention 158 | 9B Keyboard Cancel 159 | 9C Keyboard Clear 160 | 9D Keyboard Prior 161 | 9E Keyboard Return 162 | 9F Keyboard Separator 163 | A0 Keyboard Out 164 | A1 Keyboard Oper 165 | A2 Keyboard Clear/Again 166 | A3 Keyboard CrSel/Props 167 | A4 Keyboard ExSel 168 | A5-DF Reserved 169 | E0 Keyboard LeftControl 170 | E1 Keyboard LeftShift 171 | E2 Keyboard LeftAlt 172 | E3 Keyboard Left GUI 173 | E4 Keyboard RightControl 174 | E5 Keyboard RightShift 175 | E6 Keyboard RightAlt 176 | E7 Keyboard Right GUI 177 | E8-FFFF Reserved 178 | -------------------------------------------------------------------------------- /DT/keybrd.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/keybrd.hid -------------------------------------------------------------------------------- /DT/leds.upg: -------------------------------------------------------------------------------- 1 | LEDs 2 | NORMAL 3 | 00 Undefined 4 | 01 Num Lock 5 | 02 Caps Lock 6 | 03 Scroll Lock 7 | 04 Compose 8 | 05 Kana 9 | 06 Power 10 | 07 Shift 11 | 08 Do Not Disturb 12 | 09 Mute 13 | 0A Tone Enable 14 | 0B High Cut Filter 15 | 0C Low Cut Filter 16 | 0D Equalizer Enable 17 | 0E Sound Field On 18 | 0F Surround field On 19 | 10 Repeat 20 | 11 Stereo 21 | 12 Sampling Rate Detect 22 | 13 Spinning 23 | 14 CAV 24 | 15 CLV 25 | 16 Recording Format Detect 26 | 17 Off-Hook 27 | 18 Ring 28 | 19 Message Waiting 29 | 1A Data Mode 30 | 1B Battery Operation 31 | 1C Battery OK 32 | 1D Battery Low 33 | 1E Speaker 34 | 1F Head Set 35 | 20 Hold 36 | 21 Microphone 37 | 22 Coverage 38 | 23 Night Mode 39 | 24 Send Calls 40 | 25 Call Pickup 41 | 26 Conference 42 | 27 Stand-by 43 | 28 Camera On 44 | 29 Camera Off 45 | 2A On-Line 46 | 2B Off-Line 47 | 2C Busy 48 | 2D Ready 49 | 2E Paper-Out 50 | 2F Paper-Jam 51 | 30 Remote 52 | 31 Forward 53 | 32 Reverse 54 | 33 Stop 55 | 34 Rewind 56 | 35 Fast Forward 57 | 36 Play 58 | 37 Pause 59 | 38 Record 60 | 39 Error 61 | 3A Usage Selected Indicator 62 | 3B Usage In Use Indicator 63 | 3C Usage Multi Mode Indicator 64 | 3D Indicator On 65 | 3E Indicator Flash 66 | 3F Indicator Slow Blink 67 | 40 Indicator Fast Blink 68 | 41 Indicator Off 69 | 42 Flash On Time 70 | 43 Slow Blink On Time 71 | 44 Slow Blink Off Time 72 | 45 Fast Blink On Time 73 | 46 Fast Blink Off Time 74 | 47 Usage Indicator Color 75 | 48 Red 76 | 49 Green 77 | 4A Amber 78 | 4B Generic Indicator 79 | 4C-FFFF Reserved -------------------------------------------------------------------------------- /DT/mon_enum.upg: -------------------------------------------------------------------------------- 1 | Monitor Enumerated Values 2 | REPEATING0 3 | 00 unassigned 4 | 01 ENUM 5 | -------------------------------------------------------------------------------- /DT/monitor.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/monitor.hid -------------------------------------------------------------------------------- /DT/monitor.upg: -------------------------------------------------------------------------------- 1 | Monitor 2 | NORMAL 3 | 00 Undefined 4 | 01 Monitor Control 5 | 02 EDID Information 6 | 03 VDIF Information 7 | 04 VESA Version 8 | 05 On Screen Display 9 | 06 Auto Size Center 10 | 07 Polarity Horz Synch 11 | 08 Polarity Vert Synch 12 | 09 Sync Type 13 | 0A Screen Position 14 | 0B Horizontal Frequency 15 | 0C Vertical Frequency 16 | 0D-FFFF Reserved 17 | -------------------------------------------------------------------------------- /DT/mouse.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/mouse.hid -------------------------------------------------------------------------------- /DT/ordinal.upg: -------------------------------------------------------------------------------- 1 | Ordinals 2 | REPEATING 3 | 00 Unused 4 | 01 Instance -------------------------------------------------------------------------------- /DT/pwr.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/pwr.hid -------------------------------------------------------------------------------- /DT/remote.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/remote.hid -------------------------------------------------------------------------------- /DT/sim.upg: -------------------------------------------------------------------------------- 1 | Simulation Controls 2 | NORMAL 3 | 00 Undefined 4 | 01 Flight Simulation Device 5 | 02 Automobile Simulation Device 6 | 03 Tank Simulation Device 7 | 04 Spaceship Simulation Device 8 | 05 Submarine Simulation Device 9 | 06 Sailing Simulation Device 10 | 07 Motorcycle Simulation Device 11 | 08 Sports Simulation Device 12 | 09 Airplane Simulation Device 13 | 0A Helicopter Simulation Device 14 | 0B Magic Carpet Simulation Device 15 | 0C Bicycle 16 | 0D-1F reserved 17 | 20 Flight Control Stick 18 | 21 Flight Stick 19 | 22 Cyclic Control 20 | 23 Cyclic Trim 21 | 24 Flight Yoke 22 | 25 Track Control 23 | 26 Driving Control 24 | 27-CF reserved 25 | B0 Aileron 26 | B1 Aileron Trim 27 | B2 Anti-Torque Control 28 | B3 Auto-pilot enable 29 | B4 Chaff Release 30 | B5 Collective Control 31 | B6 Dive Brake 32 | B7 Electronic Counter Measures 33 | B8 Elevator 34 | B9 Elevator Trim 35 | BA Rudder 36 | BB Throttle 37 | BC Flight Communication 38 | BD Flare Release 39 | BE Landing Gear 40 | BF Toe Brake 41 | C0 Trigger 42 | C1 Weapons Arm 43 | C2 Weapons Select 44 | C3 Wing Flaps 45 | C4 Accelerator 46 | C5 Brake 47 | C6 Clutch 48 | C7 Shifter 49 | C8 Steering 50 | C9 Turret Direction 51 | CA Barrel Elevation 52 | CB Dive Plane 53 | CC Ballast 54 | CD Bicycle Crank 55 | CE Handle Bars 56 | CF Front Brake 57 | D0 Rear Brake 58 | D1-FFFF reserved 59 | -------------------------------------------------------------------------------- /DT/sports.upg: -------------------------------------------------------------------------------- 1 | Sports Controls 2 | NORMAL 3 | 00 Unidentified 4 | 01 Baseball Bat 5 | 02 Golf Club 6 | 03 Rowing Machine 7 | 04 Treadmill 8 | 05-2F Reserved 9 | 30 Oar 10 | 31 Slope 11 | 32 Rate 12 | 33 Stick Speed 13 | 34 Stick Face Angle 14 | 35 Stick Heel/Toe 15 | 36 Stick Follow Through 16 | 37 Stick Tempo 17 | 38 Stick Type 18 | 39 Stick Height 19 | 3A-4F Reserved 20 | 50 Putter 21 | 51 1 Iron 22 | 52 2 Iron 23 | 53 3 Iron 24 | 54 4 Iron 25 | 55 5 Iron 26 | 56 6 Iron 27 | 57 7 Iron 28 | 58 8 Iron 29 | 59 9 Iron 30 | 59 10 Iron 31 | 5A 11 Iron 32 | 5B Sand Wedge 33 | 5C Loft Wedge 34 | 5D Power Wedge 35 | 5E 1 Wood 36 | 5F 3 Wood 37 | 60 5 Wood 38 | 61 7 Wood 39 | 62 9 Wood 40 | 63-FFFF reserved -------------------------------------------------------------------------------- /DT/tele.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/DT/tele.hid -------------------------------------------------------------------------------- /DT/tele.upg: -------------------------------------------------------------------------------- 1 | Telephony Devices 2 | NORMAL 3 | 00 Unassigned 4 | 01 Phone 5 | 02 Answering Machine 6 | 03 Message Controls 7 | 04 Handset 8 | 05 Headset 9 | 06 Telephony Key Pad 10 | 07 Programmable Button 11 | 08-1F Reserved 12 | 20 Hook Switch 13 | 21 Flash 14 | 22 Feature 15 | 23 Hold 16 | 24 Redial 17 | 25 Transfer 18 | 26 Drop 19 | 27 Park 20 | 28 Forward Calls 21 | 29 Alternate Function 22 | 2A Line 23 | 2B Speaker Phone 24 | 2C Conference 25 | 2D Ring Enable 26 | 2E Ring Select 27 | 2F Phone Mute 28 | 30 Caller ID 29 | 31-4F Reserved 30 | 50 Speed Dial 31 | 51 Store Number 32 | 52 Recall Number 33 | 53 Phone Directory 34 | 54-6F Reserved 35 | 70 Voice Mail 36 | 71 Screen Calls 37 | 72 Do Not Disturb 38 | 73 Message 39 | 74 Answer On/Off 40 | 75-8F Reserved 41 | 90 Inside Dial Tone 42 | 91 Outside Dial Tone 43 | 92 Inside Ring Tone 44 | 93 Outside Ring Tone 45 | 94 Priority Ring Tone 46 | 95 Inside Ringback 47 | 96 Priority Ringback 48 | 97 Line Busy Tone 49 | 98 Reorder Tone 50 | 99 Call Waiting Tone 51 | 9A Confirmation Tone 1 52 | 9B Confirmation Tone 2 53 | 9C Tones Off 54 | 9D-AF Reserved 55 | B0 Phone Key 0 56 | B1 Phone Key 1 57 | B2 Phone Key 2 58 | B3 Phone Key 3 59 | B4 Phone Key 4 60 | B5 Phone Key 5 61 | B6 Phone Key 6 62 | B7 Phone Key 7 63 | B8 Phone Key 8 64 | B9 Phone Key 9 65 | BA Phone Key Star 66 | BB Phone Key Pound 67 | BC Phone Key A 68 | BD Phone Key B 69 | BE Phone Key C 70 | BF Phone Key D 71 | C0-FFFF Reserved -------------------------------------------------------------------------------- /DT/unicode.upg: -------------------------------------------------------------------------------- 1 | Unicode 2 | REPEATING 3 | 00 Unicode Char 0 4 | 00 Unicode Char -------------------------------------------------------------------------------- /DT/vendor1.upg: -------------------------------------------------------------------------------- 1 | Vendor Defined Page 1 2 | NORMAL 3 | 00 Undefined 4 | 01 Vendor Usage 1 5 | 02 Vendor Usage 2 6 | 03 Vendor Usage 3 7 | 04 Vendor Usage 4 8 | 05 Vendor Usage 5 9 | 06 Vendor Usage 6 10 | 07 Vendor Usage 7 11 | 08 Vendor Usage 8 12 | 09-FFFF Reserved 13 | -------------------------------------------------------------------------------- /DT/vr.upg: -------------------------------------------------------------------------------- 1 | VR Controls 2 | NORMAL 3 | 00 Unidentified 4 | 01 Belt 5 | 02 Body Suit 6 | 03 Flexor 7 | 04 Glove 8 | 05 Head Tracker 9 | 06 Head Mounted Display 10 | 07 Hand Tracker 11 | 08 Oculometer 12 | 09 Vest 13 | 0A Animatronic Device 14 | 0B-1F Reserved 15 | 20 Stereo Enable 16 | 21 Display Enable 17 | 22-FFFF Reserved 18 | -------------------------------------------------------------------------------- /HIDSTM32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/HIDSTM32.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RHIDDemo
2 | STM32 USB-HID demo project, and utilitities
3 | ![RHIDDemo](/RHIDDemo.png)
4 | **Functions**:
5 | * List USB-HID devices 6 | * Find USB-HID device by VID+PID and connect to it automatilcally or manually 7 | * Get/Set Feature Reports 8 | * ReadWrite Device as a file 9 | * View report size and content in Hex 10 | * Send toggle LED command 11 | * Send slider value 12 | -------------------------------------------------------------------------------- /RHIDDemo.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/RHIDDemo.PNG -------------------------------------------------------------------------------- /RHIDDemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/RHIDDemo.png -------------------------------------------------------------------------------- /USB HID Demonstrator/readme.txt: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : readme.txt 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : readme file for USB HID Demonstrator 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | Last version V1.0.2 - 06/14/2010 17 | 18 | Supported Microsoft OS: 19 | 20 | Windows 98SE, 2000, XP, Vista, Seven. 21 | 22 | How to use : 23 | 24 | 1- Uninstall previous versions: 25 | 26 | use "Start-> Settings-> Control Panel-> Add or Remove Programs" 27 | to remove the old versions V2.x.y 28 | 29 | 2- Run the setup 30 | 31 | 32 | ******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****** 33 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/DesrciptorView.cpp: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : DescriptorView.cpp 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Descriptor page implementation 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | #include "stdafx.h" 16 | #include "UsbHidDemonstrator.h" 17 | #include "DesrciptorView.h" 18 | 19 | #ifdef _DEBUG 20 | #define new DEBUG_NEW 21 | #undef THIS_FILE 22 | static char THIS_FILE[] = __FILE__; 23 | #endif 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // CDesrciptorView dialog 27 | 28 | 29 | CDesrciptorView::CDesrciptorView(CWnd* pParent /*=NULL*/) 30 | : CDialog(CDesrciptorView::IDD, pParent) 31 | { 32 | //{{AFX_DATA_INIT(CDesrciptorView) 33 | m_VIDValue = _T("0xFFFF"); 34 | m_PIDValue = _T("0xFFFF"); 35 | m_VersionNumber = _T("0xFFFF"); 36 | m_CapabilitiesList = _T(""); 37 | //}}AFX_DATA_INIT 38 | } 39 | 40 | 41 | void CDesrciptorView::DoDataExchange(CDataExchange* pDX) 42 | { 43 | CDialog::DoDataExchange(pDX); 44 | //{{AFX_DATA_MAP(CDesrciptorView) 45 | DDX_Control(pDX, IDC_VERSION, m_VersionNumberCtrl); 46 | DDX_Control(pDX, IDC_VID, m_VIDValueCtrl); 47 | DDX_Control(pDX, IDC_PID, m_PIDValueCtrl); 48 | DDX_Text(pDX, IDC_VID, m_VIDValue); 49 | DDX_Text(pDX, IDC_PID, m_PIDValue); 50 | DDX_Text(pDX, IDC_VERSION, m_VersionNumber); 51 | DDX_Text(pDX, IDC_CAPABILITIES_LIST, m_CapabilitiesList); 52 | //}}AFX_DATA_MAP 53 | } 54 | 55 | 56 | BEGIN_MESSAGE_MAP(CDesrciptorView, CDialog) 57 | //{{AFX_MSG_MAP(CDesrciptorView) 58 | // NOTE: the ClassWizard will add message map macros here 59 | //}}AFX_MSG_MAP 60 | END_MESSAGE_MAP() 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // CDesrciptorView message handlers 64 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/DesrciptorView.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : DescriptorView.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Descriptor view header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #if !defined(AFX_DESRCIPTORVIEW_H__32F3D861_E32D_46DC_A1C1_279E1FE553F7__INCLUDED_) 17 | #define AFX_DESRCIPTORVIEW_H__32F3D861_E32D_46DC_A1C1_279E1FE553F7__INCLUDED_ 18 | 19 | #if _MSC_VER > 1000 20 | #pragma once 21 | #endif // _MSC_VER > 1000 22 | // DesrciptorView.h : header file 23 | // 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // CDesrciptorView dialog* 27 | 28 | #include "hexedit.h" 29 | 30 | class CDesrciptorView : public CDialog 31 | { 32 | // Construction 33 | public: 34 | CDesrciptorView(CWnd* pParent = NULL); // standard constructor 35 | 36 | // Dialog Data 37 | //{{AFX_DATA(CDesrciptorView) 38 | enum { IDD = IDD_DESCRIPTOR_VIEW }; 39 | CHexEdit m_VersionNumberCtrl; 40 | CHexEdit m_VIDValueCtrl; 41 | CHexEdit m_PIDValueCtrl; 42 | CString m_VIDValue; 43 | CString m_PIDValue; 44 | CString m_VersionNumber; 45 | CString m_CapabilitiesList; 46 | //}}AFX_DATA 47 | 48 | 49 | // Overrides 50 | // ClassWizard generated virtual function overrides 51 | //{{AFX_VIRTUAL(CDesrciptorView) 52 | protected: 53 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 54 | 55 | //}}AFX_VIRTUAL 56 | 57 | // Implementation 58 | protected: 59 | 60 | // Generated message map functions 61 | //{{AFX_MSG(CDesrciptorView) 62 | // NOTE: the ClassWizard will add member functions here 63 | //}}AFX_MSG 64 | DECLARE_MESSAGE_MAP() 65 | }; 66 | 67 | //{{AFX_INSERT_LOCATION}} 68 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 69 | 70 | #endif // !defined(AFX_DESRCIPTORVIEW_H__32F3D861_E32D_46DC_A1C1_279E1FE553F7__INCLUDED_) 71 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/FeatureView.cpp: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : FeatureView.cpp 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Feature page implementation 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #include "stdafx.h" 17 | #include "UsbHidDemonstrator.h" 18 | #include "FeatureView.h" 19 | 20 | #ifdef _DEBUG 21 | #define new DEBUG_NEW 22 | #undef THIS_FILE 23 | static char THIS_FILE[] = __FILE__; 24 | #endif 25 | 26 | ///////////////////////////////////////////////////////////////////////////// 27 | // CFeatureView dialog 28 | 29 | 30 | CFeatureView::CFeatureView(CWnd* pParent /*=NULL*/) 31 | : CDialog(CFeatureView::IDD, pParent) 32 | { 33 | //{{AFX_DATA_INIT(CFeatureView) 34 | // NOTE: the ClassWizard will add member initialization here 35 | //}}AFX_DATA_INIT 36 | } 37 | 38 | 39 | void CFeatureView::DoDataExchange(CDataExchange* pDX) 40 | { 41 | CDialog::DoDataExchange(pDX); 42 | //{{AFX_DATA_MAP(CFeatureView) 43 | // NOTE: the ClassWizard will add DDX and DDV calls here 44 | //}}AFX_DATA_MAP 45 | } 46 | 47 | 48 | BEGIN_MESSAGE_MAP(CFeatureView, CDialog) 49 | //{{AFX_MSG_MAP(CFeatureView) 50 | // NOTE: the ClassWizard will add message map macros here 51 | //}}AFX_MSG_MAP 52 | END_MESSAGE_MAP() 53 | 54 | ///////////////////////////////////////////////////////////////////////////// 55 | // CFeatureView message handlers 56 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/FeatureView.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : FeatureView.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Feature view header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #if !defined(AFX_FEATUREVIEW_H__FB1F874E_D07B_488D_A6FF_F9AAC8EBD428__INCLUDED_) 17 | #define AFX_FEATUREVIEW_H__FB1F874E_D07B_488D_A6FF_F9AAC8EBD428__INCLUDED_ 18 | 19 | #if _MSC_VER > 1000 20 | #pragma once 21 | #endif // _MSC_VER > 1000 22 | // FeatureView.h : header file 23 | // 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // CFeatureView dialog 27 | 28 | class CFeatureView : public CDialog 29 | { 30 | // Construction 31 | public: 32 | CFeatureView(CWnd* pParent = NULL); // standard constructor 33 | 34 | // Dialog Data 35 | //{{AFX_DATA(CFeatureView) 36 | enum { IDD = IDD_FEATURE_VIEW }; 37 | // NOTE: the ClassWizard will add data members here 38 | //}}AFX_DATA 39 | 40 | 41 | // Overrides 42 | // ClassWizard generated virtual function overrides 43 | //{{AFX_VIRTUAL(CFeatureView) 44 | protected: 45 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 46 | //}}AFX_VIRTUAL 47 | 48 | // Implementation 49 | protected: 50 | 51 | // Generated message map functions 52 | //{{AFX_MSG(CFeatureView) 53 | // NOTE: the ClassWizard will add member functions here 54 | //}}AFX_MSG 55 | DECLARE_MESSAGE_MAP() 56 | }; 57 | 58 | //{{AFX_INSERT_LOCATION}} 59 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 60 | 61 | #endif // !defined(AFX_FEATUREVIEW_H__FB1F874E_D07B_488D_A6FF_F9AAC8EBD428__INCLUDED_) 62 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/GraphicConfig.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/GraphicConfig.ico -------------------------------------------------------------------------------- /USB HID Demonstrator/src/GraphicConfigView.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : GraphicConfigView.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Graphic config view header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #if !defined(AFX_GRAPHICCONFIGVIEW_H__3202A7BE_7373_4668_9020_0A1892F8E5A8__INCLUDED_) 17 | #define AFX_GRAPHICCONFIGVIEW_H__3202A7BE_7373_4668_9020_0A1892F8E5A8__INCLUDED_ 18 | 19 | #if _MSC_VER > 1000 20 | #pragma once 21 | #endif // _MSC_VER > 1000 22 | // GraphicConfigView.h : header file 23 | // 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // CGraphicConfigView dialog 27 | 28 | #include "HexEdit.h" 29 | 30 | class CGraphicConfigView : public CDialog 31 | { 32 | // Construction 33 | public: 34 | CGraphicConfigView(CWnd* pParent = NULL); // standard constructor 35 | 36 | // Dialog Data 37 | //{{AFX_DATA(CGraphicConfigView) 38 | enum { IDD = IDD_GRAPHIC_CONFIG }; 39 | CHexEdit m_B1Ctrl; 40 | CHexEdit m_B2Ctrl; 41 | CHexEdit m_B3Ctrl; 42 | CHexEdit m_B4Ctrl; 43 | CHexEdit m_B5Ctrl; 44 | CHexEdit m_B6Ctrl; 45 | CHexEdit m_B7Ctrl; 46 | CHexEdit m_L1Ctrl; 47 | CHexEdit m_L2Ctrl; 48 | CHexEdit m_L3Ctrl; 49 | CHexEdit m_L4Ctrl; 50 | CHexEdit m_VOCtrl; 51 | CHexEdit m_VI1Ctrl; 52 | CHexEdit m_VI2Ctrl; 53 | 54 | 55 | CButton m_shb7ctrl; 56 | CButton m_shb6ctrl; 57 | CButton m_shb5ctrl; 58 | CButton m_shb4ctrl; 59 | CButton m_shb3ctrl; 60 | CButton m_shb1ctrl; 61 | CButton m_shb2ctrl; 62 | CString m_B1; 63 | CString m_B2; 64 | CString m_B3; 65 | CString m_B4; 66 | CString m_B5; 67 | CString m_B6; 68 | CString m_B7; 69 | CString m_L1; 70 | CString m_L2; 71 | CString m_L3; 72 | CString m_L4; 73 | CString m_VO; 74 | CString m_VI1; 75 | CString m_VI2; 76 | BOOL m_shb1; 77 | BOOL m_shb2; 78 | BOOL m_shb3; 79 | BOOL m_shb4; 80 | BOOL m_shb5; 81 | BOOL m_shb7; 82 | BOOL m_shb6; 83 | BOOL m_Buttons; 84 | BOOL m_shl1; 85 | BOOL m_shl2; 86 | BOOL m_shl3; 87 | BOOL m_shvi1; 88 | BOOL m_shvi2; 89 | BOOL m_shvo; 90 | BOOL m_shl4; 91 | //}}AFX_DATA 92 | 93 | 94 | // Overrides 95 | // ClassWizard generated virtual function overrides 96 | //{{AFX_VIRTUAL(CGraphicConfigView) 97 | protected: 98 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 99 | //}}AFX_VIRTUAL 100 | 101 | // Implementation 102 | protected: 103 | 104 | // Generated message map functions 105 | //{{AFX_MSG(CGraphicConfigView) 106 | afx_msg void OnChangeB1(); 107 | afx_msg void OnChangeB2(); 108 | afx_msg void OnChangeB3(); 109 | afx_msg void OnChangeB4(); 110 | afx_msg void OnChangeB5(); 111 | afx_msg void OnChangeB6(); 112 | afx_msg void OnChangeB7(); 113 | afx_msg void OnChangeL1(); 114 | afx_msg void OnChangeL2(); 115 | afx_msg void OnChangeL3(); 116 | afx_msg void OnChangeVI1(); 117 | afx_msg void OnChangeVO(); 118 | afx_msg void OnChangeVI2(); 119 | afx_msg void OnShb1(); 120 | afx_msg void OnShb2(); 121 | afx_msg void OnShb3(); 122 | afx_msg void OnShb4(); 123 | afx_msg void OnShb5(); 124 | afx_msg void OnShb6(); 125 | afx_msg void OnShb7(); 126 | afx_msg void OnShl1(); 127 | afx_msg void OnShl2(); 128 | afx_msg void OnShl3(); 129 | afx_msg void OnShvi1(); 130 | afx_msg void OnShvi2(); 131 | afx_msg void OnShvo(); 132 | afx_msg void OnShl4(); 133 | afx_msg void OnChangeL4(); 134 | //}}AFX_MSG 135 | DECLARE_MESSAGE_MAP() 136 | }; 137 | 138 | //{{AFX_INSERT_LOCATION}} 139 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 140 | 141 | #endif // !defined(AFX_GRAPHICCONFIGVIEW_H__3202A7BE_7373_4668_9020_0A1892F8E5A8__INCLUDED_) 142 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/GraphicView.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : GraphicView.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Graphic view header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #if !defined(AFX_GRAPHICVIEW_H__63F7C696_E14A_453D_A678_F11A8B11108E__INCLUDED_) 17 | #define AFX_GRAPHICVIEW_H__63F7C696_E14A_453D_A678_F11A8B11108E__INCLUDED_ 18 | 19 | #if _MSC_VER > 1000 20 | #pragma once 21 | #endif // _MSC_VER > 1000 22 | // GraphicView.h : header file 23 | // 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // CGraphicView dialog 27 | 28 | #include "hexedit.h" 29 | 30 | class CGraphicView : public CDialog 31 | { 32 | // Construction 33 | public: 34 | CGraphicView(CWnd* pParent = NULL); // standard constructor 35 | 36 | // Dialog Data 37 | //{{AFX_DATA(CGraphicView) 38 | enum { IDD = IDD_GRAPHIC_VIEW }; 39 | CStatic m_VICtrl; 40 | CStatic m_L4Ctrl; 41 | CHexEdit m_RID_L4_Ctrl; 42 | CButton m_Led4OnOff_Ctrl; 43 | CStatic m_Led4_Ctrl; 44 | CStatic m_RV2_Ctrl; 45 | CStatic m_RV1_Ctrl; 46 | CButton m_Led3OnOff_Ctrl; 47 | CButton m_Led2OnOff_Ctrl; 48 | CButton m_Led1OnOff_Ctrl; 49 | CStatic m_RL2_Ctrl; 50 | CStatic m_VL_Ctrl; 51 | CStatic m_RL1_Ctrl; 52 | CStatic m_BL7_Ctrl; 53 | CStatic m_BL6_Ctrl; 54 | CStatic m_BL5_Ctrl; 55 | CStatic m_BL4_Ctrl; 56 | CStatic m_BL3_Ctrl; 57 | CStatic m_BL2_Ctrl; 58 | CStatic m_BL1_Ctrl; 59 | CHexEdit m_RID_V_Ctrl; 60 | CHexEdit m_RID_R2_Ctrl; 61 | CHexEdit m_RID_R1_Ctrl; 62 | CHexEdit m_RID_L3_Ctrl; 63 | CHexEdit m_RID_L2_Ctrl; 64 | CHexEdit m_RID_L1_Ctrl; 65 | CHexEdit m_RID_B7_Ctrl; 66 | CHexEdit m_RID_B6_Ctrl; 67 | CHexEdit m_RID_B5_Ctrl; 68 | CHexEdit m_RID_B4_Ctrl; 69 | CHexEdit m_RID_B3_Ctrl; 70 | CHexEdit m_RID_B2_Ctrl; 71 | CHexEdit m_RID_B1_Ctrl; 72 | CSliderCtrl m_VariableCtrl; 73 | CStatic m_L1Ctrl; 74 | CStatic m_L2Ctrl; 75 | CStatic m_L3Ctrl; 76 | CStatic m_B1Ctrl; 77 | CStatic m_B2Ctrl; 78 | CStatic m_B3Ctrl; 79 | CStatic m_B4Ctrl; 80 | CStatic m_B5Ctrl; 81 | CStatic m_B6Ctrl; 82 | CStatic m_B7Ctrl; 83 | CProgressCtrl m_R2Ctrl; 84 | CProgressCtrl m_R1Ctrl; 85 | CString m_RID_B1; 86 | CString m_RID_B2; 87 | CString m_RID_B3; 88 | CString m_RID_B4; 89 | CString m_RID_B5; 90 | CString m_RID_B6; 91 | CString m_RID_B7; 92 | CString m_RID_L1; 93 | CString m_RID_L2; 94 | CString m_RID_L3; 95 | CString m_RID_L4; 96 | CString m_RID_R1; 97 | CString m_RID_R2; 98 | CString m_RV1; 99 | CString m_RV2; 100 | BOOL m_Led1OnOffChecked; 101 | BOOL m_Led2OnOffChecked; 102 | BOOL m_Led3OnOffChecked; 103 | CString m_RID_V; 104 | CString m_vi_val; 105 | BOOL m_Led4OnOffChecked; 106 | int m_UseReport; 107 | //}}AFX_DATA 108 | 109 | 110 | // Overrides 111 | // ClassWizard generated virtual function overrides 112 | //{{AFX_VIRTUAL(CGraphicView) 113 | protected: 114 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 115 | //}}AFX_VIRTUAL 116 | 117 | // Implementation 118 | protected: 119 | 120 | // Generated message map functions 121 | //{{AFX_MSG(CGraphicView) 122 | virtual BOOL OnInitDialog(); 123 | afx_msg void OnLed1OnOff(); 124 | afx_msg void OnLed2OnOff(); 125 | afx_msg void OnLed3OnOff(); 126 | afx_msg void OnVariable(NMHDR* pNMHDR, LRESULT* pResult); 127 | afx_msg void OnReleasedcaptureVariable(NMHDR* pNMHDR, LRESULT* pResult); 128 | afx_msg void OnChangeRidButton1(); 129 | afx_msg void OnChangeRidButton2(); 130 | afx_msg void OnChangeRidButton3(); 131 | afx_msg void OnChangeRidButton4(); 132 | afx_msg void OnChangeRidButton5(); 133 | afx_msg void OnChangeRidButton6(); 134 | afx_msg void OnChangeRidButton7(); 135 | afx_msg void OnChangeRidRoller1(); 136 | afx_msg void OnChangeRidRoller2(); 137 | afx_msg void OnChangeRidLed1(); 138 | afx_msg void OnChangeRidLed2(); 139 | afx_msg void OnChangeRidLed3(); 140 | afx_msg void OnChangeRidVariable(); 141 | afx_msg void OnCustomdrawVariable(NMHDR* pNMHDR, LRESULT* pResult); 142 | afx_msg void OnChangeRidLed4(); 143 | afx_msg void OnLed4OnOff(); 144 | afx_msg void OnUseSetReport(); 145 | afx_msg void OnUseSetFeature(); 146 | //}}AFX_MSG 147 | DECLARE_MESSAGE_MAP() 148 | }; 149 | 150 | //{{AFX_INSERT_LOCATION}} 151 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 152 | 153 | #endif // !defined(AFX_GRAPHICVIEW_H__63F7C696_E14A_453D_A678_F11A8B11108E__INCLUDED_) 154 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/GraphicView.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/GraphicView.ico -------------------------------------------------------------------------------- /USB HID Demonstrator/src/HID Capabilities.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/HID Capabilities.ico -------------------------------------------------------------------------------- /USB HID Demonstrator/src/HexEdit.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/HexEdit.cpp -------------------------------------------------------------------------------- /USB HID Demonstrator/src/HexEdit.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : HexEdit.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : HexEdit header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #if !defined(AFX_HEXEDIT_H__52939FC1_17E0_467F_8AE8_6A0E367FB5F3__INCLUDED_) 17 | #define AFX_HEXEDIT_H__52939FC1_17E0_467F_8AE8_6A0E367FB5F3__INCLUDED_ 18 | 19 | #if _MSC_VER > 1000 20 | #pragma once 21 | #endif // _MSC_VER > 1000 22 | // HexEdit.h : header file 23 | // 24 | ///////////////////////////////////////////////////////////////////////////// 25 | #include "stdafx.h" 26 | 27 | 28 | // CHexEdit window 29 | struct TextColor { 30 | COLORREF clrTextColor; 31 | COLORREF clrBkColor; 32 | }; 33 | class CHexEdit : public CEdit 34 | { 35 | // Construction 36 | public: 37 | CHexEdit(); 38 | 39 | // Attributes 40 | public: 41 | 42 | protected: 43 | TextColor m_icHexText; 44 | TextColor m_icDecText; 45 | private: 46 | bool m_bEnd; 47 | bool m_bHex; 48 | 49 | // Operations 50 | public: 51 | 52 | // Overrides 53 | // ClassWizard generated virtual function overrides 54 | //{{AFX_VIRTUAL(CHexEdit) 55 | public: 56 | virtual BOOL PreTranslateMessage(MSG* pMsg); 57 | //}}AFX_VIRTUAL 58 | 59 | // Implementation 60 | public: 61 | virtual ~CHexEdit(); 62 | 63 | // Generated message map functions 64 | protected: 65 | //{{AFX_MSG(CHexEdit) 66 | afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); 67 | afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); 68 | // afx_msg void OnChange(); 69 | //}}AFX_MSG 70 | 71 | DECLARE_MESSAGE_MAP() 72 | public: 73 | protected: 74 | virtual void DoDataExchange(CDataExchange* pDX); 75 | public: 76 | virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); 77 | afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/); 78 | private: 79 | CBrush m_bkDecBrush;//background dec color brush 80 | CBrush m_bkHexBrush;//background hex color brush 81 | bool IsHexConvertableText(LPTSTR _text); 82 | void FormatClipboard(); 83 | public: 84 | void SetHexColor(COLORREF clrBack, COLORREF clrText); 85 | void SetDecColor(COLORREF clrBack, COLORREF clrText); 86 | afx_msg void OnEnUpdate(); 87 | afx_msg LRESULT OnConvert(WPARAM wParam, LPARAM lParam); 88 | unsigned int GetValue(void); 89 | void SetValue(unsigned int _value,bool _bHex=false); 90 | }; 91 | 92 | ///////////////////////////////////////////////////////////////////////////// 93 | 94 | //{{AFX_INSERT_LOCATION}} 95 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 96 | 97 | #endif // !defined(AFX_HEXEDIT_H__52939FC1_17E0_467F_8AE8_6A0E367FB5F3__INCLUDED_) 98 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/IconButton.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/IconButton.cpp -------------------------------------------------------------------------------- /USB HID Demonstrator/src/IconButton.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : IconButton.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Icon button header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #pragma once 17 | 18 | 19 | const int TIPBGRCOLOR = RGB ( 255, 255, 0 ); 20 | 21 | class CIconButton : public CButton 22 | { 23 | public: 24 | CIconButton(); 25 | virtual ~CIconButton(); 26 | 27 | void SetItalic ( bool bVal = true ) { m_TextMetrics.tmItalic = bVal; NewFont (); }; 28 | void SetUnderline ( bool bVal = true ) { m_TextMetrics.tmUnderlined = bVal; NewFont (); }; 29 | void SetStrikeOut ( bool bVal = true ) { m_TextMetrics.tmStruckOut = bVal; NewFont (); }; 30 | void SetFaceName ( const CString &sVal ) { m_sFaceName = sVal; NewFont (); }; 31 | void SetWeight ( const int nVal ) { m_TextMetrics.tmWeight = nVal; NewFont (); }; 32 | void SetHeight ( const int nVal) { m_TextMetrics.tmHeight = nVal; NewFont (); }; 33 | void SetWidth ( const int nVal) { m_TextMetrics.tmMaxCharWidth = nVal; NewFont (); }; 34 | 35 | void SetIconID ( const UINT nID ) { m_nIconID = nID; }; 36 | void SetTextColor ( const COLORREF color ) { m_nColor = color; }; 37 | void SetIconSize ( const int x, const int y ) { m_nIcon.cx = x; m_nIcon.cy = y; }; 38 | void SetIconRight ( bool bVal = true ) { m_bIconRight = bVal; }; 39 | void Disable ( void ); 40 | void Enable ( void ); 41 | void SetTipText ( const CString &sTxt ) { m_sTip = sTxt; m_bWithTip = true; }; 42 | 43 | //{{AFX_VIRTUAL(CIconButton) 44 | public: 45 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 46 | //}}AFX_VIRTUAL 47 | 48 | 49 | protected: 50 | //{{AFX_MSG(CIconButton) 51 | afx_msg LRESULT OnNcHitTest(CPoint point); 52 | afx_msg void OnMouseMove(UINT nFlags, CPoint point); 53 | //}}AFX_MSG 54 | DECLARE_MESSAGE_MAP() 55 | private: 56 | 57 | void NewFont ( void ); 58 | int DelAmpersand ( CString &sTxt ); 59 | void HideTip ( void ); 60 | void ShowTip ( void ); 61 | void GetCurrentTextMetric ( void ); 62 | void DrawTipBoxAndText ( void ); 63 | bool RestoreBitmap ( void ); 64 | bool SaveBitmap ( void ); 65 | // 66 | bool m_bIconRight; 67 | TEXTMETRIC m_TextMetrics; 68 | CSize m_nIcon; 69 | UINT m_nIconID; 70 | COLORREF m_nColor; 71 | CFont m_fnt; 72 | CString m_sFaceName; 73 | // 74 | bool m_bWithTip; 75 | bool m_bTipIsOpen; 76 | CString m_sTip; 77 | CSize m_TipDim; 78 | CPoint m_TipPos; 79 | CRect m_TipRect; 80 | HBITMAP m_hMemBmp; 81 | HDC m_hMemDC; 82 | HDC m_hOwnerDC; 83 | }; 84 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/Inc/Hid.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | hidexe.h 8 | 9 | Abstract: 10 | 11 | This module contains the declarations and definitions for use with the 12 | hid user more client sample driver. 13 | 14 | Environment: 15 | 16 | Kernel & user mode 17 | 18 | Revision History: 19 | 20 | Nov-96 : Created by Kenneth D. Ray 21 | 22 | --*/ 23 | 24 | #ifndef HIDEXE_H 25 | #define HIDEXE_H 26 | 27 | #include "hidsdi.h" 28 | #include "setupapi.h" 29 | 30 | // 31 | // BUGBUG: Definitions here until PlugPlay can get their act together 32 | // 33 | 34 | #define DIGCF_FUNCTION 0x00000010 35 | #define DIOD_FUNCTION 0x00000008 36 | #define DIREG_FUNCTION 0x00000008 37 | 38 | #define malloc(size) LocalAlloc (LPTR, size) 39 | 40 | typedef struct _SP_FNCLASS_DEVICE_DATA { 41 | DWORD cbSize; 42 | GUID FunctionClassGuid; 43 | TCHAR DevicePath [ANYSIZE_ARRAY]; 44 | } SP_FNCLASS_DEVICE_DATA, *PSP_FNCLASS_DEVICE_DATA; 45 | 46 | BOOLEAN 47 | SetupDiGetFunctionClassDeviceInfo ( 48 | IN HDEVINFO DeviceInfoSet, 49 | IN PSP_DEVINFO_DATA DeviceInfoData, 50 | OUT PSP_FNCLASS_DEVICE_DATA FunctionClassDeviceData, 51 | IN DWORD FunctionClassDeviceDataSize, 52 | OUT PDWORD RequiredSize 53 | ); 54 | 55 | //#define ASSERT(x) 56 | 57 | // 58 | // A structure to hold the steady state data received from the hid device. 59 | // Each time a read packet is received we fill in this structure. 60 | // Each time we wish to write to a hid device we fill in this structure. 61 | // This structure is here only for convenience. Most real applications will 62 | // have a more efficient way of moving the hid data to the read, write, and 63 | // feature routines. 64 | // 65 | typedef struct _HID_DATA { 66 | BOOLEAN IsButtonData; 67 | UCHAR Reserved; 68 | USAGE UsagePage; // The usage page for which we are looking. 69 | ULONG Status; // The last status returned from the accessor function 70 | // when updating this field. 71 | union { 72 | struct { 73 | ULONG MaxUsageLength; // Usages buffer length. 74 | PUSAGE Usages; // list of usages (buttons ``down'' on the device. 75 | 76 | } ButtonData; 77 | struct { 78 | USAGE Usage; // The usage describing this value; 79 | USHORT Reserved; 80 | 81 | ULONG Value; 82 | LONG ScaledValue; 83 | } ValueData; 84 | }; 85 | } HID_DATA, *PHID_DATA; 86 | 87 | typedef struct _HID_DEVICE { 88 | HANDLE HidDevice; // A file handle to the hid device. 89 | PHIDP_PREPARSED_DATA Ppd; // The opaque parser info describing this device 90 | HIDP_CAPS Caps; // The Capabilities of this hid device. 91 | HIDD_ATTRIBUTES Attributes; 92 | 93 | PCHAR InputReportBuffer; 94 | PHID_DATA InputData; // array of hid data structures 95 | ULONG InputDataLength; // Num elements in this array. 96 | PHIDP_BUTTON_CAPS InputButtonCaps; 97 | PHIDP_VALUE_CAPS InputValueCaps; 98 | 99 | PCHAR OutputReportBuffer; 100 | PHID_DATA OutputData; 101 | ULONG OutputDataLength; 102 | PHIDP_BUTTON_CAPS OutputButtonCaps; 103 | PHIDP_VALUE_CAPS OutputValueCaps; 104 | 105 | PCHAR FeatureReportBuffer; 106 | PHID_DATA FeatureData; 107 | ULONG FeatureDataLength; 108 | PHIDP_BUTTON_CAPS FeatureButtonCaps; 109 | PHIDP_VALUE_CAPS FeatureValueCaps; 110 | 111 | } HID_DEVICE, *PHID_DEVICE; 112 | 113 | BOOLEAN 114 | FindKnownHidDevices ( 115 | OUT PHID_DEVICE * HidDevices, // A array of struct _HID_DEVICE 116 | OUT PULONG NumberDevices // the length of this array. 117 | ); 118 | 119 | VOID 120 | CloseHidDevices ( 121 | OUT PHID_DEVICE HidDevices, // A array of struct _HID_DEVICE 122 | OUT ULONG NumberDevices // the length of this array. 123 | ); 124 | 125 | BOOLEAN 126 | Read ( 127 | PHID_DEVICE HidDevice 128 | ); 129 | 130 | BOOLEAN 131 | Write ( 132 | PHID_DEVICE HidDevice 133 | ); 134 | 135 | BOOLEAN 136 | SetFeature ( 137 | PHID_DEVICE HidDevice 138 | ); 139 | 140 | BOOLEAN 141 | GetFeature ( 142 | PHID_DEVICE HidDevice 143 | ); 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/Inc/Hidpi++.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/Inc/Hidpi++.h -------------------------------------------------------------------------------- /USB HID Demonstrator/src/LedOff.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/LedOff.ico -------------------------------------------------------------------------------- /USB HID Demonstrator/src/LedOn.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/LedOn.ico -------------------------------------------------------------------------------- /USB HID Demonstrator/src/Lib/SETUPAPI.LIB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/Lib/SETUPAPI.LIB -------------------------------------------------------------------------------- /USB HID Demonstrator/src/Lib/hid.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/Lib/hid.lib -------------------------------------------------------------------------------- /USB HID Demonstrator/src/ReportView.cpp: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : ReportView.cpp 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Report page implementation 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #include "stdafx.h" 17 | #include "UsbHidDemonstrator.h" 18 | #include "ReportView.h" 19 | 20 | #ifdef _DEBUG 21 | #define new DEBUG_NEW 22 | #undef THIS_FILE 23 | static char THIS_FILE[] = __FILE__; 24 | #endif 25 | 26 | extern BYTE InputReport[256]; 27 | extern BYTE OutputReport[256]; 28 | extern BOOL WRITE_ROPRT; 29 | 30 | ///////////////////////////////////////////////////////////////////////////// 31 | // CReportView dialog 32 | 33 | 34 | CReportView::CReportView(CWnd* pParent /*=NULL*/) 35 | : CDialog(CReportView::IDD, pParent) 36 | { 37 | //{{AFX_DATA_INIT(CReportView) 38 | m_OutPutHxEditLength = _T("FFFF"); 39 | m_InPutHxEditLength = _T("FFFF"); 40 | //}}AFX_DATA_INIT 41 | } 42 | 43 | 44 | void CReportView::DoDataExchange(CDataExchange* pDX) 45 | { 46 | CDialog::DoDataExchange(pDX); 47 | //{{AFX_DATA_MAP(CReportView) 48 | DDX_Control(pDX, IDC_OUTPUT_HEX_EDITOR, m_OutputHexEditorCtrl); 49 | DDX_Control(pDX, IDC_INPUT_HEX_EDITOR, m_InputHexEditorCtrl); 50 | DDX_Control(pDX, IDC_SIZE_INPUT_HEX_EDIT, m_InPutHxEditLengthCtrl); 51 | DDX_Control(pDX, IDC_SIZE_OUTPUT_HEX_EDIT, m_OutPutHxEditLengthCtrl); 52 | DDX_Text(pDX, IDC_SIZE_OUTPUT_HEX_EDIT, m_OutPutHxEditLength); 53 | DDX_Text(pDX, IDC_SIZE_INPUT_HEX_EDIT, m_InPutHxEditLength); 54 | //}}AFX_DATA_MAP 55 | } 56 | 57 | 58 | BEGIN_MESSAGE_MAP(CReportView, CDialog) 59 | //{{AFX_MSG_MAP(CReportView) 60 | ON_WM_PAINT() 61 | ON_BN_CLICKED(IDC_WRITE_BTN, OnWriteBtn) 62 | ON_WM_TIMER() 63 | ON_EN_CHANGE(IDC_SIZE_OUTPUT_HEX_EDIT, OnChangeSizeOutputHexEdit) 64 | ON_EN_CHANGE(IDC_SIZE_INPUT_HEX_EDIT, OnChangeSizeInputHexEdit) 65 | //}}AFX_MSG_MAP 66 | END_MESSAGE_MAP() 67 | 68 | ///////////////////////////////////////////////////////////////////////////// 69 | // CReportView message handlers 70 | 71 | void CReportView::OnPaint() 72 | { 73 | CPaintDC dc(this); // device context for painting 74 | 75 | // TODO: Add your message handler code here 76 | 77 | // Do not call CDialog::OnPaint() for painting messages 78 | 79 | UpdateData(TRUE); 80 | WORD OutSize = _tcstoul(m_OutPutHxEditLength, 0, 16); 81 | WORD InSize = _tcstoul(m_InPutHxEditLength, 0, 16); 82 | 83 | m_OutputHexEditorCtrl.SetDataSize(OutSize); 84 | m_InputHexEditorCtrl.SetDataSize(InSize); 85 | UpdateData(FALSE); 86 | } 87 | 88 | void CReportView::OnWriteBtn() 89 | { 90 | // TODO: Add your control notification handler code here 91 | UpdateData(TRUE); 92 | 93 | WORD OutSize = _tcstoul(m_OutPutHxEditLength, 0, 16); 94 | 95 | LPBYTE pData = (LPBYTE)malloc(OutSize); 96 | m_OutputHexEditorCtrl.GetData(pData, OutSize); 97 | 98 | memcpy(&OutputReport, pData, OutSize); 99 | 100 | UpdateData(FALSE); 101 | 102 | WRITE_ROPRT = TRUE; 103 | } 104 | 105 | void CReportView::OnSetfocusHexEditor() 106 | { 107 | // TODO: Add your control notification handler code here 108 | } 109 | 110 | void CReportView::OnTimer(UINT nIDEvent) 111 | { 112 | // TODO: Add your message handler code here and/or call default 113 | UpdateData(TRUE); 114 | WORD InSize = _tcstoul(m_InPutHxEditLength, 0, 16); 115 | m_InputHexEditorCtrl.SetData((LPBYTE)InputReport,InSize); 116 | UpdateData(FALSE); 117 | CDialog::OnTimer(nIDEvent); 118 | } 119 | 120 | BOOL CReportView::OnInitDialog() 121 | { 122 | CDialog::OnInitDialog(); 123 | 124 | // TODO: Add extra initialization here 125 | return TRUE; // return TRUE unless you set the focus to a control 126 | // EXCEPTION: OCX Property Pages should return FALSE 127 | } 128 | 129 | void CReportView::OnChangeSizeOutputHexEdit() 130 | { 131 | UpdateData(TRUE); 132 | WORD OutSize = _tcstoul(m_OutPutHxEditLength, 0, 16); 133 | m_OutputHexEditorCtrl.SetDataSize(OutSize); 134 | UpdateData(FALSE); 135 | } 136 | 137 | void CReportView::OnChangeSizeInputHexEdit() 138 | { 139 | UpdateData(TRUE); 140 | WORD InSize = _tcstoul(m_InPutHxEditLength, 0, 16); 141 | m_InputHexEditorCtrl.SetDataSize(InSize); 142 | UpdateData(FALSE); 143 | } 144 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/ReportView.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : ReportView.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Report view header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #if !defined(AFX_REPORTVIEW_H__64FEBAC0_58ED_48D0_9D8B_B48B6D0DAD6C__INCLUDED_) 17 | #define AFX_REPORTVIEW_H__64FEBAC0_58ED_48D0_9D8B_B48B6D0DAD6C__INCLUDED_ 18 | 19 | #if _MSC_VER > 1000 20 | #pragma once 21 | #endif // _MSC_VER > 1000 22 | // ReportView.h : header file 23 | // 24 | 25 | #include "HexEdit.h" 26 | #include "hexeditctrl.h" 27 | ///////////////////////////////////////////////////////////////////////////// 28 | // CReportView dialog 29 | 30 | class CReportView : public CDialog 31 | { 32 | // Construction 33 | public: 34 | CReportView(CWnd* pParent = NULL); // standard constructor 35 | 36 | // Dialog Data 37 | //{{AFX_DATA(CReportView) 38 | enum { IDD = IDD_REPORT_VIEW }; 39 | CHexEditor m_OutputHexEditorCtrl; 40 | CHexEditor m_InputHexEditorCtrl; 41 | CHexEdit m_InPutHxEditLengthCtrl; 42 | CHexEdit m_OutPutHxEditLengthCtrl; 43 | CString m_OutPutHxEditLength; 44 | CString m_InPutHxEditLength; 45 | //}}AFX_DATA 46 | 47 | 48 | // Overrides 49 | // ClassWizard generated virtual function overrides 50 | //{{AFX_VIRTUAL(CReportView) 51 | protected: 52 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 53 | //}}AFX_VIRTUAL 54 | 55 | // Implementation 56 | public: 57 | 58 | // Generated message map functions 59 | //{{AFX_MSG(CReportView) 60 | afx_msg void OnPaint(); 61 | afx_msg void OnWriteBtn(); 62 | afx_msg void OnSetfocusHexEditor(); 63 | afx_msg void OnTimer(UINT nIDEvent); 64 | virtual BOOL OnInitDialog(); 65 | afx_msg void OnChangeSizeOutputHexEdit(); 66 | afx_msg void OnChangeSizeInputHexEdit(); 67 | //}}AFX_MSG 68 | DECLARE_MESSAGE_MAP() 69 | }; 70 | 71 | //{{AFX_INSERT_LOCATION}} 72 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 73 | 74 | #endif // !defined(AFX_REPORTVIEW_H__64FEBAC0_58ED_48D0_9D8B_B48B6D0DAD6C__INCLUDED_) 75 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // UsbHidDemonstrator.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #if !defined(AFX_STDAFX_H__2B692B69_3481_4843_A044_44715CAAA7FF__INCLUDED_) 7 | #define AFX_STDAFX_H__2B692B69_3481_4843_A044_44715CAAA7FF__INCLUDED_ 8 | 9 | #define WINVER 0x0500 10 | #if _MSC_VER > 1000 11 | #pragma once 12 | #endif // _MSC_VER > 1000 13 | 14 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 15 | 16 | #include // MFC core and standard components 17 | #include // MFC extensions 18 | #include // MFC Automation classes 19 | #include // MFC support for Internet Explorer 4 Common Controls 20 | #ifndef _AFX_NO_AFXCMN_SUPPORT 21 | #include // MFC support for Windows Common Controls 22 | 23 | #endif // _AFX_NO_AFXCMN_SUPPORT 24 | 25 | #include // MFC socket extensions 26 | 27 | //{{AFX_INSERT_LOCATION}} 28 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 29 | 30 | #endif // !defined(AFX_STDAFX_H__2B692B69_3481_4843_A044_44715CAAA7FF__INCLUDED_) 31 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/Transfere.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/Transfere.ico -------------------------------------------------------------------------------- /USB HID Demonstrator/src/USB_Blue.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USB HID Demonstrator/src/USB_Blue.ico -------------------------------------------------------------------------------- /USB HID Demonstrator/src/UsbHidDemonstrator.cpp: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : UsbHidDemonstrator.cpp 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Defines the class behaviors for the application 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #include "stdafx.h" 17 | #include "UsbHidDemonstrator.h" 18 | #include "UsbHidDemonstratorDlg.h" 19 | 20 | #ifdef _DEBUG 21 | #define new DEBUG_NEW 22 | #undef THIS_FILE 23 | static char THIS_FILE[] = __FILE__; 24 | #endif 25 | 26 | ///////////////////////////////////////////////////////////////////////////// 27 | // CUsbHidDemonstratorApp 28 | 29 | BEGIN_MESSAGE_MAP(CUsbHidDemonstratorApp, CWinApp) 30 | //{{AFX_MSG_MAP(CUsbHidDemonstratorApp) 31 | // NOTE - the ClassWizard will add and remove mapping macros here. 32 | // DO NOT EDIT what you see in these blocks of generated code! 33 | //}}AFX_MSG 34 | ON_COMMAND(ID_HELP, CWinApp::OnHelp) 35 | END_MESSAGE_MAP() 36 | 37 | ///////////////////////////////////////////////////////////////////////////// 38 | // CUsbHidDemonstratorApp construction 39 | 40 | CUsbHidDemonstratorApp::CUsbHidDemonstratorApp() 41 | { 42 | // TODO: add construction code here, 43 | // Place all significant initialization in InitInstance 44 | } 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | // The one and only CUsbHidDemonstratorApp object 48 | 49 | CUsbHidDemonstratorApp theApp; 50 | 51 | ///////////////////////////////////////////////////////////////////////////// 52 | // CUsbHidDemonstratorApp initialization 53 | 54 | BOOL CUsbHidDemonstratorApp::InitInstance() 55 | { 56 | if (!AfxSocketInit()) 57 | { 58 | AfxMessageBox(IDP_SOCKETS_INIT_FAILED); 59 | return FALSE; 60 | } 61 | 62 | AfxEnableControlContainer(); 63 | 64 | SetDialogBkColor(RGB(243, 243, 245), RGB(0, 0, 0)); 65 | 66 | 67 | // Standard initialization 68 | // If you are not using these features and wish to reduce the size 69 | // of your final executable, you should remove from the following 70 | // the specific initialization routines you do not need. 71 | 72 | #ifdef _AFXDLL 73 | Enable3dControls(); // Call this when using MFC in a shared DLL 74 | #else 75 | Enable3dControlsStatic(); // Call this when linking to MFC statically 76 | #endif 77 | 78 | CUsbHidDemonstratorDlg dlg; 79 | m_pMainWnd = &dlg; 80 | int nResponse = dlg.DoModal(); 81 | if (nResponse == IDOK) 82 | { 83 | // TODO: Place code here to handle when the dialog is 84 | // dismissed with OK 85 | } 86 | else if (nResponse == IDCANCEL) 87 | { 88 | // TODO: Place code here to handle when the dialog is 89 | // dismissed with Cancel 90 | } 91 | 92 | // Since the dialog has been closed, return FALSE so that we exit the 93 | // application, rather than start the application's message pump. 94 | return FALSE; 95 | } 96 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/UsbHidDemonstrator.dep: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Generated Dependency File, included by UsbHidDemonstrator.mak 2 | 3 | .\DesrciptorView.cpp : \ 4 | ".\DesrciptorView.h"\ 5 | ".\StdAfx.h"\ 6 | ".\UsbHidDemonstrator.h"\ 7 | 8 | 9 | .\FeatureView.cpp : \ 10 | ".\FeatureView.h"\ 11 | ".\StdAfx.h"\ 12 | ".\UsbHidDemonstrator.h"\ 13 | 14 | 15 | .\GraphicView.cpp : \ 16 | ".\GraphicView.h"\ 17 | ".\StdAfx.h"\ 18 | ".\UsbHidDemonstrator.h"\ 19 | 20 | 21 | .\HexEdit.cpp : \ 22 | ".\HexEdit.h"\ 23 | ".\StdAfx.h"\ 24 | 25 | 26 | .\hexeditctrl.cpp : \ 27 | ".\hexeditctrl.h"\ 28 | ".\StdAfx.h"\ 29 | 30 | 31 | .\ReportView.cpp : \ 32 | ".\HexEdit.h"\ 33 | ".\hexeditctrl.h"\ 34 | ".\ReportView.h"\ 35 | ".\StdAfx.h"\ 36 | ".\UsbHidDemonstrator.h"\ 37 | 38 | 39 | .\StdAfx.cpp : \ 40 | ".\StdAfx.h"\ 41 | 42 | 43 | .\UsbHidDemonstrator.cpp : \ 44 | ".\DesrciptorView.h"\ 45 | ".\FeatureView.h"\ 46 | ".\GraphicView.h"\ 47 | ".\HexEdit.h"\ 48 | ".\hexeditctrl.h"\ 49 | ".\ReportView.h"\ 50 | ".\StdAfx.h"\ 51 | ".\UsbHidDemonstrator.h"\ 52 | ".\UsbHidDemonstratorDlg.h"\ 53 | 54 | 55 | .\UsbHidDemonstrator.rc : \ 56 | ".\res\UsbHidDemonstrator.ico"\ 57 | ".\res\UsbHidDemonstrator.rc2"\ 58 | 59 | 60 | .\UsbHidDemonstratorDlg.cpp : \ 61 | ".\DesrciptorView.h"\ 62 | ".\FeatureView.h"\ 63 | ".\GraphicView.h"\ 64 | ".\HexEdit.h"\ 65 | ".\hexeditctrl.h"\ 66 | ".\INC\hid.h"\ 67 | ".\INC\hidpi++.h"\ 68 | ".\INC\hidpi.h"\ 69 | ".\INC\hidsdi++.h"\ 70 | ".\INC\hidsdi.h"\ 71 | ".\INC\hidusage.h"\ 72 | ".\INC\setupapi.h"\ 73 | ".\INC\usb100.h"\ 74 | ".\ReportView.h"\ 75 | ".\StdAfx.h"\ 76 | ".\UsbHidDemonstrator.h"\ 77 | ".\UsbHidDemonstratorDlg.h"\ 78 | 79 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/UsbHidDemonstrator.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "UsbHidDemonstrator"=.\UsbHidDemonstrator.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | begin source code control 11 | "$/PC/USB HID Demonstrator/SOFTWARE", NBSBAAAA 12 | . 13 | end source code control 14 | }}} 15 | 16 | Package=<4> 17 | {{{ 18 | }}} 19 | 20 | ############################################################################### 21 | 22 | Global: 23 | 24 | Package=<5> 25 | {{{ 26 | }}} 27 | 28 | Package=<3> 29 | {{{ 30 | }}} 31 | 32 | ############################################################################### 33 | 34 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/UsbHidDemonstrator.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : UsbHidDemonstrator.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : main header file for the USBHIDDEMONSTRATOR application 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #if !defined(AFX_USBHIDDEMONSTRATOR_H__DE90358C_26AB_45EB_AEB9_2DC241F44CBF__INCLUDED_) 17 | #define AFX_USBHIDDEMONSTRATOR_H__DE90358C_26AB_45EB_AEB9_2DC241F44CBF__INCLUDED_ 18 | 19 | #if _MSC_VER > 1000 20 | #pragma once 21 | #endif // _MSC_VER > 1000 22 | 23 | #ifndef __AFXWIN_H__ 24 | #error include 'stdafx.h' before including this file for PCH 25 | #endif 26 | 27 | #include "resource.h" // main symbols 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | // CUsbHidDemonstratorApp: 31 | // See UsbHidDemonstrator.cpp for the implementation of this class 32 | // 33 | 34 | 35 | class CUsbHidDemonstratorApp : public CWinApp 36 | { 37 | public: 38 | CUsbHidDemonstratorApp(); 39 | 40 | // Overrides 41 | // ClassWizard generated virtual function overrides 42 | //{{AFX_VIRTUAL(CUsbHidDemonstratorApp) 43 | public: 44 | virtual BOOL InitInstance(); 45 | //}}AFX_VIRTUAL 46 | 47 | // Implementation 48 | 49 | //{{AFX_MSG(CUsbHidDemonstratorApp) 50 | // NOTE - the ClassWizard will add and remove member functions here. 51 | // DO NOT EDIT what you see in these blocks of generated code ! 52 | //}}AFX_MSG 53 | DECLARE_MESSAGE_MAP() 54 | }; 55 | 56 | 57 | ///////////////////////////////////////////////////////////////////////////// 58 | 59 | //{{AFX_INSERT_LOCATION}} 60 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 61 | 62 | #endif // !defined(AFX_USBHIDDEMONSTRATOR_H__DE90358C_26AB_45EB_AEB9_2DC241F44CBF__INCLUDED_) 63 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/UsbHidDemonstrator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UsbHidDemonstrator", "UsbHidDemonstrator.vcproj", "{8A55692C-5B73-4D3F-ACEC-EE995D28E999}" 5 | EndProject 6 | Global 7 | GlobalSection(SourceCodeControl) = preSolution 8 | SccNumberOfProjects = 1 9 | SccProjectUniqueName0 = UsbHidDemonstrator.vcproj 10 | SccProjectName0 = \u0022$/PC/USB\u0020HID\u0020Demonstrator/SOFTWARE\u0022,\u0020NBSBAAAA 11 | SccLocalPath0 = . 12 | SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe 13 | CanCheckoutShared = false 14 | EndGlobalSection 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Win32 = Debug|Win32 17 | Release|Win32 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {8A55692C-5B73-4D3F-ACEC-EE995D28E999}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {8A55692C-5B73-4D3F-ACEC-EE995D28E999}.Debug|Win32.Build.0 = Debug|Win32 22 | {8A55692C-5B73-4D3F-ACEC-EE995D28E999}.Release|Win32.ActiveCfg = Release|Win32 23 | {8A55692C-5B73-4D3F-ACEC-EE995D28E999}.Release|Win32.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/UsbHidDemonstratorDlg.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : UsbHidDemonstratorDlg.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Main dialog header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | #if !defined(AFX_USBHIDDEMONSTRATORDLG_H__568434D4_16F5_45BC_A0EA_44631DE02D1F__INCLUDED_) 17 | #define AFX_USBHIDDEMONSTRATORDLG_H__568434D4_16F5_45BC_A0EA_44631DE02D1F__INCLUDED_ 18 | 19 | #if _MSC_VER > 1000 20 | #pragma once 21 | #endif // _MSC_VER > 1000 22 | 23 | 24 | #include "ReportView.h" 25 | #include "GraphicView.h" 26 | #include "FeatureView.h" 27 | #include "DesrciptorView.h" 28 | #include "GraphicConfigView.h" 29 | #include "IconButton.h" 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | // CUsbHidDemonstratorDlg dialog 33 | 34 | class CUsbHidDemonstratorDlg : public CDialog 35 | { 36 | // Construction 37 | public: 38 | static DWORD WINAPI ReadReport(void*); 39 | static DWORD WINAPI WriteReport(void*); 40 | 41 | void DisplayData(CString Data); 42 | void RefreshDevices(); 43 | CUsbHidDemonstratorDlg(CWnd* pParent = NULL); // standard constructor 44 | void GetDeviceCapabilities(); 45 | 46 | CReportView m_ReportView_frm; 47 | CGraphicView m_GraphicView_frm; 48 | CFeatureView m_FeatureView_frm; 49 | CDesrciptorView m_DesrciptorView_frm; 50 | CGraphicConfigView m_GraphicConfig_frm; 51 | 52 | // Dialog Data 53 | //{{AFX_DATA(CUsbHidDemonstratorDlg) 54 | enum { IDD = IDD_USBHIDDEMONSTRATOR_DIALOG }; 55 | CIconButton m_GraphicConfigCtrl; 56 | CIconButton m_TransfereCtrl; 57 | CIconButton m_CapabilitiesCtrl; 58 | CIconButton m_GraphicViewCtrl; 59 | CListBox m_TargetsCtrl; 60 | CComboBox m_HidTargetsCtrl; 61 | CString m_HidTarget; 62 | int m_UseSetxxx; 63 | //}}AFX_DATA 64 | 65 | // ClassWizard generated virtual function overrides 66 | //{{AFX_VIRTUAL(CUsbHidDemonstratorDlg) 67 | protected: 68 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 69 | virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); 70 | virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); 71 | //}}AFX_VIRTUAL 72 | 73 | // Implementation 74 | protected: 75 | 76 | HICON m_hIcon; 77 | BOOL OnDeviceChange(UINT nEventType,DWORD dwData); 78 | 79 | // Generated message map functions 80 | //{{AFX_MSG(CUsbHidDemonstratorDlg) 81 | virtual BOOL OnInitDialog(); 82 | afx_msg void OnSysCommand(UINT nID, LPARAM lParam); 83 | afx_msg void OnPaint(); 84 | afx_msg HCURSOR OnQueryDragIcon(); 85 | afx_msg void OnShowDescroptorView(); 86 | afx_msg void OnShowFeatureView(); 87 | afx_msg void OnShowReportView(); 88 | afx_msg void OnShowGraphicView(); 89 | afx_msg void OnSelchangeHidTargets(); 90 | afx_msg void OnTimer(UINT nIDEvent); 91 | afx_msg void OnGraphicConfig(); 92 | afx_msg void OnSetFeature(); 93 | afx_msg void OnGetFeature(); 94 | afx_msg void OnUseSetReport(); 95 | afx_msg void OnUseSetFeature(); 96 | //}}AFX_MSG 97 | DECLARE_MESSAGE_MAP() 98 | }; 99 | 100 | //{{AFX_INSERT_LOCATION}} 101 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 102 | 103 | #endif // !defined(AFX_USBHIDDEMONSTRATORDLG_H__568434D4_16F5_45BC_A0EA_44631DE02D1F__INCLUDED_) 104 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/hexeditctrl.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : hexeditctrl.h 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Hex editor header file 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | 17 | #include "stdafx.h" 18 | 19 | class CHexEditor : public CEdit 20 | { 21 | // Construction 22 | public: 23 | CHexEditor(); 24 | 25 | enum EDITMODE{ 26 | EDIT_NONE, 27 | EDIT_ASCII, 28 | EDIT_HIGH, 29 | EDIT_LOW 30 | } ; 31 | // Attributes 32 | public: 33 | LPBYTE m_pData; // pointer to data 34 | int m_length; // length of data 35 | int m_topindex; // offset of first visible byte on screen 36 | 37 | int m_currentAddress; // address under cursor 38 | EDITMODE m_currentMode; // current editing mode: address/hex/ascii 39 | int m_selStart; // start address of selection 40 | int m_selEnd; // end address of selection 41 | 42 | int m_bpr; // byte per row 43 | int m_lpp; // lines per page 44 | BOOL m_bShowAddress; 45 | BOOL m_bShowAscii; 46 | BOOL m_bShowHex; 47 | BOOL m_bAddressIsWide; 48 | 49 | BOOL m_bNoAddressChange; // internally used 50 | BOOL m_bHalfPage; 51 | 52 | CFont m_Font; 53 | int m_lineHeight; 54 | int m_nullWidth; 55 | BOOL m_bUpdate; 56 | 57 | int m_offHex, 58 | m_offAscii, 59 | m_offAddress; 60 | 61 | CPoint m_editPos; 62 | 63 | // Operations 64 | public: 65 | 66 | // Overrides 67 | // ClassWizard generated virtual function overrides 68 | //{{AFX_VIRTUAL(CHexEditor) 69 | public: 70 | virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); 71 | protected: 72 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 73 | //}}AFX_VIRTUAL 74 | 75 | // Implementation 76 | public: 77 | void SetDataSize(WORD size); 78 | int GetData(LPBYTE p, int len); 79 | void SetData(LPBYTE p, int len); 80 | CSize GetSel(void); 81 | void SetSel(int s, int e); 82 | void SetBPR(int bpr); 83 | void SetOptions(BOOL a, BOOL h, BOOL c, BOOL w); 84 | virtual ~CHexEditor(); 85 | 86 | // Generated message map functions 87 | protected: 88 | void ScrollIntoView(int p); 89 | void RepositionCaret(int p); 90 | void Move(int x, int y); 91 | inline BOOL IsSelected(void); 92 | void UpdateScrollbars(void); 93 | void CreateEditCaret(void); 94 | void CreateAddressCaret(void); 95 | CPoint CalcPos(int x, int y); 96 | void SelInsert(int s, int l); 97 | void SelDelete(int s, int e); 98 | inline void NormalizeSel(void); 99 | afx_msg void OnContextMenu(CWnd*, CPoint point); 100 | //{{AFX_MSG(CHexEditor) 101 | afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); 102 | afx_msg void OnKillFocus(CWnd* pNewWnd); 103 | afx_msg void OnPaint(); 104 | afx_msg void OnSetFocus(CWnd* pOldWnd); 105 | afx_msg void OnSize(UINT nType, int cx, int cy); 106 | afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); 107 | afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); 108 | afx_msg UINT OnGetDlgCode(); 109 | afx_msg BOOL OnEraseBkgnd(CDC* pDC); 110 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 111 | afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); 112 | afx_msg void OnMouseMove(UINT nFlags, CPoint point); 113 | afx_msg void OnLButtonUp(UINT nFlags, CPoint point); 114 | afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); 115 | afx_msg void OnEditClear(); 116 | afx_msg void OnEditCopy(); 117 | afx_msg void OnEditCut(); 118 | afx_msg void OnEditPaste(); 119 | afx_msg void OnEditSelectAll(); 120 | afx_msg void OnEditUndo(); 121 | //}}AFX_MSG 122 | 123 | DECLARE_MESSAGE_MAP() 124 | }; 125 | -------------------------------------------------------------------------------- /USB HID Demonstrator/src/res/UsbHidDemonstrator.rc2: -------------------------------------------------------------------------------- 1 | // 2 | // USBHIDDEMONSTRATOR.RC2 - resources Microsoft Visual C++ does not edit directly 3 | // 4 | 5 | #ifdef APSTUDIO_INVOKED 6 | #error this file is not editable by Microsoft Visual C++ 7 | #endif //APSTUDIO_INVOKED 8 | 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // Add manually edited resources here... 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | -------------------------------------------------------------------------------- /USB HID Demonstrator/version.txt: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : version.txt 3 | * Author : MCD Application Team 4 | * Version : V1.0.2 5 | * Date : 06/14/2010 6 | * Description : Version file for USB HID Demonstrator 7 | ******************************************************************************** 8 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | 17 | * V1.0.2 - 06/14/2010 18 | ===================== 19 | 20 | New Features 21 | ************ 22 | + Adding support of Set_Report and Set_Feature in output mode 23 | 24 | Enhancements 25 | ************ 26 | + Fix of Output Report stopping after few minutes 27 | 28 | 29 | * V1.0.1 - 06/13/2008 30 | ===================== 31 | + Remove the Firmware License Agreement file 32 | 33 | + Update the source files's header to remove reference to the License 34 | 35 | 36 | * V1.0 - 05/08/2008 37 | ==================== 38 | Created. 39 | 40 | 41 | ******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****** -------------------------------------------------------------------------------- /USBHIDDemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USBHIDDemo.png -------------------------------------------------------------------------------- /USBHIDDemoConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/USBHIDDemoConfig.png -------------------------------------------------------------------------------- /tstHID-STM32F103/RHID.hid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/tstHID-STM32F103/RHID.hid -------------------------------------------------------------------------------- /tstHID-STM32F103/Src/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file main.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 09-September-2013 7 | * @brief RHID demo main file 8 | ****************************************************************************** 9 | */ 10 | 11 | 12 | /* Includes ------------------------------------------------------------------*/ 13 | #include "hw_config.h" 14 | #include "usb_lib.h" 15 | #include "usb_pwr.h" 16 | 17 | /* Private variables ---------------------------------------------------------*/ 18 | __IO uint8_t PrevXferComplete = 1; 19 | 20 | /* Private functions ---------------------------------------------------------*/ 21 | 22 | void Delay(volatile uint32_t nCount) { 23 | for (; nCount != 0; nCount--); 24 | } 25 | 26 | /******************************************************************************* 27 | * Function Name : main. 28 | * Description : main routine. 29 | * Input : None. 30 | * Output : None. 31 | * Return : ************************************************************/ 32 | int main(void) 33 | { 34 | Set_System(); 35 | 36 | USB_Interrupts_Config(); 37 | 38 | Set_USBClock(); 39 | 40 | USB_Init(); 41 | 42 | 43 | while (1) 44 | { 45 | 46 | if (bDeviceState == CONFIGURED) 47 | { 48 | if (PrevXferComplete) 49 | { 50 | RHIDCheckState(); 51 | } 52 | } 53 | } 54 | } 55 | 56 | #ifdef USE_FULL_ASSERT 57 | /******************************************************************************* 58 | * Function Name : assert_failed 59 | * Description : Reports the name of the source file and the source line number 60 | * where the assert_param error has occurred. 61 | * Input : - file: pointer to the source file name 62 | * - line: assert_param error line source number 63 | * Output : None 64 | * Return : None 65 | *******************************************************************************/ 66 | void assert_failed(uint8_t* file, uint32_t line) 67 | { 68 | /* User can add his own implementation to report the file name and line number, 69 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ 70 | 71 | /* Infinite loop */ 72 | while (1) 73 | {} 74 | } 75 | #endif 76 | -------------------------------------------------------------------------------- /tstHID-STM32F103/Src/usb_desc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/tstHID-STM32F103/Src/usb_desc.c -------------------------------------------------------------------------------- /tstHID-STM32F103/Src/usb_endp.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_endp.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Endpoint routines 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "hw_config.h" 31 | #include "usb_desc.h" 32 | #include "usb_lib.h" 33 | #include "usb_istr.h" 34 | 35 | /* Private typedef -----------------------------------------------------------*/ 36 | /* Private define ------------------------------------------------------------*/ 37 | /* Private macro -------------------------------------------------------------*/ 38 | /* Private variables ---------------------------------------------------------*/ 39 | uint8_t Receive_Buffer[9]; 40 | extern __IO uint8_t PrevXferComplete; 41 | extern uint8_t Buffer[RPT4_COUNT+1]; 42 | 43 | /* Private function prototypes -----------------------------------------------*/ 44 | /* Private functions ---------------------------------------------------------*/ 45 | /******************************************************************************* 46 | * Function Name : EP1_OUT_Callback. 47 | * Description : EP1 OUT Callback Routine. 48 | * Input : None. 49 | * Output : None. 50 | * Return : None. 51 | *******************************************************************************/ 52 | void EP1_OUT_Callback(void) 53 | { 54 | BitAction Led_State; 55 | 56 | /* Read received data (2 bytes) */ 57 | USB_SIL_Read(EP1_OUT, Receive_Buffer); 58 | 59 | if (Receive_Buffer[1] == 0) 60 | { 61 | Led_State = Bit_RESET; 62 | } 63 | else 64 | { 65 | Led_State = Bit_SET; 66 | } 67 | 68 | 69 | switch (Receive_Buffer[0]) 70 | { 71 | case 1: /* Led 1 */ 72 | if (Led_State != Bit_RESET) 73 | { 74 | GPIO_SetBits(LED_PORT,LED1_PIN); 75 | } 76 | else 77 | { 78 | GPIO_ResetBits(LED_PORT,LED1_PIN); 79 | } 80 | break; 81 | case 2: /* Led 2 */ 82 | if (Led_State != Bit_RESET) 83 | { 84 | GPIO_SetBits(LED_PORT,LED2_PIN); 85 | } 86 | else 87 | { 88 | GPIO_ResetBits(LED_PORT,LED2_PIN); 89 | } 90 | break; 91 | case 3: /* Led 1&2 */ 92 | Buffer[4]=Receive_Buffer[1]; 93 | break; 94 | } 95 | 96 | SetEPRxStatus(ENDP1, EP_RX_VALID); 97 | } 98 | 99 | /******************************************************************************* 100 | * Function Name : EP1_OUT_Callback. 101 | * Description : EP1 OUT Callback Routine. 102 | * Input : None. 103 | * Output : None. 104 | * Return : None. 105 | *******************************************************************************/ 106 | void EP1_IN_Callback(void) 107 | { 108 | /* Set the transfer complete token to inform upper layer that the current 109 | transfer has been complete */ 110 | PrevXferComplete = 1; 111 | } 112 | 113 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 114 | 115 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/inc/usb_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_def.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Definitions related to USB Core 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_DEF_H 30 | #define __USB_DEF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Exported types ------------------------------------------------------------*/ 34 | typedef enum _RECIPIENT_TYPE 35 | { 36 | DEVICE_RECIPIENT, /* Recipient device */ 37 | INTERFACE_RECIPIENT, /* Recipient interface */ 38 | ENDPOINT_RECIPIENT, /* Recipient endpoint */ 39 | OTHER_RECIPIENT 40 | } RECIPIENT_TYPE; 41 | 42 | 43 | typedef enum _STANDARD_REQUESTS 44 | { 45 | GET_STATUS = 0, 46 | CLEAR_FEATURE, 47 | RESERVED1, 48 | SET_FEATURE, 49 | RESERVED2, 50 | SET_ADDRESS, 51 | GET_DESCRIPTOR, 52 | SET_DESCRIPTOR, 53 | GET_CONFIGURATION, 54 | SET_CONFIGURATION, 55 | GET_INTERFACE, 56 | SET_INTERFACE, 57 | TOTAL_sREQUEST, /* Total number of Standard request */ 58 | SYNCH_FRAME = 12 59 | } STANDARD_REQUESTS; 60 | 61 | /* Definition of "USBwValue" */ 62 | typedef enum _DESCRIPTOR_TYPE 63 | { 64 | DEVICE_DESCRIPTOR = 1, 65 | CONFIG_DESCRIPTOR, 66 | STRING_DESCRIPTOR, 67 | INTERFACE_DESCRIPTOR, 68 | ENDPOINT_DESCRIPTOR 69 | } DESCRIPTOR_TYPE; 70 | 71 | /* Feature selector of a SET_FEATURE or CLEAR_FEATURE */ 72 | typedef enum _FEATURE_SELECTOR 73 | { 74 | ENDPOINT_STALL, 75 | DEVICE_REMOTE_WAKEUP 76 | } FEATURE_SELECTOR; 77 | 78 | /* Exported constants --------------------------------------------------------*/ 79 | /* Definition of "USBbmRequestType" */ 80 | #define REQUEST_TYPE 0x60 /* Mask to get request type */ 81 | #define STANDARD_REQUEST 0x00 /* Standard request */ 82 | #define CLASS_REQUEST 0x20 /* Class request */ 83 | #define VENDOR_REQUEST 0x40 /* Vendor request */ 84 | 85 | #define RECIPIENT 0x1F /* Mask to get recipient */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | /* Exported functions ------------------------------------------------------- */ 89 | 90 | #endif /* __USB_DEF_H */ 91 | 92 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 93 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/inc/usb_init.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_init.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Initialization routines & global variables 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_INIT_H 31 | #define __USB_INIT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void USB_Init(void); 39 | 40 | /* External variables --------------------------------------------------------*/ 41 | /* The number of current endpoint, it will be used to specify an endpoint */ 42 | extern uint8_t EPindex; 43 | /* The number of current device, it is an index to the Device_Table */ 44 | /*extern uint8_t Device_no; */ 45 | /* Points to the DEVICE_INFO structure of current device */ 46 | /* The purpose of this register is to speed up the execution */ 47 | extern DEVICE_INFO* pInformation; 48 | /* Points to the DEVICE_PROP structure of current device */ 49 | /* The purpose of this register is to speed up the execution */ 50 | extern DEVICE_PROP* pProperty; 51 | /* Temporary save the state of Rx & Tx status. */ 52 | /* Whenever the Rx or Tx state is changed, its value is saved */ 53 | /* in this variable first and will be set to the EPRB or EPRA */ 54 | /* at the end of interrupt process */ 55 | extern USER_STANDARD_REQUESTS *pUser_Standard_Requests; 56 | 57 | extern uint16_t SaveState ; 58 | extern uint16_t wInterrupt_Mask; 59 | 60 | #endif /* __USB_INIT_H */ 61 | 62 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 63 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/inc/usb_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_int.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Endpoint CTR (Low and High) interrupt's service routines prototypes 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_INT_H 31 | #define __USB_INT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void CTR_LP(void); 39 | void CTR_HP(void); 40 | 41 | /* External variables --------------------------------------------------------*/ 42 | 43 | #endif /* __USB_INT_H */ 44 | 45 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/inc/usb_lib.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_lib.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief USB library include files 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_LIB_H 31 | #define __USB_LIB_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "hw_config.h" 35 | #include "usb_type.h" 36 | #include "usb_regs.h" 37 | #include "usb_def.h" 38 | #include "usb_core.h" 39 | #include "usb_init.h" 40 | #include "usb_sil.h" 41 | #include "usb_mem.h" 42 | #include "usb_int.h" 43 | 44 | /* Exported types ------------------------------------------------------------*/ 45 | /* Exported constants --------------------------------------------------------*/ 46 | /* Exported macro ------------------------------------------------------------*/ 47 | /* Exported functions ------------------------------------------------------- */ 48 | /* External variables --------------------------------------------------------*/ 49 | 50 | #endif /* __USB_LIB_H */ 51 | 52 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 53 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/inc/usb_mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_mem.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Utility prototypes functions for memory/PMA transfers 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_MEM_H 31 | #define __USB_MEM_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 39 | void PMAToUserBufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 40 | 41 | /* External variables --------------------------------------------------------*/ 42 | 43 | #endif /*__USB_MEM_H*/ 44 | 45 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/inc/usb_sil.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_sil.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Simplified Interface Layer function prototypes. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_SIL_H 31 | #define __USB_SIL_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | 39 | uint32_t USB_SIL_Init(void); 40 | uint32_t USB_SIL_Write(uint8_t bEpAddr, uint8_t* pBufferPointer, uint32_t wBufferSize); 41 | uint32_t USB_SIL_Read(uint8_t bEpAddr, uint8_t* pBufferPointer); 42 | 43 | /* External variables --------------------------------------------------------*/ 44 | 45 | #endif /* __USB_SIL_H */ 46 | 47 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/inc/usb_type.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_type.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Type definitions used by the USB Library 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_TYPE_H 31 | #define __USB_TYPE_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | #ifndef NULL 39 | #define NULL ((void *)0) 40 | #endif 41 | 42 | typedef enum 43 | { 44 | FALSE = 0, TRUE = !FALSE 45 | } 46 | bool; 47 | 48 | /* Exported macro ------------------------------------------------------------*/ 49 | /* Exported functions ------------------------------------------------------- */ 50 | /* External variables --------------------------------------------------------*/ 51 | 52 | #endif /* __USB_TYPE_H */ 53 | 54 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/src/usb_init.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_init.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Initialization routines & global variables 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "usb_lib.h" 31 | 32 | /* Private typedef -----------------------------------------------------------*/ 33 | /* Private define ------------------------------------------------------------*/ 34 | /* Private macro -------------------------------------------------------------*/ 35 | /* Private variables ---------------------------------------------------------*/ 36 | /* The number of current endpoint, it will be used to specify an endpoint */ 37 | uint8_t EPindex; 38 | /* The number of current device, it is an index to the Device_Table */ 39 | /* uint8_t Device_no; */ 40 | /* Points to the DEVICE_INFO structure of current device */ 41 | /* The purpose of this register is to speed up the execution */ 42 | DEVICE_INFO *pInformation; 43 | /* Points to the DEVICE_PROP structure of current device */ 44 | /* The purpose of this register is to speed up the execution */ 45 | DEVICE_PROP *pProperty; 46 | /* Temporary save the state of Rx & Tx status. */ 47 | /* Whenever the Rx or Tx state is changed, its value is saved */ 48 | /* in this variable first and will be set to the EPRB or EPRA */ 49 | /* at the end of interrupt process */ 50 | uint16_t SaveState ; 51 | uint16_t wInterrupt_Mask; 52 | DEVICE_INFO Device_Info; 53 | USER_STANDARD_REQUESTS *pUser_Standard_Requests; 54 | 55 | /* Extern variables ----------------------------------------------------------*/ 56 | /* Private function prototypes -----------------------------------------------*/ 57 | /* Private functions ---------------------------------------------------------*/ 58 | 59 | /******************************************************************************* 60 | * Function Name : USB_Init 61 | * Description : USB system initialization 62 | * Input : None. 63 | * Output : None. 64 | * Return : None. 65 | *******************************************************************************/ 66 | void USB_Init(void) 67 | { 68 | pInformation = &Device_Info; 69 | pInformation->ControlState = 2; 70 | pProperty = &Device_Property; 71 | pUser_Standard_Requests = &User_Standard_Requests; 72 | /* Initialize devices one by one */ 73 | pProperty->Init(); 74 | } 75 | 76 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/src/usb_mem.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_mem.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Utility functions for memory transfers to/from PMA 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usb_lib.h" 30 | 31 | /* Private typedef -----------------------------------------------------------*/ 32 | /* Private define ------------------------------------------------------------*/ 33 | /* Private macro -------------------------------------------------------------*/ 34 | /* Private variables ---------------------------------------------------------*/ 35 | /* Extern variables ----------------------------------------------------------*/ 36 | /* Private function prototypes -----------------------------------------------*/ 37 | /* Private functions ---------------------------------------------------------*/ 38 | 39 | /******************************************************************************* 40 | * Function Name : UserToPMABufferCopy 41 | * Description : Copy a buffer from user memory area to packet memory area (PMA) 42 | * Input : - pbUsrBuf: pointer to user memory area. 43 | * - wPMABufAddr: address into PMA. 44 | * - wNBytes: no. of bytes to be copied. 45 | * Output : None. 46 | * Return : None . 47 | *******************************************************************************/ 48 | void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) 49 | { 50 | uint32_t n = (wNBytes + 1) >> 1; /* n = (wNBytes + 1) / 2 */ 51 | uint32_t i, temp1, temp2; 52 | uint16_t *pdwVal; 53 | pdwVal = (uint16_t *)(wPMABufAddr * 2 + PMAAddr); 54 | for (i = n; i != 0; i--) 55 | { 56 | temp1 = (uint16_t) * pbUsrBuf; 57 | pbUsrBuf++; 58 | temp2 = temp1 | (uint16_t) * pbUsrBuf << 8; 59 | *pdwVal++ = temp2; 60 | pdwVal++; 61 | pbUsrBuf++; 62 | } 63 | } 64 | 65 | /******************************************************************************* 66 | * Function Name : PMAToUserBufferCopy 67 | * Description : Copy a buffer from user memory area to packet memory area (PMA) 68 | * Input : - pbUsrBuf = pointer to user memory area. 69 | * - wPMABufAddr = address into PMA. 70 | * - wNBytes = no. of bytes to be copied. 71 | * Output : None. 72 | * Return : None. 73 | *******************************************************************************/ 74 | void PMAToUserBufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) 75 | { 76 | uint32_t n = (wNBytes + 1) >> 1;/* /2*/ 77 | uint32_t i; 78 | uint32_t *pdwVal; 79 | pdwVal = (uint32_t *)(wPMABufAddr * 2 + PMAAddr); 80 | for (i = n; i != 0; i--) 81 | { 82 | *(uint16_t*)pbUsrBuf++ = *pdwVal++; 83 | pbUsrBuf++; 84 | } 85 | } 86 | 87 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 88 | -------------------------------------------------------------------------------- /tstHID-STM32F103/USB-FS/src/usb_sil.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_sil.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Simplified Interface Layer for Global Initialization and Endpoint 8 | * Rea/Write operations. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "usb_lib.h" 32 | 33 | /* Private typedef -----------------------------------------------------------*/ 34 | /* Private define ------------------------------------------------------------*/ 35 | /* Private macro -------------------------------------------------------------*/ 36 | /* Private variables ---------------------------------------------------------*/ 37 | /* Extern variables ----------------------------------------------------------*/ 38 | /* Private function prototypes -----------------------------------------------*/ 39 | /* Private functions ---------------------------------------------------------*/ 40 | 41 | /******************************************************************************* 42 | * Function Name : USB_SIL_Init 43 | * Description : Initialize the USB Device IP and the Endpoint 0. 44 | * Input : None. 45 | * Output : None. 46 | * Return : Status. 47 | *******************************************************************************/ 48 | uint32_t USB_SIL_Init(void) 49 | { 50 | /* USB interrupts initialization */ 51 | /* clear pending interrupts */ 52 | _SetISTR(0); 53 | wInterrupt_Mask = IMR_MSK; 54 | /* set interrupts mask */ 55 | _SetCNTR(wInterrupt_Mask); 56 | return 0; 57 | } 58 | 59 | /******************************************************************************* 60 | * Function Name : USB_SIL_Write 61 | * Description : Write a buffer of data to a selected endpoint. 62 | * Input : - bEpAddr: The address of the non control endpoint. 63 | * - pBufferPointer: The pointer to the buffer of data to be written 64 | * to the endpoint. 65 | * - wBufferSize: Number of data to be written (in bytes). 66 | * Output : None. 67 | * Return : Status. 68 | *******************************************************************************/ 69 | uint32_t USB_SIL_Write(uint8_t bEpAddr, uint8_t* pBufferPointer, uint32_t wBufferSize) 70 | { 71 | /* Use the memory interface function to write to the selected endpoint */ 72 | UserToPMABufferCopy(pBufferPointer, GetEPTxAddr(bEpAddr & 0x7F), wBufferSize); 73 | 74 | /* Update the data length in the control register */ 75 | SetEPTxCount((bEpAddr & 0x7F), wBufferSize); 76 | 77 | return 0; 78 | } 79 | 80 | /******************************************************************************* 81 | * Function Name : USB_SIL_Read 82 | * Description : Write a buffer of data to a selected endpoint. 83 | * Input : - bEpAddr: The address of the non control endpoint. 84 | * - pBufferPointer: The pointer to which will be saved the 85 | * received data buffer. 86 | * Output : None. 87 | * Return : Number of received data (in Bytes). 88 | *******************************************************************************/ 89 | uint32_t USB_SIL_Read(uint8_t bEpAddr, uint8_t* pBufferPointer) 90 | { 91 | uint32_t DataLength = 0; 92 | 93 | /* Get the number of received data on the selected Endpoint */ 94 | DataLength = GetEPRxCount(bEpAddr & 0x7F); 95 | 96 | /* Use the memory interface function to write to the selected endpoint */ 97 | PMAToUserBufferCopy(pBufferPointer, GetEPRxAddr(bEpAddr & 0x7F), DataLength); 98 | 99 | /* Return the number of received data */ 100 | return DataLength; 101 | } 102 | 103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 104 | -------------------------------------------------------------------------------- /tstHID-STM32F103/cmsis_boot/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/tstHID-STM32F103/cmsis_boot/stm32f10x.h -------------------------------------------------------------------------------- /tstHID-STM32F103/cmsis_boot/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_CONF_H 31 | #define __STM32F10x_CONF_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Uncomment the line below to enable peripheral header file inclusion */ 35 | //#include "stm32f10x_adc.h" 36 | //#include "stm32f10x_bkp.h" 37 | //#include "stm32f10x_can.h" 38 | //#include "stm32f10x_crc.h" 39 | //#include "stm32f10x_dac.h" 40 | //#include "stm32f10x_dbgmcu.h" 41 | //#include "stm32f10x_dma.h" 42 | #include "stm32f10x_exti.h" 43 | //#include "stm32f10x_flash.h" 44 | //#include "stm32f10x_fsmc.h" 45 | #include "stm32f10x_gpio.h" 46 | //#include "stm32f10x_i2c.h" 47 | //#include "stm32f10x_iwdg.h" 48 | #include "stm32f10x_pwr.h" 49 | #include "stm32f10x_rcc.h" 50 | //#include "stm32f10x_rtc.h" 51 | //#include "stm32f10x_sdio.h" 52 | //#include "stm32f10x_spi.h" 53 | #include "stm32f10x_tim.h" 54 | #include "stm32f10x_usart.h" 55 | //#include "stm32f10x_wwdg.h" 56 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Uncomment the line below to expanse the "assert_param" macro in the 61 | Standard Peripheral Library drivers code */ 62 | /* #define USE_FULL_ASSERT 1 */ 63 | 64 | /* Exported macro ------------------------------------------------------------*/ 65 | #ifdef USE_FULL_ASSERT 66 | 67 | /******************************************************************************* 68 | * Macro Name : assert_param 69 | * Description : The assert_param macro is used for function's parameters check. 70 | * Input : - expr: If expr is false, it calls assert_failed function 71 | * which reports the name of the source file and the source 72 | * line number of the call that failed. 73 | * If expr is true, it returns no value. 74 | * Return : None 75 | *******************************************************************************/ 76 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 77 | /* Exported functions ------------------------------------------------------- */ 78 | void assert_failed(uint8_t* file, uint32_t line); 79 | #else 80 | #define assert_param(expr) ((void)0) 81 | #endif /* USE_FULL_ASSERT */ 82 | 83 | #endif /* __STM32F10x_CONF_H */ 84 | 85 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 86 | -------------------------------------------------------------------------------- /tstHID-STM32F103/cmsis_boot/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /tstHID-STM32F103/gcc_arm.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | MEMORY 3 | { 4 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x10000 /* 64k */ 5 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x05000 /* 20k */ 6 | } 7 | 8 | /* Linker script to place sections and symbol values. Should be used together 9 | * with other linker script that defines memory regions FLASH and RAM. 10 | * It references following symbols, which must be defined in code: 11 | * Reset_Handler : Entry of reset handler 12 | * 13 | * It defines following symbols, which code can use without definition: 14 | * __exidx_start 15 | * __exidx_end 16 | * __etext 17 | * __data_start__ 18 | * __preinit_array_start 19 | * __preinit_array_end 20 | * __init_array_start 21 | * __init_array_end 22 | * __fini_array_start 23 | * __fini_array_end 24 | * __data_end__ 25 | * __bss_start__ 26 | * __bss_end__ 27 | * __end__ 28 | * end 29 | * __HeapLimit 30 | * __StackLimit 31 | * __StackTop 32 | * __stack 33 | */ 34 | ENTRY(Reset_Handler) 35 | 36 | SECTIONS 37 | { 38 | .text : 39 | { 40 | KEEP(*(.isr_vector)) 41 | *(.text*) 42 | 43 | KEEP(*(.init)) 44 | KEEP(*(.fini)) 45 | 46 | /* .ctors */ 47 | *crtbegin.o(.ctors) 48 | *crtbegin?.o(.ctors) 49 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) 50 | *(SORT(.ctors.*)) 51 | *(.ctors) 52 | 53 | /* .dtors */ 54 | *crtbegin.o(.dtors) 55 | *crtbegin?.o(.dtors) 56 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) 57 | *(SORT(.dtors.*)) 58 | *(.dtors) 59 | 60 | *(.rodata*) 61 | 62 | KEEP(*(.eh_frame*)) 63 | } > FLASH 64 | 65 | .ARM.extab : 66 | { 67 | *(.ARM.extab* .gnu.linkonce.armextab.*) 68 | } > FLASH 69 | 70 | __exidx_start = .; 71 | .ARM.exidx : 72 | { 73 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) 74 | } > FLASH 75 | __exidx_end = .; 76 | 77 | __etext = .; 78 | 79 | .data : AT (__etext) 80 | { 81 | __data_start__ = .; 82 | *(vtable) 83 | *(.data*) 84 | 85 | . = ALIGN(4); 86 | /* preinit data */ 87 | PROVIDE_HIDDEN (__preinit_array_start = .); 88 | KEEP(*(.preinit_array)) 89 | PROVIDE_HIDDEN (__preinit_array_end = .); 90 | 91 | . = ALIGN(4); 92 | /* init data */ 93 | PROVIDE_HIDDEN (__init_array_start = .); 94 | KEEP(*(SORT(.init_array.*))) 95 | KEEP(*(.init_array)) 96 | PROVIDE_HIDDEN (__init_array_end = .); 97 | 98 | 99 | . = ALIGN(4); 100 | /* finit data */ 101 | PROVIDE_HIDDEN (__fini_array_start = .); 102 | KEEP(*(SORT(.fini_array.*))) 103 | KEEP(*(.fini_array)) 104 | PROVIDE_HIDDEN (__fini_array_end = .); 105 | 106 | . = ALIGN(4); 107 | /* All data end */ 108 | __data_end__ = .; 109 | 110 | } > RAM 111 | 112 | .bss : 113 | { 114 | __bss_start__ = .; 115 | *(.bss*) 116 | *(COMMON) 117 | __bss_end__ = .; 118 | } > RAM 119 | 120 | .heap : 121 | { 122 | __end__ = .; 123 | end = __end__; 124 | *(.heap*) 125 | __HeapLimit = .; 126 | } > RAM 127 | 128 | /* .stack_dummy section doesn't contains any symbols. It is only 129 | * used for linker to calculate size of stack sections, and assign 130 | * values to stack symbols later */ 131 | .stack_dummy : 132 | { 133 | *(.stack) 134 | } > RAM 135 | 136 | /* Set stack top to end of RAM, and stack limit move down by 137 | * size of stack_dummy section */ 138 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); 139 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); 140 | PROVIDE(__stack = __StackTop); 141 | 142 | /* Check if data + heap + stack exceeds RAM limit */ 143 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") 144 | } 145 | -------------------------------------------------------------------------------- /tstHID-STM32F103/inc/hw_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file hw_config.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Hardware Configuration & Setup 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __HW_CONFIG_H 31 | #define __HW_CONFIG_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "platform_config.h" 35 | #include "usb_type.h" 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | /* Exported constants --------------------------------------------------------*/ 39 | /* Exported macro ------------------------------------------------------------*/ 40 | /* Exported define -----------------------------------------------------------*/ 41 | 42 | /* Exported functions ------------------------------------------------------- */ 43 | void Set_System(void); 44 | void Set_USBClock(void); 45 | void GPIO_AINConfig(void); 46 | void Enter_LowPowerMode(void); 47 | void Leave_LowPowerMode(void); 48 | void USB_Interrupts_Config(void); 49 | void USB_Cable_Config (FunctionalState NewState); 50 | void RHID_Send(uint8_t report, uint8_t state); 51 | uint8_t RHIDCheckState(void); 52 | void Get_SerialNum(void); 53 | 54 | #endif /*__HW_CONFIG_H*/ 55 | 56 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 57 | -------------------------------------------------------------------------------- /tstHID-STM32F103/inc/stm32_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_it.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32_IT_H 31 | #define __STM32_IT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "platform_config.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void NMI_Handler(void); 42 | void HardFault_Handler(void); 43 | void MemManage_Handler(void); 44 | void BusFault_Handler(void); 45 | void UsageFault_Handler(void); 46 | void SVC_Handler(void); 47 | void DebugMon_Handler(void); 48 | void PendSV_Handler(void); 49 | void SysTick_Handler(void); 50 | void USB_LP_CAN1_RX0_IRQHandler(void); 51 | void USBWakeUp_IRQHandler(void); 52 | 53 | #endif /* __STM32_IT_H */ 54 | 55 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 56 | 57 | 58 | -------------------------------------------------------------------------------- /tstHID-STM32F103/inc/usb_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 09-September-2013 7 | * @brief RHID demo configuration file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_CONF_H 31 | #define __USB_CONF_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | /* External variables --------------------------------------------------------*/ 39 | /*-------------------------------------------------------------*/ 40 | /* EP_NUM */ 41 | /* defines how many endpoints are used by the device */ 42 | /*-------------------------------------------------------------*/ 43 | #define EP_NUM (2) 44 | 45 | /*-------------------------------------------------------------*/ 46 | /* -------------- Buffer Description Table -----------------*/ 47 | /*-------------------------------------------------------------*/ 48 | /* buffer table base address */ 49 | /* buffer table base address */ 50 | #define BTABLE_ADDRESS (0x00) 51 | 52 | /* EP0 */ 53 | /* rx/tx buffer base address */ 54 | #define ENDP0_RXADDR (0x18) 55 | #define ENDP0_TXADDR (0x58) 56 | 57 | /* EP1 */ 58 | /* tx buffer base address */ 59 | #define ENDP1_TXADDR (0x100) 60 | #define ENDP1_RXADDR (0x140) 61 | 62 | 63 | /*-------------------------------------------------------------*/ 64 | /* ------------------- ISTR events -------------------------*/ 65 | /*-------------------------------------------------------------*/ 66 | /* IMR_MSK */ 67 | /* mask defining which events has to be handled */ 68 | /* by the device application software */ 69 | #define IMR_MSK (CNTR_CTRM | CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM \ 70 | | CNTR_ESOFM | CNTR_RESETM ) 71 | 72 | /* CTR service routines */ 73 | /* associated to defined endpoints */ 74 | /* #define EP1_IN_Callback NOP_Process*/ 75 | #define EP2_IN_Callback NOP_Process 76 | #define EP3_IN_Callback NOP_Process 77 | #define EP4_IN_Callback NOP_Process 78 | #define EP5_IN_Callback NOP_Process 79 | #define EP6_IN_Callback NOP_Process 80 | #define EP7_IN_Callback NOP_Process 81 | 82 | //#define EP1_OUT_Callback NOP_Process 83 | #define EP2_OUT_Callback NOP_Process 84 | #define EP3_OUT_Callback NOP_Process 85 | #define EP4_OUT_Callback NOP_Process 86 | #define EP5_OUT_Callback NOP_Process 87 | #define EP6_OUT_Callback NOP_Process 88 | #define EP7_OUT_Callback NOP_Process 89 | 90 | #endif /*__USB_CONF_H*/ 91 | 92 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 93 | -------------------------------------------------------------------------------- /tstHID-STM32F103/inc/usb_desc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_desc.h 4 | * @author MCD Application Team 5 | * @version V3.4.0 6 | * @date 09-September-2013 7 | * @brief Descriptor Header for RHID Demo 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_DESC_H 31 | #define __USB_DESC_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported define -----------------------------------------------------------*/ 38 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 39 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 40 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 41 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 42 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 43 | 44 | #define HID_DESCRIPTOR_TYPE 0x21 45 | #define HID_REPORT_DESCRIPTOR_TYPE 0x22 46 | 47 | #define RHID_SIZ_HID_DESC 0x09 48 | #define RHID_OFF_HID_DESC 0x12 49 | 50 | #define RHID_SIZ_DEVICE_DESC 18 51 | #define RHID_SIZ_CONFIG_DESC 41 52 | #define RHID_SIZ_REPORT_DESC 79 53 | #define RHID_SIZ_STRING_LANGID 4 54 | #define RHID_SIZ_STRING_VENDOR 10 55 | #define RHID_SIZ_STRING_PRODUCT 22 56 | #define RHID_SIZ_STRING_SERIAL 26 57 | 58 | #define STANDARD_ENDPOINT_DESC_SIZE 0x09 59 | 60 | #define DEVICE_VER_H 0x01 61 | #define DEVICE_VER_L 0x00 62 | 63 | //HID Maximum packet size in bytes 64 | #define wMaxPacketSize 0x40 65 | #define EP1TxCount wMaxPacketSize 66 | #define EP1RxCount 2 67 | 68 | #define RPT3_COUNT 0x01 //PC->STM32 69 | #define RPT4_COUNT 0x04 //STM32->PC 70 | 71 | /* Exported functions ------------------------------------------------------- */ 72 | extern const uint8_t RHID_DeviceDescriptor[RHID_SIZ_DEVICE_DESC]; 73 | extern const uint8_t RHID_ConfigDescriptor[RHID_SIZ_CONFIG_DESC]; 74 | extern const uint8_t RHID_ReportDescriptor[RHID_SIZ_REPORT_DESC]; 75 | extern const uint8_t RHID_StringLangID[RHID_SIZ_STRING_LANGID]; 76 | extern const uint8_t RHID_StringVendor[RHID_SIZ_STRING_VENDOR]; 77 | extern const uint8_t RHID_StringProduct[RHID_SIZ_STRING_PRODUCT]; 78 | extern uint8_t RHID_StringSerial[RHID_SIZ_STRING_SERIAL]; 79 | 80 | #endif /* __USB_DESC_H */ 81 | 82 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 83 | -------------------------------------------------------------------------------- /tstHID-STM32F103/inc/usb_istr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_istr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file includes the peripherals header files in the user application. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_ISTR_H 31 | #define __USB_ISTR_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void USB_Istr(void); 42 | 43 | /* function prototypes Automatically built defining related macros */ 44 | 45 | void EP1_IN_Callback(void); 46 | void EP2_IN_Callback(void); 47 | void EP3_IN_Callback(void); 48 | void EP4_IN_Callback(void); 49 | void EP5_IN_Callback(void); 50 | void EP6_IN_Callback(void); 51 | void EP7_IN_Callback(void); 52 | 53 | void EP1_OUT_Callback(void); 54 | void EP2_OUT_Callback(void); 55 | void EP3_OUT_Callback(void); 56 | void EP4_OUT_Callback(void); 57 | void EP5_OUT_Callback(void); 58 | void EP6_OUT_Callback(void); 59 | void EP7_OUT_Callback(void); 60 | 61 | #ifdef CTR_CALLBACK 62 | void CTR_Callback(void); 63 | #endif 64 | 65 | #ifdef DOVR_CALLBACK 66 | void DOVR_Callback(void); 67 | #endif 68 | 69 | #ifdef ERR_CALLBACK 70 | void ERR_Callback(void); 71 | #endif 72 | 73 | #ifdef WKUP_CALLBACK 74 | void WKUP_Callback(void); 75 | #endif 76 | 77 | #ifdef SUSP_CALLBACK 78 | void SUSP_Callback(void); 79 | #endif 80 | 81 | #ifdef RESET_CALLBACK 82 | void RESET_Callback(void); 83 | #endif 84 | 85 | #ifdef SOF_CALLBACK 86 | void SOF_Callback(void); 87 | #endif 88 | 89 | #ifdef ESOF_CALLBACK 90 | void ESOF_Callback(void); 91 | #endif 92 | 93 | #endif /*__USB_ISTR_H*/ 94 | 95 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 96 | -------------------------------------------------------------------------------- /tstHID-STM32F103/inc/usb_prop.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_prop.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief All processing related to HID demo 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_PROP_H 31 | #define __USB_PROP_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | typedef enum _HID_REQUESTS 36 | { 37 | GET_REPORT = 1, 38 | GET_IDLE, 39 | GET_PROTOCOL, 40 | 41 | SET_REPORT = 9, 42 | SET_IDLE, 43 | SET_PROTOCOL 44 | } HID_REQUESTS; 45 | 46 | /* Exported constants --------------------------------------------------------*/ 47 | /* Exported macro ------------------------------------------------------------*/ 48 | /* Exported functions ------------------------------------------------------- */ 49 | void HID_init(void); 50 | void HID_Reset(void); 51 | void HID_SetConfiguration(void); 52 | void HID_SetDeviceAddress (void); 53 | void HID_Status_In (void); 54 | void HID_Status_Out (void); 55 | RESULT HID_Data_Setup(uint8_t); 56 | RESULT HID_NoData_Setup(uint8_t); 57 | RESULT HID_Get_Interface_Setting(uint8_t Interface, uint8_t AlternateSetting); 58 | uint8_t *HID_GetDeviceDescriptor(uint16_t ); 59 | uint8_t *HID_GetConfigDescriptor(uint16_t); 60 | uint8_t *HID_GetStringDescriptor(uint16_t); 61 | RESULT HID_SetProtocol(void); 62 | uint8_t *HID_GetProtocolValue(uint16_t Length); 63 | RESULT HID_SetProtocol(void); 64 | uint8_t *HID_GetReportDescriptor(uint16_t Length); 65 | uint8_t *HID_GetHIDDescriptor(uint16_t Length); 66 | 67 | /* Exported define -----------------------------------------------------------*/ 68 | #define HID_GetConfiguration NOP_Process 69 | //#define HID_SetConfiguration NOP_Process 70 | #define HID_GetInterface NOP_Process 71 | #define HID_SetInterface NOP_Process 72 | #define HID_GetStatus NOP_Process 73 | #define HID_ClearFeature NOP_Process 74 | #define HID_SetEndPointFeature NOP_Process 75 | #define HID_SetDeviceFeature NOP_Process 76 | //#define HID_SetDeviceAddress NOP_Process 77 | 78 | #define REPORT_DESCRIPTOR 0x22 79 | 80 | #endif /* __USB_PROP_H */ 81 | 82 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 83 | -------------------------------------------------------------------------------- /tstHID-STM32F103/inc/usb_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_pwr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Connection/disconnection & power management header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_PWR_H 31 | #define __USB_PWR_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | typedef enum _RESUME_STATE 36 | { 37 | RESUME_EXTERNAL, 38 | RESUME_INTERNAL, 39 | RESUME_LATER, 40 | RESUME_WAIT, 41 | RESUME_START, 42 | RESUME_ON, 43 | RESUME_OFF, 44 | RESUME_ESOF 45 | } RESUME_STATE; 46 | 47 | typedef enum _DEVICE_STATE 48 | { 49 | UNCONNECTED, 50 | ATTACHED, 51 | POWERED, 52 | SUSPENDED, 53 | ADDRESSED, 54 | CONFIGURED 55 | } DEVICE_STATE; 56 | 57 | /* Exported constants --------------------------------------------------------*/ 58 | /* Exported macro ------------------------------------------------------------*/ 59 | /* Exported functions ------------------------------------------------------- */ 60 | void Suspend(void); 61 | void Resume_Init(void); 62 | void Resume(RESUME_STATE eResumeSetVal); 63 | RESULT PowerOn(void); 64 | RESULT PowerOff(void); 65 | /* External variables --------------------------------------------------------*/ 66 | extern __IO uint32_t bDeviceState; /* USB device status */ 67 | extern __IO bool fSuspendEnabled; /* true when suspend is possible */ 68 | 69 | #endif /*__USB_PWR_H*/ 70 | 71 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 72 | -------------------------------------------------------------------------------- /tstHID-STM32F103/readme.txt: -------------------------------------------------------------------------------- 1 | You have to set the correct memory layout for your device in the linker script. 2 | Please check the FLASH and SRAM length. 3 | 4 | e.g. 5 | 6 | 7 | MEMORY 8 | { 9 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x08000 /* 32k */ 10 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x01000 /* 4k */ 11 | } -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_CRC_H 31 | #define __STM32F10x_CRC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup CRC 45 | * @{ 46 | */ 47 | 48 | /** @defgroup CRC_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup CRC_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup CRC_Exported_Macros 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup CRC_Exported_Functions 73 | * @{ 74 | */ 75 | 76 | void CRC_ResetDR(void); 77 | uint32_t CRC_CalcCRC(uint32_t Data); 78 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 79 | uint32_t CRC_GetCRC(void); 80 | void CRC_SetIDRegister(uint8_t IDValue); 81 | uint8_t CRC_GetIDRegister(void); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif /* __STM32F10x_CRC_H */ 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 101 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/inc/stm32f10x_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the DBGMCU 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_DBGMCU_H 31 | #define __STM32F10x_DBGMCU_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup DBGMCU 45 | * @{ 46 | */ 47 | 48 | /** @defgroup DBGMCU_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup DBGMCU_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 61 | #define DBGMCU_STOP ((uint32_t)0x00000002) 62 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 63 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) 64 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) 65 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) 66 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) 67 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) 68 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) 69 | #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) 70 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) 71 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) 72 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) 73 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) 74 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) 75 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) 76 | #define DBGMCU_CAN2_STOP ((uint32_t)0x00200000) 77 | #define DBGMCU_TIM15_STOP ((uint32_t)0x00400000) 78 | #define DBGMCU_TIM16_STOP ((uint32_t)0x00800000) 79 | #define DBGMCU_TIM17_STOP ((uint32_t)0x01000000) 80 | #define DBGMCU_TIM12_STOP ((uint32_t)0x02000000) 81 | #define DBGMCU_TIM13_STOP ((uint32_t)0x04000000) 82 | #define DBGMCU_TIM14_STOP ((uint32_t)0x08000000) 83 | #define DBGMCU_TIM9_STOP ((uint32_t)0x10000000) 84 | #define DBGMCU_TIM10_STOP ((uint32_t)0x20000000) 85 | #define DBGMCU_TIM11_STOP ((uint32_t)0x40000000) 86 | 87 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0x800000F8) == 0x00) && ((PERIPH) != 0x00)) 88 | /** 89 | * @} 90 | */ 91 | 92 | /** @defgroup DBGMCU_Exported_Macros 93 | * @{ 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @defgroup DBGMCU_Exported_Functions 101 | * @{ 102 | */ 103 | 104 | uint32_t DBGMCU_GetREVID(void); 105 | uint32_t DBGMCU_GetDEVID(void); 106 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif /* __STM32F10x_DBGMCU_H */ 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 126 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/inc/stm32f10x_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_IWDG_H 31 | #define __STM32F10x_IWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup IWDG 45 | * @{ 46 | */ 47 | 48 | /** @defgroup IWDG_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup IWDG_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup IWDG_WriteAccess 61 | * @{ 62 | */ 63 | 64 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 65 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 66 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 67 | ((ACCESS) == IWDG_WriteAccess_Disable)) 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup IWDG_prescaler 73 | * @{ 74 | */ 75 | 76 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 77 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 78 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 79 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 80 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 81 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 82 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 83 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 84 | ((PRESCALER) == IWDG_Prescaler_8) || \ 85 | ((PRESCALER) == IWDG_Prescaler_16) || \ 86 | ((PRESCALER) == IWDG_Prescaler_32) || \ 87 | ((PRESCALER) == IWDG_Prescaler_64) || \ 88 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 89 | ((PRESCALER) == IWDG_Prescaler_256)) 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup IWDG_Flag 95 | * @{ 96 | */ 97 | 98 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 99 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 100 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 101 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 102 | /** 103 | * @} 104 | */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** @defgroup IWDG_Exported_Macros 111 | * @{ 112 | */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** @defgroup IWDG_Exported_Functions 119 | * @{ 120 | */ 121 | 122 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 123 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 124 | void IWDG_SetReload(uint16_t Reload); 125 | void IWDG_ReloadCounter(void); 126 | void IWDG_Enable(void); 127 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 128 | 129 | #ifdef __cplusplus 130 | } 131 | #endif 132 | 133 | #endif /* __STM32F10x_IWDG_H */ 134 | /** 135 | * @} 136 | */ 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 147 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/inc/stm32f10x_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_pwr.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the PWR firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_PWR_H 31 | #define __STM32F10x_PWR_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup PWR 45 | * @{ 46 | */ 47 | 48 | /** @defgroup PWR_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup PWR_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup PVD_detection_level 61 | * @{ 62 | */ 63 | 64 | #define PWR_PVDLevel_2V2 ((uint32_t)0x00000000) 65 | #define PWR_PVDLevel_2V3 ((uint32_t)0x00000020) 66 | #define PWR_PVDLevel_2V4 ((uint32_t)0x00000040) 67 | #define PWR_PVDLevel_2V5 ((uint32_t)0x00000060) 68 | #define PWR_PVDLevel_2V6 ((uint32_t)0x00000080) 69 | #define PWR_PVDLevel_2V7 ((uint32_t)0x000000A0) 70 | #define PWR_PVDLevel_2V8 ((uint32_t)0x000000C0) 71 | #define PWR_PVDLevel_2V9 ((uint32_t)0x000000E0) 72 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \ 73 | ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \ 74 | ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \ 75 | ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9)) 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup Regulator_state_is_STOP_mode 81 | * @{ 82 | */ 83 | 84 | #define PWR_Regulator_ON ((uint32_t)0x00000000) 85 | #define PWR_Regulator_LowPower ((uint32_t)0x00000001) 86 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 87 | ((REGULATOR) == PWR_Regulator_LowPower)) 88 | /** 89 | * @} 90 | */ 91 | 92 | /** @defgroup STOP_mode_entry 93 | * @{ 94 | */ 95 | 96 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) 97 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) 98 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @defgroup PWR_Flag 105 | * @{ 106 | */ 107 | 108 | #define PWR_FLAG_WU ((uint32_t)0x00000001) 109 | #define PWR_FLAG_SB ((uint32_t)0x00000002) 110 | #define PWR_FLAG_PVDO ((uint32_t)0x00000004) 111 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 112 | ((FLAG) == PWR_FLAG_PVDO)) 113 | 114 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** @defgroup PWR_Exported_Macros 124 | * @{ 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** @defgroup PWR_Exported_Functions 132 | * @{ 133 | */ 134 | 135 | void PWR_DeInit(void); 136 | void PWR_BackupAccessCmd(FunctionalState NewState); 137 | void PWR_PVDCmd(FunctionalState NewState); 138 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 139 | void PWR_WakeUpPinCmd(FunctionalState NewState); 140 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 141 | void PWR_EnterSTANDBYMode(void); 142 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 143 | void PWR_ClearFlag(uint32_t PWR_FLAG); 144 | 145 | #ifdef __cplusplus 146 | } 147 | #endif 148 | 149 | #endif /* __STM32F10x_PWR_H */ 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 163 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/inc/stm32f10x_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_rtc.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the RTC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_RTC_H 31 | #define __STM32F10x_RTC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup RTC 45 | * @{ 46 | */ 47 | 48 | /** @defgroup RTC_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup RTC_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup RTC_interrupts_define 61 | * @{ 62 | */ 63 | 64 | #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ 65 | #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ 66 | #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ 67 | #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 68 | #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 69 | ((IT) == RTC_IT_SEC)) 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup RTC_interrupts_flags 75 | * @{ 76 | */ 77 | 78 | #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ 79 | #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ 80 | #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ 81 | #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ 82 | #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ 83 | #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 84 | #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 85 | ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 86 | ((FLAG) == RTC_FLAG_SEC)) 87 | #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** @defgroup RTC_Exported_Macros 98 | * @{ 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /** @defgroup RTC_Exported_Functions 106 | * @{ 107 | */ 108 | 109 | void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 110 | void RTC_EnterConfigMode(void); 111 | void RTC_ExitConfigMode(void); 112 | uint32_t RTC_GetCounter(void); 113 | void RTC_SetCounter(uint32_t CounterValue); 114 | void RTC_SetPrescaler(uint32_t PrescalerValue); 115 | void RTC_SetAlarm(uint32_t AlarmValue); 116 | uint32_t RTC_GetDivider(void); 117 | void RTC_WaitForLastTask(void); 118 | void RTC_WaitForSynchro(void); 119 | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 120 | void RTC_ClearFlag(uint16_t RTC_FLAG); 121 | ITStatus RTC_GetITStatus(uint16_t RTC_IT); 122 | void RTC_ClearITPendingBit(uint16_t RTC_IT); 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | 128 | #endif /* __STM32F10x_RTC_H */ 129 | /** 130 | * @} 131 | */ 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /** 138 | * @} 139 | */ 140 | 141 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 142 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/inc/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_WWDG_H 31 | #define __STM32F10x_WWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup WWDG 45 | * @{ 46 | */ 47 | 48 | /** @defgroup WWDG_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup WWDG_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup WWDG_Prescaler 61 | * @{ 62 | */ 63 | 64 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 65 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 66 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 67 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 68 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 69 | ((PRESCALER) == WWDG_Prescaler_2) || \ 70 | ((PRESCALER) == WWDG_Prescaler_4) || \ 71 | ((PRESCALER) == WWDG_Prescaler_8)) 72 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 73 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup WWDG_Exported_Macros 84 | * @{ 85 | */ 86 | /** 87 | * @} 88 | */ 89 | 90 | /** @defgroup WWDG_Exported_Functions 91 | * @{ 92 | */ 93 | 94 | void WWDG_DeInit(void); 95 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 96 | void WWDG_SetWindowValue(uint8_t WindowValue); 97 | void WWDG_EnableIT(void); 98 | void WWDG_SetCounter(uint8_t Counter); 99 | void WWDG_Enable(uint8_t Counter); 100 | FlagStatus WWDG_GetFlagStatus(void); 101 | void WWDG_ClearFlag(void); 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif /* __STM32F10x_WWDG_H */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/src/stm32f10x_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.c 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file provides all the CRC firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f10x_crc.h" 30 | 31 | /** @addtogroup STM32F10x_StdPeriph_Driver 32 | * @{ 33 | */ 34 | 35 | /** @defgroup CRC 36 | * @brief CRC driver modules 37 | * @{ 38 | */ 39 | 40 | /** @defgroup CRC_Private_TypesDefinitions 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | /** @defgroup CRC_Private_Defines 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup CRC_Private_Macros 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup CRC_Private_Variables 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup CRC_Private_FunctionPrototypes 73 | * @{ 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup CRC_Private_Functions 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @brief Resets the CRC Data register (DR). 86 | * @param None 87 | * @retval None 88 | */ 89 | void CRC_ResetDR(void) 90 | { 91 | /* Reset CRC generator */ 92 | CRC->CR = CRC_CR_RESET; 93 | } 94 | 95 | /** 96 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 97 | * @param Data: data word(32-bit) to compute its CRC 98 | * @retval 32-bit CRC 99 | */ 100 | uint32_t CRC_CalcCRC(uint32_t Data) 101 | { 102 | CRC->DR = Data; 103 | 104 | return (CRC->DR); 105 | } 106 | 107 | /** 108 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 109 | * @param pBuffer: pointer to the buffer containing the data to be computed 110 | * @param BufferLength: length of the buffer to be computed 111 | * @retval 32-bit CRC 112 | */ 113 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 114 | { 115 | uint32_t index = 0; 116 | 117 | for(index = 0; index < BufferLength; index++) 118 | { 119 | CRC->DR = pBuffer[index]; 120 | } 121 | return (CRC->DR); 122 | } 123 | 124 | /** 125 | * @brief Returns the current CRC value. 126 | * @param None 127 | * @retval 32-bit CRC 128 | */ 129 | uint32_t CRC_GetCRC(void) 130 | { 131 | return (CRC->DR); 132 | } 133 | 134 | /** 135 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 136 | * @param IDValue: 8-bit value to be stored in the ID register 137 | * @retval None 138 | */ 139 | void CRC_SetIDRegister(uint8_t IDValue) 140 | { 141 | CRC->IDR = IDValue; 142 | } 143 | 144 | /** 145 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 146 | * @param None 147 | * @retval 8-bit value of the ID register 148 | */ 149 | uint8_t CRC_GetIDRegister(void) 150 | { 151 | return (CRC->IDR); 152 | } 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 167 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/src/stm32f10x_dbgmcu.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.c 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file provides all the DBGMCU firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f10x_dbgmcu.h" 30 | 31 | /** @addtogroup STM32F10x_StdPeriph_Driver 32 | * @{ 33 | */ 34 | 35 | /** @defgroup DBGMCU 36 | * @brief DBGMCU driver modules 37 | * @{ 38 | */ 39 | 40 | /** @defgroup DBGMCU_Private_TypesDefinitions 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | /** @defgroup DBGMCU_Private_Defines 49 | * @{ 50 | */ 51 | 52 | #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF) 53 | /** 54 | * @} 55 | */ 56 | 57 | /** @defgroup DBGMCU_Private_Macros 58 | * @{ 59 | */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @defgroup DBGMCU_Private_Variables 66 | * @{ 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup DBGMCU_Private_FunctionPrototypes 74 | * @{ 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup DBGMCU_Private_Functions 82 | * @{ 83 | */ 84 | 85 | /** 86 | * @brief Returns the device revision identifier. 87 | * @param None 88 | * @retval Device revision identifier 89 | */ 90 | uint32_t DBGMCU_GetREVID(void) 91 | { 92 | return(DBGMCU->IDCODE >> 16); 93 | } 94 | 95 | /** 96 | * @brief Returns the device identifier. 97 | * @param None 98 | * @retval Device identifier 99 | */ 100 | uint32_t DBGMCU_GetDEVID(void) 101 | { 102 | return(DBGMCU->IDCODE & IDCODE_DEVID_MASK); 103 | } 104 | 105 | /** 106 | * @brief Configures the specified peripheral and low power mode behavior 107 | * when the MCU under Debug mode. 108 | * @param DBGMCU_Periph: specifies the peripheral and low power mode. 109 | * This parameter can be any combination of the following values: 110 | * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode 111 | * @arg DBGMCU_STOP: Keep debugger connection during STOP mode 112 | * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode 113 | * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted 114 | * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted 115 | * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted 116 | * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted 117 | * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted 118 | * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted 119 | * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted 120 | * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted 121 | * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted 122 | * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted 123 | * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted 124 | * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted 125 | * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted 126 | * @arg DBGMCU_CAN2_STOP: Debug CAN2 stopped when Core is halted 127 | * @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted 128 | * @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted 129 | * @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted 130 | * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted 131 | * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted 132 | * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted 133 | * @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted 134 | * @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted 135 | * @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted 136 | * @param NewState: new state of the specified peripheral in Debug mode. 137 | * This parameter can be: ENABLE or DISABLE. 138 | * @retval None 139 | */ 140 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState) 141 | { 142 | /* Check the parameters */ 143 | assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph)); 144 | assert_param(IS_FUNCTIONAL_STATE(NewState)); 145 | 146 | if (NewState != DISABLE) 147 | { 148 | DBGMCU->CR |= DBGMCU_Periph; 149 | } 150 | else 151 | { 152 | DBGMCU->CR &= ~DBGMCU_Periph; 153 | } 154 | } 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /** 161 | * @} 162 | */ 163 | 164 | /** 165 | * @} 166 | */ 167 | 168 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 169 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/tstHID-STM32F103/stm_lib/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/tstHID-STM32F103/stm_lib/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/src/stm32f10x_iwdg.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.c 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file provides all the IWDG firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f10x_iwdg.h" 30 | 31 | /** @addtogroup STM32F10x_StdPeriph_Driver 32 | * @{ 33 | */ 34 | 35 | /** @defgroup IWDG 36 | * @brief IWDG driver modules 37 | * @{ 38 | */ 39 | 40 | /** @defgroup IWDG_Private_TypesDefinitions 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | /** @defgroup IWDG_Private_Defines 49 | * @{ 50 | */ 51 | 52 | /* ---------------------- IWDG registers bit mask ----------------------------*/ 53 | 54 | /* KR register bit mask */ 55 | #define KR_KEY_Reload ((uint16_t)0xAAAA) 56 | #define KR_KEY_Enable ((uint16_t)0xCCCC) 57 | 58 | /** 59 | * @} 60 | */ 61 | 62 | /** @defgroup IWDG_Private_Macros 63 | * @{ 64 | */ 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup IWDG_Private_Variables 71 | * @{ 72 | */ 73 | 74 | /** 75 | * @} 76 | */ 77 | 78 | /** @defgroup IWDG_Private_FunctionPrototypes 79 | * @{ 80 | */ 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup IWDG_Private_Functions 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @brief Enables or disables write access to IWDG_PR and IWDG_RLR registers. 92 | * @param IWDG_WriteAccess: new state of write access to IWDG_PR and IWDG_RLR registers. 93 | * This parameter can be one of the following values: 94 | * @arg IWDG_WriteAccess_Enable: Enable write access to IWDG_PR and IWDG_RLR registers 95 | * @arg IWDG_WriteAccess_Disable: Disable write access to IWDG_PR and IWDG_RLR registers 96 | * @retval None 97 | */ 98 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess) 99 | { 100 | /* Check the parameters */ 101 | assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess)); 102 | IWDG->KR = IWDG_WriteAccess; 103 | } 104 | 105 | /** 106 | * @brief Sets IWDG Prescaler value. 107 | * @param IWDG_Prescaler: specifies the IWDG Prescaler value. 108 | * This parameter can be one of the following values: 109 | * @arg IWDG_Prescaler_4: IWDG prescaler set to 4 110 | * @arg IWDG_Prescaler_8: IWDG prescaler set to 8 111 | * @arg IWDG_Prescaler_16: IWDG prescaler set to 16 112 | * @arg IWDG_Prescaler_32: IWDG prescaler set to 32 113 | * @arg IWDG_Prescaler_64: IWDG prescaler set to 64 114 | * @arg IWDG_Prescaler_128: IWDG prescaler set to 128 115 | * @arg IWDG_Prescaler_256: IWDG prescaler set to 256 116 | * @retval None 117 | */ 118 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler) 119 | { 120 | /* Check the parameters */ 121 | assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler)); 122 | IWDG->PR = IWDG_Prescaler; 123 | } 124 | 125 | /** 126 | * @brief Sets IWDG Reload value. 127 | * @param Reload: specifies the IWDG Reload value. 128 | * This parameter must be a number between 0 and 0x0FFF. 129 | * @retval None 130 | */ 131 | void IWDG_SetReload(uint16_t Reload) 132 | { 133 | /* Check the parameters */ 134 | assert_param(IS_IWDG_RELOAD(Reload)); 135 | IWDG->RLR = Reload; 136 | } 137 | 138 | /** 139 | * @brief Reloads IWDG counter with value defined in the reload register 140 | * (write access to IWDG_PR and IWDG_RLR registers disabled). 141 | * @param None 142 | * @retval None 143 | */ 144 | void IWDG_ReloadCounter(void) 145 | { 146 | IWDG->KR = KR_KEY_Reload; 147 | } 148 | 149 | /** 150 | * @brief Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). 151 | * @param None 152 | * @retval None 153 | */ 154 | void IWDG_Enable(void) 155 | { 156 | IWDG->KR = KR_KEY_Enable; 157 | } 158 | 159 | /** 160 | * @brief Checks whether the specified IWDG flag is set or not. 161 | * @param IWDG_FLAG: specifies the flag to check. 162 | * This parameter can be one of the following values: 163 | * @arg IWDG_FLAG_PVU: Prescaler Value Update on going 164 | * @arg IWDG_FLAG_RVU: Reload Value Update on going 165 | * @retval The new state of IWDG_FLAG (SET or RESET). 166 | */ 167 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG) 168 | { 169 | FlagStatus bitstatus = RESET; 170 | /* Check the parameters */ 171 | assert_param(IS_IWDG_FLAG(IWDG_FLAG)); 172 | if ((IWDG->SR & IWDG_FLAG) != (uint32_t)RESET) 173 | { 174 | bitstatus = SET; 175 | } 176 | else 177 | { 178 | bitstatus = RESET; 179 | } 180 | /* Return the flag status */ 181 | return bitstatus; 182 | } 183 | 184 | /** 185 | * @} 186 | */ 187 | 188 | /** 189 | * @} 190 | */ 191 | 192 | /** 193 | * @} 194 | */ 195 | 196 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 197 | -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RavWin/RHIDDemo/1849f7aa25d088824defafc8b83df3748c7e9d03/tstHID-STM32F103/stm_lib/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /tstHID-STM32F103/stm_lib/src/stm32f10x_wwdg.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.c 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file provides all the WWDG firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f10x_wwdg.h" 30 | #include "stm32f10x_rcc.h" 31 | 32 | /** @addtogroup STM32F10x_StdPeriph_Driver 33 | * @{ 34 | */ 35 | 36 | /** @defgroup WWDG 37 | * @brief WWDG driver modules 38 | * @{ 39 | */ 40 | 41 | /** @defgroup WWDG_Private_TypesDefinitions 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | /** @defgroup WWDG_Private_Defines 50 | * @{ 51 | */ 52 | 53 | /* ----------- WWDG registers bit address in the alias region ----------- */ 54 | #define WWDG_OFFSET (WWDG_BASE - PERIPH_BASE) 55 | 56 | /* Alias word address of EWI bit */ 57 | #define CFR_OFFSET (WWDG_OFFSET + 0x04) 58 | #define EWI_BitNumber 0x09 59 | #define CFR_EWI_BB (PERIPH_BB_BASE + (CFR_OFFSET * 32) + (EWI_BitNumber * 4)) 60 | 61 | /* --------------------- WWDG registers bit mask ------------------------ */ 62 | 63 | /* CR register bit mask */ 64 | #define CR_WDGA_Set ((uint32_t)0x00000080) 65 | 66 | /* CFR register bit mask */ 67 | #define CFR_WDGTB_Mask ((uint32_t)0xFFFFFE7F) 68 | #define CFR_W_Mask ((uint32_t)0xFFFFFF80) 69 | #define BIT_Mask ((uint8_t)0x7F) 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup WWDG_Private_Macros 76 | * @{ 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup WWDG_Private_Variables 84 | * @{ 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @defgroup WWDG_Private_FunctionPrototypes 92 | * @{ 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup WWDG_Private_Functions 100 | * @{ 101 | */ 102 | 103 | /** 104 | * @brief Deinitializes the WWDG peripheral registers to their default reset values. 105 | * @param None 106 | * @retval None 107 | */ 108 | void WWDG_DeInit(void) 109 | { 110 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, ENABLE); 111 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, DISABLE); 112 | } 113 | 114 | /** 115 | * @brief Sets the WWDG Prescaler. 116 | * @param WWDG_Prescaler: specifies the WWDG Prescaler. 117 | * This parameter can be one of the following values: 118 | * @arg WWDG_Prescaler_1: WWDG counter clock = (PCLK1/4096)/1 119 | * @arg WWDG_Prescaler_2: WWDG counter clock = (PCLK1/4096)/2 120 | * @arg WWDG_Prescaler_4: WWDG counter clock = (PCLK1/4096)/4 121 | * @arg WWDG_Prescaler_8: WWDG counter clock = (PCLK1/4096)/8 122 | * @retval None 123 | */ 124 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler) 125 | { 126 | uint32_t tmpreg = 0; 127 | /* Check the parameters */ 128 | assert_param(IS_WWDG_PRESCALER(WWDG_Prescaler)); 129 | /* Clear WDGTB[1:0] bits */ 130 | tmpreg = WWDG->CFR & CFR_WDGTB_Mask; 131 | /* Set WDGTB[1:0] bits according to WWDG_Prescaler value */ 132 | tmpreg |= WWDG_Prescaler; 133 | /* Store the new value */ 134 | WWDG->CFR = tmpreg; 135 | } 136 | 137 | /** 138 | * @brief Sets the WWDG window value. 139 | * @param WindowValue: specifies the window value to be compared to the downcounter. 140 | * This parameter value must be lower than 0x80. 141 | * @retval None 142 | */ 143 | void WWDG_SetWindowValue(uint8_t WindowValue) 144 | { 145 | __IO uint32_t tmpreg = 0; 146 | 147 | /* Check the parameters */ 148 | assert_param(IS_WWDG_WINDOW_VALUE(WindowValue)); 149 | /* Clear W[6:0] bits */ 150 | 151 | tmpreg = WWDG->CFR & CFR_W_Mask; 152 | 153 | /* Set W[6:0] bits according to WindowValue value */ 154 | tmpreg |= WindowValue & (uint32_t) BIT_Mask; 155 | 156 | /* Store the new value */ 157 | WWDG->CFR = tmpreg; 158 | } 159 | 160 | /** 161 | * @brief Enables the WWDG Early Wakeup interrupt(EWI). 162 | * @param None 163 | * @retval None 164 | */ 165 | void WWDG_EnableIT(void) 166 | { 167 | *(__IO uint32_t *) CFR_EWI_BB = (uint32_t)ENABLE; 168 | } 169 | 170 | /** 171 | * @brief Sets the WWDG counter value. 172 | * @param Counter: specifies the watchdog counter value. 173 | * This parameter must be a number between 0x40 and 0x7F. 174 | * @retval None 175 | */ 176 | void WWDG_SetCounter(uint8_t Counter) 177 | { 178 | /* Check the parameters */ 179 | assert_param(IS_WWDG_COUNTER(Counter)); 180 | /* Write to T[6:0] bits to configure the counter value, no need to do 181 | a read-modify-write; writing a 0 to WDGA bit does nothing */ 182 | WWDG->CR = Counter & BIT_Mask; 183 | } 184 | 185 | /** 186 | * @brief Enables WWDG and load the counter value. 187 | * @param Counter: specifies the watchdog counter value. 188 | * This parameter must be a number between 0x40 and 0x7F. 189 | * @retval None 190 | */ 191 | void WWDG_Enable(uint8_t Counter) 192 | { 193 | /* Check the parameters */ 194 | assert_param(IS_WWDG_COUNTER(Counter)); 195 | WWDG->CR = CR_WDGA_Set | Counter; 196 | } 197 | 198 | /** 199 | * @brief Checks whether the Early Wakeup interrupt flag is set or not. 200 | * @param None 201 | * @retval The new state of the Early Wakeup interrupt flag (SET or RESET) 202 | */ 203 | FlagStatus WWDG_GetFlagStatus(void) 204 | { 205 | return (FlagStatus)(WWDG->SR); 206 | } 207 | 208 | /** 209 | * @brief Clears Early Wakeup interrupt flag. 210 | * @param None 211 | * @retval None 212 | */ 213 | void WWDG_ClearFlag(void) 214 | { 215 | WWDG->SR = (uint32_t)RESET; 216 | } 217 | 218 | /** 219 | * @} 220 | */ 221 | 222 | /** 223 | * @} 224 | */ 225 | 226 | /** 227 | * @} 228 | */ 229 | 230 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 231 | -------------------------------------------------------------------------------- /tstHID-STM32F103/tstHID-STM32F103.elay: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | --------------------------------------------------------------------------------