├── .gitattributes ├── .gitignore ├── KiCAD ├── .gitignore ├── Gerber │ ├── SmallyMouse2-B.Cu.gbl │ ├── SmallyMouse2-B.Mask.gbs │ ├── SmallyMouse2-B.SilkS.gbo │ ├── SmallyMouse2-Edge.Cuts.gm1 │ ├── SmallyMouse2-F.Cu.gtl │ ├── SmallyMouse2-F.Mask.gts │ ├── SmallyMouse2-F.SilkS.gto │ ├── SmallyMouse2-NPTH.drl │ └── SmallyMouse2.drl ├── PDF │ └── SmallyMouse2.pdf ├── SmallyMouse2-cache.lib ├── SmallyMouse2-rescue.dcm ├── SmallyMouse2-rescue.lib ├── SmallyMouse2.cmp ├── SmallyMouse2.kicad_pcb ├── SmallyMouse2.pro ├── SmallyMouse2.sch └── sm2logo.kicad_mod ├── Logo ├── README.md ├── SmallyMouse2.ai └── SmallyMouse2.png ├── Makefile ├── README.md ├── SmallyMouse2.atsln └── SmallyMouse2 ├── .gitignore ├── ConfigDescriptor.c ├── ConfigDescriptor.h ├── SmallyMouse2.componentinfo.xml ├── SmallyMouse2.cproj ├── main.c ├── main.h └── src ├── LUFA └── LUFA │ ├── Common │ ├── ArchitectureSpecific.h │ ├── Architectures.h │ ├── Attributes.h │ ├── BoardTypes.h │ ├── Common.h │ ├── CompilerSpecific.h │ └── Endianness.h │ ├── Drivers │ ├── Board │ │ ├── Board.h │ │ └── LEDs.h │ ├── Misc │ │ └── TerminalCodes.h │ ├── Peripheral │ │ ├── AVR8 │ │ │ ├── Serial_AVR8.c │ │ │ └── Serial_AVR8.h │ │ └── Serial.h │ └── USB │ │ ├── Class │ │ ├── AndroidAccessoryClass.h │ │ ├── AudioClass.h │ │ ├── CDCClass.h │ │ ├── Common │ │ │ ├── AndroidAccessoryClassCommon.h │ │ │ ├── AudioClassCommon.h │ │ │ ├── CDCClassCommon.h │ │ │ ├── HIDClassCommon.h │ │ │ ├── HIDParser.c │ │ │ ├── HIDParser.h │ │ │ ├── HIDReportData.h │ │ │ ├── MIDIClassCommon.h │ │ │ ├── MassStorageClassCommon.h │ │ │ ├── PrinterClassCommon.h │ │ │ ├── RNDISClassCommon.h │ │ │ └── StillImageClassCommon.h │ │ ├── Device │ │ │ ├── AudioClassDevice.c │ │ │ ├── AudioClassDevice.h │ │ │ ├── CDCClassDevice.c │ │ │ ├── CDCClassDevice.h │ │ │ ├── HIDClassDevice.c │ │ │ ├── HIDClassDevice.h │ │ │ ├── MIDIClassDevice.c │ │ │ ├── MIDIClassDevice.h │ │ │ ├── MassStorageClassDevice.c │ │ │ ├── MassStorageClassDevice.h │ │ │ ├── PrinterClassDevice.c │ │ │ ├── PrinterClassDevice.h │ │ │ ├── RNDISClassDevice.c │ │ │ └── RNDISClassDevice.h │ │ ├── HIDClass.h │ │ ├── Host │ │ │ ├── AndroidAccessoryClassHost.c │ │ │ ├── AndroidAccessoryClassHost.h │ │ │ ├── AudioClassHost.c │ │ │ ├── AudioClassHost.h │ │ │ ├── CDCClassHost.c │ │ │ ├── CDCClassHost.h │ │ │ ├── HIDClassHost.c │ │ │ ├── HIDClassHost.h │ │ │ ├── MIDIClassHost.c │ │ │ ├── MIDIClassHost.h │ │ │ ├── MassStorageClassHost.c │ │ │ ├── MassStorageClassHost.h │ │ │ ├── PrinterClassHost.c │ │ │ ├── PrinterClassHost.h │ │ │ ├── RNDISClassHost.c │ │ │ ├── RNDISClassHost.h │ │ │ ├── StillImageClassHost.c │ │ │ └── StillImageClassHost.h │ │ ├── MIDIClass.h │ │ ├── MassStorageClass.h │ │ ├── PrinterClass.h │ │ ├── RNDISClass.h │ │ └── StillImageClass.h │ │ ├── Core │ │ ├── AVR8 │ │ │ ├── Device_AVR8.c │ │ │ ├── Device_AVR8.h │ │ │ ├── EndpointStream_AVR8.c │ │ │ ├── EndpointStream_AVR8.h │ │ │ ├── Endpoint_AVR8.c │ │ │ ├── Endpoint_AVR8.h │ │ │ ├── Host_AVR8.c │ │ │ ├── Host_AVR8.h │ │ │ ├── OTG_AVR8.h │ │ │ ├── PipeStream_AVR8.c │ │ │ ├── PipeStream_AVR8.h │ │ │ ├── Pipe_AVR8.c │ │ │ ├── Pipe_AVR8.h │ │ │ ├── Template │ │ │ │ ├── Template_Endpoint_Control_R.c │ │ │ │ ├── Template_Endpoint_Control_W.c │ │ │ │ ├── Template_Endpoint_RW.c │ │ │ │ └── Template_Pipe_RW.c │ │ │ ├── USBController_AVR8.c │ │ │ ├── USBController_AVR8.h │ │ │ ├── USBInterrupt_AVR8.c │ │ │ └── USBInterrupt_AVR8.h │ │ ├── ConfigDescriptors.c │ │ ├── ConfigDescriptors.h │ │ ├── Device.h │ │ ├── DeviceStandardReq.c │ │ ├── DeviceStandardReq.h │ │ ├── Endpoint.h │ │ ├── EndpointStream.h │ │ ├── Events.c │ │ ├── Events.h │ │ ├── Host.h │ │ ├── HostStandardReq.c │ │ ├── HostStandardReq.h │ │ ├── OTG.h │ │ ├── Pipe.h │ │ ├── PipeStream.h │ │ ├── StdDescriptors.h │ │ ├── StdRequestType.h │ │ ├── USBController.h │ │ ├── USBInterrupt.h │ │ ├── USBMode.h │ │ ├── USBTask.c │ │ └── USBTask.h │ │ └── USB.h │ ├── Platform │ └── Platform.h │ └── Version.h ├── asf.h └── config └── LUFAConfig.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | *.vcxproj.filters 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | [Ll]og/ 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | # Uncomment if you have tasks that create the project's static files in wwwroot 31 | #wwwroot/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | # NUNIT 38 | *.VisualState.xml 39 | TestResult.xml 40 | 41 | # Build Results of an ATL Project 42 | [Dd]ebugPS/ 43 | [Rr]eleasePS/ 44 | dlldata.c 45 | 46 | # .NET Core 47 | project.lock.json 48 | project.fragment.lock.json 49 | artifacts/ 50 | **/Properties/launchSettings.json 51 | 52 | *_i.c 53 | *_p.c 54 | *_i.h 55 | *.ilk 56 | *.meta 57 | *.obj 58 | *.pch 59 | *.pdb 60 | *.pgc 61 | *.pgd 62 | *.rsp 63 | *.sbr 64 | *.tlb 65 | *.tli 66 | *.tlh 67 | *.tmp 68 | *.tmp_proj 69 | *.log 70 | *.vspscc 71 | *.vssscc 72 | .builds 73 | *.pidb 74 | *.svclog 75 | *.scc 76 | 77 | # Chutzpah Test files 78 | _Chutzpah* 79 | 80 | # Visual C++ cache files 81 | ipch/ 82 | *.aps 83 | *.ncb 84 | *.opendb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | *.VC.db 89 | *.VC.VC.opendb 90 | 91 | # Visual Studio profiler 92 | *.psess 93 | *.vsp 94 | *.vspx 95 | *.sap 96 | 97 | # TFS 2012 Local Workspace 98 | $tf/ 99 | 100 | # Guidance Automation Toolkit 101 | *.gpState 102 | 103 | # ReSharper is a .NET coding add-in 104 | _ReSharper*/ 105 | *.[Rr]e[Ss]harper 106 | *.DotSettings.user 107 | 108 | # JustCode is a .NET coding add-in 109 | .JustCode 110 | 111 | # TeamCity is a build add-in 112 | _TeamCity* 113 | 114 | # DotCover is a Code Coverage Tool 115 | *.dotCover 116 | 117 | # Visual Studio code coverage results 118 | *.coverage 119 | *.coveragexml 120 | 121 | # NCrunch 122 | _NCrunch_* 123 | .*crunch*.local.xml 124 | nCrunchTemp_* 125 | 126 | # MightyMoose 127 | *.mm.* 128 | AutoTest.Net/ 129 | 130 | # Web workbench (sass) 131 | .sass-cache/ 132 | 133 | # Installshield output folder 134 | [Ee]xpress/ 135 | 136 | # DocProject is a documentation generator add-in 137 | DocProject/buildhelp/ 138 | DocProject/Help/*.HxT 139 | DocProject/Help/*.HxC 140 | DocProject/Help/*.hhc 141 | DocProject/Help/*.hhk 142 | DocProject/Help/*.hhp 143 | DocProject/Help/Html2 144 | DocProject/Help/html 145 | 146 | # Click-Once directory 147 | publish/ 148 | 149 | # Publish Web Output 150 | *.[Pp]ublish.xml 151 | *.azurePubxml 152 | # TODO: Comment the next line if you want to checkin your web deploy settings 153 | # but database connection strings (with potential passwords) will be unencrypted 154 | *.pubxml 155 | *.publishproj 156 | 157 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 158 | # checkin your Azure Web App publish settings, but sensitive information contained 159 | # in these scripts will be unencrypted 160 | PublishScripts/ 161 | 162 | # NuGet Packages 163 | *.nupkg 164 | # The packages folder can be ignored because of Package Restore 165 | **/packages/* 166 | # except build/, which is used as an MSBuild target. 167 | !**/packages/build/ 168 | # Uncomment if necessary however generally it will be regenerated when needed 169 | #!**/packages/repositories.config 170 | # NuGet v3's project.json files produces more ignoreable files 171 | *.nuget.props 172 | *.nuget.targets 173 | 174 | # Microsoft Azure Build Output 175 | csx/ 176 | *.build.csdef 177 | 178 | # Microsoft Azure Emulator 179 | ecf/ 180 | rcf/ 181 | 182 | # Windows Store app package directories and files 183 | AppPackages/ 184 | BundleArtifacts/ 185 | Package.StoreAssociation.xml 186 | _pkginfo.txt 187 | 188 | # Visual Studio cache files 189 | # files ending in .cache can be ignored 190 | *.[Cc]ache 191 | # but keep track of directories ending in .cache 192 | !*.[Cc]ache/ 193 | 194 | # Others 195 | ClientBin/ 196 | ~$* 197 | *~ 198 | *.dbmdl 199 | *.dbproj.schemaview 200 | *.jfm 201 | *.pfx 202 | *.publishsettings 203 | node_modules/ 204 | orleans.codegen.cs 205 | 206 | # Since there are multiple workflows, uncomment next line to ignore bower_components 207 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 208 | #bower_components/ 209 | 210 | # RIA/Silverlight projects 211 | Generated_Code/ 212 | 213 | # Backup & report files from converting an old project file 214 | # to a newer Visual Studio version. Backup files are not needed, 215 | # because we have git ;-) 216 | _UpgradeReport_Files/ 217 | Backup*/ 218 | UpgradeLog*.XML 219 | UpgradeLog*.htm 220 | 221 | # SQL Server files 222 | *.mdf 223 | *.ldf 224 | 225 | # Business Intelligence projects 226 | *.rdl.data 227 | *.bim.layout 228 | *.bim_*.settings 229 | 230 | # Microsoft Fakes 231 | FakesAssemblies/ 232 | 233 | # GhostDoc plugin setting file 234 | *.GhostDoc.xml 235 | 236 | # Node.js Tools for Visual Studio 237 | .ntvs_analysis.dat 238 | 239 | # Visual Studio 6 build log 240 | *.plg 241 | 242 | # Visual Studio 6 workspace options file 243 | *.opt 244 | 245 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 246 | *.vbw 247 | 248 | # Visual Studio LightSwitch build output 249 | **/*.HTMLClient/GeneratedArtifacts 250 | **/*.DesktopClient/GeneratedArtifacts 251 | **/*.DesktopClient/ModelManifest.xml 252 | **/*.Server/GeneratedArtifacts 253 | **/*.Server/ModelManifest.xml 254 | _Pvt_Extensions 255 | 256 | # Paket dependency manager 257 | .paket/paket.exe 258 | paket-files/ 259 | 260 | # FAKE - F# Make 261 | .fake/ 262 | 263 | # JetBrains Rider 264 | .idea/ 265 | *.sln.iml 266 | 267 | # CodeRush 268 | .cr/ 269 | 270 | # Python Tools for Visual Studio (PTVS) 271 | __pycache__/ 272 | *.pyc 273 | 274 | # Cake - Uncomment if you are using it 275 | # tools/ -------------------------------------------------------------------------------- /KiCAD/.gitignore: -------------------------------------------------------------------------------- 1 | # For PCBs designed using KiCad: http://www.kicad-pcb.org/ 2 | 3 | # Temporary files 4 | *.000 5 | *.bak 6 | *.bck 7 | *.kicad_pcb-bak 8 | *~ 9 | _autosave-* 10 | *.tmp 11 | 12 | # Netlist files (exported from Eeschema) 13 | *.net 14 | 15 | # Autorouter files (exported from Pcbnew) 16 | *.dsn 17 | *.ses 18 | 19 | # Exported BOM files 20 | *.xml 21 | *.csv -------------------------------------------------------------------------------- /KiCAD/Gerber/SmallyMouse2-B.Mask.gbs: -------------------------------------------------------------------------------- 1 | G04 #@! TF.FileFunction,Soldermask,Bot* 2 | %FSLAX46Y46*% 3 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 4 | G04 Created by KiCad (PCBNEW 4.0.6) date 05/07/17 15:41:17* 5 | %MOMM*% 6 | %LPD*% 7 | G01* 8 | G04 APERTURE LIST* 9 | %ADD10C,0.100000*% 10 | %ADD11R,1.700000X1.700000*% 11 | %ADD12O,1.700000X1.700000*% 12 | %ADD13R,1.727200X1.727200*% 13 | %ADD14O,1.727200X1.727200*% 14 | %ADD15C,3.000000*% 15 | %ADD16C,3.200000*% 16 | G04 APERTURE END LIST* 17 | D10* 18 | D11* 19 | X130302000Y-118872000D03* 20 | D12* 21 | X132842000Y-118872000D03* 22 | X135382000Y-118872000D03* 23 | X137922000Y-118872000D03* 24 | X140462000Y-118872000D03* 25 | X143002000Y-118872000D03* 26 | X145542000Y-118872000D03* 27 | X148082000Y-118872000D03* 28 | X150622000Y-118872000D03* 29 | X153162000Y-118872000D03* 30 | D11* 31 | X153162000Y-86614000D03* 32 | D12* 33 | X153162000Y-84074000D03* 34 | D13* 35 | X162306000Y-113030000D03* 36 | D14* 37 | X159766000Y-113030000D03* 38 | X162306000Y-110490000D03* 39 | X159766000Y-110490000D03* 40 | X162306000Y-107950000D03* 41 | X159766000Y-107950000D03* 42 | X162306000Y-105410000D03* 43 | X159766000Y-105410000D03* 44 | X162306000Y-102870000D03* 45 | X159766000Y-102870000D03* 46 | X162306000Y-100330000D03* 47 | X159766000Y-100330000D03* 48 | X162306000Y-97790000D03* 49 | X159766000Y-97790000D03* 50 | X162306000Y-95250000D03* 51 | X159766000Y-95250000D03* 52 | X162306000Y-92710000D03* 53 | X159766000Y-92710000D03* 54 | X162306000Y-90170000D03* 55 | X159766000Y-90170000D03* 56 | D11* 57 | X168656000Y-113030000D03* 58 | D12* 59 | X168656000Y-110490000D03* 60 | X168656000Y-107950000D03* 61 | X168656000Y-105410000D03* 62 | X168656000Y-102870000D03* 63 | X168656000Y-100330000D03* 64 | X168656000Y-97790000D03* 65 | X168656000Y-95250000D03* 66 | X168656000Y-92710000D03* 67 | X168656000Y-90170000D03* 68 | D15* 69 | X124352000Y-107916000D03* 70 | X124352000Y-94776000D03* 71 | D16* 72 | X124460000Y-83820000D03* 73 | X124460000Y-118618000D03* 74 | X169672000Y-83820000D03* 75 | X169672000Y-118618000D03* 76 | D11* 77 | X131826000Y-104648000D03* 78 | D12* 79 | X134366000Y-104648000D03* 80 | D11* 81 | X129413000Y-90170000D03* 82 | D12* 83 | X129413000Y-87630000D03* 84 | M02* 85 | -------------------------------------------------------------------------------- /KiCAD/Gerber/SmallyMouse2-Edge.Cuts.gm1: -------------------------------------------------------------------------------- 1 | G04 #@! TF.FileFunction,Profile,NP* 2 | %FSLAX46Y46*% 3 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 4 | G04 Created by KiCad (PCBNEW 4.0.6) date 05/07/17 15:41:17* 5 | %MOMM*% 6 | %LPD*% 7 | G01* 8 | G04 APERTURE LIST* 9 | %ADD10C,0.100000*% 10 | G04 APERTURE END LIST* 11 | D10* 12 | X120904000Y-122428000D02* 13 | X120904000Y-80264000D01* 14 | X173228000Y-122428000D02* 15 | X120904000Y-122428000D01* 16 | X173228000Y-80264000D02* 17 | X173228000Y-122428000D01* 18 | X120904000Y-80264000D02* 19 | X173228000Y-80264000D01* 20 | M02* 21 | -------------------------------------------------------------------------------- /KiCAD/Gerber/SmallyMouse2-F.Mask.gts: -------------------------------------------------------------------------------- 1 | G04 #@! TF.FileFunction,Soldermask,Top* 2 | %FSLAX46Y46*% 3 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 4 | G04 Created by KiCad (PCBNEW 4.0.6) date 05/07/17 15:41:17* 5 | %MOMM*% 6 | %LPD*% 7 | G01* 8 | G04 APERTURE LIST* 9 | %ADD10C,0.100000*% 10 | %ADD11R,1.250000X1.500000*% 11 | %ADD12R,1.500000X1.250000*% 12 | %ADD13R,1.500000X0.550000*% 13 | %ADD14R,0.550000X1.500000*% 14 | %ADD15R,1.700000X1.700000*% 15 | %ADD16O,1.700000X1.700000*% 16 | %ADD17R,1.727200X1.727200*% 17 | %ADD18O,1.727200X1.727200*% 18 | %ADD19C,3.000000*% 19 | %ADD20R,2.880000X1.120000*% 20 | %ADD21R,1.500000X1.300000*% 21 | %ADD22R,1.500000X1.500000*% 22 | %ADD23R,3.500000X2.400000*% 23 | %ADD24C,3.200000*% 24 | %ADD25R,1.300000X1.500000*% 25 | G04 APERTURE END LIST* 26 | D10* 27 | D11* 28 | X132334000Y-110724000D03* 29 | X132334000Y-108224000D03* 30 | X135128000Y-110724000D03* 31 | X135128000Y-108224000D03* 32 | D12* 33 | X142728000Y-89662000D03* 34 | X140228000Y-89662000D03* 35 | D11* 36 | X135128000Y-101326000D03* 37 | X135128000Y-98826000D03* 38 | D12* 39 | X137902000Y-89662000D03* 40 | X135402000Y-89662000D03* 41 | X142474000Y-110998000D03* 42 | X139974000Y-110998000D03* 43 | X148102000Y-89408000D03* 44 | X150602000Y-89408000D03* 45 | X150642000Y-115062000D03* 46 | X153142000Y-115062000D03* 47 | X165080000Y-119888000D03* 48 | X162580000Y-119888000D03* 49 | X160040000Y-83058000D03* 50 | X162540000Y-83058000D03* 51 | D13* 52 | X137588000Y-94076000D03* 53 | X137588000Y-94876000D03* 54 | X137588000Y-95676000D03* 55 | X137588000Y-96476000D03* 56 | X137588000Y-97276000D03* 57 | X137588000Y-98076000D03* 58 | X137588000Y-98876000D03* 59 | X137588000Y-99676000D03* 60 | X137588000Y-100476000D03* 61 | X137588000Y-101276000D03* 62 | X137588000Y-102076000D03* 63 | X137588000Y-102876000D03* 64 | X137588000Y-103676000D03* 65 | X137588000Y-104476000D03* 66 | X137588000Y-105276000D03* 67 | X137588000Y-106076000D03* 68 | D14* 69 | X139288000Y-107776000D03* 70 | X140088000Y-107776000D03* 71 | X140888000Y-107776000D03* 72 | X141688000Y-107776000D03* 73 | X142488000Y-107776000D03* 74 | X143288000Y-107776000D03* 75 | X144088000Y-107776000D03* 76 | X144888000Y-107776000D03* 77 | X145688000Y-107776000D03* 78 | X146488000Y-107776000D03* 79 | X147288000Y-107776000D03* 80 | X148088000Y-107776000D03* 81 | X148888000Y-107776000D03* 82 | X149688000Y-107776000D03* 83 | X150488000Y-107776000D03* 84 | X151288000Y-107776000D03* 85 | D13* 86 | X152988000Y-106076000D03* 87 | X152988000Y-105276000D03* 88 | X152988000Y-104476000D03* 89 | X152988000Y-103676000D03* 90 | X152988000Y-102876000D03* 91 | X152988000Y-102076000D03* 92 | X152988000Y-101276000D03* 93 | X152988000Y-100476000D03* 94 | X152988000Y-99676000D03* 95 | X152988000Y-98876000D03* 96 | X152988000Y-98076000D03* 97 | X152988000Y-97276000D03* 98 | X152988000Y-96476000D03* 99 | X152988000Y-95676000D03* 100 | X152988000Y-94876000D03* 101 | X152988000Y-94076000D03* 102 | D14* 103 | X151288000Y-92376000D03* 104 | X150488000Y-92376000D03* 105 | X149688000Y-92376000D03* 106 | X148888000Y-92376000D03* 107 | X148088000Y-92376000D03* 108 | X147288000Y-92376000D03* 109 | X146488000Y-92376000D03* 110 | X145688000Y-92376000D03* 111 | X144888000Y-92376000D03* 112 | X144088000Y-92376000D03* 113 | X143288000Y-92376000D03* 114 | X142488000Y-92376000D03* 115 | X141688000Y-92376000D03* 116 | X140888000Y-92376000D03* 117 | X140088000Y-92376000D03* 118 | X139288000Y-92376000D03* 119 | D15* 120 | X130302000Y-118872000D03* 121 | D16* 122 | X132842000Y-118872000D03* 123 | X135382000Y-118872000D03* 124 | X137922000Y-118872000D03* 125 | X140462000Y-118872000D03* 126 | X143002000Y-118872000D03* 127 | X145542000Y-118872000D03* 128 | X148082000Y-118872000D03* 129 | X150622000Y-118872000D03* 130 | X153162000Y-118872000D03* 131 | D15* 132 | X153162000Y-86614000D03* 133 | D16* 134 | X153162000Y-84074000D03* 135 | D17* 136 | X162306000Y-113030000D03* 137 | D18* 138 | X159766000Y-113030000D03* 139 | X162306000Y-110490000D03* 140 | X159766000Y-110490000D03* 141 | X162306000Y-107950000D03* 142 | X159766000Y-107950000D03* 143 | X162306000Y-105410000D03* 144 | X159766000Y-105410000D03* 145 | X162306000Y-102870000D03* 146 | X159766000Y-102870000D03* 147 | X162306000Y-100330000D03* 148 | X159766000Y-100330000D03* 149 | X162306000Y-97790000D03* 150 | X159766000Y-97790000D03* 151 | X162306000Y-95250000D03* 152 | X159766000Y-95250000D03* 153 | X162306000Y-92710000D03* 154 | X159766000Y-92710000D03* 155 | X162306000Y-90170000D03* 156 | X159766000Y-90170000D03* 157 | D15* 158 | X168656000Y-113030000D03* 159 | D16* 160 | X168656000Y-110490000D03* 161 | X168656000Y-107950000D03* 162 | X168656000Y-105410000D03* 163 | X168656000Y-102870000D03* 164 | X168656000Y-100330000D03* 165 | X168656000Y-97790000D03* 166 | X168656000Y-95250000D03* 167 | X168656000Y-92710000D03* 168 | X168656000Y-90170000D03* 169 | D19* 170 | X124352000Y-107916000D03* 171 | D20* 172 | X127992000Y-104846000D03* 173 | X127992000Y-102346000D03* 174 | X127992000Y-100346000D03* 175 | X127992000Y-97846000D03* 176 | D19* 177 | X124352000Y-94776000D03* 178 | D21* 179 | X134700000Y-96774000D03* 180 | X132000000Y-96774000D03* 181 | X134700000Y-94742000D03* 182 | X132000000Y-94742000D03* 183 | D22* 184 | X132080000Y-83820000D03* 185 | X137668000Y-83820000D03* 186 | X143256000Y-83820000D03* 187 | X146050000Y-83820000D03* 188 | X134874000Y-83820000D03* 189 | X140462000Y-83820000D03* 190 | X148844000Y-83820000D03* 191 | D23* 192 | X137474000Y-114046000D03* 193 | X132274000Y-114046000D03* 194 | D24* 195 | X124460000Y-83820000D03* 196 | X124460000Y-118618000D03* 197 | X169672000Y-83820000D03* 198 | X169672000Y-118618000D03* 199 | D15* 200 | X131826000Y-104648000D03* 201 | D16* 202 | X134366000Y-104648000D03* 203 | D15* 204 | X129413000Y-90170000D03* 205 | D16* 206 | X129413000Y-87630000D03* 207 | D25* 208 | X153924000Y-109902000D03* 209 | X153924000Y-112602000D03* 210 | X126365000Y-88058000D03* 211 | X126365000Y-90758000D03* 212 | M02* 213 | -------------------------------------------------------------------------------- /KiCAD/Gerber/SmallyMouse2-NPTH.drl: -------------------------------------------------------------------------------- 1 | M48 2 | ;DRILL file {KiCad 4.0.6} date 05/07/17 15:42:04 3 | ;FORMAT={-:-/ absolute / inch / decimal} 4 | FMAT,2 5 | INCH,TZ 6 | T1C0.126 7 | % 8 | G90 9 | G05 10 | M72 11 | T1 12 | X4.9Y-3.3 13 | X4.9Y-4.67 14 | X6.68Y-3.3 15 | X6.68Y-4.67 16 | T0 17 | M30 18 | -------------------------------------------------------------------------------- /KiCAD/Gerber/SmallyMouse2.drl: -------------------------------------------------------------------------------- 1 | M48 2 | ;DRILL file {KiCad 4.0.6} date 05/07/17 15:42:04 3 | ;FORMAT={-:-/ absolute / inch / decimal} 4 | FMAT,2 5 | INCH,TZ 6 | T1C0.016 7 | T2C0.039 8 | T3C0.040 9 | T4C0.091 10 | % 11 | G90 12 | G05 13 | M72 14 | T1 15 | X5.2Y-3.43 16 | X5.33Y-3.43 17 | X5.33Y-3.6 18 | X5.51Y-3.92 19 | X5.52Y-3.45 20 | X5.52Y-4.31 21 | X5.58Y-4.015 22 | X5.61Y-4.43 23 | X5.61Y-4.49 24 | X5.74Y-4.08 25 | X5.75Y-3.37 26 | X5.77Y-4.11 27 | X5.8Y-3.72 28 | X5.8Y-4.14 29 | X5.83Y-4.17 30 | X5.93Y-3.3 31 | X5.93Y-4.47 32 | X5.945Y-3.86 33 | X5.995Y-4.325 34 | X6.29Y-4.77 35 | X6.49Y-3.27 36 | T2 37 | X5.095Y-3.45 38 | X5.095Y-3.55 39 | X5.13Y-4.68 40 | X5.19Y-4.12 41 | X5.23Y-4.68 42 | X5.29Y-4.12 43 | X5.33Y-4.68 44 | X5.43Y-4.68 45 | X5.53Y-4.68 46 | X5.63Y-4.68 47 | X5.73Y-4.68 48 | X5.83Y-4.68 49 | X5.93Y-4.68 50 | X6.03Y-3.31 51 | X6.03Y-3.41 52 | X6.03Y-4.68 53 | X6.64Y-3.55 54 | X6.64Y-3.65 55 | X6.64Y-3.75 56 | X6.64Y-3.85 57 | X6.64Y-3.95 58 | X6.64Y-4.05 59 | X6.64Y-4.15 60 | X6.64Y-4.25 61 | X6.64Y-4.35 62 | X6.64Y-4.45 63 | T3 64 | X6.29Y-3.55 65 | X6.29Y-3.65 66 | X6.29Y-3.75 67 | X6.29Y-3.85 68 | X6.29Y-3.95 69 | X6.29Y-4.05 70 | X6.29Y-4.15 71 | X6.29Y-4.25 72 | X6.29Y-4.35 73 | X6.29Y-4.45 74 | X6.39Y-3.55 75 | X6.39Y-3.65 76 | X6.39Y-3.75 77 | X6.39Y-3.85 78 | X6.39Y-3.95 79 | X6.39Y-4.05 80 | X6.39Y-4.15 81 | X6.39Y-4.25 82 | X6.39Y-4.35 83 | X6.39Y-4.45 84 | T4 85 | X4.8957Y-3.7313 86 | X4.8957Y-4.2487 87 | T0 88 | M30 89 | -------------------------------------------------------------------------------- /KiCAD/PDF/SmallyMouse2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoninns/SmallyMouse2/66cf90d63e7168b3948b8680cc1ac9173dab672e/KiCAD/PDF/SmallyMouse2.pdf -------------------------------------------------------------------------------- /KiCAD/SmallyMouse2-rescue.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /KiCAD/SmallyMouse2-rescue.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # USB_A-RESCUE-SmallyMouse2 5 | # 6 | DEF USB_A-RESCUE-SmallyMouse2 P 0 40 Y Y 1 F N 7 | F0 "P" 200 -200 50 H V C CNN 8 | F1 "USB_A-RESCUE-SmallyMouse2" -50 200 50 H V C CNN 9 | F2 "" -50 -100 50 V V C CNN 10 | F3 "" -50 -100 50 V V C CNN 11 | $FPLIST 12 | USB* 13 | $ENDFPLIST 14 | DRAW 15 | S -250 -150 150 150 0 1 0 N 16 | S -205 -150 -195 -120 0 1 0 N 17 | S -105 -150 -95 -120 0 1 0 N 18 | S -5 -150 5 -120 0 1 0 N 19 | S 95 -150 105 -120 0 1 0 N 20 | X VBUS 1 -200 -300 150 U 50 50 1 1 W 21 | X D- 2 -100 -300 150 U 50 50 1 1 P 22 | X D+ 3 0 -300 150 U 50 50 1 1 P 23 | X GND 4 100 -300 150 U 50 50 1 1 W 24 | X shield 5 300 100 150 L 50 50 1 1 P 25 | ENDDRAW 26 | ENDDEF 27 | # 28 | #End Library 29 | -------------------------------------------------------------------------------- /KiCAD/SmallyMouse2.cmp: -------------------------------------------------------------------------------- 1 | Cmp-Mod V01 Created by PcbNew date = 28/02/2017 21:12:12 2 | 3 | BeginCmp 4 | TimeStamp = 58B5D468 5 | Path = /58A4F945 6 | Reference = Y1; 7 | ValeurCmp = 16 MHz Crystal; 8 | IdModule = Crystals:Crystal_SMD_5032-2pin_5.0x3.2mm_HandSoldering; 9 | EndCmp 10 | 11 | BeginCmp 12 | TimeStamp = 58B5D462 13 | Path = /58B5F32A 14 | Reference = TP7; 15 | ValeurCmp = GND; 16 | IdModule = Measurement_Points:Measurement_Point_Square-SMD-Pad_Small; 17 | EndCmp 18 | 19 | BeginCmp 20 | TimeStamp = 58B5D45D 21 | Path = /58B5F2B1 22 | Reference = TP6; 23 | ValeurCmp = +5V; 24 | IdModule = Measurement_Points:Measurement_Point_Square-SMD-Pad_Small; 25 | EndCmp 26 | 27 | BeginCmp 28 | TimeStamp = 58B5D458 29 | Path = /58B5EE0B 30 | Reference = TP5; 31 | ValeurCmp = ~RESET; 32 | IdModule = Measurement_Points:Measurement_Point_Square-SMD-Pad_Small; 33 | EndCmp 34 | 35 | BeginCmp 36 | TimeStamp = 58B5D453 37 | Path = /58B5E49A 38 | Reference = TP4; 39 | ValeurCmp = TDO; 40 | IdModule = Measurement_Points:Measurement_Point_Square-SMD-Pad_Small; 41 | EndCmp 42 | 43 | BeginCmp 44 | TimeStamp = 58B5D44E 45 | Path = /58B5E194 46 | Reference = TP3; 47 | ValeurCmp = TCK; 48 | IdModule = Measurement_Points:Measurement_Point_Square-SMD-Pad_Small; 49 | EndCmp 50 | 51 | BeginCmp 52 | TimeStamp = 58B5D449 53 | Path = /58B5E4F3 54 | Reference = TP2; 55 | ValeurCmp = TDI; 56 | IdModule = Measurement_Points:Measurement_Point_Square-SMD-Pad_Small; 57 | EndCmp 58 | 59 | BeginCmp 60 | TimeStamp = 58B5D444 61 | Path = /58B5E42F 62 | Reference = TP1; 63 | ValeurCmp = TMS; 64 | IdModule = Measurement_Points:Measurement_Point_Square-SMD-Pad_Small; 65 | EndCmp 66 | 67 | BeginCmp 68 | TimeStamp = 58B5D433 69 | Path = /58A4E483 70 | Reference = R2; 71 | ValeurCmp = 22R; 72 | IdModule = Resistors_SMD:R_1206_HandSoldering; 73 | EndCmp 74 | 75 | BeginCmp 76 | TimeStamp = 58B5D42D 77 | Path = /58A4E546 78 | Reference = R1; 79 | ValeurCmp = 22R; 80 | IdModule = Resistors_SMD:R_1206_HandSoldering; 81 | EndCmp 82 | 83 | BeginCmp 84 | TimeStamp = 58B5D427 85 | Path = /58A51935 86 | Reference = P2; 87 | ValeurCmp = CONN_01X10; 88 | IdModule = Connectors_JST:JST_PH_B10B-PH-K_10x2.00mm_Straight; 89 | EndCmp 90 | 91 | BeginCmp 92 | TimeStamp = 58B5D419 93 | Path = /58A4E3C4 94 | Reference = P1; 95 | ValeurCmp = USB_A; 96 | IdModule = SimonsFPLibrary2017:Amphenol_87583-2010BLF; 97 | EndCmp 98 | 99 | BeginCmp 100 | TimeStamp = 58B5D40B 101 | Path = /58A4E37E 102 | Reference = IC1; 103 | ValeurCmp = AT90USB1287; 104 | IdModule = Housings_QFP:TQFP-64_14x14mm_Pitch0.8mm; 105 | EndCmp 106 | 107 | BeginCmp 108 | TimeStamp = 58B5D3C7 109 | Path = /58A50DC2 110 | Reference = F1; 111 | ValeurCmp = 500mA Polyfuse; 112 | IdModule = Resistors_SMD:R_1812_HandSoldering; 113 | EndCmp 114 | 115 | BeginCmp 116 | TimeStamp = 58B5D3C1 117 | Path = /58A4FE1E 118 | Reference = C7; 119 | ValeurCmp = 100nF; 120 | IdModule = Capacitors_SMD:C_0805_HandSoldering; 121 | EndCmp 122 | 123 | BeginCmp 124 | TimeStamp = 58B5D3BB 125 | Path = /58A4FDE1 126 | Reference = C6; 127 | ValeurCmp = 100nF; 128 | IdModule = Capacitors_SMD:C_0805_HandSoldering; 129 | EndCmp 130 | 131 | BeginCmp 132 | TimeStamp = 58B5D3B5 133 | Path = /58A4FD2F 134 | Reference = C5; 135 | ValeurCmp = 100nF; 136 | IdModule = Capacitors_SMD:C_0805_HandSoldering; 137 | EndCmp 138 | 139 | BeginCmp 140 | TimeStamp = 58B5D3AF 141 | Path = /58A4F76F 142 | Reference = C4; 143 | ValeurCmp = 1uF; 144 | IdModule = Capacitors_SMD:C_0805_HandSoldering; 145 | EndCmp 146 | 147 | BeginCmp 148 | TimeStamp = 58B5D3A9 149 | Path = /58A4F61A 150 | Reference = C3; 151 | ValeurCmp = 100nF; 152 | IdModule = Capacitors_SMD:C_0805_HandSoldering; 153 | EndCmp 154 | 155 | BeginCmp 156 | TimeStamp = 58B5D3A3 157 | Path = /58A4FA4D 158 | Reference = C2; 159 | ValeurCmp = 22pF; 160 | IdModule = Capacitors_SMD:C_0805_HandSoldering; 161 | EndCmp 162 | 163 | BeginCmp 164 | TimeStamp = 58B5D39D 165 | Path = /58A4F9FD 166 | Reference = C1; 167 | ValeurCmp = 22pF; 168 | IdModule = Capacitors_SMD:C_0805_HandSoldering; 169 | EndCmp 170 | 171 | BeginCmp 172 | TimeStamp = 58B5D43F 173 | Path = /58B5C3A4 174 | Reference = SW1; 175 | ValeurCmp = SW_DIP_x04; 176 | IdModule = Buttons_Switches_SMD:SW_DIP_x4_W6.15mm_Slide_Omron_A6H; 177 | EndCmp 178 | 179 | EndListe 180 | -------------------------------------------------------------------------------- /KiCAD/SmallyMouse2.pro: -------------------------------------------------------------------------------- 1 | update=27/05/2017 06:29:39 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [eeschema] 27 | version=1 28 | LibDir= 29 | [eeschema/libraries] 30 | LibName1=SmallyMouse2-rescue 31 | LibName2=power 32 | LibName3=device 33 | LibName4=transistors 34 | LibName5=conn 35 | LibName6=linear 36 | LibName7=regul 37 | LibName8=74xx 38 | LibName9=cmos4000 39 | LibName10=adc-dac 40 | LibName11=memory 41 | LibName12=xilinx 42 | LibName13=microcontrollers 43 | LibName14=dsp 44 | LibName15=microchip 45 | LibName16=analog_switches 46 | LibName17=motorola 47 | LibName18=texas 48 | LibName19=intel 49 | LibName20=audio 50 | LibName21=interface 51 | LibName22=digital-audio 52 | LibName23=philips 53 | LibName24=display 54 | LibName25=cypress 55 | LibName26=siliconi 56 | LibName27=opto 57 | LibName28=atmel 58 | LibName29=contrib 59 | LibName30=valves 60 | LibName31=I:/simon/Documents/KiCad/Libraries/SimonsLibrary2017 61 | LibName32=74xgxx 62 | LibName33=ac-dc 63 | LibName34=actel 64 | LibName35=allegro 65 | LibName36=Altera 66 | LibName37=analog_devices 67 | LibName38=battery_management 68 | LibName39=bbd 69 | LibName40=brooktre 70 | LibName41=cmos_ieee 71 | LibName42=dc-dc 72 | LibName43=diode 73 | LibName44=elec-unifil 74 | LibName45=ESD_Protection 75 | LibName46=ftdi 76 | LibName47=gennum 77 | LibName48=graphic 78 | LibName49=hc11 79 | LibName50=ir 80 | LibName51=Lattice 81 | LibName52=logo 82 | LibName53=maxim 83 | LibName54=mechanical 84 | LibName55=microchip_dspic33dsc 85 | LibName56=microchip_pic10mcu 86 | LibName57=microchip_pic12mcu 87 | LibName58=microchip_pic16mcu 88 | LibName59=microchip_pic18mcu 89 | LibName60=microchip_pic32mcu 90 | LibName61=motor_drivers 91 | LibName62=motors 92 | LibName63=msp430 93 | LibName64=nordicsemi 94 | LibName65=nxp_armmcu 95 | LibName66=onsemi 96 | LibName67=Oscillators 97 | LibName68=Power_Management 98 | LibName69=powerint 99 | LibName70=pspice 100 | LibName71=references 101 | LibName72=relays 102 | LibName73=rfcom 103 | LibName74=sensors 104 | LibName75=silabs 105 | LibName76=stm8 106 | LibName77=stm32 107 | LibName78=supertex 108 | LibName79=switches 109 | LibName80=transf 110 | LibName81=ttl_ieee 111 | LibName82=video 112 | LibName83=wiznet 113 | LibName84=Worldsemi 114 | LibName85=Xicor 115 | LibName86=zetex 116 | LibName87=Zilog 117 | [schematic_editor] 118 | version=1 119 | PageLayoutDescrFile= 120 | PlotDirectoryName=PDF/ 121 | SubpartIdSeparator=0 122 | SubpartFirstId=65 123 | NetFmtName= 124 | SpiceForceRefPrefix=0 125 | SpiceUseNetNumbers=0 126 | LabSize=60 127 | [general] 128 | version=1 129 | -------------------------------------------------------------------------------- /Logo/README.md: -------------------------------------------------------------------------------- 1 | ## License (Logotype) 2 | 3 | (c)2017 Simon Inns 4 | 5 | Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) 6 | 7 | For details of the licensing requirements please see 8 | -------------------------------------------------------------------------------- /Logo/SmallyMouse2.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoninns/SmallyMouse2/66cf90d63e7168b3948b8680cc1ac9173dab672e/Logo/SmallyMouse2.ai -------------------------------------------------------------------------------- /Logo/SmallyMouse2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoninns/SmallyMouse2/66cf90d63e7168b3948b8680cc1ac9173dab672e/Logo/SmallyMouse2.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CC=avr-gcc 2 | OBJCOPY=avr-objcopy 3 | OBJS=SmallyMouse2/main.o SmallyMouse2/ConfigDescriptor.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/USBTask.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/HostStandardReq.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/ConfigDescriptors.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/Events.o 4 | 5 | CFLAGS=-Os -DUSE_LUFA_CONFIG_HEADER -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_CPU=16000000UL -DF_USB=16000000UL -D__AVR_AT90USB1287__ -mmcu=at90usb1287 -ISmallyMouse2/src/ -ISmallyMouse2/src/config/ -ISmallyMouse2/src/LUFA/ 6 | PORT=/dev/ttyACM0 7 | 8 | smallymouse.hex: smallymouse.elf 9 | ${OBJCOPY} -j .text -j .data -O ihex smallymouse.elf smallymouse.hex 10 | 11 | smallymouse.elf: ${OBJS} 12 | ${CC} -mmcu=at90usb1287 -o smallymouse.elf ${OBJS} 13 | 14 | install: smallymouse.hex 15 | dfu-programmer at90usb1287 erase --force 16 | dfu-programmer at90usb1287 flash smallymouse.hex 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Synopsis 2 | 3 | SmallyMouse2 is the AT90USB1287 firmware source code and KiCAD schematic/PCB design for the SmallyMouse2 project. 4 | 5 | ## Motivation 6 | 7 | SmallyMouse2 is a project that creates a USB mouse adaptor for retro computers that use quadrature mouse input including the Acorn BBC Micro, Acorn Master series, Commodore Amiga, Atari ST, busmouse compatible computers and many more. SmallyMouse2 provides both a generic mouse output header (for attaching mouse to retro computer cables) and an IDC connector suitable for use with Acorn 8-bit user-ports. SmallyMouse2 also features a configurable quadrature rate limiter that prevents VIA overrun when in use with slower 8-bit machines. 8 | 9 | SmallyMouse2 supports both JTAG and USB bootloader programming. The AT90USB1287 is pre-programmed by Atmel with the (FLIP) DFU bootloader; this bootloader is recognised by Atmel Studio as a programming device and can be used to flash the firmware to the board. 10 | 11 | ## Installation 12 | 13 | Note: This is an Atmel Studio 7 project that can be loaded and compiled by the IDE 14 | 15 | Please see http://www.waitingforfriday.com/?p=827 for detailed documentation about SmallyMouse2 16 | 17 | ## Author 18 | 19 | SmallyMouse2 is written and maintained by Simon Inns. 20 | 21 | ## License (Software) 22 | 23 | SmallyMouse2 is free software: you can redistribute it and/or modify 24 | it under the terms of the GNU General Public License as published by 25 | the Free Software Foundation, either version 3 of the License, or 26 | (at your option) any later version. 27 | 28 | SmallyMouse2 is distributed in the hope that it will be useful, 29 | but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 | GNU General Public License for more details. 32 | 33 | You should have received a copy of the GNU General Public License 34 | along with SmallyMouse2. If not, see . 35 | 36 | ## License (Hardware) 37 | 38 | Both the schematic and the PCB design of SmallyMouse2 (i.e. the KiCAD project and files) are covered by a Creative Commons license; as with the software you are welcome (and encouraged!) to extend, re-spin and otherwise use and modify the design as allowed by the license. However; under the terms of the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license you are required to release your design (or redesign) under the same license. For details of the licensing requirements please see 39 | -------------------------------------------------------------------------------- /SmallyMouse2.atsln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Atmel Studio Solution File, Format Version 11.00 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "SmallyMouse2", "SmallyMouse2\SmallyMouse2.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|AVR = Debug|AVR 11 | Release|AVR = Release|AVR 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR 15 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR 16 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR 17 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /SmallyMouse2/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | *.vcxproj.filters 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | [Ll]og/ 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | # Uncomment if you have tasks that create the project's static files in wwwroot 31 | #wwwroot/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | # NUNIT 38 | *.VisualState.xml 39 | TestResult.xml 40 | 41 | # Build Results of an ATL Project 42 | [Dd]ebugPS/ 43 | [Rr]eleasePS/ 44 | dlldata.c 45 | 46 | # .NET Core 47 | project.lock.json 48 | project.fragment.lock.json 49 | artifacts/ 50 | **/Properties/launchSettings.json 51 | 52 | *_i.c 53 | *_p.c 54 | *_i.h 55 | *.ilk 56 | *.meta 57 | *.obj 58 | *.pch 59 | *.pdb 60 | *.pgc 61 | *.pgd 62 | *.rsp 63 | *.sbr 64 | *.tlb 65 | *.tli 66 | *.tlh 67 | *.tmp 68 | *.tmp_proj 69 | *.log 70 | *.vspscc 71 | *.vssscc 72 | .builds 73 | *.pidb 74 | *.svclog 75 | *.scc 76 | 77 | # Chutzpah Test files 78 | _Chutzpah* 79 | 80 | # Visual C++ cache files 81 | ipch/ 82 | *.aps 83 | *.ncb 84 | *.opendb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | *.VC.db 89 | *.VC.VC.opendb 90 | 91 | # Visual Studio profiler 92 | *.psess 93 | *.vsp 94 | *.vspx 95 | *.sap 96 | 97 | # TFS 2012 Local Workspace 98 | $tf/ 99 | 100 | # Guidance Automation Toolkit 101 | *.gpState 102 | 103 | # ReSharper is a .NET coding add-in 104 | _ReSharper*/ 105 | *.[Rr]e[Ss]harper 106 | *.DotSettings.user 107 | 108 | # JustCode is a .NET coding add-in 109 | .JustCode 110 | 111 | # TeamCity is a build add-in 112 | _TeamCity* 113 | 114 | # DotCover is a Code Coverage Tool 115 | *.dotCover 116 | 117 | # Visual Studio code coverage results 118 | *.coverage 119 | *.coveragexml 120 | 121 | # NCrunch 122 | _NCrunch_* 123 | .*crunch*.local.xml 124 | nCrunchTemp_* 125 | 126 | # MightyMoose 127 | *.mm.* 128 | AutoTest.Net/ 129 | 130 | # Web workbench (sass) 131 | .sass-cache/ 132 | 133 | # Installshield output folder 134 | [Ee]xpress/ 135 | 136 | # DocProject is a documentation generator add-in 137 | DocProject/buildhelp/ 138 | DocProject/Help/*.HxT 139 | DocProject/Help/*.HxC 140 | DocProject/Help/*.hhc 141 | DocProject/Help/*.hhk 142 | DocProject/Help/*.hhp 143 | DocProject/Help/Html2 144 | DocProject/Help/html 145 | 146 | # Click-Once directory 147 | publish/ 148 | 149 | # Publish Web Output 150 | *.[Pp]ublish.xml 151 | *.azurePubxml 152 | # TODO: Comment the next line if you want to checkin your web deploy settings 153 | # but database connection strings (with potential passwords) will be unencrypted 154 | *.pubxml 155 | *.publishproj 156 | 157 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 158 | # checkin your Azure Web App publish settings, but sensitive information contained 159 | # in these scripts will be unencrypted 160 | PublishScripts/ 161 | 162 | # NuGet Packages 163 | *.nupkg 164 | # The packages folder can be ignored because of Package Restore 165 | **/packages/* 166 | # except build/, which is used as an MSBuild target. 167 | !**/packages/build/ 168 | # Uncomment if necessary however generally it will be regenerated when needed 169 | #!**/packages/repositories.config 170 | # NuGet v3's project.json files produces more ignoreable files 171 | *.nuget.props 172 | *.nuget.targets 173 | 174 | # Microsoft Azure Build Output 175 | csx/ 176 | *.build.csdef 177 | 178 | # Microsoft Azure Emulator 179 | ecf/ 180 | rcf/ 181 | 182 | # Windows Store app package directories and files 183 | AppPackages/ 184 | BundleArtifacts/ 185 | Package.StoreAssociation.xml 186 | _pkginfo.txt 187 | 188 | # Visual Studio cache files 189 | # files ending in .cache can be ignored 190 | *.[Cc]ache 191 | # but keep track of directories ending in .cache 192 | !*.[Cc]ache/ 193 | 194 | # Others 195 | ClientBin/ 196 | ~$* 197 | *~ 198 | *.dbmdl 199 | *.dbproj.schemaview 200 | *.jfm 201 | *.pfx 202 | *.publishsettings 203 | node_modules/ 204 | orleans.codegen.cs 205 | 206 | # Since there are multiple workflows, uncomment next line to ignore bower_components 207 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 208 | #bower_components/ 209 | 210 | # RIA/Silverlight projects 211 | Generated_Code/ 212 | 213 | # Backup & report files from converting an old project file 214 | # to a newer Visual Studio version. Backup files are not needed, 215 | # because we have git ;-) 216 | _UpgradeReport_Files/ 217 | Backup*/ 218 | UpgradeLog*.XML 219 | UpgradeLog*.htm 220 | 221 | # SQL Server files 222 | *.mdf 223 | *.ldf 224 | 225 | # Business Intelligence projects 226 | *.rdl.data 227 | *.bim.layout 228 | *.bim_*.settings 229 | 230 | # Microsoft Fakes 231 | FakesAssemblies/ 232 | 233 | # GhostDoc plugin setting file 234 | *.GhostDoc.xml 235 | 236 | # Node.js Tools for Visual Studio 237 | .ntvs_analysis.dat 238 | 239 | # Visual Studio 6 build log 240 | *.plg 241 | 242 | # Visual Studio 6 workspace options file 243 | *.opt 244 | 245 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 246 | *.vbw 247 | 248 | # Visual Studio LightSwitch build output 249 | **/*.HTMLClient/GeneratedArtifacts 250 | **/*.DesktopClient/GeneratedArtifacts 251 | **/*.DesktopClient/ModelManifest.xml 252 | **/*.Server/GeneratedArtifacts 253 | **/*.Server/ModelManifest.xml 254 | _Pvt_Extensions 255 | 256 | # Paket dependency manager 257 | .paket/paket.exe 258 | paket-files/ 259 | 260 | # FAKE - F# Make 261 | .fake/ 262 | 263 | # JetBrains Rider 264 | .idea/ 265 | *.sln.iml 266 | 267 | # CodeRush 268 | .cr/ 269 | 270 | # Python Tools for Visual Studio (PTVS) 271 | __pycache__/ 272 | *.pyc 273 | 274 | # Cake - Uncomment if you are using it 275 | # tools/ -------------------------------------------------------------------------------- /SmallyMouse2/ConfigDescriptor.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * 33 | * USB Device Configuration Descriptor processing routines, to determine the correct pipe configurations 34 | * needed to communication with an attached USB device. Descriptors are special computer-readable structures 35 | * which the host requests upon device enumeration, to determine the device's capabilities and functions. 36 | */ 37 | 38 | #include "ConfigDescriptor.h" 39 | 40 | /** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This 41 | * routine will read in the entire configuration descriptor, and configure the hosts pipes to correctly communicate 42 | * with compatible devices. 43 | * 44 | * This routine searches for a HID interface descriptor containing at least one Interrupt type IN endpoint. 45 | * 46 | * \return An error code from the \ref MouseHost_GetConfigDescriptorDataCodes_t enum. 47 | */ 48 | uint8_t ProcessConfigurationDescriptor(void) 49 | { 50 | uint8_t ConfigDescriptorData[512]; 51 | void* CurrConfigLocation = ConfigDescriptorData; 52 | uint16_t CurrConfigBytesRem; 53 | 54 | USB_Descriptor_Interface_t* HIDInterface = NULL; 55 | USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; 56 | 57 | /* Retrieve the entire configuration descriptor into the allocated buffer */ 58 | switch (USB_Host_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData))) 59 | { 60 | case HOST_GETCONFIG_Successful: 61 | break; 62 | case HOST_GETCONFIG_InvalidData: 63 | return InvalidConfigDataReturned; 64 | case HOST_GETCONFIG_BuffOverflow: 65 | return DescriptorTooLarge; 66 | default: 67 | return ControlError; 68 | } 69 | 70 | while (!(DataINEndpoint)) 71 | { 72 | /* See if we've found a likely compatible interface, and if there is an endpoint within that interface */ 73 | if (!(HIDInterface) || 74 | USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, 75 | DComp_NextMouseInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) 76 | { 77 | /* Get the next HID interface from the configuration descriptor */ 78 | if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, 79 | DComp_NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found) 80 | { 81 | /* Descriptor not found, error out */ 82 | return NoCompatibleInterfaceFound; 83 | } 84 | 85 | /* Save the interface in case we need to refer back to it later */ 86 | HIDInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t); 87 | 88 | /* Skip the remainder of the loop as we have not found an endpoint yet */ 89 | continue; 90 | } 91 | 92 | /* Retrieve the endpoint address from the endpoint descriptor */ 93 | USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t); 94 | 95 | /* If the endpoint is a IN type endpoint */ 96 | if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) 97 | DataINEndpoint = EndpointData; 98 | } 99 | 100 | /* Configure the HID data IN pipe */ 101 | Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1); 102 | Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS); 103 | 104 | /* Valid data found, return success */ 105 | return SuccessfulConfigRead; 106 | } 107 | 108 | /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's 109 | * configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration 110 | * descriptor processing if an incompatible descriptor configuration is found. 111 | * 112 | * This comparator searches for the next Interface descriptor of the correct Mouse HID Class and Protocol values. 113 | * 114 | * \return A value from the DSEARCH_Return_ErrorCodes_t enum 115 | */ 116 | uint8_t DComp_NextMouseInterface(void* CurrentDescriptor) 117 | { 118 | USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); 119 | 120 | /* Determine if the current descriptor is an interface descriptor */ 121 | if (Header->Type == DTYPE_Interface) 122 | { 123 | USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); 124 | 125 | /* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */ 126 | if ((Interface->Class == HID_CSCP_HIDClass) && 127 | (Interface->Protocol == HID_CSCP_MouseBootProtocol)) 128 | { 129 | /* Indicate that the descriptor being searched for has been found */ 130 | return DESCRIPTOR_SEARCH_Found; 131 | } 132 | } 133 | 134 | /* Current descriptor does not match what this comparator is looking for */ 135 | return DESCRIPTOR_SEARCH_NotFound; 136 | } 137 | 138 | /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's 139 | * configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration 140 | * descriptor processing if an incompatible descriptor configuration is found. 141 | * 142 | * This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the 143 | * search if another interface descriptor is found before the required endpoint. 144 | * 145 | * \return A value from the DSEARCH_Return_ErrorCodes_t enum 146 | */ 147 | uint8_t DComp_NextMouseInterfaceDataEndpoint(void* CurrentDescriptor) 148 | { 149 | USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); 150 | 151 | /* Determine the type of the current descriptor */ 152 | if (Header->Type == DTYPE_Endpoint) 153 | return DESCRIPTOR_SEARCH_Found; 154 | else if (Header->Type == DTYPE_Interface) 155 | return DESCRIPTOR_SEARCH_Fail; 156 | else 157 | return DESCRIPTOR_SEARCH_NotFound; 158 | } 159 | 160 | -------------------------------------------------------------------------------- /SmallyMouse2/ConfigDescriptor.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * 33 | * Header file for ConfigDescriptor.c. 34 | */ 35 | 36 | #ifndef _CONFIGDESCRIPTOR_H_ 37 | #define _CONFIGDESCRIPTOR_H_ 38 | 39 | /* Includes: */ 40 | #include 41 | 42 | #include "main.h" 43 | 44 | /* Macros: */ 45 | /** Pipe address for the mouse data IN pipe. */ 46 | #define MOUSE_DATA_IN_PIPE (PIPE_DIR_IN | 1) 47 | 48 | /* Enums: */ 49 | /** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */ 50 | enum MouseHost_GetConfigDescriptorDataCodes_t 51 | { 52 | SuccessfulConfigRead = 0, /**< Configuration Descriptor was processed successfully */ 53 | ControlError = 1, /**< A control request to the device failed to complete successfully */ 54 | DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */ 55 | InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */ 56 | NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */ 57 | }; 58 | 59 | /* Function Prototypes: */ 60 | uint8_t ProcessConfigurationDescriptor(void); 61 | 62 | uint8_t DComp_NextMouseInterface(void* CurrentDescriptor); 63 | uint8_t DComp_NextMouseInterfaceDataEndpoint(void* CurrentDescriptor); 64 | 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /SmallyMouse2/SmallyMouse2.componentinfo.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Device 8 | Startup 9 | 10 | 11 | Atmel 12 | 1.0.0 13 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs 14 | 15 | 16 | 17 | 18 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.0.106\include 19 | 20 | include 21 | C 22 | 23 | 24 | include 25 | 26 | 27 | 28 | 29 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.0.106\include\avr\iousb1287.h 30 | 31 | header 32 | C 33 | h+EcHgBzi0q94+4gMY1FqA== 34 | 35 | include/avr/iousb1287.h 36 | 37 | 38 | 39 | 40 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.0.106\templates\main.c 41 | template 42 | source 43 | C Exe 44 | p7MXIacWPm074TzjN5tf5Q== 45 | 46 | templates/main.c 47 | Main file (.c) 48 | 49 | 50 | 51 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.0.106\templates\main.cpp 52 | template 53 | source 54 | C Exe 55 | YXFphlh0CtZJU+ebktABgQ== 56 | 57 | templates/main.cpp 58 | Main file (.cpp) 59 | 60 | 61 | 62 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.0.106\gcc\dev\at90usb1287 63 | 64 | libraryPrefix 65 | GCC 66 | 67 | 68 | gcc/dev/at90usb1287 69 | 70 | 71 | 72 | 73 | ATmega_DFP 74 | C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.0.106/Atmel.ATmega_DFP.pdsc 75 | 1.0.106 76 | true 77 | AT90USB1287 78 | 79 | 80 | 81 | Resolved 82 | Fixed 83 | true 84 | 85 | 86 | -------------------------------------------------------------------------------- /SmallyMouse2/main.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | main.h 3 | 4 | Main functions 5 | SmallyMouse2 - USB to quadrature mouse converter 6 | Copyright (C) 2017-2020 Simon Inns 7 | 8 | This file is part of SmallyMouse2. 9 | 10 | SmallyMouse2 is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | 23 | Email: simon.inns@gmail.com 24 | 25 | ************************************************************************/ 26 | 27 | #ifndef _MAIN_H_ 28 | #define _MAIN_H_ 29 | 30 | // Hardware map 31 | 32 | // Quadrature mouse output port 33 | // Right mouse button 34 | #define RB_PORT PORTC 35 | #define RB_PIN PINC 36 | #define RB_DDR DDRC 37 | #define RB (1 << 6) 38 | 39 | // Middle mouse button 40 | #define MB_PORT PORTC 41 | #define MB_PIN PINC 42 | #define MB_DDR DDRC 43 | #define MB (1 << 5) 44 | 45 | // Left mouse button 46 | #define LB_PORT PORTC 47 | #define LB_PIN PINC 48 | #define LB_DDR DDRC 49 | #define LB (1 << 4) 50 | 51 | // Y axis output 52 | #define Y2_PORT PORTC 53 | #define Y2_PIN PINC 54 | #define Y2_DDR DDRC 55 | #define Y2 (1 << 3) 56 | 57 | #define Y1_PORT PORTC 58 | #define Y1_PIN PINC 59 | #define Y1_DDR DDRC 60 | #define Y1 (1 << 1) 61 | 62 | // X axis output 63 | #define X2_PORT PORTC 64 | #define X2_PIN PINC 65 | #define X2_DDR DDRC 66 | #define X2 (1 << 2) 67 | 68 | #define X1_PORT PORTC 69 | #define X1_PIN PINC 70 | #define X1_DDR DDRC 71 | #define X1 (1 << 0) 72 | 73 | // Rate limit on/off switch (marked 'slow') 74 | #define RATESW_PORT PORTA 75 | #define RATESW_PIN PINA 76 | #define RATESW_DDR DDRA 77 | #define RATESW (1 << 4) 78 | 79 | // Expansion (Ian) header 80 | #define E0_PORT PORTD 81 | #define E0_PIN PIND 82 | #define E0_DDR DDRD 83 | #define E0 (1 << 0) 84 | 85 | #define E1_PORT PORTD 86 | #define E1_PIN PIND 87 | #define E1_DDR DDRD 88 | #define E1 (1 << 1) 89 | 90 | #define E2_PORT PORTD 91 | #define E2_PIN PIND 92 | #define E2_DDR DDRD 93 | #define E2 (1 << 2) 94 | 95 | #define E3_PORT PORTD 96 | #define E3_PIN PIND 97 | #define E3_DDR DDRD 98 | #define E3 (1 << 3) 99 | 100 | #define E4_PORT PORTD 101 | #define E4_PIN PIND 102 | #define E4_DDR DDRD 103 | #define E4 (1 << 4) 104 | 105 | #define E5_PORT PORTD 106 | #define E5_PIN PIND 107 | #define E5_DDR DDRD 108 | #define E5 (1 << 5) 109 | 110 | #define E6_PORT PORTD 111 | #define E6_PIN PIND 112 | #define E6_DDR DDRD 113 | #define E6 (1 << 6) 114 | 115 | 116 | // E7 is now used as the DPISW header 117 | #define DPISW_PORT PORTD 118 | #define DPISW_PIN PIND 119 | #define DPISW_DDR DDRD 120 | #define DPISW (1 << 7) 121 | 122 | // Function prototypes 123 | void initialiseHardware(void); 124 | void initialiseTimers(void); 125 | void processMouse(void); 126 | uint8_t processMouseMovement(int8_t movementUnits, uint8_t axis, bool limitRate, bool dpiDivide); 127 | 128 | // USB callback event handlers (LUFA) 129 | void EVENT_USB_Host_HostError(const uint8_t ErrorCode); 130 | void EVENT_USB_Host_DeviceAttached(void); 131 | void EVENT_USB_Host_DeviceUnattached(void); 132 | void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); 133 | void EVENT_USB_Host_DeviceEnumerationComplete(void); 134 | 135 | void ReadNextReport(void); 136 | 137 | #endif 138 | 139 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Common/Architectures.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Supported library architecture defines. 33 | * 34 | * \copydetails Group_Architectures 35 | * 36 | * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's 37 | * functionality. 38 | */ 39 | 40 | /** \ingroup Group_Common 41 | * \defgroup Group_Architectures Hardware Architectures 42 | * \brief Supported library architecture defines. 43 | * 44 | * Architecture macros for selecting the desired target microcontroller architecture. One of these values should be 45 | * defined as the value of \c ARCH in the user project makefile via the \c -D compiler switch to GCC, to select the 46 | * target architecture. 47 | * 48 | * The selected architecture should remain consistent with the makefile \c ARCH value, which is used to select the 49 | * underlying driver source files for each architecture. 50 | * 51 | * @{ 52 | */ 53 | 54 | #ifndef __LUFA_ARCHITECTURES_H__ 55 | #define __LUFA_ARCHITECTURES_H__ 56 | 57 | /* Preprocessor Checks: */ 58 | #if !defined(__INCLUDE_FROM_COMMON_H) 59 | #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. 60 | #endif 61 | 62 | /* Public Interface - May be used in end-application: */ 63 | /* Macros: */ 64 | /** Selects the Atmel 8-bit AVR (AT90USB* and ATMEGA*U* chips) architecture. */ 65 | #define ARCH_AVR8 0 66 | 67 | /** Selects the Atmel 32-bit UC3 AVR (AT32UC3* chips) architecture. */ 68 | #define ARCH_UC3 1 69 | 70 | /** Selects the Atmel XMEGA AVR (ATXMEGA* chips) architecture. */ 71 | #define ARCH_XMEGA 2 72 | 73 | #if !defined(__DOXYGEN__) 74 | #define ARCH_ ARCH_AVR8 75 | 76 | #if !defined(ARCH) 77 | #define ARCH ARCH_AVR8 78 | #endif 79 | #endif 80 | 81 | #endif 82 | 83 | /** @} */ 84 | 85 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Common/CompilerSpecific.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Compiler specific definitions for code optimization and correctness. 33 | * 34 | * \copydetails Group_CompilerSpecific 35 | * 36 | * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's 37 | * functionality. 38 | */ 39 | 40 | /** \ingroup Group_Common 41 | * \defgroup Group_CompilerSpecific Compiler Specific Definitions 42 | * \brief Compiler specific definitions for code optimization and correctness. 43 | * 44 | * Compiler specific definitions to expose certain compiler features which may increase the level of code optimization 45 | * for a specific compiler, or correct certain issues that may be present such as memory barriers for use in conjunction 46 | * with atomic variable access. 47 | * 48 | * Where possible, on alternative compilers, these macros will either have no effect, or default to returning a sane value 49 | * so that they can be used in existing code without the need for extra compiler checks in the user application code. 50 | * 51 | * @{ 52 | */ 53 | 54 | #ifndef __LUFA_COMPILERSPEC_H__ 55 | #define __LUFA_COMPILERSPEC_H__ 56 | 57 | /* Preprocessor Checks: */ 58 | #if !defined(__INCLUDE_FROM_COMMON_H) 59 | #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. 60 | #endif 61 | 62 | /* Public Interface - May be used in end-application: */ 63 | /* Macros: */ 64 | #if defined(__GNUC__) || defined(__DOXYGEN__) 65 | /** Forces GCC to use pointer indirection (via the device's pointer register pairs) when accessing the given 66 | * struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through 67 | * a pointer, resulting in a larger binary. When this macro is used on a (non \c const) structure pointer before 68 | * use, it will force GCC to use pointer indirection on the elements rather than direct store and load 69 | * instructions. 70 | * 71 | * \param[in, out] StructPtr Pointer to a structure which is to be forced into indirect access mode. 72 | */ 73 | #define GCC_FORCE_POINTER_ACCESS(StructPtr) __asm__ __volatile__("" : "=b" (StructPtr) : "0" (StructPtr)) 74 | 75 | /** Forces GCC to create a memory barrier, ensuring that memory accesses are not reordered past the barrier point. 76 | * This can be used before ordering-critical operations, to ensure that the compiler does not re-order the resulting 77 | * assembly output in an unexpected manner on sections of code that are ordering-specific. 78 | */ 79 | #define GCC_MEMORY_BARRIER() __asm__ __volatile__("" ::: "memory"); 80 | 81 | /** Determines if the specified value can be determined at compile-time to be a constant value when compiling under GCC. 82 | * 83 | * \param[in] x Value to check compile-time constantness of. 84 | * 85 | * \return Boolean \c true if the given value is known to be a compile time constant, \c false otherwise. 86 | */ 87 | #define GCC_IS_COMPILE_CONST(x) __builtin_constant_p(x) 88 | #else 89 | #define GCC_FORCE_POINTER_ACCESS(StructPtr) 90 | #define GCC_MEMORY_BARRIER() 91 | #define GCC_IS_COMPILE_CONST(x) 0 92 | #endif 93 | 94 | #endif 95 | 96 | /** @} */ 97 | 98 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/Board/Board.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Board hardware information driver. 33 | * 34 | * This file is the master dispatch header file for the board-specific information driver, to give information 35 | * on the hardware contained on a specific board. 36 | * 37 | * User code should include this file, which will in turn include the correct board driver header file for the 38 | * currently selected board. 39 | * 40 | * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Board.h file in the user project 41 | * directory. 42 | * 43 | * For possible \c BOARD makefile values, see \ref Group_BoardTypes. 44 | */ 45 | 46 | /** \ingroup Group_BoardDrivers 47 | * \defgroup Group_BoardInfo Board Information Driver - LUFA/Drivers/Board/Board.h 48 | * \brief Board hardware information driver. 49 | * 50 | * \section Sec_BoardInfo_Dependencies Module Source Dependencies 51 | * The following files must be built with any user project that uses this module: 52 | * - None 53 | * 54 | * @{ 55 | */ 56 | 57 | #ifndef __BOARD_H__ 58 | #define __BOARD_H__ 59 | 60 | /* Macros: */ 61 | #define __INCLUDE_FROM_BOARD_H 62 | 63 | /* Includes: */ 64 | #include "../../Common/Common.h" 65 | 66 | #if (BOARD == BOARD_USBKEY) 67 | #include "AVR8/USBKEY/Board.h" 68 | #elif (BOARD == BOARD_STK525) 69 | #include "AVR8/STK525/Board.h" 70 | #elif (BOARD == BOARD_STK526) 71 | #include "AVR8/STK526/Board.h" 72 | #elif (BOARD == BOARD_RZUSBSTICK) 73 | #include "AVR8/RZUSBSTICK/Board.h" 74 | #elif (BOARD == BOARD_ATAVRUSBRF01) 75 | #include "AVR8/ATAVRUSBRF01/Board.h" 76 | #elif ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) 77 | #include "AVR8/XPLAIN/Board.h" 78 | #elif (BOARD == BOARD_BUMBLEB) 79 | #include "AVR8/BUMBLEB/Board.h" 80 | #elif (BOARD == BOARD_EVK527) 81 | #include "AVR8/EVK527/Board.h" 82 | #elif ((BOARD == BOARD_TEENSY) || (BOARD == BOARD_TEENSY2)) 83 | #include "AVR8/TEENSY/Board.h" 84 | #elif (BOARD == BOARD_USBTINYMKII) 85 | #include "AVR8/USBTINYMKII/Board.h" 86 | #elif (BOARD == BOARD_BENITO) 87 | #include "AVR8/BENITO/Board.h" 88 | #elif (BOARD == BOARD_JMDBU2) 89 | #include "AVR8/JMDBU2/Board.h" 90 | #elif (BOARD == BOARD_OLIMEX162) 91 | #include "AVR8/OLIMEX162/Board.h" 92 | #elif (BOARD == BOARD_USBFOO) 93 | #include "AVR8/USBFOO/Board.h" 94 | #elif (BOARD == BOARD_UDIP) 95 | #include "AVR8/UDIP/Board.h" 96 | #elif (BOARD == BOARD_BUI) 97 | #include "AVR8/BUI/Board.h" 98 | #elif (BOARD == BOARD_UNO) 99 | #include "AVR8/UNO/Board.h" 100 | #elif (BOARD == BOARD_CULV3) 101 | #include "AVR8/CULV3/Board.h" 102 | #elif (BOARD == BOARD_BLACKCAT) 103 | #include "AVR8/BLACKCAT/Board.h" 104 | #elif (BOARD == BOARD_MAXIMUS) 105 | #include "AVR8/MAXIMUS/Board.h" 106 | #elif (BOARD == BOARD_MINIMUS) 107 | #include "AVR8/MINIMUS/Board.h" 108 | #elif (BOARD == BOARD_ADAFRUITU4) 109 | #include "AVR8/ADAFRUITU4/Board.h" 110 | #elif (BOARD == BOARD_MICROSIN162) 111 | #include "AVR8/MICROSIN162/Board.h" 112 | #elif (BOARD == BOARD_SPARKFUN8U2) 113 | #include "AVR8/SPARKFUN8U2/Board.h" 114 | #elif (BOARD == BOARD_EVK1101) 115 | #include "UC3/EVK1101/Board.h" 116 | #elif (BOARD == BOARD_TUL) 117 | #include "AVR8/TUL/Board.h" 118 | #elif (BOARD == BOARD_EVK1100) 119 | #include "UC3/EVK1100/Board.h" 120 | #elif (BOARD == BOARD_EVK1104) 121 | #include "UC3/EVK1104/Board.h" 122 | #elif (BOARD == BOARD_A3BU_XPLAINED) 123 | #include "XMEGA/A3BU_XPLAINED/Board.h" 124 | #elif ((BOARD == BOARD_USB2AX) || (BOARD == BOARD_USB2AX_V3) || (BOARD == BOARD_USB2AX_V31)) 125 | #include "AVR8/USB2AX/Board.h" 126 | #elif ((BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_REV2) || \ 127 | (BOARD == BOARD_MICROPENDOUS_32U2) || (BOARD == BOARD_MICROPENDOUS_A) || \ 128 | (BOARD == BOARD_MICROPENDOUS_1) || (BOARD == BOARD_MICROPENDOUS_2) || \ 129 | (BOARD == BOARD_MICROPENDOUS_3) || (BOARD == BOARD_MICROPENDOUS_4) || \ 130 | (BOARD == BOARD_MICROPENDOUS_DIP)) 131 | #include "AVR8/MICROPENDOUS/Board.h" 132 | #elif (BOARD == BOARD_B1_XPLAINED) 133 | #include "XMEGA/B1_XPLAINED/Board.h" 134 | #elif (BOARD == BOARD_MULTIO) 135 | #include "AVR8/MULTIO/Board.h" 136 | #elif (BOARD == BOARD_BIGMULTIO) 137 | #include "AVR8/BIGMULTIO/Board.h" 138 | #elif (BOARD == BOARD_DUCE) 139 | #include "AVR8/DUCE/Board.h" 140 | #elif (BOARD == BOARD_OLIMEX32U4) 141 | #include "AVR8/OLIMEX32U4/Board.h" 142 | #elif (BOARD == BOARD_OLIMEXT32U4) 143 | #include "AVR8/OLIMEXT32U4/Board.h" 144 | #elif (BOARD == BOARD_OLIMEXISPMK2) 145 | #include "AVR8/OLIMEXISPMK2/Board.h" 146 | #elif (BOARD == BOARD_LEONARDO) 147 | #include "AVR8/LEONARDO/Board.h" 148 | #elif (BOARD == BOARD_UC3A3_XPLAINED) 149 | #include "UC3/UC3A3_XPLAINED/Board.h" 150 | #elif (BOARD == BOARD_STANGE_ISP) 151 | #include "AVR8/STANGE_ISP/Board.h" 152 | #elif (BOARD == BOARD_C3_XPLAINED) 153 | #include "XMEGA/C3_XPLAINED/Board.h" 154 | #elif (BOARD == BOARD_U2S) 155 | #include "AVR8/U2S/Board.h" 156 | #elif (BOARD == BOARD_YUN) 157 | #include "AVR8/YUN/Board.h" 158 | #elif (BOARD == BOARD_MICRO) 159 | #include "AVR8/MICRO/Board.h" 160 | #elif (BOARD == BOARD_XPLAINED_MINI) 161 | #include "AVR8/XPLAINED_MINI/Board.h" 162 | #else 163 | #include "Board/Board.h" 164 | #endif 165 | 166 | #endif 167 | 168 | /** @} */ 169 | 170 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #include "../../../Common/Common.h" 32 | #if (ARCH == ARCH_AVR8) 33 | 34 | #define __INCLUDE_FROM_SERIAL_C 35 | #include "../Serial.h" 36 | 37 | FILE USARTSerialStream; 38 | 39 | int Serial_putchar(char DataByte, 40 | FILE *Stream) 41 | { 42 | (void)Stream; 43 | 44 | Serial_SendByte(DataByte); 45 | return 0; 46 | } 47 | 48 | int Serial_getchar(FILE *Stream) 49 | { 50 | (void)Stream; 51 | 52 | if (!(Serial_IsCharReceived())) 53 | return _FDEV_EOF; 54 | 55 | return Serial_ReceiveByte(); 56 | } 57 | 58 | int Serial_getchar_Blocking(FILE *Stream) 59 | { 60 | (void)Stream; 61 | 62 | while (!(Serial_IsCharReceived())); 63 | return Serial_ReceiveByte(); 64 | } 65 | 66 | void Serial_SendString_P(const char* FlashStringPtr) 67 | { 68 | uint8_t CurrByte; 69 | 70 | while ((CurrByte = pgm_read_byte(FlashStringPtr)) != 0x00) 71 | { 72 | Serial_SendByte(CurrByte); 73 | FlashStringPtr++; 74 | } 75 | } 76 | 77 | void Serial_SendString(const char* StringPtr) 78 | { 79 | uint8_t CurrByte; 80 | 81 | while ((CurrByte = *StringPtr) != 0x00) 82 | { 83 | Serial_SendByte(CurrByte); 84 | StringPtr++; 85 | } 86 | } 87 | 88 | void Serial_SendData(const void* Buffer, 89 | uint16_t Length) 90 | { 91 | while (Length--) 92 | Serial_SendByte(*((uint8_t*)Buffer++)); 93 | } 94 | 95 | void Serial_CreateStream(FILE* Stream) 96 | { 97 | if (!(Stream)) 98 | { 99 | Stream = &USARTSerialStream; 100 | stdin = Stream; 101 | stdout = Stream; 102 | } 103 | 104 | *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar, _FDEV_SETUP_RW); 105 | } 106 | 107 | void Serial_CreateBlockingStream(FILE* Stream) 108 | { 109 | if (!(Stream)) 110 | { 111 | Stream = &USARTSerialStream; 112 | stdin = Stream; 113 | stdout = Stream; 114 | } 115 | 116 | *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar_Blocking, _FDEV_SETUP_RW); 117 | } 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/Peripheral/Serial.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Hardware Serial USART driver. 33 | * 34 | * This file is the master dispatch header file for the device-specific USART driver, for microcontrollers 35 | * containing a hardware USART. 36 | * 37 | * User code should include this file, which will in turn include the correct ADC driver header file for the 38 | * currently selected architecture and microcontroller model. 39 | */ 40 | 41 | /** \ingroup Group_PeripheralDrivers 42 | * \defgroup Group_Serial Serial USART Driver - LUFA/Drivers/Peripheral/Serial.h 43 | * \brief Hardware Serial USART driver. 44 | * 45 | * \section Sec_Serial_Dependencies Module Source Dependencies 46 | * The following files must be built with any user project that uses this module: 47 | * - LUFA/Drivers/Peripheral/ARCH/Serial_ARCH.c (Makefile source module name: LUFA_SRC_SERIAL) 48 | * 49 | * \section Sec_Serial_ModDescription Module Description 50 | * Hardware serial USART driver. This module provides an easy to use driver for the setup and transfer 51 | * of data over the selected architecture and microcontroller model's USART port. 52 | * 53 | * \note The exact API for this driver may vary depending on the target used - see 54 | * individual target module documentation for the API specific to your target processor. 55 | */ 56 | 57 | #ifndef __SERIAL_H__ 58 | #define __SERIAL_H__ 59 | 60 | /* Macros: */ 61 | #define __INCLUDE_FROM_SERIAL_H 62 | 63 | /* Includes: */ 64 | #include "../../Common/Common.h" 65 | 66 | /* Includes: */ 67 | #if (ARCH == ARCH_AVR8) 68 | #include "AVR8/Serial_AVR8.h" 69 | #elif (ARCH == ARCH_XMEGA) 70 | #include "XMEGA/Serial_XMEGA.h" 71 | #else 72 | #error The Serial peripheral driver is not currently available for your selected architecture. 73 | #endif 74 | 75 | #endif 76 | 77 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB Android Open Accessory Class driver. 33 | * 34 | * Master include file for the library USB Android Open Accessory Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassAOA Android Open Accessory Class Driver 42 | * \brief USB class driver for the Google Android Open Accessory class standard. 43 | * 44 | * \section Sec_USBClassAOA_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * 48 | * \section Sec_USBClassAOA_ModDescription Module Description 49 | * Android Open Accessory Class Driver module. This module contains an internal implementation of the USB Android Open Accessory 50 | * Class, for Host USB mode. User applications can use this class driver instead of implementing the Android Open Accessory Class 51 | * manually via the low-level LUFA APIs. 52 | * 53 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 54 | * Host using the USB Android Open Accessory Class. 55 | * 56 | * @{ 57 | */ 58 | 59 | #ifndef _AOA_CLASS_H_ 60 | #define _AOA_CLASS_H_ 61 | 62 | /* Macros: */ 63 | #define __INCLUDE_FROM_USB_DRIVER 64 | #define __INCLUDE_FROM_AOA_DRIVER 65 | 66 | /* Includes: */ 67 | #include "../Core/USBMode.h" 68 | 69 | #if defined(USB_CAN_BE_HOST) 70 | #include "Host/AndroidAccessoryClassHost.h" 71 | #endif 72 | 73 | #endif 74 | 75 | /** @} */ 76 | 77 | 78 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/AudioClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB Audio 1.0 Class driver. 33 | * 34 | * Master include file for the library USB Audio 1.0 Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassAudio Audio 1.0 Class Driver 42 | * \brief USB class driver for the USB-IF Audio 1.0 class standard. 43 | * 44 | * \section Sec_USBClassAudio_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Device/AudioClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * - LUFA/Drivers/USB/Class/Host/AudioClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 48 | * 49 | * \section Sec_USBClassAudio_ModDescription Module Description 50 | * Audio 1.0 Class Driver module. This module contains an internal implementation of the USB Audio 1.0 Class, for both 51 | * Device and Host USB modes. User applications can use this class driver instead of implementing the Audio 1.0 class 52 | * manually via the low-level LUFA APIs. 53 | * 54 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 55 | * Hosts or Devices using the USB Audio 1.0 Class. 56 | * 57 | * @{ 58 | */ 59 | 60 | #ifndef _AUDIO_CLASS_H_ 61 | #define _AUDIO_CLASS_H_ 62 | 63 | /* Macros: */ 64 | #define __INCLUDE_FROM_USB_DRIVER 65 | #define __INCLUDE_FROM_AUDIO_DRIVER 66 | 67 | /* Includes: */ 68 | #include "../Core/USBMode.h" 69 | 70 | #if defined(USB_CAN_BE_DEVICE) 71 | #include "Device/AudioClassDevice.h" 72 | #endif 73 | 74 | #if defined(USB_CAN_BE_HOST) 75 | #include "Host/AudioClassHost.h" 76 | #endif 77 | 78 | #endif 79 | 80 | /** @} */ 81 | 82 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/CDCClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB CDC-ACM Class driver. 33 | * 34 | * Master include file for the library USB CDC Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassCDC CDC-ACM (Virtual Serial) Class Driver 42 | * \brief USB class driver for the USB-IF CDC-ACM (Virtual Serial) class standard. 43 | * 44 | * \section Sec_USBClassCDC_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Device/CDCClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * - LUFA/Drivers/USB/Class/Host/CDCClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 48 | * 49 | * \section Sec_USBClassCDC_ModDescription Module Description 50 | * CDC Class Driver module. This module contains an internal implementation of the USB CDC-ACM class Virtual Serial 51 | * Ports, for both Device and Host USB modes. User applications can use this class driver instead of implementing the 52 | * CDC class manually via the low-level LUFA APIs. 53 | * 54 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 55 | * Hosts or Devices using the USB CDC Class. 56 | * 57 | * @{ 58 | */ 59 | 60 | #ifndef _CDC_CLASS_H_ 61 | #define _CDC_CLASS_H_ 62 | 63 | /* Macros: */ 64 | #define __INCLUDE_FROM_USB_DRIVER 65 | #define __INCLUDE_FROM_CDC_DRIVER 66 | 67 | /* Includes: */ 68 | #include "../Core/USBMode.h" 69 | 70 | #if defined(USB_CAN_BE_DEVICE) 71 | #include "Device/CDCClassDevice.h" 72 | #endif 73 | 74 | #if defined(USB_CAN_BE_HOST) 75 | #include "Host/CDCClassHost.h" 76 | #endif 77 | 78 | #endif 79 | 80 | /** @} */ 81 | 82 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Common definitions and declarations for the library USB Android Open Accessory Class driver. 33 | * 34 | * Common definitions and declarations for the library USB Android Open Accessory Class driver. 35 | * 36 | * \note This file should not be included directly. It is automatically included as needed by the USB module driver 37 | * dispatch header located in LUFA/Drivers/USB.h. 38 | */ 39 | 40 | /** \ingroup Group_USBClassAOA 41 | * \defgroup Group_USBClassAOACommon Common Class Definitions 42 | * 43 | * \section Sec_USBClassAOACommon_ModDescription Module Description 44 | * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB 45 | * Android Open Accessory Class. 46 | * 47 | * @{ 48 | */ 49 | 50 | #ifndef _AOA_CLASS_COMMON_H_ 51 | #define _AOA_CLASS_COMMON_H_ 52 | 53 | /* Includes: */ 54 | #include "../../Core/StdDescriptors.h" 55 | 56 | /* Enable C linkage for C++ Compilers: */ 57 | #if defined(__cplusplus) 58 | extern "C" { 59 | #endif 60 | 61 | /* Preprocessor Checks: */ 62 | #if !defined(__INCLUDE_FROM_AOA_DRIVER) 63 | #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. 64 | #endif 65 | 66 | /* Macros: */ 67 | /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory mode. */ 68 | #define ANDROID_ACCESSORY_PRODUCT_ID 0x2D00 69 | 70 | /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory and Android Debug mode. */ 71 | #define ANDROID_ACCESSORY_ADB_PRODUCT_ID 0x2D01 72 | 73 | /* Enums: */ 74 | /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the 75 | * Android Open Accessory class. 76 | */ 77 | enum AOA_Descriptor_ClassSubclassProtocol_t 78 | { 79 | AOA_CSCP_AOADataClass = 0xFF, /**< Descriptor Class value indicating that the device or interface 80 | * belongs to the AOA data class. 81 | */ 82 | AOA_CSCP_AOADataSubclass = 0xFF, /**< Descriptor Subclass value indicating that the device or interface 83 | * belongs to AOA data subclass. 84 | */ 85 | AOA_CSCP_AOADataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface 86 | * belongs to the AOA data class protocol. 87 | */ 88 | }; 89 | 90 | /** Enum for the Android Open Accessory class specific control requests that can be issued by the USB bus host. */ 91 | enum AOA_ClassRequests_t 92 | { 93 | AOA_REQ_GetAccessoryProtocol = 0x33, /**< Android Open Accessory control request to retrieve the device's supported Accessory Protocol version. */ 94 | AOA_REQ_SendString = 0x34, /**< Android Open Accessory control request to set an accessory property string in the device. */ 95 | AOA_REQ_StartAccessoryMode = 0x35, /**< Android Open Accessory control request to switch the device into Accessory mode. */ 96 | }; 97 | 98 | /** Enum for the possible Android Open Accessory property string indexes. */ 99 | enum AOA_Strings_t 100 | { 101 | AOA_STRING_Manufacturer = 0, /**< Index of the Manufacturer property string. */ 102 | AOA_STRING_Model = 1, /**< Index of the Model Name property string. */ 103 | AOA_STRING_Description = 2, /**< Index of the Description property string. */ 104 | AOA_STRING_Version = 3, /**< Index of the Version Number property string. */ 105 | AOA_STRING_URI = 4, /**< Index of the URI Information property string. */ 106 | AOA_STRING_Serial = 5, /**< Index of the Serial Number property string. */ 107 | 108 | #if !defined(__DOXYGEN__) 109 | AOA_STRING_TOTAL_STRINGS 110 | #endif 111 | }; 112 | 113 | /** Enum for the possible Android Open Accessory protocol versions. */ 114 | enum AOA_Protocols_t 115 | { 116 | AOA_PROTOCOL_AccessoryV1 = 0x0001, /**< Android Open Accessory version 1. */ 117 | AOA_PROTOCOL_AccessoryV2 = 0x0002, /**< Android Open Accessory version 2. */ 118 | }; 119 | 120 | /* Disable C linkage for C++ Compilers: */ 121 | #if defined(__cplusplus) 122 | } 123 | #endif 124 | 125 | #endif 126 | 127 | /** @} */ 128 | 129 | 130 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/Common/HIDReportData.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Constants for HID report item attributes. 33 | * 34 | * HID report item constants for report item attributes. Refer to the HID specification for 35 | * details on each flag's meaning when applied to an IN, OUT or FEATURE item. 36 | */ 37 | 38 | /** \ingroup Group_HIDParser 39 | * \defgroup Group_HIDReportItemConst HID Report Descriptor Item Constants 40 | * 41 | * General HID constant definitions for HID Report Descriptor elements. 42 | * 43 | * @{ 44 | */ 45 | 46 | #ifndef __HIDREPORTDATA_H__ 47 | #define __HIDREPORTDATA_H__ 48 | 49 | /* Private Interface - For use in library only: */ 50 | #if !defined(__DOXYGEN__) 51 | /* Macros: */ 52 | #define HID_RI_DATA_SIZE_MASK 0x03 53 | #define HID_RI_TYPE_MASK 0x0C 54 | #define HID_RI_TAG_MASK 0xF0 55 | 56 | #define HID_RI_TYPE_MAIN 0x00 57 | #define HID_RI_TYPE_GLOBAL 0x04 58 | #define HID_RI_TYPE_LOCAL 0x08 59 | 60 | #define HID_RI_DATA_BITS_0 0x00 61 | #define HID_RI_DATA_BITS_8 0x01 62 | #define HID_RI_DATA_BITS_16 0x02 63 | #define HID_RI_DATA_BITS_32 0x03 64 | #define HID_RI_DATA_BITS(DataBits) CONCAT_EXPANDED(HID_RI_DATA_BITS_, DataBits) 65 | 66 | #define _HID_RI_ENCODE_0(Data) 67 | #define _HID_RI_ENCODE_8(Data) , (Data & 0xFF) 68 | #define _HID_RI_ENCODE_16(Data) _HID_RI_ENCODE_8(Data) _HID_RI_ENCODE_8(Data >> 8) 69 | #define _HID_RI_ENCODE_32(Data) _HID_RI_ENCODE_16(Data) _HID_RI_ENCODE_16(Data >> 16) 70 | #define _HID_RI_ENCODE(DataBits, ...) CONCAT_EXPANDED(_HID_RI_ENCODE_, DataBits(__VA_ARGS__)) 71 | 72 | #define _HID_RI_ENTRY(Type, Tag, DataBits, ...) (Type | Tag | HID_RI_DATA_BITS(DataBits)) _HID_RI_ENCODE(DataBits, (__VA_ARGS__)) 73 | #endif 74 | 75 | /* Public Interface - May be used in end-application: */ 76 | /* Macros: */ 77 | /** \name HID Input, Output and Feature Report Descriptor Item Flags */ 78 | //@{ 79 | #define HID_IOF_CONSTANT (1 << 0) 80 | #define HID_IOF_DATA (0 << 0) 81 | #define HID_IOF_VARIABLE (1 << 1) 82 | #define HID_IOF_ARRAY (0 << 1) 83 | #define HID_IOF_RELATIVE (1 << 2) 84 | #define HID_IOF_ABSOLUTE (0 << 2) 85 | #define HID_IOF_WRAP (1 << 3) 86 | #define HID_IOF_NO_WRAP (0 << 3) 87 | #define HID_IOF_NON_LINEAR (1 << 4) 88 | #define HID_IOF_LINEAR (0 << 4) 89 | #define HID_IOF_NO_PREFERRED_STATE (1 << 5) 90 | #define HID_IOF_PREFERRED_STATE (0 << 5) 91 | #define HID_IOF_NULLSTATE (1 << 6) 92 | #define HID_IOF_NO_NULL_POSITION (0 << 6) 93 | #define HID_IOF_VOLATILE (1 << 7) 94 | #define HID_IOF_NON_VOLATILE (0 << 7) 95 | #define HID_IOF_BUFFERED_BYTES (1 << 8) 96 | #define HID_IOF_BITFIELD (0 << 8) 97 | //@} 98 | 99 | /** \name HID Report Descriptor Item Macros */ 100 | //@{ 101 | #define HID_RI_INPUT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0x80, DataBits, __VA_ARGS__) 102 | #define HID_RI_OUTPUT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0x90, DataBits, __VA_ARGS__) 103 | #define HID_RI_COLLECTION(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xA0, DataBits, __VA_ARGS__) 104 | #define HID_RI_FEATURE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xB0, DataBits, __VA_ARGS__) 105 | #define HID_RI_END_COLLECTION(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xC0, DataBits, __VA_ARGS__) 106 | #define HID_RI_USAGE_PAGE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x00, DataBits, __VA_ARGS__) 107 | #define HID_RI_LOGICAL_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x10, DataBits, __VA_ARGS__) 108 | #define HID_RI_LOGICAL_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x20, DataBits, __VA_ARGS__) 109 | #define HID_RI_PHYSICAL_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x30, DataBits, __VA_ARGS__) 110 | #define HID_RI_PHYSICAL_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x40, DataBits, __VA_ARGS__) 111 | #define HID_RI_UNIT_EXPONENT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x50, DataBits, __VA_ARGS__) 112 | #define HID_RI_UNIT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x60, DataBits, __VA_ARGS__) 113 | #define HID_RI_REPORT_SIZE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x70, DataBits, __VA_ARGS__) 114 | #define HID_RI_REPORT_ID(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x80, DataBits, __VA_ARGS__) 115 | #define HID_RI_REPORT_COUNT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x90, DataBits, __VA_ARGS__) 116 | #define HID_RI_PUSH(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xA0, DataBits, __VA_ARGS__) 117 | #define HID_RI_POP(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xB0, DataBits, __VA_ARGS__) 118 | #define HID_RI_USAGE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x00, DataBits, __VA_ARGS__) 119 | #define HID_RI_USAGE_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x10, DataBits, __VA_ARGS__) 120 | #define HID_RI_USAGE_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x20, DataBits, __VA_ARGS__) 121 | //@} 122 | 123 | /** @} */ 124 | 125 | #endif 126 | 127 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Common definitions and declarations for the library USB Printer Class driver. 33 | * 34 | * Common definitions and declarations for the library USB Printer Class driver. 35 | * 36 | * \note This file should not be included directly. It is automatically included as needed by the USB module driver 37 | * dispatch header located in LUFA/Drivers/USB.h. 38 | */ 39 | 40 | /** \ingroup Group_USBClassPrinter 41 | * \defgroup Group_USBClassPrinterCommon Common Class Definitions 42 | * 43 | * \section Sec_USBClassPrinterCommon_ModDescription Module Description 44 | * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB 45 | * Printer Class. 46 | * 47 | * @{ 48 | */ 49 | 50 | #ifndef _PRINTER_CLASS_COMMON_H_ 51 | #define _PRINTER_CLASS_COMMON_H_ 52 | 53 | /* Includes: */ 54 | #include "../../Core/StdDescriptors.h" 55 | 56 | /* Enable C linkage for C++ Compilers: */ 57 | #if defined(__cplusplus) 58 | extern "C" { 59 | #endif 60 | 61 | /* Preprocessor Checks: */ 62 | #if !defined(__INCLUDE_FROM_PRINTER_DRIVER) 63 | #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. 64 | #endif 65 | 66 | /* Macros: */ 67 | /** \name Virtual Printer Status Line Masks */ 68 | //@{ 69 | /** Port status mask for a printer device, indicating that an error has *not* occurred. */ 70 | #define PRNT_PORTSTATUS_NOTERROR (1 << 3) 71 | 72 | /** Port status mask for a printer device, indicating that the device is currently selected. */ 73 | #define PRNT_PORTSTATUS_SELECT (1 << 4) 74 | 75 | /** Port status mask for a printer device, indicating that the device is currently out of paper. */ 76 | #define PRNT_PORTSTATUS_PAPEREMPTY (1 << 5) 77 | //@} 78 | 79 | /* Enums: */ 80 | /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Printer 81 | * device class. 82 | */ 83 | enum PRNT_Descriptor_ClassSubclassProtocol_t 84 | { 85 | PRNT_CSCP_PrinterClass = 0x07, /**< Descriptor Class value indicating that the device or interface 86 | * belongs to the Printer class. 87 | */ 88 | PRNT_CSCP_PrinterSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface 89 | * belongs to the Printer subclass. 90 | */ 91 | PRNT_CSCP_BidirectionalProtocol = 0x02, /**< Descriptor Protocol value indicating that the device or interface 92 | * belongs to the Bidirectional protocol of the Printer class. 93 | */ 94 | }; 95 | 96 | /** Enum for the Printer class specific control requests that can be issued by the USB bus host. */ 97 | enum PRNT_ClassRequests_t 98 | { 99 | PRNT_REQ_GetDeviceID = 0x00, /**< Printer class-specific request to retrieve the Unicode ID 100 | * string of the device, containing the device's name, manufacturer 101 | * and supported printer languages. 102 | */ 103 | PRNT_REQ_GetPortStatus = 0x01, /**< Printer class-specific request to get the current status of the 104 | * virtual printer port, for device selection and ready states. 105 | */ 106 | PRNT_REQ_SoftReset = 0x02, /**< Printer class-specific request to reset the device, ready for new 107 | * printer commands. 108 | */ 109 | }; 110 | 111 | /* Disable C linkage for C++ Compilers: */ 112 | #if defined(__cplusplus) 113 | } 114 | #endif 115 | 116 | #endif 117 | 118 | /** @} */ 119 | 120 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #define __INCLUDE_FROM_USB_DRIVER 32 | #include "../../Core/USBMode.h" 33 | 34 | #if defined(USB_CAN_BE_DEVICE) 35 | 36 | #define __INCLUDE_FROM_MIDI_DRIVER 37 | #define __INCLUDE_FROM_MIDI_DEVICE_C 38 | #include "MIDIClassDevice.h" 39 | 40 | bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) 41 | { 42 | memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State)); 43 | 44 | MIDIInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; 45 | MIDIInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; 46 | 47 | if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataINEndpoint, 1))) 48 | return false; 49 | 50 | if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataOUTEndpoint, 1))) 51 | return false; 52 | 53 | return true; 54 | } 55 | 56 | void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) 57 | { 58 | if (USB_DeviceState != DEVICE_STATE_Configured) 59 | return; 60 | 61 | #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) 62 | Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address); 63 | 64 | if (Endpoint_IsINReady()) 65 | MIDI_Device_Flush(MIDIInterfaceInfo); 66 | #endif 67 | } 68 | 69 | uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, 70 | const MIDI_EventPacket_t* const Event) 71 | { 72 | if (USB_DeviceState != DEVICE_STATE_Configured) 73 | return ENDPOINT_RWSTREAM_DeviceDisconnected; 74 | 75 | uint8_t ErrorCode; 76 | 77 | Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address); 78 | 79 | if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != ENDPOINT_RWSTREAM_NoError) 80 | return ErrorCode; 81 | 82 | if (!(Endpoint_IsReadWriteAllowed())) 83 | Endpoint_ClearIN(); 84 | 85 | return ENDPOINT_RWSTREAM_NoError; 86 | } 87 | 88 | uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) 89 | { 90 | if (USB_DeviceState != DEVICE_STATE_Configured) 91 | return ENDPOINT_RWSTREAM_DeviceDisconnected; 92 | 93 | uint8_t ErrorCode; 94 | 95 | Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address); 96 | 97 | if (Endpoint_BytesInEndpoint()) 98 | { 99 | Endpoint_ClearIN(); 100 | 101 | if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) 102 | return ErrorCode; 103 | } 104 | 105 | return ENDPOINT_READYWAIT_NoError; 106 | } 107 | 108 | bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, 109 | MIDI_EventPacket_t* const Event) 110 | { 111 | if (USB_DeviceState != DEVICE_STATE_Configured) 112 | return false; 113 | 114 | Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpoint.Address); 115 | 116 | if (!(Endpoint_IsOUTReceived())) 117 | return false; 118 | 119 | if (!(Endpoint_IsReadWriteAllowed())) 120 | return false; 121 | 122 | Endpoint_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL); 123 | 124 | if (!(Endpoint_IsReadWriteAllowed())) 125 | Endpoint_ClearOUT(); 126 | 127 | return true; 128 | } 129 | 130 | #endif 131 | 132 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/HIDClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB HID Class driver. 33 | * 34 | * Master include file for the library USB HID Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassHID HID Class Driver 42 | * \brief USB class driver for the USB-IF Human Interface Device (HID) class standard. 43 | * 44 | * \section Sec_USBClassHID_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Device/HIDClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * - LUFA/Drivers/USB/Class/Host/HIDClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 48 | * - LUFA/Drivers/USB/Class/Host/HIDParser.c (Makefile source module name: LUFA_SRC_USB) 49 | * 50 | * \section Sec_USBClassHID_ModDescription Module Description 51 | * HID Class Driver module. This module contains an internal implementation of the USB HID Class, for both Device 52 | * and Host USB modes. User applications can use this class driver instead of implementing the HID class manually 53 | * via the low-level LUFA APIs. 54 | * 55 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 56 | * Hosts or Devices using the USB HID Class. 57 | * 58 | * @{ 59 | */ 60 | 61 | #ifndef _HID_CLASS_H_ 62 | #define _HID_CLASS_H_ 63 | 64 | /* Macros: */ 65 | #define __INCLUDE_FROM_USB_DRIVER 66 | #define __INCLUDE_FROM_HID_DRIVER 67 | 68 | /* Includes: */ 69 | #include "../Core/USBMode.h" 70 | 71 | #if defined(USB_CAN_BE_DEVICE) 72 | #include "Device/HIDClassDevice.h" 73 | #endif 74 | 75 | #if defined(USB_CAN_BE_HOST) 76 | #include "Host/HIDClassHost.h" 77 | #endif 78 | 79 | #endif 80 | 81 | /** @} */ 82 | 83 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/MIDIClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB MIDI Class driver. 33 | * 34 | * Master include file for the library USB MIDI Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassMIDI MIDI Class Driver 42 | * \brief USB class driver for the USB-IF MIDI class standard. 43 | * 44 | * \section Sec_USBClassMIDI_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * - LUFA/Drivers/USB/Class/Host/MIDIClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 48 | * 49 | * \section Sec_USBClassMIDI_ModDescription Module Description 50 | * MIDI Class Driver module. This module contains an internal implementation of the USB MIDI Class, for both Device 51 | * and Host USB modes. User applications can use this class driver instead of implementing the MIDI class manually 52 | * via the low-level LUFA APIs. 53 | * 54 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 55 | * Hosts or Devices using the USB MIDI Class. 56 | * 57 | * \note The USB MIDI class is actually a special case of the regular Audio class, thus this module depends on 58 | * structure definitions from the \ref Group_USBClassAudioDevice class driver module. 59 | * 60 | * @{ 61 | */ 62 | 63 | #ifndef _MIDI_CLASS_H_ 64 | #define _MIDI_CLASS_H_ 65 | 66 | /* Macros: */ 67 | #define __INCLUDE_FROM_USB_DRIVER 68 | #define __INCLUDE_FROM_MIDI_DRIVER 69 | 70 | /* Includes: */ 71 | #include "../Core/USBMode.h" 72 | 73 | #if defined(USB_CAN_BE_DEVICE) 74 | #include "Device/MIDIClassDevice.h" 75 | #endif 76 | 77 | #if defined(USB_CAN_BE_HOST) 78 | #include "Host/MIDIClassHost.h" 79 | #endif 80 | 81 | #endif 82 | 83 | /** @} */ 84 | 85 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/MassStorageClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB Mass Storage Class driver. 33 | * 34 | * Master include file for the library USB Mass Storage Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassMS Mass Storage Class Driver 42 | * \brief USB class driver for the USB-IF Bulk-Only Transport Mass Storage class standard. 43 | * 44 | * \section Sec_USBClassMS_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * - LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 48 | * 49 | * \section Sec_USBClassMS_ModDescription Module Description 50 | * Mass Storage Class Driver module. This module contains an internal implementation of the USB Mass Storage Class, for both 51 | * Device and Host USB modes. User applications can use this class driver instead of implementing the Mass Storage class 52 | * manually via the low-level LUFA APIs. 53 | * 54 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 55 | * Hosts or Devices using the USB Mass Storage Class. 56 | * 57 | * @{ 58 | */ 59 | 60 | #ifndef _MS_CLASS_H_ 61 | #define _MS_CLASS_H_ 62 | 63 | /* Macros: */ 64 | #define __INCLUDE_FROM_USB_DRIVER 65 | #define __INCLUDE_FROM_MS_DRIVER 66 | 67 | /* Includes: */ 68 | #include "../Core/USBMode.h" 69 | 70 | #if defined(USB_CAN_BE_DEVICE) 71 | #include "Device/MassStorageClassDevice.h" 72 | #endif 73 | 74 | #if defined(USB_CAN_BE_HOST) 75 | #include "Host/MassStorageClassHost.h" 76 | #endif 77 | 78 | #endif 79 | 80 | /** @} */ 81 | 82 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/PrinterClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB Printer Class driver. 33 | * 34 | * Master include file for the library USB Printer Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassPrinter Printer Class Driver 42 | * \brief USB class driver for the USB-IF Printer class standard. 43 | * 44 | * \section Sec_USBClassPrinter_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Host/PrinterClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * - LUFA/Drivers/USB/Class/Host/PrinterClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 48 | * 49 | * \section Sec_USBClassPrinter_ModDescription Module Description 50 | * Printer Class Driver module. This module contains an internal implementation of the USB Printer Class, for the base 51 | * USB Printer transport layer for USB Host mode only. Note that printers are free to implement whatever printer language 52 | * they choose on top of this (e.g. Postscript), and so this driver exposes low level data transport functions only rather 53 | * than high level raster or text functions. User applications can use this class driver instead of implementing the Printer 54 | * class manually via the low-level LUFA APIs. 55 | * 56 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 57 | * Devices using the USB Printer Class. 58 | * 59 | * @{ 60 | */ 61 | 62 | #ifndef _PRINTER_CLASS_H_ 63 | #define _PRINTER_CLASS_H_ 64 | 65 | /* Macros: */ 66 | #define __INCLUDE_FROM_USB_DRIVER 67 | #define __INCLUDE_FROM_PRINTER_DRIVER 68 | 69 | /* Includes: */ 70 | #include "../Core/USBMode.h" 71 | 72 | #if defined(USB_CAN_BE_DEVICE) 73 | #include "Device/PrinterClassDevice.h" 74 | #endif 75 | 76 | #if defined(USB_CAN_BE_HOST) 77 | #include "Host/PrinterClassHost.h" 78 | #endif 79 | 80 | #endif 81 | 82 | /** @} */ 83 | 84 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/RNDISClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB RNDIS Class driver. 33 | * 34 | * Master include file for the library USB RNDIS Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassRNDIS RNDIS (Networking) Class Driver 42 | * \brief USB class driver for the Microsoft Remote Network Driver Interface Specification (RNDIS) class standard. 43 | * 44 | * \section Sec_USBClassRNDIS_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * - LUFA/Drivers/USB/Class/Host/RNDISClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 48 | * 49 | * \section Sec_USBClassRNDIS_ModDescription Module Description 50 | * RNDIS Class Driver module. This module contains an internal implementation of the Microsoft USB RNDIS Networking 51 | * Class, for both Device and Host USB modes. User applications can use this class driver instead of implementing the 52 | * RNDIS class manually via the low-level LUFA APIs. 53 | * 54 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 55 | * Hosts using the USB RNDIS Class. 56 | * 57 | * @{ 58 | */ 59 | 60 | #ifndef _RNDIS_CLASS_H_ 61 | #define _RNDIS_CLASS_H_ 62 | 63 | /* Macros: */ 64 | #define __INCLUDE_FROM_USB_DRIVER 65 | #define __INCLUDE_FROM_RNDIS_DRIVER 66 | 67 | /* Includes: */ 68 | #include "../Core/USBMode.h" 69 | 70 | #if defined(USB_CAN_BE_DEVICE) 71 | #include "Device/RNDISClassDevice.h" 72 | #endif 73 | 74 | #if defined(USB_CAN_BE_HOST) 75 | #include "Host/RNDISClassHost.h" 76 | #endif 77 | 78 | #endif 79 | 80 | /** @} */ 81 | 82 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Class/StillImageClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Master include file for the library USB Still Image Class driver. 33 | * 34 | * Master include file for the library USB Still Image Class driver, for both host and device modes, where available. 35 | * 36 | * This file should be included in all user projects making use of this optional class driver, instead of 37 | * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. 38 | */ 39 | 40 | /** \ingroup Group_USBClassDrivers 41 | * \defgroup Group_USBClassSI Still Image Class Driver 42 | * \brief USB class driver for the USB-IF Still Image (PIMA-compliant) class standard. 43 | * 44 | * \section Sec_USBClassSI_Dependencies Module Source Dependencies 45 | * The following files must be built with any user project that uses this module: 46 | * - LUFA/Drivers/USB/Class/Host/StillImageClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) 47 | * 48 | * \section Sec_USBClassSI_ModDescription Module Description 49 | * Still Image Class Driver module. This module contains an internal implementation of the USB Still Image Class, 50 | * for USB Host mode only. User applications can use this class driver instead of implementing the Still Image class 51 | * manually via the low-level LUFA APIs. 52 | * 53 | * This module is designed to simplify the user code by exposing only the required interface needed to interface with 54 | * Devices using the USB Still Image Class. 55 | * 56 | * @{ 57 | */ 58 | 59 | #ifndef _SI_CLASS_H_ 60 | #define _SI_CLASS_H_ 61 | 62 | /* Macros: */ 63 | #define __INCLUDE_FROM_USB_DRIVER 64 | #define __INCLUDE_FROM_SI_DRIVER 65 | 66 | /* Includes: */ 67 | #include "../Core/USBMode.h" 68 | 69 | #if defined(USB_CAN_BE_HOST) 70 | #include "Host/StillImageClassHost.h" 71 | #endif 72 | 73 | #endif 74 | 75 | /** @} */ 76 | 77 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #include "../../../../Common/Common.h" 32 | #if (ARCH == ARCH_AVR8) 33 | 34 | #define __INCLUDE_FROM_USB_DRIVER 35 | #include "../USBMode.h" 36 | 37 | #if defined(USB_CAN_BE_DEVICE) 38 | 39 | #include "../Device.h" 40 | 41 | void USB_Device_SendRemoteWakeup(void) 42 | { 43 | if (!(USB_Options & USB_OPT_MANUAL_PLL)) 44 | { 45 | USB_PLL_On(); 46 | while (!(USB_PLL_IsReady())); 47 | } 48 | 49 | USB_CLK_Unfreeze(); 50 | 51 | UDCON |= (1 << RMWKUP); 52 | while (UDCON & (1 << RMWKUP)); 53 | } 54 | 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #include "../../../../Common/Common.h" 32 | #if (ARCH == ARCH_AVR8) 33 | 34 | #define __INCLUDE_FROM_USB_DRIVER 35 | #include "../USBMode.h" 36 | 37 | #if defined(USB_CAN_BE_DEVICE) 38 | 39 | #include "../Endpoint.h" 40 | 41 | #if !defined(FIXED_CONTROL_ENDPOINT_SIZE) 42 | uint8_t USB_Device_ControlEndpointSize = ENDPOINT_CONTROLEP_DEFAULT_SIZE; 43 | #endif 44 | 45 | bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, 46 | const uint8_t Entries) 47 | { 48 | for (uint8_t i = 0; i < Entries; i++) 49 | { 50 | if (!(Table[i].Address)) 51 | continue; 52 | 53 | if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks))) 54 | return false; 55 | } 56 | 57 | return true; 58 | } 59 | 60 | bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, 61 | const uint8_t UECFG0XData, 62 | const uint8_t UECFG1XData) 63 | { 64 | #if defined(CONTROL_ONLY_DEVICE) || defined(ORDERED_EP_CONFIG) 65 | Endpoint_SelectEndpoint(Number); 66 | Endpoint_EnableEndpoint(); 67 | 68 | UECFG1X = 0; 69 | UECFG0X = UECFG0XData; 70 | UECFG1X = UECFG1XData; 71 | 72 | return Endpoint_IsConfigured(); 73 | #else 74 | for (uint8_t EPNum = Number; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) 75 | { 76 | uint8_t UECFG0XTemp; 77 | uint8_t UECFG1XTemp; 78 | uint8_t UEIENXTemp; 79 | 80 | Endpoint_SelectEndpoint(EPNum); 81 | 82 | if (EPNum == Number) 83 | { 84 | UECFG0XTemp = UECFG0XData; 85 | UECFG1XTemp = UECFG1XData; 86 | UEIENXTemp = 0; 87 | } 88 | else 89 | { 90 | UECFG0XTemp = UECFG0X; 91 | UECFG1XTemp = UECFG1X; 92 | UEIENXTemp = UEIENX; 93 | } 94 | 95 | if (!(UECFG1XTemp & (1 << ALLOC))) 96 | continue; 97 | 98 | Endpoint_DisableEndpoint(); 99 | UECFG1X &= ~(1 << ALLOC); 100 | 101 | Endpoint_EnableEndpoint(); 102 | UECFG0X = UECFG0XTemp; 103 | UECFG1X = UECFG1XTemp; 104 | UEIENX = UEIENXTemp; 105 | 106 | if (!(Endpoint_IsConfigured())) 107 | return false; 108 | } 109 | 110 | Endpoint_SelectEndpoint(Number); 111 | return true; 112 | #endif 113 | } 114 | 115 | void Endpoint_ClearEndpoints(void) 116 | { 117 | UEINT = 0; 118 | 119 | for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) 120 | { 121 | Endpoint_SelectEndpoint(EPNum); 122 | UEIENX = 0; 123 | UEINTX = 0; 124 | UECFG1X = 0; 125 | Endpoint_DisableEndpoint(); 126 | } 127 | } 128 | 129 | void Endpoint_ClearStatusStage(void) 130 | { 131 | if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST) 132 | { 133 | while (!(Endpoint_IsOUTReceived())) 134 | { 135 | if (USB_DeviceState == DEVICE_STATE_Unattached) 136 | return; 137 | } 138 | 139 | Endpoint_ClearOUT(); 140 | } 141 | else 142 | { 143 | while (!(Endpoint_IsINReady())) 144 | { 145 | if (USB_DeviceState == DEVICE_STATE_Unattached) 146 | return; 147 | } 148 | 149 | Endpoint_ClearIN(); 150 | } 151 | } 152 | 153 | #if !defined(CONTROL_ONLY_DEVICE) 154 | uint8_t Endpoint_WaitUntilReady(void) 155 | { 156 | #if (USB_STREAM_TIMEOUT_MS < 0xFF) 157 | uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; 158 | #else 159 | uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; 160 | #endif 161 | 162 | uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber(); 163 | 164 | for (;;) 165 | { 166 | if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN) 167 | { 168 | if (Endpoint_IsINReady()) 169 | return ENDPOINT_READYWAIT_NoError; 170 | } 171 | else 172 | { 173 | if (Endpoint_IsOUTReceived()) 174 | return ENDPOINT_READYWAIT_NoError; 175 | } 176 | 177 | uint8_t USB_DeviceState_LCL = USB_DeviceState; 178 | 179 | if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) 180 | return ENDPOINT_READYWAIT_DeviceDisconnected; 181 | else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) 182 | return ENDPOINT_READYWAIT_BusSuspended; 183 | else if (Endpoint_IsStalled()) 184 | return ENDPOINT_READYWAIT_EndpointStalled; 185 | 186 | uint16_t CurrentFrameNumber = USB_Device_GetFrameNumber(); 187 | 188 | if (CurrentFrameNumber != PreviousFrameNumber) 189 | { 190 | PreviousFrameNumber = CurrentFrameNumber; 191 | 192 | if (!(TimeoutMSRem--)) 193 | return ENDPOINT_READYWAIT_Timeout; 194 | } 195 | } 196 | } 197 | #endif 198 | 199 | #endif 200 | 201 | #endif 202 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief USB OTG definitions for the AVR8 microcontrollers. 33 | * \copydetails Group_OTG_AVR8 34 | * 35 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 36 | * dispatch header located in LUFA/Drivers/USB/USB.h. 37 | */ 38 | 39 | /** \ingroup Group_OTG 40 | * \defgroup Group_OTG_AVR8 USB On The Go (OTG) Management (AVR8) 41 | * \brief USB OTG definitions for the AVR8 microcontrollers. 42 | * 43 | * Architecture specific USB OTG definitions for the Atmel 8-bit AVR microcontrollers. 44 | * 45 | * @{ 46 | */ 47 | 48 | #ifndef __USBOTG_AVR8_H__ 49 | #define __USBOTG_AVR8_H__ 50 | 51 | /* Includes: */ 52 | #include "../../../../Common/Common.h" 53 | 54 | /* Enable C linkage for C++ Compilers: */ 55 | #if defined(__cplusplus) 56 | extern "C" { 57 | #endif 58 | 59 | /* Preprocessor Checks: */ 60 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 61 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 62 | #endif 63 | 64 | /* Public Interface - May be used in end-application: */ 65 | /* Macros: */ 66 | /** Mask for the VBUS pulsing method of SRP, supported by some OTG devices. 67 | * 68 | * \see \ref USB_OTG_Device_InitiateSRP(). 69 | */ 70 | #define USB_OTG_SRP_VBUS (1 << SRPSEL) 71 | 72 | /** Mask for the Data + pulsing method of SRP, supported by some OTG devices. 73 | * 74 | * \see \ref USB_OTG_Device_InitiateSRP(). 75 | */ 76 | #define USB_OTG_STP_DATA 0 77 | 78 | /* Inline Functions: */ 79 | /** Initiate a Host Negotiation Protocol request. This indicates to the other connected device 80 | * that the device wishes to change device/host roles. 81 | */ 82 | static inline void USB_OTG_Device_RequestHNP(void) ATTR_ALWAYS_INLINE; 83 | static inline void USB_OTG_Device_RequestHNP(void) 84 | { 85 | OTGCON |= (1 << HNPREQ); 86 | } 87 | 88 | /** Cancel a Host Negotiation Protocol request. This stops a pending HNP request to the other 89 | * connected device. 90 | */ 91 | static inline void USB_OTG_Device_CancelHNPRequest(void) ATTR_ALWAYS_INLINE; 92 | static inline void USB_OTG_Device_CancelHNPRequest(void) 93 | { 94 | OTGCON &= ~(1 << HNPREQ); 95 | } 96 | 97 | /** Determines if the device is currently sending a HNP to an attached host. 98 | * 99 | * \return Boolean \c true if currently sending a HNP to the other connected device, \c false otherwise 100 | */ 101 | static inline bool USB_OTG_Device_IsSendingHNP(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; 102 | static inline bool USB_OTG_Device_IsSendingHNP(void) 103 | { 104 | return ((OTGCON & (1 << HNPREQ)) ? true : false); 105 | } 106 | 107 | /** Initiates a Session Request Protocol request. Most OTG devices turn off VBUS when the USB 108 | * interface is not in use, to conserve power. Sending a SRP to a USB OTG device running in 109 | * host mode indicates that VBUS should be applied and a session started. 110 | * 111 | * There are two different methods of sending a SRP - either pulses on the VBUS line, or by 112 | * pulsing the Data + line via the internal pull-up resistor. 113 | * 114 | * \param[in] SRPTypeMask Mask indicating the type of SRP to use, either \ref USB_OTG_SRP_VBUS or 115 | * \ref USB_OTG_STP_DATA. 116 | */ 117 | static inline void USB_OTG_Device_InitiateSRP(const uint8_t SRPTypeMask) ATTR_ALWAYS_INLINE; 118 | static inline void USB_OTG_Device_InitiateSRP(const uint8_t SRPTypeMask) 119 | { 120 | OTGCON = ((OTGCON & ~(1 << SRPSEL)) | (SRPTypeMask | (1 << SRPREQ))); 121 | } 122 | 123 | /** Accepts a HNP from a connected device, indicating that both devices should exchange 124 | * device/host roles. 125 | */ 126 | static inline void USB_OTG_Host_AcceptHNP(void) ATTR_ALWAYS_INLINE; 127 | static inline void USB_OTG_Host_AcceptHNP(void) 128 | { 129 | OTGCON |= (1 << HNPREQ); 130 | } 131 | 132 | /** Rejects a HNP from a connected device, indicating that both devices should remain in their 133 | * current device/host roles. 134 | */ 135 | static inline void USB_OTG_Host_RejectHNP(void) ATTR_ALWAYS_INLINE; 136 | static inline void USB_OTG_Host_RejectHNP(void) 137 | { 138 | OTGCON &= ~(1 << HNPREQ); 139 | } 140 | 141 | /** Indicates if the connected device is currently sending a HNP request. 142 | * 143 | * \return Boolean \c true if a HNP is currently being issued by the connected device, \c false otherwise. 144 | */ 145 | static inline bool USB_OTG_Host_IsHNPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; 146 | static inline bool USB_OTG_Host_IsHNPReceived(void) 147 | { 148 | return ((OTGCON & (1 << HNPREQ)) ? true : false); 149 | } 150 | 151 | /* Disable C linkage for C++ Compilers: */ 152 | #if defined(__cplusplus) 153 | } 154 | #endif 155 | 156 | #endif 157 | 158 | /** @} */ 159 | 160 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #include "../../../../Common/Common.h" 32 | #if (ARCH == ARCH_AVR8) 33 | 34 | #define __INCLUDE_FROM_USB_DRIVER 35 | #include "../USBMode.h" 36 | 37 | #if defined(USB_CAN_BE_HOST) 38 | 39 | #include "../Pipe.h" 40 | 41 | uint8_t USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; 42 | 43 | bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table, 44 | const uint8_t Entries) 45 | { 46 | for (uint8_t i = 0; i < Entries; i++) 47 | { 48 | if (!(Table[i].Address)) 49 | continue; 50 | 51 | if (!(Pipe_ConfigurePipe(Table[i].Address, Table[i].Type, Table[i].EndpointAddress, Table[i].Size, Table[i].Banks))) 52 | { 53 | return false; 54 | } 55 | } 56 | 57 | return true; 58 | } 59 | 60 | bool Pipe_ConfigurePipe(const uint8_t Address, 61 | const uint8_t Type, 62 | const uint8_t EndpointAddress, 63 | const uint16_t Size, 64 | const uint8_t Banks) 65 | { 66 | uint8_t Number = (Address & PIPE_EPNUM_MASK); 67 | uint8_t Token = (Address & PIPE_DIR_IN) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT; 68 | 69 | if (Number >= PIPE_TOTAL_PIPES) 70 | return false; 71 | 72 | if (Type == EP_TYPE_CONTROL) 73 | Token = PIPE_TOKEN_SETUP; 74 | 75 | #if defined(ORDERED_EP_CONFIG) 76 | Pipe_SelectPipe(Number); 77 | Pipe_EnablePipe(); 78 | 79 | UPCFG1X = 0; 80 | 81 | UPCFG0X = ((Type << EPTYPE0) | Token | ((EndpointAddress & PIPE_EPNUM_MASK) << PEPNUM0)); 82 | UPCFG1X = ((1 << ALLOC) | ((Banks > 1) ? (1 << EPBK0) : 0) | Pipe_BytesToEPSizeMask(Size)); 83 | 84 | Pipe_SetInfiniteINRequests(); 85 | 86 | return Pipe_IsConfigured(); 87 | #else 88 | for (uint8_t PNum = Number; PNum < PIPE_TOTAL_PIPES; PNum++) 89 | { 90 | uint8_t UPCFG0XTemp; 91 | uint8_t UPCFG1XTemp; 92 | uint8_t UPCFG2XTemp; 93 | uint8_t UPIENXTemp; 94 | 95 | Pipe_SelectPipe(PNum); 96 | 97 | if (PNum == Number) 98 | { 99 | UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointAddress & PIPE_EPNUM_MASK) << PEPNUM0)); 100 | UPCFG1XTemp = ((1 << ALLOC) | ((Banks > 1) ? (1 << EPBK0) : 0) | Pipe_BytesToEPSizeMask(Size)); 101 | UPCFG2XTemp = 0; 102 | UPIENXTemp = 0; 103 | } 104 | else 105 | { 106 | UPCFG0XTemp = UPCFG0X; 107 | UPCFG1XTemp = UPCFG1X; 108 | UPCFG2XTemp = UPCFG2X; 109 | UPIENXTemp = UPIENX; 110 | } 111 | 112 | if (!(UPCFG1XTemp & (1 << ALLOC))) 113 | continue; 114 | 115 | Pipe_DisablePipe(); 116 | UPCFG1X &= ~(1 << ALLOC); 117 | 118 | Pipe_EnablePipe(); 119 | UPCFG0X = UPCFG0XTemp; 120 | UPCFG1X = UPCFG1XTemp; 121 | UPCFG2X = UPCFG2XTemp; 122 | UPIENX = UPIENXTemp; 123 | 124 | Pipe_SetInfiniteINRequests(); 125 | 126 | if (!(Pipe_IsConfigured())) 127 | return false; 128 | } 129 | 130 | Pipe_SelectPipe(Number); 131 | return true; 132 | #endif 133 | } 134 | 135 | void Pipe_ClearPipes(void) 136 | { 137 | UPINT = 0; 138 | 139 | for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) 140 | { 141 | Pipe_SelectPipe(PNum); 142 | UPIENX = 0; 143 | UPINTX = 0; 144 | UPCFG1X = 0; 145 | Pipe_DisablePipe(); 146 | } 147 | } 148 | 149 | bool Pipe_IsEndpointBound(const uint8_t EndpointAddress) 150 | { 151 | uint8_t PrevPipeNumber = Pipe_GetCurrentPipe(); 152 | 153 | for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) 154 | { 155 | Pipe_SelectPipe(PNum); 156 | 157 | if (!(Pipe_IsConfigured())) 158 | continue; 159 | 160 | if (Pipe_GetBoundEndpointAddress() == EndpointAddress) 161 | return true; 162 | } 163 | 164 | Pipe_SelectPipe(PrevPipeNumber); 165 | return false; 166 | } 167 | 168 | uint8_t Pipe_WaitUntilReady(void) 169 | { 170 | #if (USB_STREAM_TIMEOUT_MS < 0xFF) 171 | uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; 172 | #else 173 | uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; 174 | #endif 175 | 176 | uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); 177 | 178 | for (;;) 179 | { 180 | if (Pipe_GetPipeToken() == PIPE_TOKEN_IN) 181 | { 182 | if (Pipe_IsINReceived()) 183 | return PIPE_READYWAIT_NoError; 184 | } 185 | else 186 | { 187 | if (Pipe_IsOUTReady()) 188 | return PIPE_READYWAIT_NoError; 189 | } 190 | 191 | if (Pipe_IsStalled()) 192 | return PIPE_READYWAIT_PipeStalled; 193 | else if (USB_HostState == HOST_STATE_Unattached) 194 | return PIPE_READYWAIT_DeviceDisconnected; 195 | 196 | uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber(); 197 | 198 | if (CurrentFrameNumber != PreviousFrameNumber) 199 | { 200 | PreviousFrameNumber = CurrentFrameNumber; 201 | 202 | if (!(TimeoutMSRem--)) 203 | return PIPE_READYWAIT_Timeout; 204 | } 205 | } 206 | } 207 | 208 | #endif 209 | 210 | #endif 211 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #if defined(TEMPLATE_FUNC_NAME) 32 | 33 | uint8_t TEMPLATE_FUNC_NAME (void* const Buffer, 34 | uint16_t Length) 35 | { 36 | uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); 37 | 38 | if (!(Length)) 39 | Endpoint_ClearOUT(); 40 | 41 | while (Length) 42 | { 43 | uint8_t USB_DeviceState_LCL = USB_DeviceState; 44 | 45 | if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) 46 | return ENDPOINT_RWCSTREAM_DeviceDisconnected; 47 | else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) 48 | return ENDPOINT_RWCSTREAM_BusSuspended; 49 | else if (Endpoint_IsSETUPReceived()) 50 | return ENDPOINT_RWCSTREAM_HostAborted; 51 | 52 | if (Endpoint_IsOUTReceived()) 53 | { 54 | while (Length && Endpoint_BytesInEndpoint()) 55 | { 56 | TEMPLATE_TRANSFER_BYTE(DataStream); 57 | TEMPLATE_BUFFER_MOVE(DataStream, 1); 58 | Length--; 59 | } 60 | 61 | Endpoint_ClearOUT(); 62 | } 63 | } 64 | 65 | while (!(Endpoint_IsINReady())) 66 | { 67 | uint8_t USB_DeviceState_LCL = USB_DeviceState; 68 | 69 | if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) 70 | return ENDPOINT_RWCSTREAM_DeviceDisconnected; 71 | else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) 72 | return ENDPOINT_RWCSTREAM_BusSuspended; 73 | } 74 | 75 | return ENDPOINT_RWCSTREAM_NoError; 76 | } 77 | 78 | #undef TEMPLATE_BUFFER_OFFSET 79 | #undef TEMPLATE_BUFFER_MOVE 80 | #undef TEMPLATE_FUNC_NAME 81 | #undef TEMPLATE_TRANSFER_BYTE 82 | 83 | #endif 84 | 85 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #if defined(TEMPLATE_FUNC_NAME) 32 | 33 | uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer, 34 | uint16_t Length) 35 | { 36 | uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); 37 | bool LastPacketFull = false; 38 | 39 | if (Length > USB_ControlRequest.wLength) 40 | Length = USB_ControlRequest.wLength; 41 | else if (!(Length)) 42 | Endpoint_ClearIN(); 43 | 44 | while (Length || LastPacketFull) 45 | { 46 | uint8_t USB_DeviceState_LCL = USB_DeviceState; 47 | 48 | if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) 49 | return ENDPOINT_RWCSTREAM_DeviceDisconnected; 50 | else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) 51 | return ENDPOINT_RWCSTREAM_BusSuspended; 52 | else if (Endpoint_IsSETUPReceived()) 53 | return ENDPOINT_RWCSTREAM_HostAborted; 54 | else if (Endpoint_IsOUTReceived()) 55 | break; 56 | 57 | if (Endpoint_IsINReady()) 58 | { 59 | uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); 60 | 61 | while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize)) 62 | { 63 | TEMPLATE_TRANSFER_BYTE(DataStream); 64 | TEMPLATE_BUFFER_MOVE(DataStream, 1); 65 | Length--; 66 | BytesInEndpoint++; 67 | } 68 | 69 | LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize); 70 | Endpoint_ClearIN(); 71 | } 72 | } 73 | 74 | while (!(Endpoint_IsOUTReceived())) 75 | { 76 | uint8_t USB_DeviceState_LCL = USB_DeviceState; 77 | 78 | if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) 79 | return ENDPOINT_RWCSTREAM_DeviceDisconnected; 80 | else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) 81 | return ENDPOINT_RWCSTREAM_BusSuspended; 82 | else if (Endpoint_IsSETUPReceived()) 83 | return ENDPOINT_RWCSTREAM_HostAborted; 84 | } 85 | 86 | return ENDPOINT_RWCSTREAM_NoError; 87 | } 88 | 89 | #undef TEMPLATE_BUFFER_OFFSET 90 | #undef TEMPLATE_BUFFER_MOVE 91 | #undef TEMPLATE_FUNC_NAME 92 | #undef TEMPLATE_TRANSFER_BYTE 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #if defined(TEMPLATE_FUNC_NAME) 32 | 33 | uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, 34 | uint16_t Length, 35 | uint16_t* const BytesProcessed) 36 | { 37 | uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); 38 | uint16_t BytesInTransfer = 0; 39 | uint8_t ErrorCode; 40 | 41 | if ((ErrorCode = Endpoint_WaitUntilReady())) 42 | return ErrorCode; 43 | 44 | if (BytesProcessed != NULL) 45 | { 46 | Length -= *BytesProcessed; 47 | TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); 48 | } 49 | 50 | while (Length) 51 | { 52 | if (!(Endpoint_IsReadWriteAllowed())) 53 | { 54 | TEMPLATE_CLEAR_ENDPOINT(); 55 | 56 | #if !defined(INTERRUPT_CONTROL_ENDPOINT) 57 | USB_USBTask(); 58 | #endif 59 | 60 | if (BytesProcessed != NULL) 61 | { 62 | *BytesProcessed += BytesInTransfer; 63 | return ENDPOINT_RWSTREAM_IncompleteTransfer; 64 | } 65 | 66 | if ((ErrorCode = Endpoint_WaitUntilReady())) 67 | return ErrorCode; 68 | } 69 | else 70 | { 71 | TEMPLATE_TRANSFER_BYTE(DataStream); 72 | TEMPLATE_BUFFER_MOVE(DataStream, 1); 73 | Length--; 74 | BytesInTransfer++; 75 | } 76 | } 77 | 78 | return ENDPOINT_RWSTREAM_NoError; 79 | } 80 | 81 | #undef TEMPLATE_FUNC_NAME 82 | #undef TEMPLATE_BUFFER_TYPE 83 | #undef TEMPLATE_TRANSFER_BYTE 84 | #undef TEMPLATE_CLEAR_ENDPOINT 85 | #undef TEMPLATE_BUFFER_OFFSET 86 | #undef TEMPLATE_BUFFER_MOVE 87 | 88 | #endif 89 | 90 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #if defined(TEMPLATE_FUNC_NAME) 32 | 33 | uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, 34 | uint16_t Length, 35 | uint16_t* const BytesProcessed) 36 | { 37 | uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); 38 | uint16_t BytesInTransfer = 0; 39 | uint8_t ErrorCode; 40 | 41 | Pipe_SetPipeToken(TEMPLATE_TOKEN); 42 | 43 | if ((ErrorCode = Pipe_WaitUntilReady())) 44 | return ErrorCode; 45 | 46 | if (BytesProcessed != NULL) 47 | { 48 | Length -= *BytesProcessed; 49 | TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); 50 | } 51 | 52 | while (Length) 53 | { 54 | if (!(Pipe_IsReadWriteAllowed())) 55 | { 56 | TEMPLATE_CLEAR_PIPE(); 57 | 58 | if (BytesProcessed != NULL) 59 | { 60 | *BytesProcessed += BytesInTransfer; 61 | return PIPE_RWSTREAM_IncompleteTransfer; 62 | } 63 | 64 | if ((ErrorCode = Pipe_WaitUntilReady())) 65 | return ErrorCode; 66 | } 67 | else 68 | { 69 | TEMPLATE_TRANSFER_BYTE(DataStream); 70 | TEMPLATE_BUFFER_MOVE(DataStream, 1); 71 | Length--; 72 | BytesInTransfer++; 73 | } 74 | } 75 | 76 | return PIPE_RWSTREAM_NoError; 77 | } 78 | 79 | #undef TEMPLATE_FUNC_NAME 80 | #undef TEMPLATE_BUFFER_TYPE 81 | #undef TEMPLATE_TOKEN 82 | #undef TEMPLATE_TRANSFER_BYTE 83 | #undef TEMPLATE_CLEAR_PIPE 84 | #undef TEMPLATE_BUFFER_OFFSET 85 | #undef TEMPLATE_BUFFER_MOVE 86 | 87 | #endif 88 | 89 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/ConfigDescriptors.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #define __INCLUDE_FROM_USB_DRIVER 32 | #include "ConfigDescriptors.h" 33 | 34 | #if defined(USB_CAN_BE_HOST) 35 | uint8_t USB_Host_GetDeviceConfigDescriptor(const uint8_t ConfigNumber, 36 | uint16_t* const ConfigSizePtr, 37 | void* const BufferPtr, 38 | const uint16_t BufferSize) 39 | { 40 | uint8_t ErrorCode; 41 | uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)]; 42 | 43 | USB_ControlRequest = (USB_Request_Header_t) 44 | { 45 | .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), 46 | .bRequest = REQ_GetDescriptor, 47 | .wValue = ((DTYPE_Configuration << 8) | (ConfigNumber - 1)), 48 | .wIndex = 0, 49 | .wLength = sizeof(USB_Descriptor_Configuration_Header_t), 50 | }; 51 | 52 | Pipe_SelectPipe(PIPE_CONTROLPIPE); 53 | 54 | if ((ErrorCode = USB_Host_SendControlRequest(ConfigHeader)) != HOST_SENDCONTROL_Successful) 55 | return ErrorCode; 56 | 57 | *ConfigSizePtr = le16_to_cpu(DESCRIPTOR_PCAST(ConfigHeader, USB_Descriptor_Configuration_Header_t)->TotalConfigurationSize); 58 | 59 | if (*ConfigSizePtr > BufferSize) 60 | return HOST_GETCONFIG_BuffOverflow; 61 | 62 | USB_ControlRequest.wLength = *ConfigSizePtr; 63 | 64 | if ((ErrorCode = USB_Host_SendControlRequest(BufferPtr)) != HOST_SENDCONTROL_Successful) 65 | return ErrorCode; 66 | 67 | if (DESCRIPTOR_TYPE(BufferPtr) != DTYPE_Configuration) 68 | return HOST_GETCONFIG_InvalidData; 69 | 70 | return HOST_GETCONFIG_Successful; 71 | } 72 | #endif 73 | 74 | void USB_GetNextDescriptorOfType(uint16_t* const BytesRem, 75 | void** const CurrConfigLoc, 76 | const uint8_t Type) 77 | { 78 | while (*BytesRem) 79 | { 80 | USB_GetNextDescriptor(BytesRem, CurrConfigLoc); 81 | 82 | if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type) 83 | return; 84 | } 85 | } 86 | 87 | void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem, 88 | void** const CurrConfigLoc, 89 | const uint8_t Type, 90 | const uint8_t BeforeType) 91 | { 92 | while (*BytesRem) 93 | { 94 | USB_GetNextDescriptor(BytesRem, CurrConfigLoc); 95 | 96 | if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type) 97 | { 98 | return; 99 | } 100 | else if (DESCRIPTOR_TYPE(*CurrConfigLoc) == BeforeType) 101 | { 102 | *BytesRem = 0; 103 | return; 104 | } 105 | } 106 | } 107 | 108 | void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, 109 | void** const CurrConfigLoc, 110 | const uint8_t Type, 111 | const uint8_t AfterType) 112 | { 113 | USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, AfterType); 114 | 115 | if (*BytesRem) 116 | USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type); 117 | } 118 | 119 | uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, 120 | void** const CurrConfigLoc, 121 | ConfigComparatorPtr_t const ComparatorRoutine) 122 | { 123 | uint8_t ErrorCode; 124 | 125 | while (*BytesRem) 126 | { 127 | uint8_t* PrevDescLoc = *CurrConfigLoc; 128 | uint16_t PrevBytesRem = *BytesRem; 129 | 130 | USB_GetNextDescriptor(BytesRem, CurrConfigLoc); 131 | 132 | if ((ErrorCode = ComparatorRoutine(*CurrConfigLoc)) != DESCRIPTOR_SEARCH_NotFound) 133 | { 134 | if (ErrorCode == DESCRIPTOR_SEARCH_Fail) 135 | { 136 | *CurrConfigLoc = PrevDescLoc; 137 | *BytesRem = PrevBytesRem; 138 | } 139 | 140 | return ErrorCode; 141 | } 142 | } 143 | 144 | return DESCRIPTOR_SEARCH_COMP_EndOfDescriptor; 145 | } 146 | 147 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/DeviceStandardReq.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief USB device standard request management. 33 | * 34 | * This file contains the function prototypes necessary for the processing of incoming standard control requests 35 | * when the library is in USB device mode. 36 | * 37 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 38 | * dispatch header located in LUFA/Drivers/USB/USB.h. 39 | */ 40 | 41 | #ifndef __DEVICESTDREQ_H__ 42 | #define __DEVICESTDREQ_H__ 43 | 44 | /* Includes: */ 45 | #include "../../../Common/Common.h" 46 | #include "USBMode.h" 47 | #include "StdDescriptors.h" 48 | #include "Events.h" 49 | #include "StdRequestType.h" 50 | #include "USBTask.h" 51 | #include "USBController.h" 52 | 53 | /* Enable C linkage for C++ Compilers: */ 54 | #if defined(__cplusplus) 55 | extern "C" { 56 | #endif 57 | 58 | /* Preprocessor Checks: */ 59 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 60 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 61 | #endif 62 | 63 | /* Public Interface - May be used in end-application: */ 64 | /* Enums: */ 65 | #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) || defined(__DOXYGEN__) 66 | /** Enum for the possible descriptor memory spaces, for the \c MemoryAddressSpace parameter of the 67 | * \ref CALLBACK_USB_GetDescriptor() function. This can be used when none of the \c USE_*_DESCRIPTORS 68 | * compile time options are used, to indicate in which memory space the descriptor is stored. 69 | * 70 | * \ingroup Group_Device 71 | */ 72 | enum USB_DescriptorMemorySpaces_t 73 | { 74 | #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) || defined(__DOXYGEN__) 75 | MEMSPACE_FLASH = 0, /**< Indicates the requested descriptor is located in FLASH memory. */ 76 | #endif 77 | #if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) || defined(__DOXYGEN__) 78 | MEMSPACE_EEPROM = 1, /**< Indicates the requested descriptor is located in EEPROM memory. */ 79 | #endif 80 | MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory. */ 81 | }; 82 | #endif 83 | 84 | /* Global Variables: */ 85 | /** Indicates the currently set configuration number of the device. USB devices may have several 86 | * different configurations which the host can select between; this indicates the currently selected 87 | * value, or 0 if no configuration has been selected. 88 | * 89 | * \attention This variable should be treated as read-only in the user application, and never manually 90 | * changed in value. 91 | * 92 | * \ingroup Group_Device 93 | */ 94 | extern uint8_t USB_Device_ConfigurationNumber; 95 | 96 | #if !defined(NO_DEVICE_REMOTE_WAKEUP) 97 | /** Indicates if the host is currently allowing the device to issue remote wakeup events. If this 98 | * flag is cleared, the device should not issue remote wakeup events to the host. 99 | * 100 | * \attention This variable should be treated as read-only in the user application, and never manually 101 | * changed in value. 102 | * 103 | * \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported, 104 | * this global and the underlying management code can be disabled by defining the 105 | * \c NO_DEVICE_REMOTE_WAKEUP token in the project makefile and passing it to the compiler via 106 | * the -D switch. 107 | * 108 | * \ingroup Group_Device 109 | */ 110 | extern bool USB_Device_RemoteWakeupEnabled; 111 | #endif 112 | 113 | #if !defined(NO_DEVICE_SELF_POWER) 114 | /** Indicates if the device is currently being powered by its own power supply, rather than being 115 | * powered by the host's USB supply. This flag should remain cleared if the device does not 116 | * support self powered mode, as indicated in the device descriptors. 117 | * 118 | * \ingroup Group_Device 119 | */ 120 | extern bool USB_Device_CurrentlySelfPowered; 121 | #endif 122 | 123 | /* Private Interface - For use in library only: */ 124 | #if !defined(__DOXYGEN__) 125 | #if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) 126 | #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. 127 | #elif defined(USE_RAM_DESCRIPTORS) && defined(USE_FLASH_DESCRIPTORS) 128 | #error USE_RAM_DESCRIPTORS and USE_FLASH_DESCRIPTORS are mutually exclusive. 129 | #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) 130 | #error USE_FLASH_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. 131 | #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS) 132 | #error Only one of the USE_*_DESCRIPTORS modes should be selected. 133 | #endif 134 | 135 | /* Function Prototypes: */ 136 | void USB_Device_ProcessControlRequest(void); 137 | 138 | #if defined(__INCLUDE_FROM_DEVICESTDREQ_C) 139 | static void USB_Device_SetAddress(void); 140 | static void USB_Device_SetConfiguration(void); 141 | static void USB_Device_GetConfiguration(void); 142 | static void USB_Device_GetDescriptor(void); 143 | static void USB_Device_GetStatus(void); 144 | static void USB_Device_ClearSetFeature(void); 145 | 146 | #if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) 147 | static void USB_Device_GetInternalSerialDescriptor(void); 148 | #endif 149 | #endif 150 | #endif 151 | 152 | /* Disable C linkage for C++ Compilers: */ 153 | #if defined(__cplusplus) 154 | } 155 | #endif 156 | 157 | #endif 158 | 159 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/Endpoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief USB Endpoint definitions for all architectures. 33 | * \copydetails Group_EndpointManagement 34 | * 35 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 36 | * dispatch header located in LUFA/Drivers/USB/USB.h. 37 | */ 38 | 39 | /** \ingroup Group_EndpointManagement 40 | * \defgroup Group_EndpointRW Endpoint Data Reading and Writing 41 | * \brief Endpoint data read/write definitions. 42 | * 43 | * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints. 44 | */ 45 | 46 | /** \ingroup Group_EndpointRW 47 | * \defgroup Group_EndpointPrimitiveRW Read/Write of Primitive Data Types 48 | * \brief Endpoint data primitive read/write definitions. 49 | * 50 | * Functions, macros, variables, enums and types related to data reading and writing of primitive data types 51 | * from and to endpoints. 52 | */ 53 | 54 | /** \ingroup Group_EndpointManagement 55 | * \defgroup Group_EndpointPacketManagement Endpoint Packet Management 56 | * \brief USB Endpoint package management definitions. 57 | * 58 | * Functions, macros, variables, enums and types related to packet management of endpoints. 59 | */ 60 | 61 | /** \ingroup Group_USB 62 | * \defgroup Group_EndpointManagement Endpoint Management 63 | * \brief Endpoint management definitions. 64 | * 65 | * Functions, macros and enums related to endpoint management when in USB Device mode. This 66 | * module contains the endpoint management macros, as well as endpoint interrupt and data 67 | * send/receive functions for various data types. 68 | * 69 | * @{ 70 | */ 71 | 72 | #ifndef __ENDPOINT_H__ 73 | #define __ENDPOINT_H__ 74 | 75 | /* Includes: */ 76 | #include "../../../Common/Common.h" 77 | #include "USBMode.h" 78 | 79 | /* Enable C linkage for C++ Compilers: */ 80 | #if defined(__cplusplus) 81 | extern "C" { 82 | #endif 83 | 84 | /* Preprocessor Checks: */ 85 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 86 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 87 | #endif 88 | 89 | /* Public Interface - May be used in end-application: */ 90 | /* Type Defines: */ 91 | /** Type define for a endpoint table entry, used to configure endpoints in groups via 92 | * \ref Endpoint_ConfigureEndpointTable(). 93 | */ 94 | typedef struct 95 | { 96 | uint8_t Address; /**< Address of the endpoint to configure, or zero if the table entry is to be unused. */ 97 | uint16_t Size; /**< Size of the endpoint bank, in bytes. */ 98 | uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */ 99 | uint8_t Banks; /**< Number of hardware banks to use for the endpoint. */ 100 | } USB_Endpoint_Table_t; 101 | 102 | /* Macros: */ 103 | /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's 104 | * numerical address in the device. 105 | */ 106 | #define ENDPOINT_EPNUM_MASK 0x0F 107 | 108 | /** Endpoint address for the default control endpoint, which always resides in address 0. This is 109 | * defined for convenience to give more readable code when used with the endpoint macros. 110 | */ 111 | #define ENDPOINT_CONTROLEP 0 112 | 113 | /* Architecture Includes: */ 114 | #if (ARCH == ARCH_AVR8) 115 | #include "AVR8/Endpoint_AVR8.h" 116 | #elif (ARCH == ARCH_UC3) 117 | #include "UC3/Endpoint_UC3.h" 118 | #elif (ARCH == ARCH_XMEGA) 119 | #include "XMEGA/Endpoint_XMEGA.h" 120 | #endif 121 | 122 | /* Disable C linkage for C++ Compilers: */ 123 | #if defined(__cplusplus) 124 | } 125 | #endif 126 | 127 | #endif 128 | 129 | /** @} */ 130 | 131 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/EndpointStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Endpoint data stream transmission and reception management. 33 | * \copydetails Group_EndpointStreamRW 34 | * 35 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 36 | * dispatch header located in LUFA/Drivers/USB/USB.h. 37 | */ 38 | 39 | /** \ingroup Group_EndpointRW 40 | * \defgroup Group_EndpointStreamRW Read/Write of Multi-Byte Streams 41 | * \brief Endpoint data stream transmission and reception management. 42 | * 43 | * Functions, macros, variables, enums and types related to data reading and writing of data streams from 44 | * and to endpoints. 45 | * 46 | * @{ 47 | */ 48 | 49 | #ifndef __ENDPOINT_STREAM_H__ 50 | #define __ENDPOINT_STREAM_H__ 51 | 52 | /* Includes: */ 53 | #include "../../../Common/Common.h" 54 | #include "USBMode.h" 55 | 56 | /* Enable C linkage for C++ Compilers: */ 57 | #if defined(__cplusplus) 58 | extern "C" { 59 | #endif 60 | 61 | /* Preprocessor Checks: */ 62 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 63 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 64 | #endif 65 | 66 | /* Public Interface - May be used in end-application: */ 67 | /* Enums: */ 68 | /** Enum for the possible error return codes of the \c Endpoint_*_Stream_* functions. */ 69 | enum Endpoint_Stream_RW_ErrorCodes_t 70 | { 71 | ENDPOINT_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */ 72 | ENDPOINT_RWSTREAM_EndpointStalled = 1, /**< The endpoint was stalled during the stream 73 | * transfer by the host or device. 74 | */ 75 | ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during 76 | * the transfer. 77 | */ 78 | ENDPOINT_RWSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and 79 | * no USB endpoint traffic can occur until the bus 80 | * has resumed. 81 | */ 82 | ENDPOINT_RWSTREAM_Timeout = 4, /**< The host failed to accept or send the next packet 83 | * within the software timeout period set by the 84 | * \ref USB_STREAM_TIMEOUT_MS macro. 85 | */ 86 | ENDPOINT_RWSTREAM_IncompleteTransfer = 5, /**< Indicates that the endpoint bank became full or empty before 87 | * the complete contents of the current stream could be 88 | * transferred. The endpoint stream function should be called 89 | * again to process the next chunk of data in the transfer. 90 | */ 91 | }; 92 | 93 | /** Enum for the possible error return codes of the \c Endpoint_*_Control_Stream_* functions. */ 94 | enum Endpoint_ControlStream_RW_ErrorCodes_t 95 | { 96 | ENDPOINT_RWCSTREAM_NoError = 0, /**< Command completed successfully, no error. */ 97 | ENDPOINT_RWCSTREAM_HostAborted = 1, /**< The aborted the transfer prematurely. */ 98 | ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during 99 | * the transfer. 100 | */ 101 | ENDPOINT_RWCSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and 102 | * no USB endpoint traffic can occur until the bus 103 | * has resumed. 104 | */ 105 | }; 106 | 107 | /* Architecture Includes: */ 108 | #if (ARCH == ARCH_AVR8) 109 | #include "AVR8/EndpointStream_AVR8.h" 110 | #elif (ARCH == ARCH_UC3) 111 | #include "UC3/EndpointStream_UC3.h" 112 | #elif (ARCH == ARCH_XMEGA) 113 | #include "XMEGA/EndpointStream_XMEGA.h" 114 | #endif 115 | 116 | /* Disable C linkage for C++ Compilers: */ 117 | #if defined(__cplusplus) 118 | } 119 | #endif 120 | 121 | #endif 122 | 123 | /** @} */ 124 | 125 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/Events.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #define __INCLUDE_FROM_EVENTS_C 32 | #define __INCLUDE_FROM_USB_DRIVER 33 | #include "Events.h" 34 | 35 | void USB_Event_Stub(void) 36 | { 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/OTG.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Common USB OTG definitions for all architectures. 33 | * \copydetails Group_OTG 34 | * 35 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 36 | * dispatch header located in LUFA/Drivers/USB/USB.h. 37 | */ 38 | 39 | /** \ingroup Group_USB 40 | * \defgroup Group_OTG USB On The Go (OTG) Management 41 | * \brief USB OTG management definitions. 42 | * 43 | * This module contains macros for embedded USB hosts with dual role On The Go capabilities, for managing role 44 | * exchange. OTG is a way for two USB dual role devices to talk to one another directly without fixed device/host 45 | * roles. 46 | * 47 | * @{ 48 | */ 49 | 50 | #ifndef __USBOTG_H__ 51 | #define __USBOTG_H__ 52 | 53 | /* Includes: */ 54 | #include "../../../Common/Common.h" 55 | #include "USBMode.h" 56 | 57 | /* Enable C linkage for C++ Compilers: */ 58 | #if defined(__cplusplus) 59 | extern "C" { 60 | #endif 61 | 62 | /* Preprocessor Checks: */ 63 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 64 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 65 | #endif 66 | 67 | /* Architecture Includes: */ 68 | #if (ARCH == ARCH_AVR8) 69 | #include "AVR8/OTG_AVR8.h" 70 | #endif 71 | 72 | /* Disable C linkage for C++ Compilers: */ 73 | #if defined(__cplusplus) 74 | } 75 | #endif 76 | 77 | #endif 78 | 79 | /** @} */ 80 | 81 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/Pipe.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Common USB Pipe definitions for all architectures. 33 | * \copydetails Group_PipeManagement 34 | * 35 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 36 | * dispatch header located in LUFA/Drivers/USB/USB.h. 37 | */ 38 | 39 | /** \ingroup Group_PipeManagement 40 | * \defgroup Group_PipeRW Pipe Data Reading and Writing 41 | * \brief Pipe data read/write definitions. 42 | * 43 | * Functions, macros, variables, enums and types related to data reading and writing from and to pipes. 44 | */ 45 | 46 | /** \ingroup Group_PipeRW 47 | * \defgroup Group_PipePrimitiveRW Read/Write of Primitive Data Types 48 | * \brief Pipe data primitive read/write definitions. 49 | * 50 | * Functions, macros, variables, enums and types related to data reading and writing of primitive data types 51 | * from and to pipes. 52 | */ 53 | 54 | /** \ingroup Group_PipeManagement 55 | * \defgroup Group_PipePacketManagement Pipe Packet Management 56 | * \brief Pipe packet management definitions. 57 | * 58 | * Functions, macros, variables, enums and types related to packet management of pipes. 59 | */ 60 | 61 | /** \ingroup Group_PipeManagement 62 | * \defgroup Group_PipeControlReq Pipe Control Request Management 63 | * \brief Pipe control request definitions. 64 | * 65 | * Module for host mode request processing. This module allows for the transmission of standard, class and 66 | * vendor control requests to the default control endpoint of an attached device while in host mode. 67 | * 68 | * \see Chapter 9 of the USB 2.0 specification. 69 | */ 70 | 71 | /** \ingroup Group_USB 72 | * \defgroup Group_PipeManagement Pipe Management 73 | * \brief Pipe management definitions. 74 | * 75 | * This module contains functions, macros and enums related to pipe management when in USB Host mode. This 76 | * module contains the pipe management macros, as well as pipe interrupt and data send/receive functions 77 | * for various data types. 78 | * 79 | * @{ 80 | */ 81 | 82 | #ifndef __PIPE_H__ 83 | #define __PIPE_H__ 84 | 85 | /* Includes: */ 86 | #include "../../../Common/Common.h" 87 | #include "USBMode.h" 88 | 89 | /* Enable C linkage for C++ Compilers: */ 90 | #if defined(__cplusplus) 91 | extern "C" { 92 | #endif 93 | 94 | /* Preprocessor Checks: */ 95 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 96 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 97 | #endif 98 | 99 | /* Public Interface - May be used in end-application: */ 100 | /* Type Defines: */ 101 | /** Type define for a pipe table entry, used to configure pipes in groups via 102 | * \ref Pipe_ConfigurePipeTable(). 103 | */ 104 | typedef struct 105 | { 106 | uint8_t Address; /**< Address of the pipe to configure, or zero if the table entry is to be unused. */ 107 | uint16_t Size; /**< Size of the pipe bank, in bytes. */ 108 | uint8_t EndpointAddress; /**< Address of the endpoint in the connected device. */ 109 | uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */ 110 | uint8_t Banks; /**< Number of hardware banks to use for the pipe. */ 111 | } USB_Pipe_Table_t; 112 | 113 | /* Macros: */ 114 | /** Pipe address for the default control pipe, which always resides in address 0. This is 115 | * defined for convenience to give more readable code when used with the pipe macros. 116 | */ 117 | #define PIPE_CONTROLPIPE 0 118 | 119 | /** Pipe number mask, for masking against pipe addresses to retrieve the pipe's numerical address 120 | * in the device. 121 | */ 122 | #define PIPE_PIPENUM_MASK 0x0F 123 | 124 | /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's 125 | * numerical address in the attached device. 126 | */ 127 | #define PIPE_EPNUM_MASK 0x0F 128 | 129 | /* Architecture Includes: */ 130 | #if (ARCH == ARCH_AVR8) 131 | #include "AVR8/Pipe_AVR8.h" 132 | #elif (ARCH == ARCH_UC3) 133 | #include "UC3/Pipe_UC3.h" 134 | #endif 135 | 136 | /* Disable C linkage for C++ Compilers: */ 137 | #if defined(__cplusplus) 138 | } 139 | #endif 140 | 141 | #endif 142 | 143 | /** @} */ 144 | 145 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/PipeStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Pipe data stream transmission and reception management. 33 | * \copydetails Group_PipeStreamRW 34 | * 35 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 36 | * dispatch header located in LUFA/Drivers/USB/USB.h. 37 | */ 38 | 39 | /** \ingroup Group_PipeRW 40 | * \defgroup Group_PipeStreamRW Read/Write of Multi-Byte Streams 41 | * \brief Pipe data stream transmission and reception management. 42 | * 43 | * Functions, macros, variables, enums and types related to data reading and writing of data streams from 44 | * and to pipes. 45 | * 46 | * @{ 47 | */ 48 | 49 | #ifndef __PIPE_STREAM_H__ 50 | #define __PIPE_STREAM_H__ 51 | 52 | /* Includes: */ 53 | #include "../../../Common/Common.h" 54 | #include "USBMode.h" 55 | 56 | /* Enable C linkage for C++ Compilers: */ 57 | #if defined(__cplusplus) 58 | extern "C" { 59 | #endif 60 | 61 | /* Preprocessor Checks: */ 62 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 63 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 64 | #endif 65 | 66 | /* Public Interface - May be used in end-application: */ 67 | /* Enums: */ 68 | /** Enum for the possible error return codes of the Pipe_*_Stream_* functions. */ 69 | enum Pipe_Stream_RW_ErrorCodes_t 70 | { 71 | PIPE_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */ 72 | PIPE_RWSTREAM_PipeStalled = 1, /**< The device stalled the pipe during the transfer. */ 73 | PIPE_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during 74 | * the transfer. 75 | */ 76 | PIPE_RWSTREAM_Timeout = 3, /**< The device failed to accept or send the next packet 77 | * within the software timeout period set by the 78 | * \ref USB_STREAM_TIMEOUT_MS macro. 79 | */ 80 | PIPE_RWSTREAM_IncompleteTransfer = 4, /**< Indicates that the pipe bank became full/empty before the 81 | * complete contents of the stream could be transferred. 82 | */ 83 | }; 84 | 85 | /* Architecture Includes: */ 86 | #if (ARCH == ARCH_AVR8) 87 | #include "AVR8/PipeStream_AVR8.h" 88 | #elif (ARCH == ARCH_UC3) 89 | #include "UC3/PipeStream_UC3.h" 90 | #endif 91 | 92 | /* Disable C linkage for C++ Compilers: */ 93 | #if defined(__cplusplus) 94 | } 95 | #endif 96 | 97 | #endif 98 | 99 | /** @} */ 100 | 101 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/USBController.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Common USB Controller definitions for all architectures. 33 | * \copydetails Group_USBManagement 34 | * 35 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 36 | * dispatch header located in LUFA/Drivers/USB/USB.h. 37 | */ 38 | 39 | /** \ingroup Group_USB 40 | * \defgroup Group_USBManagement USB Interface Management 41 | * \brief USB Controller definitions for general USB controller management. 42 | * 43 | * Functions, macros, variables, enums and types related to the setup and management of the USB interface. 44 | * 45 | * @{ 46 | */ 47 | 48 | #ifndef __USBCONTROLLER_H__ 49 | #define __USBCONTROLLER_H__ 50 | 51 | /* Includes: */ 52 | #include "../../../Common/Common.h" 53 | #include "USBMode.h" 54 | 55 | /* Enable C linkage for C++ Compilers: */ 56 | #if defined(__cplusplus) 57 | extern "C" { 58 | #endif 59 | 60 | /* Preprocessor Checks and Defines: */ 61 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 62 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 63 | #endif 64 | 65 | /* Defines: */ 66 | /** \name Endpoint Direction Masks */ 67 | //@{ 68 | /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's 69 | * direction for comparing with the \c ENDPOINT_DIR_* masks. 70 | */ 71 | #define ENDPOINT_DIR_MASK 0x80 72 | 73 | /** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with 74 | * the index of the address within a device to obtain the full endpoint address. 75 | */ 76 | #define ENDPOINT_DIR_OUT 0x00 77 | 78 | /** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with 79 | * the index of the address within a device to obtain the full endpoint address. 80 | */ 81 | #define ENDPOINT_DIR_IN 0x80 82 | //@} 83 | 84 | /** \name Pipe Direction Masks */ 85 | //@{ 86 | /** Pipe direction mask, for masking against pipe addresses to retrieve the pipe's 87 | * direction for comparing with the \c PIPE_DIR_* masks. 88 | */ 89 | #define PIPE_DIR_MASK 0x80 90 | 91 | /** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with 92 | * the index of the address within a device to obtain the full endpoint address. 93 | */ 94 | #define PIPE_DIR_OUT 0x00 95 | 96 | /** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with 97 | * the index of the address within a device to obtain the full endpoint address. 98 | */ 99 | #define PIPE_DIR_IN 0x80 100 | //@} 101 | 102 | /** \name Endpoint/Pipe Type Masks */ 103 | //@{ 104 | /** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared 105 | * with the \c EP_TYPE_* masks to determine the exact type of the endpoint. 106 | */ 107 | #define EP_TYPE_MASK 0x03 108 | 109 | /** Mask for a CONTROL type endpoint or pipe. 110 | * 111 | * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. 112 | */ 113 | #define EP_TYPE_CONTROL 0x00 114 | 115 | /** Mask for an ISOCHRONOUS type endpoint or pipe. 116 | * 117 | * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. 118 | */ 119 | #define EP_TYPE_ISOCHRONOUS 0x01 120 | 121 | /** Mask for a BULK type endpoint or pipe. 122 | * 123 | * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. 124 | */ 125 | #define EP_TYPE_BULK 0x02 126 | 127 | /** Mask for an INTERRUPT type endpoint or pipe. 128 | * 129 | * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. 130 | */ 131 | #define EP_TYPE_INTERRUPT 0x03 132 | //@} 133 | 134 | /* Enums: */ 135 | /** Enum for the possible USB controller modes, for initialization via \ref USB_Init() and indication back to the 136 | * user application via \ref USB_CurrentMode. 137 | */ 138 | enum USB_Modes_t 139 | { 140 | USB_MODE_None = 0, /**< Indicates that the controller is currently not initialized in any specific USB mode. */ 141 | USB_MODE_Device = 1, /**< Indicates that the controller is currently initialized in USB Device mode. */ 142 | USB_MODE_Host = 2, /**< Indicates that the controller is currently initialized in USB Host mode. */ 143 | USB_MODE_UID = 3, /**< Indicates that the controller should determine the USB mode from the UID pin of the 144 | * USB connector. 145 | */ 146 | }; 147 | 148 | /* Architecture Includes: */ 149 | #if (ARCH == ARCH_AVR8) 150 | #include "AVR8/USBController_AVR8.h" 151 | #elif (ARCH == ARCH_UC3) 152 | #include "UC3/USBController_UC3.h" 153 | #elif (ARCH == ARCH_XMEGA) 154 | #include "XMEGA/USBController_XMEGA.h" 155 | #endif 156 | 157 | /* Disable C linkage for C++ Compilers: */ 158 | #if defined(__cplusplus) 159 | } 160 | #endif 161 | 162 | #endif 163 | 164 | /** @} */ 165 | 166 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/USBInterrupt.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief USB controller interrupt service routine management. 33 | * 34 | * This file contains definitions required for the correct handling of low level USB service routine interrupts 35 | * from the USB controller. 36 | * 37 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 38 | * dispatch header located in LUFA/Drivers/USB/USB.h. 39 | */ 40 | 41 | #ifndef __USBINTERRUPT_H__ 42 | #define __USBINTERRUPT_H__ 43 | 44 | /* Includes: */ 45 | #include "../../../Common/Common.h" 46 | #include "USBMode.h" 47 | 48 | /* Enable C linkage for C++ Compilers: */ 49 | #if defined(__cplusplus) 50 | extern "C" { 51 | #endif 52 | 53 | /* Preprocessor Checks: */ 54 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 55 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 56 | #endif 57 | 58 | /* Architecture Includes: */ 59 | #if (ARCH == ARCH_AVR8) 60 | #include "AVR8/USBInterrupt_AVR8.h" 61 | #elif (ARCH == ARCH_UC3) 62 | #include "UC3/USBInterrupt_UC3.h" 63 | #elif (ARCH == ARCH_XMEGA) 64 | #include "XMEGA/USBInterrupt_XMEGA.h" 65 | #endif 66 | 67 | /* Disable C linkage for C++ Compilers: */ 68 | #if defined(__cplusplus) 69 | } 70 | #endif 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/USBTask.c: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | #define __INCLUDE_FROM_USBTASK_C 32 | #define __INCLUDE_FROM_USB_DRIVER 33 | #include "USBTask.h" 34 | 35 | volatile bool USB_IsInitialized; 36 | USB_Request_Header_t USB_ControlRequest; 37 | 38 | #if defined(USB_CAN_BE_HOST) && !defined(HOST_STATE_AS_GPIOR) 39 | volatile uint8_t USB_HostState; 40 | #endif 41 | 42 | #if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR) 43 | volatile uint8_t USB_DeviceState; 44 | #endif 45 | 46 | void USB_USBTask(void) 47 | { 48 | #if defined(USB_CAN_BE_BOTH) 49 | if (USB_CurrentMode == USB_MODE_Device) 50 | USB_DeviceTask(); 51 | else if (USB_CurrentMode == USB_MODE_Host) 52 | USB_HostTask(); 53 | #elif defined(USB_CAN_BE_HOST) 54 | USB_HostTask(); 55 | #elif defined(USB_CAN_BE_DEVICE) 56 | USB_DeviceTask(); 57 | #endif 58 | } 59 | 60 | #if defined(USB_CAN_BE_DEVICE) 61 | static void USB_DeviceTask(void) 62 | { 63 | if (USB_DeviceState == DEVICE_STATE_Unattached) 64 | return; 65 | 66 | uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); 67 | 68 | Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); 69 | 70 | if (Endpoint_IsSETUPReceived()) 71 | USB_Device_ProcessControlRequest(); 72 | 73 | Endpoint_SelectEndpoint(PrevEndpoint); 74 | } 75 | #endif 76 | 77 | #if defined(USB_CAN_BE_HOST) 78 | static void USB_HostTask(void) 79 | { 80 | uint8_t PrevPipe = Pipe_GetCurrentPipe(); 81 | 82 | Pipe_SelectPipe(PIPE_CONTROLPIPE); 83 | 84 | USB_Host_ProcessNextHostState(); 85 | 86 | Pipe_SelectPipe(PrevPipe); 87 | } 88 | #endif 89 | 90 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Platform/Platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief Architecture Specific Hardware Platform Drivers. 33 | * 34 | * This file is the master dispatch header file for the device-specific hardware platform drivers, for low level 35 | * hardware configuration and management. The platform drivers are a set of drivers which are designed to provide 36 | * a high level management layer for the various low level system functions such as clock control and interrupt 37 | * management. 38 | * 39 | * User code may choose to either include this master dispatch header file to include all available platform 40 | * driver header files for the current architecture, or may choose to only include the specific platform driver 41 | * modules required for a particular application. 42 | */ 43 | 44 | /** \defgroup Group_PlatformDrivers System Platform Drivers - LUFA/Platform/Platform.h 45 | * \brief Hardware platform drivers. 46 | * 47 | * \section Sec_PlatformDrivers_Dependencies Module Source Dependencies 48 | * The following files must be built with any user project that uses this module: 49 | * - UC3 Architecture Only: LUFA/Platform/UC3/InterruptManagement.c (Makefile source module name: LUFA_SRC_PLATFORM) 50 | * - UC3 Architecture Only: LUFA/Platform/UC3/Exception.S (Makefile source module name: LUFA_SRC_PLATFORM) 51 | * 52 | * \section Sec_PlatformDrivers_ModDescription Module Description 53 | * Device-specific hardware platform drivers, for low level hardware configuration and management. The platform 54 | * drivers are a set of drivers which are designed to provide a high level management layer for the various low level 55 | * system functions such as clock control and interrupt management. 56 | * 57 | * User code may choose to either include this master dispatch header file to include all available platform 58 | * driver header files for the current architecture, or may choose to only include the specific platform driver 59 | * modules required for a particular application. 60 | * 61 | * \note The exact APIs and availability of sub-modules within the platform driver group may vary depending on the 62 | * target used - see individual target module documentation for the API specific to your target processor. 63 | */ 64 | 65 | #ifndef __LUFA_PLATFORM_H__ 66 | #define __LUFA_PLATFORM_H__ 67 | 68 | /* Includes: */ 69 | #include "../Common/Common.h" 70 | 71 | /* Includes: */ 72 | #if (ARCH == ARCH_UC3) 73 | #include "UC3/ClockManagement.h" 74 | #include "UC3/InterruptManagement.h" 75 | #elif (ARCH == ARCH_XMEGA) 76 | #include "XMEGA/ClockManagement.h" 77 | #endif 78 | 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /SmallyMouse2/src/LUFA/LUFA/Version.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * 33 | * \brief LUFA library version constants. 34 | * 35 | * Version constants for informational purposes and version-specific macro creation. This header file contains the 36 | * current LUFA version number in several forms, for use in the user-application (for example, for printing out 37 | * whilst debugging, or for testing for version compatibility). 38 | */ 39 | 40 | #ifndef __LUFA_VERSION_H__ 41 | #define __LUFA_VERSION_H__ 42 | 43 | /* Public Interface - May be used in end-application: */ 44 | /* Macros: */ 45 | /** Indicates the version number of the library, as an integer. */ 46 | #define LUFA_VERSION_INTEGER 0x151115 47 | 48 | /** Indicates the version number of the library, as a string. */ 49 | #define LUFA_VERSION_STRING "151115" 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /SmallyMouse2/src/asf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Autogenerated API include file for the Atmel Software Framework (ASF) 5 | * 6 | * Copyright (c) 2012 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | 44 | #ifndef ASF_H 45 | #define ASF_H 46 | 47 | /* 48 | * This file includes all API header files for the selected drivers from ASF. 49 | * Note: There might be duplicate includes required by more than one driver. 50 | * 51 | * The file is automatically generated and will be re-written when 52 | * running the ASF driver selector tool. Any changes will be discarded. 53 | */ 54 | 55 | // From module: LUFA ANSI Terminal Commands 56 | #include 57 | 58 | // From module: LUFA Board Hardware Information Driver 59 | #include 60 | 61 | // From module: LUFA Board LED Driver 62 | #include 63 | 64 | // From module: LUFA Common Infrastructure 65 | #include 66 | #include 67 | 68 | // From module: LUFA Platform Specific Support - AVR8 69 | #include 70 | 71 | // From module: LUFA USART Driver - AVR8 72 | #include 73 | 74 | // From module: LUFA USB Driver 75 | #include 76 | 77 | #endif // ASF_H 78 | -------------------------------------------------------------------------------- /SmallyMouse2/src/config/LUFAConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | LUFA Library 3 | Copyright (C) Dean Camera, 2015. 4 | 5 | dean [at] fourwalledcubicle [dot] com 6 | www.lufa-lib.org 7 | */ 8 | 9 | /* 10 | Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) 11 | 12 | Permission to use, copy, modify, distribute, and sell this 13 | software and its documentation for any purpose is hereby granted 14 | without fee, provided that the above copyright notice appear in 15 | all copies and that both that the copyright notice and this 16 | permission notice and warranty disclaimer appear in supporting 17 | documentation, and that the name of the author not be used in 18 | advertising or publicity pertaining to distribution of the 19 | software without specific, written prior permission. 20 | 21 | The author disclaims all warranties with regard to this 22 | software, including all implied warranties of merchantability 23 | and fitness. In no event shall the author be liable for any 24 | special, indirect or consequential damages or any damages 25 | whatsoever resulting from loss of use, data or profits, whether 26 | in an action of contract, negligence or other tortious action, 27 | arising out of or in connection with the use or performance of 28 | this software. 29 | */ 30 | 31 | /** \file 32 | * \brief LUFA Library Configuration Header File 33 | * 34 | * This header file is used to configure LUFA's compile time options, 35 | * as an alternative to the compile time constants supplied through 36 | * a makefile. 37 | * 38 | * For information on what each token does, refer to the LUFA 39 | * manual section "Summary of Compile Tokens". 40 | */ 41 | 42 | #ifndef _LUFA_CONFIG_H_ 43 | #define _LUFA_CONFIG_H_ 44 | 45 | #if (ARCH == ARCH_AVR8) 46 | 47 | /* Non-USB Related Configuration Tokens: */ 48 | // #define DISABLE_TERMINAL_CODES 49 | 50 | /* USB Class Driver Related Tokens: */ 51 | // #define HID_HOST_BOOT_PROTOCOL_ONLY 52 | // #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} 53 | // #define HID_USAGE_STACK_DEPTH {Insert Value Here} 54 | // #define HID_MAX_COLLECTIONS {Insert Value Here} 55 | // #define HID_MAX_REPORTITEMS {Insert Value Here} 56 | // #define HID_MAX_REPORT_IDS {Insert Value Here} 57 | // #define NO_CLASS_DRIVER_AUTOFLUSH 58 | 59 | /* General USB Driver Related Tokens: */ 60 | // #define ORDERED_EP_CONFIG 61 | #define USE_STATIC_OPTIONS (USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) 62 | // #define USB_DEVICE_ONLY 63 | #define USB_HOST_ONLY 64 | // #define USB_STREAM_TIMEOUT_MS {Insert Value Here} 65 | // #define NO_LIMITED_CONTROLLER_CONNECT 66 | // #define NO_SOF_EVENTS 67 | 68 | /* USB Device Mode Driver Related Tokens: */ 69 | // #define USE_RAM_DESCRIPTORS 70 | // #define USE_FLASH_DESCRIPTORS 71 | // #define USE_EEPROM_DESCRIPTORS 72 | // #define NO_INTERNAL_SERIAL 73 | // #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here} 74 | // #define DEVICE_STATE_AS_GPIOR {Insert Value Here} 75 | // #define FIXED_NUM_CONFIGURATIONS {Insert Value Here} 76 | // #define CONTROL_ONLY_DEVICE 77 | // #define INTERRUPT_CONTROL_ENDPOINT 78 | // #define NO_DEVICE_REMOTE_WAKEUP 79 | // #define NO_DEVICE_SELF_POWER 80 | 81 | /* USB Host Mode Driver Related Tokens: */ 82 | // #define HOST_STATE_AS_GPIOR {Insert Value Here} 83 | // #define USB_HOST_TIMEOUT_MS {Insert Value Here} 84 | // #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} 85 | // #define NO_AUTO_VBUS_MANAGEMENT 86 | // #define INVERTED_VBUS_ENABLE_LINE 87 | 88 | #else 89 | 90 | #error Unsupported architecture for this LUFA configuration file. 91 | 92 | #endif 93 | #endif 94 | --------------------------------------------------------------------------------