commit ea4cc966c5f047ffe03f2b2288532ed94c8b5c16 Author: NicoHood Date: Tue Jun 3 17:10:40 2014 +0200 Release 1.0 diff --git a/Firmwares/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex b/Firmwares/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex new file mode 100644 index 0000000..6ff3644 --- /dev/null +++ b/Firmwares/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex @@ -0,0 +1,254 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123420001000102DC0109023E0002017D +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:00000001FF diff --git a/Firmwares/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex b/Firmwares/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex new file mode 100644 index 0000000..1ca40e2 --- /dev/null +++ b/Firmwares/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex @@ -0,0 +1,254 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123440001000102DC0109023E0002017B +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:00000001FF diff --git a/Firmwares/Arduino-usbserial-atmega16u2-Uno-Rev3.hex b/Firmwares/Arduino-usbserial-atmega16u2-Uno-Rev3.hex new file mode 100644 index 0000000..711fabf --- /dev/null +++ b/Firmwares/Arduino-usbserial-atmega16u2-Uno-Rev3.hex @@ -0,0 +1,254 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123430001000102DC0109023E0002017C +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:00000001FF diff --git a/Firmwares/Hoodloader.hex b/Firmwares/Hoodloader.hex new file mode 100644 index 0000000..7ba7666 --- /dev/null +++ b/Firmwares/Hoodloader.hex @@ -0,0 +1,473 @@ +:1000000073C100008DC100008BC1000089C10000D8 +:1000100087C1000085C1000083C1000081C10000CC +:100020007FC100007DC100007BC100000C947E08F0 +:100030000C94270975C1000073C1000071C1000054 +:100040006FC100006DC100006BC1000069C10000FC +:1000500067C1000065C1000063C10000BDC30000AE +:100060005FC100005DC100005BC1000059C100001C +:1000700057C1000030034100720064007500690040 +:100080006E006F00200048006F006F0064006C007D +:100090006F0061006400650072002000420065008E +:1000A00074006100000012034E00690063006F00DD +:1000B00048006F006F006400000004030904090297 +:1000C0005F00030100C032080B00020202010009B8 +:1000D00004000001020201000524001001042402B2 +:1000E000060524060001070582030800FF09040134 +:1000F00000020A0000000705040240000107058312 +:10010000024000010904020001030000000921115E +:1001100001000122B801070581032000011201102E +:1001200001EF020108EB03684E01000102DC01054A +:10013000010902A1010901A100850105091901298F +:10014000051500250195057501810295017503814D +:100150000305010930093109381581257F75089596 +:10016000038106C0C005010906A101850205071922 +:10017000E029E715002501750195088102950175B3 +:1001800008810395067508150025650507190029DE +:1001900065810005081901290595057501910295EC +:1001A0000175039103C006C0FF0A000CA10185037D +:1001B0007508150026FF0095400901810295400948 +:1001C000029102C0050C0901A1018504150026FF5A +:1001D000FF19002AFFFF950475108100C005010971 +:1001E00080A1018505150026FF00190029FF950152 +:1001F00075088100C005010905A1018506050919D9 +:10020000012920150025017501952081020501A114 +:10021000000930093109320933093409351500273D +:10022000FFFF0000751095068102C005010939091C +:100230003915012508950275048102C005010905DB +:10024000A10185070509190129201500250175015E +:10025000952081020501A1000930093109320933D5 +:1002600009340935150027FFFF0000751095068138 +:1002700002C0093909391501250895027504810262 +:10028000C005010904A1018508A10005091901297A +:100290000215002501750195028102050109300949 +:1002A00031150026FF03750A95028102750295013A +:1002B0008103C0C005010904A1018509A100050948 +:1002C0001901290215002501750195028102050118 +:1002D00009300931150026FF03750A950281027560 +:1002E0000295018103C0C00011241FBECFEFD2E0F0 +:1002F000DEBFCDBF11E0A0E0B1E0EEE4FDE102C061 +:1003000005900D92AE32B107D9F712E0AEE2B1E03E +:1003100001C01D92A738B107E1F70BD10C94A50ECF +:100320006FCECF93DF9384B7877F84BF28E10FB66A +:10033000F89420936000109260000FBE80E190E07E +:100340009093CD008093CC00CAECD0E096E09883E7 +:10035000A8ECB0E082E08C93E9ECF0E02083539AC3 +:100360005A9A5B9A10821C92188298838C9388E91F +:1003700080835B988AB180638AB98BB180638BB9C3 +:10038000AED684E085BD5F9A579A22982A9ADF916B +:10039000CF9108950F931F93CF93DF93C9E6D2E0D7 +:1003A000082F10E00AC08091200180FF05C06881FD +:1003B00080E191E00E940D0B2196CE01895692407A +:1003C0008017910784F3DF91CF911F910F910895CA +:1003D000CF93DF9360913B02662311F180913D0240 +:1003E000882319F010923B021BC070E0716081E01D +:1003F00013D4C2E6D2E00AC08091200180FF05C07C +:10040000688180E191E00E940D0B21969E012256A9 +:1004100032408091610290E0281739076CF3E2CFF7 +:10042000DF91CF9108951F93CF93DF9382D38823D9 +:1004300009F47BC01A9B79C09ED28130C9F5AAD23B +:1004400080FF36C0C5DFA3D280933B0210923D02ED +:1004500091E1EFE3F2E0DF01292F1D922A95E9F700 +:100460008530A9F038F4823081F0843071F0813029 +:10047000C9F405C0883088F08A30A0F411C094E037 +:1004800090933C0280933E020FC088E001C082E05E +:1004900080933C0210923E0207C090933C02FACF38 +:1004A00083E0F6CF10923B02DF91CF911F915FC2A4 +:1004B00080913B028823C9F15ED210913D02C12F89 +:1004C000D0E090E09E012E5F3F4F359527952F5F3E +:1004D0003F4F8217930729F55AD2C15CDD4F8883BD +:1004E000C12FCF5FC0933D0280913C028C1749F031 +:1004F00051D2EC2FF0E0E15CFD4F80831E5F109342 +:100500003D0290913C0280913D029813CDCF04C0F2 +:1005100080E091E00E94A20D80913B028111F8CF12 +:10052000C3CFDF91CF911F9153CFDF91CF911F9117 +:100530000895F7DE2FB7F89481E391E09093B2012C +:100540008093B1019093B4018093B3012FBF2FB773 +:10055000F89486EB91E09093370280933602909363 +:100560003902809338022FBF789410923D02109286 +:100570003B02239A219AC1E3D1E08C0153E0E52E9E +:100580009FB7F8948091B5019FBF803819F180E141 +:1005900091E00E94750B97FD1DC0E091B101F091B3 +:1005A000B20180838091B1019091B2010196909344 +:1005B000B2018093B101815B914021F4D093B201EB +:1005C000C093B1019FB7F8948091B5018F5F80937C +:1005D000B5019FBF8FB7F894F0903A028FBFA899EA +:1005E00004C080E68F1508F050C0A89A80913A02A6 +:1005F000882329F15D98E0922E0121C0CED1877F1A +:1006000021F0E6DE80916802C5DEE0913802F091CB +:1006100039028191F0933902E0933802E653F240B7 +:1006200021F410933902009338022FB7F894909177 +:100630003A02915090933A022FBFF5DEFA94F110EE +:10064000DDCF80912E018823A1F080912E01815071 +:1006500080932E0181110DC0BBDE9FD183FD07C0A9 +:10066000F09068029AD187FDF3948F2D93DE7FD1AD +:100670005D9A80912F01882341F080912F01815054 +:1006800080932F01811101C05C9A9FB7F8948091EB +:10069000B5019FBF882309F1E091B301F091B40146 +:1006A0009191F093B401E093B301E15BF14021F447 +:1006B000D093B401C093B3012FB7F8948091B501E2 +:1006C00081508093B5012FBF8091C80085FFFCCF7A +:1006D0009093CE005C98E0922F0180E191E0EFD7FB +:1006E0005BD74ECF08950895CF9380E091E00E94AC +:1006F0008D0DC82F80E191E06BD79091E20094605E +:100700009093E200882321F0CC2311F080E001C017 +:1007100080E39BB18095906389238BB9CF91089535 +:100720001F93CF93DF93EC01E98DE150E23028F481 +:10073000F0E0E45DFE4F108101C010E0888D823052 +:1007400009F418608A8D873031F0883031F08630B6 +:1007500029F4126003C0146001C016605B9A109205 +:10076000C9001092C8001092CA002C893D894E8998 +:100770005F89211581EE38074105510579F0CA01DD +:10078000B901969587957795679560587B47814E17 +:100790009F4F0E94660E2150310902C020E130E0D7 +:1007A0003093CD002093CC001093CA008C899D8992 +:1007B000AE89BF898115914EA105B10511F480E084 +:1007C00001C082E08093C80088E98093C9005B98EB +:1007D000DF91CF911F9108951F920F920FB60F9244 +:1007E00011242F938F939F93EF93FF938091CE00CB +:1007F00090917E029430F1F4E0913602F09137024C +:100800008083E0913602F0913702CF0101969093F8 +:100810003702809336028653924021F486EB91E0B2 +:10082000928381839FB7F89480913A028F5F80937F +:100830003A029FBFFF91EF919F918F912F910F905F +:100840000FBE0F901F901895FC01208920FF02C059 +:100850005F9808955F9A8BB180638BB9089580E1AA +:1008600091E071D780E091E00C94560C80910E01DC +:1008700090910F01009729F0019790930F018093B9 +:100880000E010895EF92FF920F931F93CF93DF9382 +:100890007B01C901E80110913C02EFE3F2E0412F36 +:1008A00050E0BF010E94950EEBE3F2E08081D7019A +:1008B0008C9318831982108280913E02DF91CF9130 +:1008C0001F910F91FF90EF9008950895292F3327DE +:1008D00023303105B1F04CF42130310509F439C031 +:1008E0002230310509F03AC007C02132310539F113 +:1008F0002232310549F132C0EFE5F0E08EEB90E0B5 +:1009000031C099278130910561F08230910581F0E5 +:10091000892B21F5EAEBF0E0E491F0E08AEB90E03E +:1009200021C0E6EAF0E0E491F0E086EA90E01AC047 +:10093000E4E7F0E0E491F0E084E790E013C0E9E060 +:10094000F0E08DE091E00EC0E8EBF1E08FE291E0A5 +:1009500009C0E2E1F0E08DE191E004C0E0E0F0E008 +:1009600080E090E0DA018D939C93CF01089588E0B8 +:1009700080932B0108958091700208956091710217 +:100980007091720280917302909174020895809127 +:100990007102089580917202089580912B0108954B +:1009A000982F80912B018823E9F083FF0AC01092D1 +:1009B00075021092760210927702109278021092CD +:1009C000790287FF0DC040916802E42FF0E0E759FB +:1009D000FD4F80818093690281E08093680202C0AC +:1009E0001092680210926F021092700210927102BF +:1009F00010927202109273021092740210922B01E4 +:100A000020916802E22FF0E0E759FD4F9083822F9A +:100A10008F5F80936802392F307C80917502303867 +:100A200009F440C0303C09F05EC0882329F080E919 +:100A300080932B0120936802292F287326952695F1 +:100A40002695223018F02730E1F40AC09F709F5F8E +:100A500090936F021092750280912B0185603DC0CA +:100A6000492F4F7050E060E070E040937602509361 +:100A70007702609378027093790285E08093750223 +:100A800056C0892F877090E0A0E0B0E08093760296 +:100A900090937702A0937802B0937902215020932B +:100AA000750245C0282F2150209375028130C9F46A +:100AB0009F739F5F9093700280917602909177026E +:100AC000A0917802B09179028093710290937202A2 +:100AD000A0937302B093740283E080932B0181E0B2 +:100AE000089580E507C0282F215020937502823099 +:100AF00030F480E380932B011092750218C040916E +:100B0000760250917702609178027091790287E0C5 +:100B1000440F551F661F771F8A95D1F7492B4093C5 +:100B2000760250937702609378027093790280E0A6 +:100B300008950F931F9334DF8823A9F01CDF8823C7 +:100B400091F01CDF8C0122273327DC01CB01AA277F +:100B5000BB27082719272A273B2781E00F3F1F4F74 +:100B60002105310509F080E01F910F9108950F9341 +:100B70001F93A0916202ECE1F0E097E08A019B01F3 +:100B80000E2E04C036952795179507950A94D2F72F +:100B9000083040F0A0936202973059F4009362024B +:100BA00096E007C091503797A02F923039F7009305 +:100BB0006202A92FA25013C0EA2FF0E0EE59FD4FB8 +:100BC0008A019B010F771127222733270083E7E053 +:100BD0007695679557954795EA95D1F7A150A1115C +:100BE000EBCF492F50E09A0163E0220F331F6A9543 +:100BF000E1F7206C3F6F30916202322B309362023A +:100C0000FA01EF59FD4F81508F7380688083909374 +:100C100061021F910F9108950F931F938B01AB01F8 +:100C20004095509560E070E0BA015527442720E0D8 +:100C300030E0402B512B622B732B1F910F9197CFDC +:100C4000BF92CF92DF92EF92FF920F931F93CF93B9 +:100C5000DF937C018B01EA01D7D1B82E811132C01C +:100C6000209731F028813981021B130BE20EF31E0D +:100C7000C12CD12C22C08091E80085FD14C0809148 +:100C8000E8008E778093E800209749F08881998169 +:100C90008C0D9D1D9983888325E0B22E13C0B4D19D +:100CA000882359F00EC0F70181917F018093F100F4 +:100CB00001501109FFEFCF1ADF0A01151105D9F60E +:100CC00001C0B82E8B2DDF91CF911F910F91FF9016 +:100CD000EF90DF90CF90BF900895209185023091E2 +:100CE00086022617370748F06115710539F42091FF +:100CF000E8002E772093E80001C0B9019C0180E054 +:100D000034C090917E02992309F443C0953009F4D0 +:100D100042C09091E80093FD3AC09091E80092FDA6 +:100D200030C09091E80090FF20C08091F20090E0E8 +:100D3000F901821B930B05C021912093F1006150B2 +:100D400071099F01280F391F6115710519F02830AD +:100D5000310590F381E02830310509F080E0909171 +:100D6000E8009E779093E8009F016115710549F6B0 +:100D70008111C7CF06C080917E02882351F0853053 +:100D800051F08091E80082FFF6CF80E0089581E085 +:100D9000089582E0089583E008956115710529F4AE +:100DA0002091E8002B772093E8009C0121C08091DE +:100DB0007E02882381F1853041F18091E80083FD36 +:100DC00026C08091E80082FFF2CFF90107C0809130 +:100DD000F10081939F016150710929F09F01809179 +:100DE000F2008111F4CF8091E8008B778093E800C6 +:100DF00061157105E1F68091E80080FD0AC08091DF +:100E00007E02882341F08530B1F783E0089581E0C8 +:100E1000089580E0089582E0089520918502309140 +:100E200086022617370748F06115710539F42091BD +:100E3000E8002E772093E80001C0B9019C0180E012 +:100E400035C090917E02992309F444C0953009F48D +:100E500043C09091E80093FD3BC09091E80092FD63 +:100E600031C09091E80090FF21C08091F20090E0A5 +:100E7000F901821B930B06C024912093F100319657 +:100E8000615071099C012E0F3F1F6115710519F00A +:100E90002830310588F381E02830310509F080E001 +:100EA0009091E8009E779093E8009F01611571058D +:100EB00041F68111C6CF06C080917E02882351F091 +:100EC000853051F08091E80082FFF6CF80E00895F0 +:100ED00081E0089582E0089583E00895982F2CC062 +:100EE0009093E900981739F07091EC002091ED0093 +:100EF0005091F00003C0242F762F50E021FD02C056 +:100F00009F5F1AC03091EB003E7F3093EB00309131 +:100F1000ED003D7F3093ED003091EB003160309378 +:100F2000EB007093EC002093ED005093F0002091C3 +:100F3000EE0027FDE5CF07C0953090F28F708093CB +:100F4000E90081E0089580E008950F931F93CF9307 +:100F5000DF93062FEC0110E02EC09881911103C0A1 +:100F60001F5F259628C02C81E981FA816B81892F2A +:100F70008F70853010F080E021C0223010F056E0F4 +:100F800001C052E028E030E040E003C04F5F220F94 +:100F9000331F2E173F07D0F34295407F452B991FF3 +:100FA0009927991F6295660F660F607C692B96DF03 +:100FB0008111D6CFE0CF1013D0CF81E0DF91CF9158 +:100FC0001F910F91089580917F0287FD05C0809148 +:100FD000E80080FF0EC012C08091E80082FD05C0CD +:100FE00080917E028111F8CF08958091E8008B777F +:100FF00008C080917E028111EACF08958091E800B7 +:101000008E778093E80008958091E4009091E50048 +:1010100045E62091EC0020FD1FC023C020917E02F8 +:10102000222391F0253091F02091EB0025FD10C096 +:101030002091E4003091E5002817390751F3415021 +:10104000C90139F784E0089582E0089583E00895A6 +:1010500081E0089580E008952091E80020FFDECF30 +:10106000F9CF2091E80022FFD9CFF4CF41D043D06F +:101070008091D8008F778093D8008091D8008068C5 +:101080008093D8008091D8008F7D8093D80084E031 +:1010900089BD86E089BD09B400FEFDCF10927E02B5 +:1010A00010927A0210927C0210927B0242E060E081 +:1010B00080E014DF8091E1008E7F8093E1008091D9 +:1010C000E20081608093E2008091E200886080937A +:1010D000E2008091E0008E7F8093E0000895E3E6D7 +:1010E000F0E080818E7F808381E080937D02BECF9F +:1010F0001092E20008951092E10008951F920F925D +:101100000FB60F9211242F933F934F935F936F93DA +:101110007F938F939F93AF93BF93EF93FF938091B0 +:10112000E10082FF0AC08091E20082FF06C0809148 +:10113000E1008B7F8093E10099DB8091E10080FFEB +:1011400017C08091E20080FF13C08091E2008E7F83 +:101150008093E2008091E20080618093E2008091C0 +:10116000D80080628093D80019BC10927E02BBDA4E +:101170008091E10084FF2FC08091E20084FF2BC0AA +:1011800084E089BD86E089BD09B400FEFDCF809171 +:10119000D8008F7D8093D8008091E1008F7E80936E +:1011A000E1008091E2008F7E8093E2008091E20076 +:1011B00081608093E20080917A02882311F084E0BC +:1011C00007C08091E30087FF02C083E001C081E097 +:1011D00080937E0287DA8091E10083FF27C08091AF +:1011E000E20083FF23C08091E100877F8093E100CC +:1011F00082E080937E0210927A028091E1008E7FDD +:101200008093E1008091E2008E7F8093E2008091E4 +:10121000E20080618093E20042E060E080E05EDE18 +:101220008091F00088608093F000B5D1FF91EF913C +:10123000BF91AF919F918F917F916F915F914F91EE +:101240003F912F910F900FBE0F901F9018951F92F6 +:101250000F920FB60F9211242F933F934F935F93EA +:101260006F937F938F939F93AF93BF93CF93EF939E +:10127000FF938091E9008F709091EC0090FF02C085 +:1012800090E801C090E0C92FC82B1092E90080912E +:10129000F000877F8093F00078941CD01092E900D2 +:1012A0008091F00088608093F000CF70C093E900D7 +:1012B000FF91EF91CF91BF91AF919F918F917F91CE +:1012C0006F915F914F913F912F910F900FBE0F90B3 +:1012D0001F9018951F93CF93DF93CDB7DEB7AC97D0 +:1012E0000FB6F894DEBF0FBECDBFEFE7F2E08091FE +:1012F000F100819322E0E738F207C9F7B0DA809174 +:10130000E80083FF30C180917F0290918002953088 +:1013100009F487C038F49130B1F170F0933009F0DE +:1013200022C131C0983009F4F3C0993009F4FFC0EC +:10133000963009F018C19BC0803821F0823809F03E +:1013400012C108C080917B0290917C02992389F0A0 +:1013500082600FC080918302909184028F709927E0 +:101360008093E9008091EB0085FB882780F910923B +:10137000E9009091E800977F9093E8008093F10056 +:101380001092F100D0C0882319F0823009F0EBC030 +:101390008F7121F0823009F0E6C00BC0809181028C +:1013A000813009F0E0C0933009F080E080937C0246 +:1013B0002FC08091810281112BC080918302909176 +:1013C00084028F709927009709F4CDC08093E900BB +:1013D0002091EB0020FF1CC020918002233021F4DB +:1013E0008091EB00806212C09091EB00906190932D +:1013F000EB0021E030E001C0220F8A95EAF720934C +:10140000EA001092EA008091EB0088608093EB0084 +:101410001092E9008091E800877F8093E800D3DD97 +:10142000A2C08111A0C080918102909182028F7729 +:101430009927182F9091E3009078982B9093E300D0 +:101440008091E800877F8093E800BDDD8091E8000F +:1014500080FFFCCF8091E30080688093E30011233C +:1014600011F083E001C082E080937E027CC080584E +:10147000823008F078C080918102909182028C3D88 +:1014800023E0920771F583E08A838AE289834FB76C +:10149000F894DE01139620E03EE051E2E32FF0E005 +:1014A00050935700E49120FF03C0E295EF703F5F37 +:1014B000EF708E2F90E0EA3010F0C79601C0C09612 +:1014C0008D939D932F5F243149F74FBF8091E800A2 +:1014D000877F8093E8006AE270E0CE010196FDDB31 +:1014E00011C0AE01455D5F4F60918302EFD9009757 +:1014F000D1F12091E800277F2093E800BC018BA563 +:101500009CA58BDC8091E8008B778093E8002BC052 +:10151000803849F58091E800877F8093E8008091CA +:101520007A028093F1008091E8008E7776CF811166 +:101530001AC0909181029230B0F48091E800877FC8 +:101540008093E80090937A023EDD80917A028111C7 +:1015500004C08091E30087FF02C084E001C081E005 +:1015600080937E02C1D88091E80083FF0AC08091F9 +:10157000E800877F8093E8008091EB008062809391 +:10158000EB00AC960FB6F894DEBF0FBECDBFDF9177 +:10159000CF911F9108950895CF9380917E02882363 +:1015A000A9F08091E9008F709091EC0090FF02C04B +:1015B00090E801C090E0C92FC82B1092E9008091FB +:1015C000E80083FD87DECF70C093E900CF910895D6 +:1015D000CF93DF93EC014096FC018BE0DF011D927D +:1015E0008A95E9F782E08C83898783E08E8761E0C2 +:1015F000CE010196AADC882361F061E0CE01069657 +:10160000A4DC882331F061E0CE010B96DF91CF910D +:101610009CCC80E0DF91CF910895CF93C62F20918D +:101620007E022430F1F4FC0144895589668977896A +:10163000452B462B472BA9F081818F708093E900C1 +:101640008091E80085FF04C0C093F10080E00AC0EB +:101650008091E8008E778093E800D6DC8823A1F3A0 +:1016600001C082E0CF91089520917E02243029F5B7 +:10167000FC014489558966897789452B462B472B80 +:10168000E1F081818F708093E9008091F2008111F7 +:1016900002C080E008959091E8008091E8008E7784 +:1016A0008093E80095FDF5CFAFDC811107C09091E4 +:1016B000E8009E779093E800089582E008952091D5 +:1016C0007E02243089F4FC01448955896689778932 +:1016D000452B462B472B41F021812F702093E900A9 +:1016E0002091E80020FDC0CF089520917E02243093 +:1016F00019F02FEF3FEF24C0FC014489558966891A +:101700007789452B462B472BA1F386818F708093D9 +:10171000E9008091E80082FFECCF8091F2008823FD +:1017200021F02091F10030E002C02FEF3FEF8091D7 +:10173000F200811105C08091E8008B778093E8006A +:10174000C90108950895CF93DF93EC018091E800DB +:1017500083FFA9C0888190E02091830230918402A8 +:101760002817390709F09FC080918002813261F00B +:1017700020F4803209F097C03DC0823209F46EC077 +:10178000833209F090C07FC080917F02813A09F0D6 +:101790008AC08091E800877F8093E8008091E8000C +:1017A00080FFFCCF4C895D896E897F894093F10071 +:1017B000BB27A72F962F852F8093F100CB01AA2757 +:1017C000BB278093F100472F552766277727409343 +:1017D000F100888D8093F100898D8093F1008A8DCE +:1017E0008093F1008091E8008E778093E800DF918C +:1017F000CF91E9CB80917F02813209F054C0809172 +:10180000E800877F8093E80005C080917E028823EE +:1018100009F449C08091E80082FFF7CF3091F100D0 +:101820002091F1009091F1008091F1003C8B2D8B83 +:101830009E8B8F8B8091F100888F8091F100898F32 +:101840008091F1008A8F8091E8008B778093E80087 +:10185000BADBCE01DF91CF910C94900380917F028F +:10186000813209F58091E800877F8093E800ABDB47 +:101870008091810290918202998B888BCE01DF91B9 +:10188000CF910C94240480917F02813261F4809185 +:10189000E800877F8093E80096DB60918102CE01AB +:1018A000DF91CF914FCFDF91CF9108956F927F92CB +:1018B0008F929F92AF92BF92CF92DF92EF92FF9260 +:1018C0000F931F93CF93DF9300D01F92CDB7DEB756 +:1018D0007C01ADB6BEB68091E80083FF07C1F70179 +:1018E000808190E02091830230918402281739078B +:1018F00009F0FCC080918002833009F49EC030F46E +:10190000813071F0823009F0F1C0D4C08A3009F41E +:10191000B9C08B3009F4A2C0893009F0E7C04CC0CF +:1019200080917F02813A09F0E1C08DB69EB61A829D +:10193000198280918102109182028B83F701408588 +:101940008DB79EB7841B91090FB6F8949EBF0FBE4A +:101950008DBFCDB6DEB6EFEFCE1ADE0A360150E00F +:1019600060E070E0C601EAD1412F41508E010F5F67 +:101970001F4F9601BE016D5F7F4FC7010E94420459 +:10198000F701268137812115310529F0408550E086 +:10199000B601C901CAD11092E9008091E800877FA1 +:1019A0008093E80069817A81C30197D98091E8002A +:1019B0008B778093E80039C080917F02813209F0F3 +:1019C00095C08DB69EB600918502109186027090EA +:1019D0008102609082028DB79EB7801B910B0FB67B +:1019E000F8949EBF0FBE8DBFCDB6DEB6EFEFCE1A18 +:1019F000DE0A8091E800877F8093E800B801C60185 +:101A0000CCD98091E8008E778093E80021E07110B6 +:101A100001C020E030E0021B130B2C0D3D1D462DB4 +:101A20004150672DC7010E946504882D992D0FB67E +:101A3000F8949EBF0FBE8DBF59C080917F02813A3E +:101A400009F054C08091E800877F8093E80080917E +:101A5000E80080FFFCCFF701818540C080917F02C4 +:101A6000813209F043C08091E800877F8093E800CD +:101A7000AADA9091810281E0911101C080E0F70122 +:101A8000818734C080917F02813281F58091E800A6 +:101A9000877F8093E80097DA80918102909182029B +:101AA000882736E0969587953A95E1F7F70195876F +:101AB00084871CC080917F02813AC1F48091E80044 +:101AC000877F8093E8008091E80080FFFCCFF701DA +:101AD0008485958596958795969587958093F10051 +:101AE0008091E8008E778093E8006DDA0FB6F89465 +:101AF000BEBE0FBEADBE0F900F900F90DF91CF9185 +:101B00001F910F91FF90EF90DF90CF90BF90AF901B +:101B10009F908F907F906F9008959C01275F3F4F1B +:101B2000F90127E0DF011D922A95E9F721E0FC0188 +:101B3000218724EF31E03587248723E0248361E087 +:101B4000019603CA4F925F926F927F928F929F92FB +:101B5000AF92BF92CF92DF92EF92FF920F931F93BB +:101B6000CF93DF9300D01F92CDB7DEB77C01ADB627 +:101B7000BEB680917E02843009F08FC08091E4006F +:101B80009091E500F701228533852817390709F47C +:101B900084C081818F708093E9008091E80085FF87 +:101BA0007CC06DB67EB640858DB79EB7841B91090B +:101BB0000FB6F8949EBF0FBE8DBFCDB6DEB6EFEF69 +:101BC000CE1ADE0A1B821A821982460150E060E0BA +:101BD00070E0C601B3D08E010F5F1F4F960140E049 +:101BE000BE016D5F7F4FC7010E944204582EF7016E +:101BF00084859585892B31F001E010E086859785F5 +:101C0000892B11F000E010E0F701C680D780C114E5 +:101C1000D10489F049815A81B601C40179D04424A4 +:101C20004394009709F4412CF701408550E0B4013A +:101C3000C6017BD001C0412C89819A81892BF9F0A2 +:101C4000511004C0411002C000FF19C0F701848583 +:101C500095859787868781818F708093E9008B8136 +:101C600081118093F10069817A8140E050E0C401E4 +:101C70000E9420068091E8008E778093E800809192 +:101C8000E4009091E500F70193878287862D972DD8 +:101C90000FB6F8949EBF0FBE8DBF0FB6F894BEBEB0 +:101CA0000FBEADBE0F900F900F90DF91CF911F919F +:101CB0000F91FF90EF90DF90CF90BF90AF909F90EB +:101CC0008F907F906F905F904F900895A1E21A2EB1 +:101CD000AA1BBB1BFD010DC0AA1FBB1FEE1FFF1FD0 +:101CE000A217B307E407F50720F0A21BB30BE40B20 +:101CF000F50B661F771F881F991F1A9469F7609567 +:101D00007095809590959B01AC01BD01CF01089520 +:101D1000FB01DC0104C08D910190801921F4415038 +:101D20005040C8F7881B990B0895FB01DC0102C0E5 +:101D300001900D9241505040D8F70895DC0101C048 +:0E1D40006D9341505040E0F70895F894FFCFA6 +:101D4E00028120000001500211000000000000007E +:101D5E0000834000000104400000018208000001E1 +:0E1D6E0000000000000000000000000830200F +:00000001FF diff --git a/Flip_1.PNG b/Flip_1.PNG new file mode 100644 index 0000000..46f0952 Binary files /dev/null and b/Flip_1.PNG differ diff --git a/Flip_2.PNG b/Flip_2.PNG new file mode 100644 index 0000000..d44f3e8 Binary files /dev/null and b/Flip_2.PNG differ diff --git a/Flip_3.PNG b/Flip_3.PNG new file mode 100644 index 0000000..3243964 Binary files /dev/null and b/Flip_3.PNG differ diff --git a/HID.cpp b/HID.cpp new file mode 100644 index 0000000..bde3f82 --- /dev/null +++ b/HID.cpp @@ -0,0 +1,516 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include "HID.h" + +//================================================================================ +// HID +//================================================================================ + +HID_ HID; + +void HID_::sendReport(uint8_t ReportID, const void* HIDReport, uint8_t length){ + // write the Report via Protocol and checksum. 16bit for each sending + // send control address + NHPHID.sendChecksum(NHP_ADDRESS_CONTROL, (NHP_USAGE_ARDUINOHID<<8)|ReportID , Serial); + const uint8_t* report = (const uint8_t*)HIDReport; + for(int i = 0; i 0) + return true; + return false; +} + +//================================================================================ +// Keyboard +//================================================================================ + +Keyboard_ Keyboard; + +Keyboard_::Keyboard_(void){ + // empty +} + +void Keyboard_::begin(void){ + memset(&_report, 0, sizeof(_report)); + HID.sendReport(HID_REPORTID_KeyboardReport, &_report, sizeof(_report)); +} + +void Keyboard_::end(void){ + begin(); +} + +extern + const uint8_t _asciimap[128] PROGMEM; + +#define SHIFT 0x80 +const uint8_t _asciimap[128] = +{ + 0x00, // NUL + 0x00, // SOH + 0x00, // STX + 0x00, // ETX + 0x00, // EOT + 0x00, // ENQ + 0x00, // ACK + 0x00, // BEL + 0x2a, // BS Backspace + 0x2b, // TAB Tab + 0x28, // LF Enter + 0x00, // VT + 0x00, // FF + 0x00, // CR + 0x00, // SO + 0x00, // SI + 0x00, // DEL + 0x00, // DC1 + 0x00, // DC2 + 0x00, // DC3 + 0x00, // DC4 + 0x00, // NAK + 0x00, // SYN + 0x00, // ETB + 0x00, // CAN + 0x00, // EM + 0x00, // SUB + 0x00, // ESC + 0x00, // FS + 0x00, // GS + 0x00, // RS + 0x00, // US + + 0x2c, // ' ' + 0x1e|SHIFT, // ! + 0x34|SHIFT, // " + 0x20|SHIFT, // # + 0x21|SHIFT, // $ + 0x22|SHIFT, // % + 0x24|SHIFT, // & + 0x34, // ' + 0x26|SHIFT, // ( + 0x27|SHIFT, // ) + 0x25|SHIFT, // * + 0x2e|SHIFT, // + + 0x36, // , + 0x2d, // - + 0x37, // . + 0x38, // / + 0x27, // 0 + 0x1e, // 1 + 0x1f, // 2 + 0x20, // 3 + 0x21, // 4 + 0x22, // 5 + 0x23, // 6 + 0x24, // 7 + 0x25, // 8 + 0x26, // 9 + 0x33|SHIFT, // : + 0x33, // ; + 0x36|SHIFT, // < + 0x2e, // = + 0x37|SHIFT, // > + 0x38|SHIFT, // ? + 0x1f|SHIFT, // @ + 0x04|SHIFT, // A + 0x05|SHIFT, // B + 0x06|SHIFT, // C + 0x07|SHIFT, // D + 0x08|SHIFT, // E + 0x09|SHIFT, // F + 0x0a|SHIFT, // G + 0x0b|SHIFT, // H + 0x0c|SHIFT, // I + 0x0d|SHIFT, // J + 0x0e|SHIFT, // K + 0x0f|SHIFT, // L + 0x10|SHIFT, // M + 0x11|SHIFT, // N + 0x12|SHIFT, // O + 0x13|SHIFT, // P + 0x14|SHIFT, // Q + 0x15|SHIFT, // R + 0x16|SHIFT, // S + 0x17|SHIFT, // T + 0x18|SHIFT, // U + 0x19|SHIFT, // V + 0x1a|SHIFT, // W + 0x1b|SHIFT, // X + 0x1c|SHIFT, // Y + 0x1d|SHIFT, // Z + 0x2f, // [ + 0x31, // bslash + 0x30, // ] + 0x23|SHIFT, // ^ + 0x2d|SHIFT, // _ + 0x35, // ` + 0x04, // a + 0x05, // b + 0x06, // c + 0x07, // d + 0x08, // e + 0x09, // f + 0x0a, // g + 0x0b, // h + 0x0c, // i + 0x0d, // j + 0x0e, // k + 0x0f, // l + 0x10, // m + 0x11, // n + 0x12, // o + 0x13, // p + 0x14, // q + 0x15, // r + 0x16, // s + 0x17, // t + 0x18, // u + 0x19, // v + 0x1a, // w + 0x1b, // x + 0x1c, // y + 0x1d, // z + 0x2f|SHIFT, // + 0x31|SHIFT, // | + 0x30|SHIFT, // } + 0x35|SHIFT, // ~ + 0 // DEL +}; + +// removed <-- +//uint8_t USBPutChar(uint8_t c); + +size_t Keyboard_::write(uint8_t c) +{ + uint8_t p = press(c); // Keydown + //uint8_t r = + release(c); // Keyup + return (p); // just return the result of press() since release() almost always returns 1 +} + +// press() adds the specified key (printing, non-printing, or modifier) +// to the persistent key report and sends the report. Because of the way +// USB HID works, the host acts like the key remains pressed until we +// call release(), releaseAll(), or otherwise clear the report and resend. +size_t Keyboard_::press(uint8_t k) +{ + uint8_t i; + if (k >= 136) { // it's a non-printing key (not a modifier) + k = k - 136; + } else if (k >= 128) { // it's a modifier key + _report.modifiers |= (1<<(k-128)); + k = 0; + } else { // it's a printing key + k = pgm_read_byte(_asciimap + k); + if (!k) { + setWriteError(); + return 0; + } + if (k & 0x80) { // it's a capital letter or other character reached with shift + _report.modifiers |= 0x02; // the left shift modifier + k &= 0x7F; + } + } + + // Add k to the key report only if it's not already present + // and if there is an empty slot. + if (_report.keys[0] != k && _report.keys[1] != k && + _report.keys[2] != k && _report.keys[3] != k && + _report.keys[4] != k && _report.keys[5] != k) { + + for (i=0; i<6; i++) { + if (_report.keys[i] == 0x00) { + _report.keys[i] = k; + break; + } + } + if (i == 6) { + setWriteError(); + return 0; + } + } + HID.sendReport(HID_REPORTID_KeyboardReport, &_report, sizeof(_report)); + return 1; +} + +// release() takes the specified key out of the persistent key report and +// sends the report. This tells the OS the key is no longer pressed and that +// it shouldn't be repeated any more. +size_t Keyboard_::release(uint8_t k) +{ + uint8_t i; + if (k >= 136) { // it's a non-printing key (not a modifier) + k = k - 136; + } else if (k >= 128) { // it's a modifier key + _report.modifiers &= ~(1<<(k-128)); + k = 0; + } else { // it's a printing key + k = pgm_read_byte(_asciimap + k); + if (!k) { + return 0; + } + if (k & 0x80) { // it's a capital letter or other character reached with shift + _report.modifiers &= ~(0x02); // the left shift modifier + k &= 0x7F; + } + } + + // Test the key report to see if k is present. Clear it if it exists. + // Check all positions in case the key is present more than once (which it shouldn't be) + for (i=0; i<6; i++) { + if (0 != k && _report.keys[i] == k) { + _report.keys[i] = 0x00; + } + } + + HID.sendReport(HID_REPORTID_KeyboardReport, &_report, sizeof(_report)); + return 1; +} + +void Keyboard_::releaseAll(void){ + begin(); +} + +//================================================================================ +// Media +//================================================================================ + +Media_ Media; + +Media_::Media_(void){ + // empty +} + +void Media_::begin(void){ + memset(&_report, 0, sizeof(_report)); + HID.sendReport(HID_REPORTID_MediaReport, &_report, sizeof(_report)); +} + +void Media_::end(void){ + begin(); +} + +void Media_::write(uint16_t m){ + press(m); + release(m); +} + +void Media_::press(uint16_t m){ + // search for a free spot + for (int i=0; i +#include "HID_Reports.h" +// somehow you need to declare it in the main program too +#include + +//================================================================================ +// HID +//================================================================================ + +class HID_{ +public: + inline HID_(void){} + inline void begin(void){Serial.begin(115200);} + inline void end(void){Serial.end();} + + // everything public for your own modifications + NHProtocol NHPHID; + void sendReport(uint8_t ReportID, const void* HIDReport, uint8_t length); +private: +}; +extern HID_ HID; + +//================================================================================ +// Mouse +//================================================================================ + +#define MOUSE_LEFT 0x01 +#define MOUSE_RIGHT 0x02 +#define MOUSE_MIDDLE 0x04 +#define MOUSE_PREV 0x08 +#define MOUSE_NEXT 0x10 +#define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE | MOUSE_PREV | MOUSE_NEXT) + +class Mouse_{ +public: + Mouse_(void); + void begin(void); + void end(void); + void click(uint8_t b = MOUSE_LEFT); + void move(signed char x, signed char y, signed char wheel = 0); + void press(uint8_t b = MOUSE_LEFT); // press LEFT by default + void release(uint8_t b = MOUSE_LEFT); // release LEFT by default + void releaseAll(void); + bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default +private: + void buttons(uint8_t b); + HID_MouseReport_Data_t _report; +}; +extern Mouse_ Mouse; + +//================================================================================ +// Keyboard +//================================================================================ + +#define KEY_LEFT_CTRL 0x80 +#define KEY_LEFT_SHIFT 0x81 +#define KEY_LEFT_ALT 0x82 +#define KEY_LEFT_GUI 0x83 +#define KEY_RIGHT_CTRL 0x84 +#define KEY_RIGHT_SHIFT 0x85 +#define KEY_RIGHT_ALT 0x86 +#define KEY_RIGHT_GUI 0x87 + +#define KEY_UP_ARROW 0xDA +#define KEY_DOWN_ARROW 0xD9 +#define KEY_LEFT_ARROW 0xD8 +#define KEY_RIGHT_ARROW 0xD7 +#define KEY_BACKSPACE 0xB2 +#define KEY_TAB 0xB3 +#define KEY_RETURN 0xB0 +#define KEY_ESC 0xB1 +#define KEY_INSERT 0xD1 +#define KEY_DELETE 0xD4 +#define KEY_PAGE_UP 0xD3 +#define KEY_PAGE_DOWN 0xD6 +#define KEY_HOME 0xD2 +#define KEY_END 0xD5 +#define KEY_CAPS_LOCK 0xC1 +#define KEY_F1 0xC2 +#define KEY_F2 0xC3 +#define KEY_F3 0xC4 +#define KEY_F4 0xC5 +#define KEY_F5 0xC6 +#define KEY_F6 0xC7 +#define KEY_F7 0xC8 +#define KEY_F8 0xC9 +#define KEY_F9 0xCA +#define KEY_F10 0xCB +#define KEY_F11 0xCC +#define KEY_F12 0xCD + +//Keyboard fixed/added missing Keys +#define KEY_PRINT 0xCE +#define KEY_SCROLL_LOCK 0xCF +#define KEY_PAUSE 0xD0 + +//Raw Keyboard definitions +#define RAW_KEYBOARD_LEFT_CTRL B00000001 +#define RAW_KEYBOARD_LEFT_SHIFT B00000010 +#define RAW_KEYBOARD_LEFT_ALT B00000100 +#define RAW_KEYBOARD_LEFT_GUI B00001000 +#define RAW_KEYBOARD_RIGHT_CTRL B00010000 +#define RAW_KEYBOARD_RIGHT_SHIFT B00100000 +#define RAW_KEYBOARD_RIGHT_ALT B01000000 +#define RAW_KEYBOARD_RIGHT_GUI B10000000 + +#define RAW_KEYBOARD_UP_ARROW 0x52 +#define RAW_KEYBOARD_DOWN_ARROW 0x51 +#define RAW_KEYBOARD_LEFT_ARROW 0x50 +#define RAW_KEYBOARD_RIGHT_ARROW 0x4F +#define RAW_KEYBOARD_SPACEBAR 0x2C +#define RAW_KEYBOARD_BACKSPACE 0x2A +#define RAW_KEYBOARD_TAB 0x2B +#define RAW_KEYBOARD_RETURN 0x28 +#define RAW_KEYBOARD_ESC 0x29 +#define RAW_KEYBOARD_INSERT 0x49 +#define RAW_KEYBOARD_DELETE 0x4C +#define RAW_KEYBOARD_PAGE_UP 0x4B +#define RAW_KEYBOARD_PAGE_DOWN 0x4E +#define RAW_KEYBOARD_HOME 0x4A +#define RAW_KEYBOARD_END 0x4D +#define RAW_KEYBOARD_CAPS_LOCK 0x39 +#define RAW_KEYBOARD_F1 0x3A +#define RAW_KEYBOARD_F2 0x3B +#define RAW_KEYBOARD_F3 0x3C +#define RAW_KEYBOARD_F4 0x3D +#define RAW_KEYBOARD_F5 0x3E +#define RAW_KEYBOARD_F6 0x3F +#define RAW_KEYBOARD_F7 0x40 +#define RAW_KEYBOARD_F8 0x41 +#define RAW_KEYBOARD_F9 0x42 +#define RAW_KEYBOARD_F10 0x43 +#define RAW_KEYBOARD_F11 0x44 +#define RAW_KEYBOARD_F12 0x45 +#define RAW_KEYBOARD_PRINT 0x46 +#define RAW_KEYBOARD_SCROLL_LOCK 0x47 +#define RAW_KEYBOARD_PAUSE 0x48 + +//Keyboard fixed/added missing Keys +#define KEY_PRINT 0xCE +#define KEY_SCROLL_LOCK 0xCF +#define KEY_PAUSE 0xD0 + +class Keyboard_ : public Print{ +public: + Keyboard_(void); + void begin(void); + void end(void); + virtual size_t write(uint8_t k); + virtual size_t press(uint8_t k); + virtual size_t release(uint8_t k); + virtual void releaseAll(void); +private: + HID_KeyboardReport_Data_t _report; +}; +extern Keyboard_ Keyboard; + +//================================================================================ +// Media +//================================================================================ + +#define MEDIA_FAST_FORWARD 0xB3 +#define MEDIA_REWIND 0xB4 +#define MEDIA_NEXT 0xB5 +#define MEDIA_PREVIOUS 0xB6 +#define MEDIA_STOP 0xB7 +#define MEDIA_PLAY_PAUSE 0xCD + +#define MEDIA_VOLUME_MUTE 0xE2 +#define MEDIA_VOLUME_UP 0xE9 +#define MEDIA_VOLUME_DOWN 0xEA + +#define MEDIA_EMAIL_READER 0x18A +#define MEDIA_CALCULATOR 0x192 +#define MEDIA_EXPLORER 0x194 + +#define MEDIA_BROWSER_HOME 0x223 +#define MEDIA_BROWSER_BACK 0x224 +#define MEDIA_BROWSER_FORWARD 0x225 +#define MEDIA_BROWSER_REFRESH 0x227 +#define MEDIA_BROWSER_BOOKMARKS 0x22A + +class Media_{ +public: + Media_(void); + void begin(void); + void end(void); + void write(uint16_t m); + void press(uint16_t m); + void release(uint16_t m); + void releaseAll(void); +private: + HID_MediaReport_Data_t _report; +}; +extern Media_ Media; + +//================================================================================ +// System +//================================================================================ + +#define SYSTEM_POWER_DOWN 0x81 +#define SYSTEM_SLEEP 0x82 +#define SYSTEM_WAKE_UP 0x83 + +class System_{ +public: + System_(void); + void begin(void); + void end(void); + void write(uint16_t s); + void press(uint16_t s); + void release(void); + void releaseAll(void); +}; +extern System_ System; + +//================================================================================ +// Gamepad +//================================================================================ + +class Gamepad_{ +public: + Gamepad_(uint8_t reportID); + void begin(void); + void end(void); + void write(void); + void press(uint8_t b); + void release(uint8_t b); + void releaseAll(void); + inline void buttons(uint32_t b){ _report.whole32[0]=b; } + inline void xAxis(uint16_t a){ _report.xAxis=a; } + inline void yAxis(uint16_t a){ _report.yAxis=a; } + inline void zAxis(uint16_t a){ _report.zAxis=a; } + inline void rxAxis(uint16_t a){ _report.rxAxis=a; } + inline void ryAxis(uint16_t a){ _report.ryAxis=a; } + inline void rzAxis(uint16_t a){ _report.rzAxis=a; } + inline void dPad1(uint8_t d){ _report.dPad1=d; } + inline void dPad2(uint8_t d){ _report.dPad2=d; } +private: + HID_GamepadReport_Data_t _report; + uint8_t _reportID; +}; +extern Gamepad_ Gamepad1; +extern Gamepad_ Gamepad2; + +//================================================================================ +// Joystick +//================================================================================ + +class Joystick_{ +public: + Joystick_(uint8_t reportID); + void begin(void); + void end(void); + void write(void); + void press(uint8_t b); + void release(uint8_t b); + void releaseAll(void); + inline void xAxis(uint16_t a){ _report.xAxis=a; } + inline void yAxis(uint16_t a){ _report.yAxis=a; } + +private: + HID_JoystickReport_Data_t _report; + uint8_t _reportID; +}; +extern Joystick_ Joystick1; +extern Joystick_ Joystick2; + +#endif + diff --git a/HID_Reports.h b/HID_Reports.h new file mode 100644 index 0000000..0129e89 --- /dev/null +++ b/HID_Reports.h @@ -0,0 +1,207 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#ifndef HID_REPORTS_H +#define HID_REPORTS_H + +//================================================================================ +//Settings +//================================================================================ + +#define HID_MOUSE_ENABLE +#define HID_KEYBOARD_ENABLE +#define HID_RAWKEYBOARD_ENABLE +#define HID_MEDIA_ENABLE +#define HID_SYSTEM_ENABLE +#define HID_GAMEPAD1_ENABLE +#define HID_GAMEPAD2_ENABLE +#define HID_JOYSTICK1_ENABLE +#define HID_JOYSTICK2_ENABLE +//#define HID_MIDI_ENABLE + +//================================================================================ +//Definitions +//================================================================================ + +// empty + +//================================================================================ +//Report Typedefinitions +//================================================================================ + +typedef union{ + // mouse report: 5 buttons, position, wheel + uint8_t whole8[4]; + uint16_t whole16[4/2]; + uint32_t whole32[4/4]; + + struct{ + uint8_t buttons:5; + uint8_t reserved:3; + int8_t xAxis; + int8_t yAxis; + int8_t wheel; + }; +} HID_MouseReport_Data_t; + + +typedef union{ + // Low level key report: up to 6 keys and shift, ctrl etc at once + uint8_t whole8[8]; + uint16_t whole16[8/2]; + uint32_t whole32[8/4]; + + struct{ + uint8_t modifiers; + uint8_t reserved; + uint8_t keys[6]; + }; +} HID_KeyboardReport_Data_t; + + +typedef union{ + // every usable media key possible. Only one at the same time. + uint8_t whole8[8]; + uint16_t whole16[8/2]; + uint32_t whole32[8/4]; + + struct{ + uint16_t key1; + uint16_t key2; + uint16_t key3; + uint16_t key4; + }; +} HID_MediaReport_Data_t; + + +typedef union{ + // every usable system control key possible. Only one at the same time. + uint8_t whole8[2]; + uint16_t whole16[2/2]; + uint16_t key; +} HID_SystemReport_Data_t; + + +typedef union { + // 32 Buttons, 6 Axis, 2 D-Pads + uint8_t whole8[17]; + uint16_t whole16[17/2]; + uint32_t whole32[17/4]; + uint32_t buttons; + + struct{ + uint8_t button1 :1; + uint8_t button2 :1; + uint8_t button3 :1; + uint8_t button4 :1; + uint8_t button5 :1; + uint8_t button6 :1; + uint8_t button7 :1; + uint8_t button8 :1; + + uint8_t button9 :1; + uint8_t button10 :1; + uint8_t button11 :1; + uint8_t button12 :1; + uint8_t button13 :1; + uint8_t button14 :1; + uint8_t button15 :1; + uint8_t button16 :1; + + uint8_t button17 :1; + uint8_t button18 :1; + uint8_t button19 :1; + uint8_t button20 :1; + uint8_t button21 :1; + uint8_t button22 :1; + uint8_t button23 :1; + uint8_t button24 :1; + + uint8_t button25 :1; + uint8_t button26 :1; + uint8_t button27 :1; + uint8_t button28 :1; + uint8_t button29 :1; + uint8_t button30 :1; + uint8_t button31 :1; + uint8_t button32 :1; + + uint16_t xAxis; + uint16_t yAxis; + uint16_t zAxis; + + uint16_t rxAxis; + uint16_t ryAxis; + uint16_t rzAxis; + + uint8_t dPad1: 4; + uint8_t dPad2: 4; + + // deactivated because windows only supports 7 axis. should be enough. + //uint8_t throttle; + //uint8_t rudder; + + }; +} HID_GamepadReport_Data_t; + + +typedef union{ + // 2 Buttons, 2 Axis + uint8_t whole8[3]; + uint16_t whole16[3/2]; + + struct{ + uint16_t button1 :1; + uint16_t button2 :1; + uint16_t xAxis :10; + uint16_t yAxis :10; + uint16_t reserved :2; + }; +} HID_JoystickReport_Data_t; + + +typedef union{ + HID_MouseReport_Data_t Mouse; + HID_KeyboardReport_Data_t Keyboard; + HID_MediaReport_Data_t Media; + HID_GamepadReport_Data_t Gamepad1; + HID_GamepadReport_Data_t Gamepad2; + HID_JoystickReport_Data_t Joystick1; + HID_JoystickReport_Data_t Joystick2; +} HID_HIDReport_Data_t; + + +/** Enum for the HID report IDs used in the device. */ +typedef enum{ + HID_REPORTID_MouseReport = 0x01, /**< Report ID for the Mouse report within the device. */ + HID_REPORTID_KeyboardReport = 0x02, /**< Report ID for the Keyboard report within the device. */ + HID_REPORTID_RawKeyboardReport=0x03, /**< Report ID for the Raw Keyboard report within the device. */ + HID_REPORTID_MediaReport = 0x04, /**< Report ID for the Media report within the device. */ + HID_REPORTID_SystemReport = 0x05, /**< Report ID for the Power report within the device. */ + HID_REPORTID_Gamepad1Report = 0x06, /**< Report ID for the Gamepad1 report within the device. */ + HID_REPORTID_Gamepad2Report = 0x07, /**< Report ID for the Gamepad2 report within the device. */ + HID_REPORTID_Joystick1Report = 0x08, /**< Report ID for the Joystick1 report within the device. */ + HID_REPORTID_Joystick2Report = 0x09, /**< Report ID for the Joystick2 report within the device. */ +} HID_Report_IDs; + +#endif \ No newline at end of file diff --git a/Hoodloader/Board/LEDs.h b/Hoodloader/Board/LEDs.h new file mode 100644 index 0000000..ff1157e --- /dev/null +++ b/Hoodloader/Board/LEDs.h @@ -0,0 +1,110 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/* + Board LEDs driver for the Benito board, from www.dorkbotpdx.org. +*/ + +#ifndef __LEDS_ARDUINOUNO_H__ +#define __LEDS_ARDUINOUNO_H__ + + /* Includes: */ + #include + +/* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(INCLUDE_FROM_LEDS_H) + //#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** LED mask for the first LED on the board. */ + #define LEDS_LED1 (1 << 5) + + /** LED mask for the second LED on the board. */ + #define LEDS_LED2 (1 << 4) + + /** LED mask for all the LEDs on the board. */ + #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) + + /** LED mask for the none of the board LEDs */ + #define LEDS_NO_LEDS 0 + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void LEDs_Init(void) + { + DDRD |= LEDS_ALL_LEDS; + PORTD |= LEDS_ALL_LEDS; + } + + static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) + { + PORTD &= ~LEDMask; + } + + static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) + { + PORTD |= LEDMask; + } + + static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) + { + PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); + } + + static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) + { + PORTD = ((PORTD | ActiveMask) & ~LEDMask); + } + + static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) + { + PORTD ^= LEDMask; + } + + static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t LEDs_GetLEDs(void) + { + return (PORTD & LEDS_ALL_LEDS); + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif diff --git a/Hoodloader/Config/LUFAConfig.h b/Hoodloader/Config/LUFAConfig.h new file mode 100644 index 0000000..3c3b68b --- /dev/null +++ b/Hoodloader/Config/LUFAConfig.h @@ -0,0 +1,126 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief LUFA Library Configuration Header File + * + * This header file is used to configure LUFA's compile time options, + * as an alternative to the compile time constants supplied through + * a makefile. + * + * For information on what each token does, refer to the LUFA + * manual section "Summary of Compile Tokens". + */ + +#ifndef _LUFA_CONFIG_H_ +#define _LUFA_CONFIG_H_ + + #if (ARCH == ARCH_AVR8) + + /* Non-USB Related Configuration Tokens: */ +// #define DISABLE_TERMINAL_CODES + + /* USB Class Driver Related Tokens: */ +// #define HID_HOST_BOOT_PROTOCOL_ONLY +// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} +// #define HID_USAGE_STACK_DEPTH {Insert Value Here} +// #define HID_MAX_COLLECTIONS {Insert Value Here} +// #define HID_MAX_REPORTITEMS {Insert Value Here} +// #define HID_MAX_REPORT_IDS {Insert Value Here} +// #define NO_CLASS_DRIVER_AUTOFLUSH + + /* General USB Driver Related Tokens: */ +// #define ORDERED_EP_CONFIG + #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) + #define USB_DEVICE_ONLY +// #define USB_HOST_ONLY +// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} +// #define NO_LIMITED_CONTROLLER_CONNECT +// #define NO_SOF_EVENTS + + /* USB Device Mode Driver Related Tokens: */ +// #define USE_RAM_DESCRIPTORS + #define USE_FLASH_DESCRIPTORS +// #define USE_EEPROM_DESCRIPTORS +// #define NO_INTERNAL_SERIAL + #define FIXED_CONTROL_ENDPOINT_SIZE 8 +// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} + #define FIXED_NUM_CONFIGURATIONS 1 +// #define CONTROL_ONLY_DEVICE + #define INTERRUPT_CONTROL_ENDPOINT +// #define NO_DEVICE_REMOTE_WAKEUP +// #define NO_DEVICE_SELF_POWER + + /* USB Host Mode Driver Related Tokens: */ +// #define HOST_STATE_AS_GPIOR {Insert Value Here} +// #define USB_HOST_TIMEOUT_MS {Insert Value Here} +// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} +// #define NO_AUTO_VBUS_MANAGEMENT +// #define INVERTED_VBUS_ENABLE_LINE + + #elif (ARCH == ARCH_XMEGA) + + /* Non-USB Related Configuration Tokens: */ +// #define DISABLE_TERMINAL_CODES + + /* USB Class Driver Related Tokens: */ +// #define HID_HOST_BOOT_PROTOCOL_ONLY +// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} +// #define HID_USAGE_STACK_DEPTH {Insert Value Here} +// #define HID_MAX_COLLECTIONS {Insert Value Here} +// #define HID_MAX_REPORTITEMS {Insert Value Here} +// #define HID_MAX_REPORT_IDS {Insert Value Here} +// #define NO_CLASS_DRIVER_AUTOFLUSH + + /* General USB Driver Related Tokens: */ + #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH) +// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} +// #define NO_LIMITED_CONTROLLER_CONNECT +// #define NO_SOF_EVENTS + + /* USB Device Mode Driver Related Tokens: */ +// #define USE_RAM_DESCRIPTORS + #define USE_FLASH_DESCRIPTORS +// #define USE_EEPROM_DESCRIPTORS +// #define NO_INTERNAL_SERIAL + #define FIXED_CONTROL_ENDPOINT_SIZE 8 +// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} + #define FIXED_NUM_CONFIGURATIONS 1 +// #define CONTROL_ONLY_DEVICE + #define MAX_ENDPOINT_INDEX 4 +// #define NO_DEVICE_REMOTE_WAKEUP +// #define NO_DEVICE_SELF_POWER + + #else + + #error Unsupported architecture for this LUFA configuration file. + + #endif +#endif diff --git a/Hoodloader/Descriptors.c b/Hoodloader/Descriptors.c new file mode 100644 index 0000000..ec022ea --- /dev/null +++ b/Hoodloader/Descriptors.c @@ -0,0 +1,619 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/** \file +* +* USB Device Descriptors, for library use when in USB device mode. Descriptors are special +* computer-readable structures which the host requests upon device enumeration, to determine +* the device's capabilities and functions. +*/ + +#include "Descriptors.h" + +/** HID class report descriptor. This is a special descriptor constructed with values from the +* USBIF HID class specification to describe the reports and capabilities of the HID device. This +* descriptor is parsed by the host and its contents used to determine what data (and in what encoding) +* the device will send, and what it may be sent back from the host. Refer to the HID specification for +* more details on HID report descriptors. +* +* This descriptor describes the multiple possible reports of the HID interface's report structure. +*/ + +const USB_Descriptor_HIDReport_Datatype_t PROGMEM HIDReport[] = +{ + +#ifdef HID_MOUSE_ENABLE + // Mouse + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 54 + 0x09, 0x02, // USAGE (Mouse) + 0xa1, 0x01, // COLLECTION (Application) + 0x09, 0x01, // USAGE (Pointer) + 0xa1, 0x00, // COLLECTION (Physical) + 0x85, HID_REPORTID_MouseReport,// REPORT_ID + // 5 buttons + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x05, // USAGE_MAXIMUM (Button 5) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x95, 0x05, // REPORT_COUNT (5) + 0x75, 0x01, // REPORT_SIZE (1) + 0x81, 0x02, // INPUT (Data,Var,Abs) + // reserved + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x03, // REPORT_SIZE (3) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + // x, y, wheel + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x09, 0x38, // USAGE (Wheel) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x03, // REPORT_COUNT (3) + 0x81, 0x06, // INPUT (Data,Var,Rel) + // end + 0xc0, // END_COLLECTION + 0xc0, // END_COLLECTION +#endif + +#ifdef HID_KEYBOARD_ENABLE + // Keyboard + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, HID_REPORTID_KeyboardReport, // REPORT_ID + 0x05, 0x07, // USAGE_PAGE (Keyboard) + // modifiers + 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + // reserved byte + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + // Key[6] Array + 0x95, 0x06, // REPORT_COUNT (6) + 0x75, 0x08, // REPORT_SIZE (8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x65, // LOGICAL_MAXIMUM (101) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + // LEDs for num lock etc + 0x05, 0x08, /* USAGE_PAGE (LEDs) */ + 0x19, 0x01, /* USAGE_MINIMUM (Num Lock) */ + 0x29, 0x05, /* USAGE_MAXIMUM (Kana) */ + 0x95, 0x05, /* REPORT_COUNT (5) */ + 0x75, 0x01, /* REPORT_SIZE (1) */ + 0x91, 0x02, /* OUTPUT (Data,Var,Abs) */ + // Reserved 3 bits + 0x95, 0x01, /* REPORT_COUNT (1) */ + 0x75, 0x03, /* REPORT_SIZE (3) */ + 0x91, 0x03, /* OUTPUT (Cnst,Var,Abs) */ + // end + 0xc0, // END_COLLECTION +#endif + +#ifdef HID_RAWKEYBOARD_ENABLE + // RAW HID + 0x06, 0xC0, 0xFF, + 0x0A, 0x00, 0x0C, + + 0xA1, 0x01, // Collection 0x01 + 0x85, HID_REPORTID_RawKeyboardReport, // REPORT_ID + 0x75, 0x08, // report size = 8 bits + 0x15, 0x00, // logical minimum = 0 + 0x26, 0xFF, 0x00, // logical maximum = 255 + + 0x95, 64, // report count TX + 0x09, 0x01, // usage + 0x81, 0x02, // Input (array) + + 0x95, 64, // report count RX + 0x09, 0x02, // usage + 0x91, 0x02, // Output (array) + 0xC0, // end collection +#endif + +#ifdef HID_MEDIA_ENABLE + // Media + 0x05, 0x0C, // usage page (consumer device) + 0x09, 0x01, // usage -- consumer control + 0xA1, 0x01, // collection (application) + 0x85, HID_REPORTID_MediaReport, // report id + // 4 media Keys + 0x15, 0x00, //logical minimum + 0x26, 0xFF, 0xFF, //logical maximum (3ff) + 0x19, 0x00, // usage minimum (0) + 0x2A, 0xFF, 0xFF, //usage maximum (3ff) + 0x95, 0x04, //report count (4) + 0x75, 0x10, //report size (16) + 0x81, 0x00, //input + 0xC0, //end collection +#endif + +#ifdef HID_SYSTEM_ENABLE + // System + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x80, // USAGE (System Control) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, HID_REPORTID_SystemReport, // REPORT_ID + // 1 system key + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x19, 0x00, // USAGE_MINIMUM (Undefined) + 0x29, 0xff, // USAGE_MAXIMUM (System Menu Down) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0, // END_COLLECTION +#endif + +#ifdef HID_GAMEPAD1_ENABLE + // Gamepad1 + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x05, // USAGE (Game Pad) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, HID_REPORTID_Gamepad1Report, // REPORT_ID + // 32 Buttons + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x20, // USAGE_MAXIMUM (Button 32) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x20, // REPORT_COUNT (32) + 0x81, 0x02, // INPUT (Data,Var,Abs) + // 6 16bit Axis + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0xa1, 0x00, // COLLECTION (Physical) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x09, 0x32, // USAGE (Z) + 0x09, 0x33, // USAGE (Rx) + 0x09, 0x34, // USAGE (Ry) + 0x09, 0x35, // USAGE (Rz) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x27, 0xff, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65535) + 0x75, 0x10, // REPORT_SIZE (16) + 0x95, 0x06, // REPORT_COUNT (6) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0xc0, // END_COLLECTION + // 2 Hat Switches + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x39, // USAGE (Hat switch) + 0x09, 0x39, // USAGE (Hat switch) + 0x15, 0x01, // LOGICAL_MINIMUM (1) + 0x25, 0x08, // LOGICAL_MAXIMUM (8) + 0x95, 0x02, // REPORT_COUNT (2) + 0x75, 0x04, // REPORT_SIZE (4) + 0x81, 0x02, // INPUT (Data,Var,Abs) + // 8bit Throttle + Rudder + //0x05, 0x02, // USAGE_PAGE (Simulation Controls) + //0xa1, 0x00, // COLLECTION (Physical) + //0x15, 0x00, // LOGICAL_MINIMUM (0) + //0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + //0x09, 0xbb, // USAGE (Throttle) + //0x09, 0xba, // USAGE (Rudder) + //0x75, 0x08, // REPORT_SIZE (8) + //0x95, 0x02, // REPORT_COUNT (2) + //0x81, 0x02, // INPUT (Data,Var,Abs) + //0xc0, // END_COLLECTION + 0xc0, // END_COLLECTION +#endif + +#ifdef HID_GAMEPAD2_ENABLE + // Gamepad2 + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x05, // USAGE (Game Pad) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, HID_REPORTID_Gamepad2Report, // REPORT_ID + // 32 Buttons + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x20, // USAGE_MAXIMUM (Button 32) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x20, // REPORT_COUNT (32) + 0x81, 0x02, // INPUT (Data,Var,Abs) + // 6 16bit Axis + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0xa1, 0x00, // COLLECTION (Physical) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x09, 0x32, // USAGE (Z) + 0x09, 0x33, // USAGE (Rx) + 0x09, 0x34, // USAGE (Ry) + 0x09, 0x35, // USAGE (Rz) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x27, 0xff, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65535) + 0x75, 0x10, // REPORT_SIZE (16) + 0x95, 0x06, // REPORT_COUNT (6) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0xc0, // END_COLLECTION + // 2 Hat Switches + 0x09, 0x39, // USAGE (Hat switch) + 0x09, 0x39, // USAGE (Hat switch) + 0x15, 0x01, // LOGICAL_MINIMUM (1) + 0x25, 0x08, // LOGICAL_MAXIMUM (8) + 0x95, 0x02, // REPORT_COUNT (2) + 0x75, 0x04, // REPORT_SIZE (4) + 0x81, 0x02, // INPUT (Data,Var,Abs) + // 8bit Throttle + Rudder + //0x05, 0x02, // USAGE_PAGE (Simulation Controls) + //0xa1, 0x00, // COLLECTION (Physical) + //0x15, 0x00, // LOGICAL_MINIMUM (0) + //0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + //0x09, 0xbb, // USAGE (Throttle) + //0x09, 0xba, // USAGE (Rudder) + //0x75, 0x08, // REPORT_SIZE (8) + //0x95, 0x02, // REPORT_COUNT (2) + //0x81, 0x02, // INPUT (Data,Var,Abs) + //0xc0, // END_COLLECTION + 0xc0, // END_COLLECTION +#endif + +#ifdef HID_JOYSTICK1_ENABLE + // Joystick1 + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x04, // USAGE (Joystick) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, HID_REPORTID_Joystick1Report, // REPORT_ID + 0xa1, 0x00, // COLLECTION (Physical) + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x02, // USAGE_MAXIMUM (Button 2) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x02, // REPORT_COUNT (2) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x03, // LOGICAL_MAXIMUM (1023) + 0x75, 0x0a, // REPORT_SIZE (10) + 0x95, 0x02, // REPORT_COUNT (2) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x75, 0x02, // REPORT_SIZE (2) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0xc0, // END_COLLECTION + 0xc0, // END_COLLECTION +#endif + +#ifdef HID_JOYSTICK2_ENABLE + // Joystick2 + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x04, // USAGE (Joystick) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, HID_REPORTID_Joystick2Report, // REPORT_ID + 0xa1, 0x00, // COLLECTION (Physical) + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x02, // USAGE_MAXIMUM (Button 2) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x02, // REPORT_COUNT (2) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x03, // LOGICAL_MAXIMUM (1023) + 0x75, 0x0a, // REPORT_SIZE (10) + 0x95, 0x02, // REPORT_COUNT (2) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x75, 0x02, // REPORT_SIZE (2) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0xc0, // END_COLLECTION + 0xc0 // END_COLLECTION +#endif + +}; + +/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall +* device characteristics, including the supported USB version, control endpoint size and the +* number of device configurations. The descriptor is read out by the USB host when the enumeration +* process begins. +*/ +const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(1,1,0), + .Class = USB_CSCP_IADDeviceClass, + .SubClass = USB_CSCP_IADDeviceSubclass, + .Protocol = USB_CSCP_IADDeviceProtocol, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + //new, passed by makefile <-- + .VendorID = HOODLOADER_VID, //used by Lufa + .ProductID = HOODLOADER_PID, //created for ArduinoHID + + //.VendorID = 0x2341, // Arduino + //.ProductID = 0x0043, // Arduino Uno + + .ReleaseNumber = VERSION_BCD(0,0,1), + + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, + .SerialNumStrIndex = USE_INTERNAL_SERIAL, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage +* of the device in one of its supported configurations, including information about any device interfaces +* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting +* a configuration so that the host may correctly communicate with the USB device. +*/ +const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = +{ + .Config = + { + .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, + + .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalInterfaces = 3, + + .ConfigurationNumber = 1, + .ConfigurationStrIndex = NO_DESCRIPTOR, + + .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED), + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) + }, + + .CDC_IAD = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation}, + + .FirstInterfaceIndex = INTERFACE_ID_CDC_CCI, + .TotalInterfaces = 2, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .IADStrIndex = NO_DESCRIPTOR + }, + + .CDC_CCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_CDC_CCI, + .AlternateSetting = 0, + + .TotalEndpoints = 1, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_Functional_Header = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Header, + + .CDCSpecification = VERSION_BCD(1,1,0), + }, + + .CDC_Functional_ACM = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_ACM, + + .Capabilities = 0x06, + }, + + .CDC_Functional_Union = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Union, + + .MasterInterfaceNumber = INTERFACE_ID_CDC_CCI, + .SlaveInterfaceNumber = INTERFACE_ID_CDC_DCI, + }, + + .CDC_NotificationEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_NOTIFICATION_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .PollingIntervalMS = 0xFF + }, + + .CDC_DCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_CDC_DCI, + .AlternateSetting = 0, + + .TotalEndpoints = 2, + + .Class = CDC_CSCP_CDCDataClass, + .SubClass = CDC_CSCP_NoDataSubclass, + .Protocol = CDC_CSCP_NoDataProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_DataOutEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_RX_EPADDR, + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x01 //new<-- + }, + + .CDC_DataInEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_TX_EPADDR, + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x01 //new<-- + }, + + + //new <-- + .HID_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_HID, + .AlternateSetting = 0x00, + + .TotalEndpoints = 1, + + .Class = HID_CSCP_HIDClass, + .SubClass = HID_CSCP_NonBootSubclass, + .Protocol = HID_CSCP_NonBootProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .HID_HIDData = + { + .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, + + .HIDSpec = VERSION_BCD(1,1,1), + .CountryCode = 0x00, + .TotalReportDescriptors = 1, + .HIDReportType = HID_DTYPE_Report, + .HIDReportLength = sizeof(HIDReport) + }, + + .HID_ReportINEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = HID_IN_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = HID_EPSIZE, + .PollingIntervalMS = 0x01 //new<-- + } +}; + +/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests +* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate +* via the language ID table available at USB.org what languages the device supports for its string descriptors. +*/ +const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); + +/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable +* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device +* Descriptor. +*/ +const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"NicoHood"); + +/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, +* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device +* Descriptor. +*/ +const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"Arduino Hoodloader Beta"); + + +/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" +* documentation) by the application code so that the address and size of a requested descriptor can be given +* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function +* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the +* USB host. +*/ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); + + const void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; + + switch (DescriptorType) + { + case DTYPE_Device: + Address = &DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); + break; + case DTYPE_Configuration: + Address = &ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + switch (DescriptorNumber) + { + case STRING_ID_Language: + Address = &LanguageString; + Size = pgm_read_byte(&LanguageString.Header.Size); + break; + case STRING_ID_Manufacturer: + Address = &ManufacturerString; + Size = pgm_read_byte(&ManufacturerString.Header.Size); + break; + case STRING_ID_Product: + Address = &ProductString; + Size = pgm_read_byte(&ProductString.Header.Size); + break; + } + + break; + + //new <-- + case HID_DTYPE_HID: + Address = &ConfigurationDescriptor.HID_HIDData; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; + case HID_DTYPE_Report: + Address = &HIDReport; + Size = sizeof(HIDReport); + break; + } + + *DescriptorAddress = Address; + return Size; +} + diff --git a/Hoodloader/Descriptors.h b/Hoodloader/Descriptors.h new file mode 100644 index 0000000..c07979c --- /dev/null +++ b/Hoodloader/Descriptors.h @@ -0,0 +1,121 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/** \file +* +* Header file for Descriptors.c. +*/ + +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + +/* Includes: */ +#include +#include +#include <../HID_Reports.h> + +/* Macros: */ +/** Endpoint address of the CDC device-to-host notification IN endpoint. */ +#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2) + +/** Endpoint address of the CDC device-to-host data IN endpoint. */ +#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3) + +/** Endpoint address of the CDC host-to-device data OUT endpoint. */ +#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4) + +/** Size in bytes of the CDC device-to-host notification IN endpoint. */ +#define CDC_NOTIFICATION_EPSIZE 8 + +/** Size in bytes of the CDC data IN and OUT endpoints. */ +#define CDC_TXRX_EPSIZE 64 //<--new + + +/** Endpoint address of the HID reporting IN endpoint. */ +#define HID_IN_EPADDR (ENDPOINT_DIR_IN | 1) + +/** Size in bytes of each of the HID reporting IN endpoint. */ +// important: only use 8,16,32,64 here!! <-- +#define HID_EPSIZE 32 + + +/* Type Defines: */ +/** Type define for the device configuration descriptor structure. This must be defined in the +* application code, as the configuration descriptor contains several sub-descriptors which +* vary between devices, and which describe the device's usage to the host. +*/ +typedef struct +{ + USB_Descriptor_Configuration_Header_t Config; + + // CDC Control Interface + USB_Descriptor_Interface_Association_t CDC_IAD; //<--new + USB_Descriptor_Interface_t CDC_CCI_Interface; + USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header; + USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM; + USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union; + USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; + + // CDC Data Interface + USB_Descriptor_Interface_t CDC_DCI_Interface; + USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; + USB_Descriptor_Endpoint_t CDC_DataInEndpoint; + + // HID Interface + USB_Descriptor_Interface_t HID_Interface; + USB_HID_Descriptor_HID_t HID_HIDData; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + +} USB_Descriptor_Configuration_t; + +/* Enums: */ + +/** Enum for the device interface descriptor IDs within the device. Each interface descriptor +* should have a unique ID index associated with it, which can be used to refer to the +* interface from other descriptors. +*/ +enum InterfaceDescriptors_t +{ + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + INTERFACE_ID_HID = 2, /**< HID interface descriptor ID */ +}; + +/** Enum for the device string descriptor IDs within the device. Each string descriptor should +* have a unique ID index associated with it, which can be used to refer to the string from +* other descriptors. +*/ +enum StringDescriptors_t +{ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ +}; + +/* Function Prototypes: */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + +#endif diff --git a/Hoodloader/Hoodloader.c b/Hoodloader/Hoodloader.c new file mode 100644 index 0000000..8678f20 --- /dev/null +++ b/Hoodloader/Hoodloader.c @@ -0,0 +1,555 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/** \file +* +* Main source file for the VirtualSerialMouse demo. This file contains the main tasks of +* the demo and is responsible for the initial application hardware configuration. +*/ + +#include "Hoodloader.h" + + +/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */ +//new important ram fix!! <-- +static RingBuff_t USBtoUSART_Buffer; + +/** Circular buffer to hold data from the serial port before it is sent to the host. */ +static RingBuff_t USARTtoUSB_Buffer; + +/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */ +//new important ram fix!! <-- +static volatile struct +{ + uint8_t TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */ + uint8_t RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ + uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */ +} PulseMSRemaining; + + +/** LUFA CDC Class driver interface configuration and state information. This structure is +* passed to all CDC Class driver functions, so that multiple instances of the same class +* within a device can be differentiated from one another. +*/ +USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = +{ + .Config = + { + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, + .DataINEndpoint = + { + .Address = CDC_TX_EPADDR, + .Size = CDC_TXRX_EPSIZE, + .Banks = 1, + }, + .DataOUTEndpoint = + { + .Address = CDC_RX_EPADDR, + .Size = CDC_TXRX_EPSIZE, + .Banks = 1, + }, + .NotificationEndpoint = + { + .Address = CDC_NOTIFICATION_EPADDR, + .Size = CDC_NOTIFICATION_EPSIZE, + .Banks = 1, + }, + }, +}; + +/** Buffer to hold the previously generated HID report, for comparison purposes inside the HID class driver. */ +static uint8_t PrevHIDReportBuffer[sizeof(HID_HIDReport_Data_t)]; +static uint8_t CurrentHIDReportBuffer[sizeof(HID_HIDReport_Data_t)]; + +static struct{ + // variable to perform a "HID flush" and to indicate what report should be written down + uint8_t ID; + // length of the report + uint8_t length; + // number of bytes received + uint8_t recvlength; + // should the report been written even if nothing changed? important for mouse + bool forcewrite; +} HIDReportState; + +/** LUFA HID Class driver interface configuration and state information. This structure is +* passed to all HID Class driver functions, so that multiple instances of the same class +* within a device can be differentiated from one another. +*/ +USB_ClassInfo_HID_Device_t Device_HID_Interface = +{ + .Config = + { + .InterfaceNumber = INTERFACE_ID_HID, + .ReportINEndpoint = + { + .Address = HID_IN_EPADDR, + .Size = HID_EPSIZE, + .Banks = 1, + }, + .PrevReportINBuffer = PrevHIDReportBuffer, + .PrevReportINBufferSize = sizeof(PrevHIDReportBuffer), + }, +}; + +/** Main program entry point. This routine contains the overall program flow, including initial +* setup of all components and the main program loop. +*/ +int main(void) +{ + SetupHardware(); + + RingBuffer_InitBuffer(&USBtoUSART_Buffer); + RingBuffer_InitBuffer(&USARTtoUSB_Buffer); + + GlobalInterruptEnable(); + + // Protocolsetup + HIDReportState.recvlength=0; + HIDReportState.ID=0; + + // Debug + DDRB |= 0x08; //led out + DDRB |= 0x02; //led out + + for (;;) + { + /* Only try to read in bytes from the CDC interface if the transmit buffer is not full */ + if (!(RingBuffer_IsFull(&USBtoUSART_Buffer))) + { + int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); + + /* Read bytes from the USB OUT endpoint into the USART transmit buffer */ + if (!(ReceivedByte < 0)) + RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte); + } + + /* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */ + RingBuff_Count_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer); + if ((TIFR0 & (1 << TOV0)) || (BufferCount > BUFFER_NEARLY_FULL)) + { + TIFR0 |= (1 << TOV0); + + if (USARTtoUSB_Buffer.Count) { + LEDs_TurnOnLEDs(LEDMASK_TX); + PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS; + } + + /* Read bytes from the USART receive buffer*/ + while (BufferCount--){ + //new Protocol check<-- + // if a reading finished succesfull without valid checksum or an error occured (ignore a reset) + if(NHPgetErrorLevel()&(~NHP_INPUT_RESET)){ + // check if previous reading was a valid Control Address and write it down + checkNHPControlAddressError(); + + // Write the last invalid signals. This will not write a possible new lead to keep + // it for the next reading. This is implemented in the Protocol itself. + writeNHPreadBuffer(NHPreadlength); + } + + //read newest byte and check for Protocol + RingBuff_Data_t b = RingBuffer_Remove(&USARTtoUSB_Buffer); + checkNHPProtocol(b); + } + + // if reading has timed out write the buffers down the serial and turn off the led + if (PulseMSRemaining.TxLEDPulse && !(--PulseMSRemaining.TxLEDPulse)){ + + // check if previous reading was a valid Control Address and write it down + checkNHPControlAddressError(); + + // only write if there is input (ignore a reset) + if(!(NHPgetErrorLevel() & NHP_INPUT_RESET)){ + // Lead errors are not in the buff length to keep them for next reading. + // But we want to write it down now after timeout. + uint8_t len= NHPreadlength; + if(NHPgetErrorLevel()& NHP_ERR_LEAD) len++; + writeNHPreadBuffer(len); + } + // do not write again in the while loop above anyways + NHPreset(); + + /* Turn off TX LED(s) once the TX pulse period has elapsed */ + LEDs_TurnOffLEDs(LEDMASK_TX); + } + + /* Turn off RX LED(s) once the RX pulse period has elapsed */ + if (PulseMSRemaining.RxLEDPulse && !(--PulseMSRemaining.RxLEDPulse)) + LEDs_TurnOffLEDs(LEDMASK_RX); + } + + /* Load the next byte from the USART transmit buffer into the USART */ + if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer))) { + Serial_SendByte(RingBuffer_Remove(&USBtoUSART_Buffer)); //<--new syntax + + LEDs_TurnOnLEDs(LEDMASK_RX); + PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS; + } + + //new Send reports <-- + CDC_Device_USBTask(&VirtualSerial_CDC_Interface); + USB_USBTask(); + } +} + +/** Configures the board hardware and chip peripherals for the demo's functionality. */ +void SetupHardware(void) +{ + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Hardware Initialization */ + Serial_Init(115200, true); + + /* Must turn off USART before reconfiguring it, otherwise incorrect operation may occur */ + // Added for correct Serial connection at baud 115200 <-- + PORTD |= (1 << PD3); // Turn ON Tx while USART is being reconfigured + UCSR1B = 0; + UCSR1A = 0; + UCSR1C = 0; + + UCSR1C = ((1 << UCSZ11) | (1 << UCSZ10)); //C: 0x06 + UCSR1A = (1 << U2X1); //A: 0x02 + UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1)); //B: 0x98 + PORTD &= ~(1 << PD3); // And turn OFF Tx once USART has been reconfigured (this is overridden by TXEN) + + LEDs_Init(); + USB_Init(); + + /* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */ + TCCR0B = (1 << CS02); + + /* Pull target /RESET line high */ + AVR_RESET_LINE_PORT |= AVR_RESET_LINE_MASK; + AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK; + + // Hardwaresetup to turn off the HID function with shorting the MOSI pin with GND next to it + AVR_NO_HID_DDR &= ~AVR_NO_HID_MASK; // Input + AVR_NO_HID_PORT |= AVR_NO_HID_MASK; // Pullup +} + +/** Writes the NHP read buffer with the given length */ +void writeNHPreadBuffer(uint8_t length){ + for(int i=0; iState.LineEncoding.ParityType) + { + case CDC_PARITY_Odd: + ConfigMask = ((1 << UPM11) | (1 << UPM10)); + break; + case CDC_PARITY_Even: + ConfigMask = (1 << UPM11); + break; + } + + if (CDCInterfaceInfo->State.LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits) + ConfigMask |= (1 << USBS1); + + switch (CDCInterfaceInfo->State.LineEncoding.DataBits) + { + case 6: + ConfigMask |= (1 << UCSZ10); + break; + case 7: + ConfigMask |= (1 << UCSZ11); + break; + case 8: + ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10)); + break; + } + + /* Must turn off USART before reconfiguring it, otherwise incorrect operation may occur */ + PORTD |= (1 << PD3); // Turn ON Tx while USART is being reconfigured + UCSR1B = 0; + UCSR1A = 0; + UCSR1C = 0; + + /* Special case 57600 baud for compatibility with the ATmega328 bootloader. */ + UBRR1 = (CDCInterfaceInfo->State.LineEncoding.BaudRateBPS == 57600) + ? SERIAL_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS) + : SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS); + + UCSR1C = ConfigMask; + UCSR1A = (CDCInterfaceInfo->State.LineEncoding.BaudRateBPS == 57600) ? 0 : (1 << U2X1); + UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1)); + PORTD &= ~(1 << PD3); // And turn OFF Tx once USART has been reconfigured (this is overridden by TXEN) +} + +/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer +* for later transmission to the host. +*/ +ISR(USART1_RX_vect, ISR_BLOCK) +{ + uint8_t ReceivedByte = UDR1; + + if (USB_DeviceState == DEVICE_STATE_Configured) + RingBuffer_Insert(&USARTtoUSB_Buffer, ReceivedByte); +} + +/** Event handler for the CDC Class driver Host-to-Device Line Encoding Changed event. +* +* \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced +*/ +void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + bool CurrentDTRState = (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR); + + if (CurrentDTRState){ + AVR_RESET_LINE_PORT &= ~AVR_RESET_LINE_MASK; + } + else{ + AVR_RESET_LINE_PORT |= AVR_RESET_LINE_MASK; + LEDs_SetAllLEDs(LEDS_NO_LEDS); //<--new + } +} + +/** Event handler for the library USB Control Request reception event. */ +void EVENT_USB_Device_ControlRequest(void) +{ + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + HID_Device_ProcessControlRequest(&Device_HID_Interface); //<--new +} + +/** Event handler for the USB device Start Of Frame event. */ +void EVENT_USB_Device_StartOfFrame(void) +{ + HID_Device_MillisecondElapsed(&Device_HID_Interface); +} + +/** HID class driver callback function for the creation of HID reports to the host. +* +* \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced +* \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID +* \param[in] ReportType Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature +* \param[out] ReportData Pointer to a buffer where the created report should be stored +* \param[out] ReportSize Number of bytes written in the report (or zero if no report is to be sent) +* +* \return Boolean \c true to force the sending of the report, \c false to let the library determine if it needs to be sent +*/ +bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, + uint8_t* const ReportID, + const uint8_t ReportType, + void* ReportData, + uint16_t* const ReportSize) +{ + //write report and reset ID + memcpy(ReportData, CurrentHIDReportBuffer, HIDReportState.length); + *ReportID = HIDReportState.ID; + *ReportSize = HIDReportState.length; + HIDReportState.ID=0; + return HIDReportState.forcewrite; +} + +/** HID class driver callback function for the processing of HID reports from the host. +* +* \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced +* \param[in] ReportID Report ID of the received report from the host +* \param[in] ReportType The type of report that the host has sent, either HID_REPORT_ITEM_Out or HID_REPORT_ITEM_Feature +* \param[in] ReportData Pointer to a buffer where the received report has been stored +* \param[in] ReportSize Size in bytes of the received HID report +*/ +void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, + const uint8_t ReportID, + const uint8_t ReportType, + const void* ReportData, + const uint16_t ReportSize) +{ + // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports + // uint8_t* LEDReport = (uint8_t*)ReportData; +} + diff --git a/Hoodloader/Hoodloader.h b/Hoodloader/Hoodloader.h new file mode 100644 index 0000000..170c602 --- /dev/null +++ b/Hoodloader/Hoodloader.h @@ -0,0 +1,111 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/** \file +* +* Header file for Hoodloader.c. +*/ + +#ifndef HOODLOADER_H +#define HOODLOADER_H + +/* Includes: */ +#include +#include +#include +#include +#include + +#include "Descriptors.h" + +#include "Lib/LightweightRingBuff.h" + +#include +#include +#include + +//new, version: unnecessary? help <-- +#include +#include + +#include "../../NicoHoodProtocol/NicoHoodProtocol_c.h" + +/* Macros: */ + +//new, normally passed through makefile <-- +#define TX_RX_LED_PULSE_MS 3 +#define PING_PONG_LED_PULSE_MS 100 + +#define AVR_RESET_LINE_PORT PORTD +#define AVR_RESET_LINE_DDR DDRD +#define AVR_RESET_LINE_MASK (1 << 7) + +#define AVR_NO_HID_PORT PORTB +#define AVR_NO_HID_DDR DDRB +#define AVR_NO_HID_PIN PINB +#define AVR_NO_HID_MASK (1 << 2) + +/** LED mask for the library LED driver, to indicate TX activity. */ +#define LEDMASK_TX LEDS_LED1 + +/** LED mask for the library LED driver, to indicate RX activity. */ +#define LEDMASK_RX LEDS_LED2 + +/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ +#define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2) + +/** LED mask for the library LED driver, to indicate that the USB interface is busy. */ +#define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2) + + +/* Function Prototypes: */ +void SetupHardware(void); + +void checkNHPProtocol(RingBuff_Data_t input); +void checkNHPControlAddressError(void); +void writeNHPreadBuffer(uint8_t length); + +void EVENT_USB_Device_Connect(void); +void EVENT_USB_Device_Disconnect(void); +void EVENT_USB_Device_ConfigurationChanged(void); +void EVENT_USB_Device_UnhandledControlRequest(void); + +void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); +void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); + +// new <-- +void EVENT_USB_Device_ControlRequest(void); +void EVENT_USB_Device_StartOfFrame(void); + +bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, + uint8_t* const ReportID, + const uint8_t ReportType, + void* ReportData, + uint16_t* const ReportSize); +void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, + const uint8_t ReportID, + const uint8_t ReportType, + const void* ReportData, + const uint16_t ReportSize); +#endif + diff --git a/Hoodloader/Hoodloader.inf b/Hoodloader/Hoodloader.inf new file mode 100644 index 0000000..983b3e4 --- /dev/null +++ b/Hoodloader/Hoodloader.inf @@ -0,0 +1,66 @@ +;************************************************************ +; Windows USB CDC ACM Setup File +; Copyright (c) 2000 Microsoft Corporation +;************************************************************ + +[DefaultInstall] +CopyINF="Hoodloader.inf" + +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%MFGNAME% +DriverVer=7/1/2012,10.0.0.0 + +[Manufacturer] +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 + +[SourceDisksNames] + +[SourceDisksFiles] + +[DestinationDirs] +DefaultDestDir=12 + +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg + +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst + +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" + +;------------------------------------------------------------------------------ +; Vendor and Product ID Definitions +;------------------------------------------------------------------------------ +; When developing your USB device, the VID and PID used in the PC side +; application program and the firmware on the microcontroller must match. +; Modify the below line to use your VID and PID. Use the format as shown below. +; Note: One INF file can be used for multiple devices with different VID and PIDs. +; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. +;------------------------------------------------------------------------------ +[DeviceList] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_4E68&MI_00 + +[DeviceList.NTx86] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_4E68&MI_00 + +[DeviceList.NTamd64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_4E68&MI_00 + +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_4E68&MI_00 + +;------------------------------------------------------------------------------ +; String Definitions +;------------------------------------------------------------------------------ +;Modify these strings to customize your device +;------------------------------------------------------------------------------ +[Strings] +MFGNAME="NicoHood" +DESCRIPTION="Arduino Hoodloader" \ No newline at end of file diff --git a/Hoodloader/Lib/LightweightRingBuff.h b/Hoodloader/Lib/LightweightRingBuff.h new file mode 100644 index 0000000..5a9a125 --- /dev/null +++ b/Hoodloader/Lib/LightweightRingBuff.h @@ -0,0 +1,197 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Ultra lightweight ring buffer, for fast insertion/deletion. + */ + +#ifndef _ULW_RING_BUFF_H_ +#define _ULW_RING_BUFF_H_ + + /* Includes: */ + #include + + #include + #include + + /* Defines: */ + /** Size of each ring buffer, in data elements - must be between 1 and 255. */ + #define BUFFER_SIZE 128 + + /** Maximum number of data elements to buffer before forcing a flush. + * Must be less than BUFFER_SIZE + */ + #define BUFFER_NEARLY_FULL 96 + + /** Type of data to store into the buffer. */ + #define RingBuff_Data_t uint8_t + + /** Datatype which may be used to store the count of data stored in a buffer, retrieved + * via a call to \ref RingBuffer_GetCount(). + */ + #if (BUFFER_SIZE <= 0xFF) + #define RingBuff_Count_t uint8_t + #else + #define RingBuff_Count_t uint16_t + #endif + + /* Type Defines: */ + /** Type define for a new ring buffer object. Buffers should be initialized via a call to + * \ref RingBuffer_InitBuffer() before use. + */ + typedef struct + { + RingBuff_Data_t Buffer[BUFFER_SIZE]; /**< Internal ring buffer data, referenced by the buffer pointers. */ + RingBuff_Data_t* In; /**< Current storage location in the circular buffer */ + RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */ + RingBuff_Count_t Count; + } RingBuff_t; + + /* Inline Functions: */ + /** Initializes a ring buffer ready for use. Buffers must be initialized via this function + * before any operations are called upon them. Already initialized buffers may be reset + * by re-initializing them using this function. + * + * \param[out] Buffer Pointer to a ring buffer structure to initialize + */ + static inline void RingBuffer_InitBuffer(RingBuff_t* const Buffer) + { + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + { + Buffer->In = Buffer->Buffer; + Buffer->Out = Buffer->Buffer; + } + } + + /** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed + * by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that + * the buffer cannot be modified while the computation takes place. This value should be cached + * when reading out the contents of the buffer, so that as small a time as possible is spent + * in an atomic lock. + * + * \note The value returned by this function is guaranteed to only be the minimum number of bytes + * stored in the given buffer; this value may change as other threads write new data and so + * the returned number should be used only to determine how many successive reads may safely + * be performed on the buffer. + * + * \param[in] Buffer Pointer to a ring buffer structure whose count is to be computed + */ + static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer) + { + RingBuff_Count_t Count; + + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + { + Count = Buffer->Count; + } + + return Count; + } + + /** Atomically determines if the specified ring buffer contains any free space. This should + * be tested before storing data to the buffer, to ensure that no data is lost due to a + * buffer overrun. + * + * \param[in,out] Buffer Pointer to a ring buffer structure to insert into + * + * \return Boolean true if the buffer contains no free space, false otherwise + */ + static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer) + { + return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE); + } + + /** Atomically determines if the specified ring buffer contains any data. This should + * be tested before removing data from the buffer, to ensure that the buffer does not + * underflow. + * + * If the data is to be removed in a loop, store the total number of bytes stored in the + * buffer (via a call to the \ref RingBuffer_GetCount() function) in a temporary variable + * to reduce the time spent in atomicity locks. + * + * \param[in,out] Buffer Pointer to a ring buffer structure to insert into + * + * \return Boolean true if the buffer contains no free space, false otherwise + */ + static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer) + { + return (RingBuffer_GetCount(Buffer) == 0); + } + + /** Inserts an element into the ring buffer. + * + * \note Only one execution thread (main program thread or an ISR) may insert into a single buffer + * otherwise data corruption may occur. Insertion and removal may occur from different execution + * threads. + * + * \param[in,out] Buffer Pointer to a ring buffer structure to insert into + * \param[in] Data Data element to insert into the buffer + */ + static inline void RingBuffer_Insert(RingBuff_t* const Buffer, + const RingBuff_Data_t Data) + { + *Buffer->In = Data; + + if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE]) + Buffer->In = Buffer->Buffer; + + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + { + Buffer->Count++; + } + } + + /** Removes an element from the ring buffer. + * + * \note Only one execution thread (main program thread or an ISR) may remove from a single buffer + * otherwise data corruption may occur. Insertion and removal may occur from different execution + * threads. + * + * \param[in,out] Buffer Pointer to a ring buffer structure to retrieve from + * + * \return Next data element stored in the buffer + */ + static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer) + { + RingBuff_Data_t Data = *Buffer->Out; + + if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE]) + Buffer->Out = Buffer->Buffer; + + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + { + Buffer->Count--; + } + + return Data; + } + +#endif diff --git a/Hoodloader/makefile b/Hoodloader/makefile new file mode 100644 index 0000000..bea89da --- /dev/null +++ b/Hoodloader/makefile @@ -0,0 +1,52 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2014. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# -------------------------------------- +# LUFA Project Makefile. +# -------------------------------------- + +# Run "make help" for target help. + +# This work for the 8u2 and 16u2 +MCU = atmega8u2 +MCU_AVRDUDE = atmega8u2 +MCU_DFU = atmega8u2 + +F_CPU = 16000000 +BOARD = USER + +#Vendor ID from lufa +#Product ID created my own +ARDUNIOHID_OPTS = -DHOODLOADER_VID=0x03EB +ARDUNIOHID_OPTS += -DHOODLOADER_PID=0x4E68 +#You can also use the native Arduino VID and PID +#VendorID Arduino 0x2341 +#ProductID Arduino Uno 0x0001 +#ProductID Arduino Mega 0x0010 + +ARCH = AVR8 +F_USB = $(F_CPU) +OPTIMIZATION = s +TARGET = Hoodloader +SRC = $(TARGET).c Descriptors.c ../../NicoHoodProtocol/NicoHoodProtocol_c.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) +LUFA_PATH = ../lufa-LUFA-140302/LUFA +CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ $(ARDUNIOHID_OPTS) +LD_FLAGS = + +# Default target +all: + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/IMG_5687.JPG b/IMG_5687.JPG new file mode 100644 index 0000000..c8aefcc Binary files /dev/null and b/IMG_5687.JPG differ diff --git a/IMG_5688.JPG b/IMG_5688.JPG new file mode 100644 index 0000000..87954a7 Binary files /dev/null and b/IMG_5688.JPG differ diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..f9ca1b7 --- /dev/null +++ b/Readme.md @@ -0,0 +1,164 @@ +Arduino HID Project +=================== +Dont you always wanted to turn your Arduino in a Generic HID device like a Keyboard or a Gamepad? +Disappointed that the Uno doesnt support this at all and the Micro/Leonardo only Mouse + Keyboard? + +Introducing the Arduino HID Project that gives you everything you need for that. +No need for extra hardware. You just need one of the Arduinos and an USB cable. + +Features +======== +Use your *Arduino Uno, Mega, Micro, Leonardo or Micro Pro* as Generic HID Device and still be able to upload sketches how you are used to do. +This project provides a new bootloader for the 8u2/16u2 and HID libraries Arduino Uno/Mega and Micro/Leonardo. +I also corrected some bugs in the original sources. + +Software includes: + +* Arduino HID Uno/Mega library +* Arduino HID Micro/Leonardo library +* Arduino HID Bootloader +* [NicoHoodProtocol](https://github.com/NicoHood/NicoHoodProtocol) library needed for the Uno/Mega! + +The following devices are supported: + +* Keyboard (modifiers + 6 keys) +* Mouse (5 buttons, move, wheel) +* Media Keys (4 keys for music player) +* System Key (for PC standby/shutdown) +* 2 Gamepads (32 buttons, 6 16bit axis, 2 D-Pads) +* 2 Joysticks (2 buttons, 2 10bit axis) + +Projects can be found here: +http://nicohood.wordpress.com/ + +Installation +============ +Download the library and rename the folder. See [this instruction](http://arduino.cc/en/Guide/Libraries) how to install new libraries. + +[NicoHoodProtocol](https://github.com/NicoHood/NicoHoodProtocol) library needed for the Uno/Mega! + +*Always release buttons to not cause any erros. Replug USB cable to reset the values if anything went wrong. +Connect GND and MOSI2 to deactivate HID function on Uno/Mega* + +*Arduino Uno/Mega only* +To install the new bootloader connect your Arduino to your PC and put it into DFU mode. +See [this](http://arduino.cc/en/Hacking/DFUProgramming8U2) and [this](http://forum.arduino.cc/index.php?topic=111.0) +and also [this](http://andrewmemory.wordpress.com/2011/04/14/upgrading-the-arduino-uno-8u2-using-flip/) on how to upload +the hey file to your Arduino. Some notes here: The Arduino R3 doesnt need a resistor or so, just connect the two pins near +the USB B jack. Choose atmega16u2 for the new R3 version. For older version you need to check the links. + +Upload the hex file to your Arduino. It doesnt care if its a Uno/Mega/Mega ADK. It will just work the same. +Unplug the Arduino if it sais successful and plug it back in. You cannot destroy anything here and you can always +switch back to the original firmware. +You need to install new drivers for that on Windows. Actually they are not new, its just an .inf file that tells +Windows to use its built in CDC Serial driver. Ironically Microsoft never signed its own driver. +Also see [this tutorial](http://arduino.cc/en/guide/windows) on how to install the drivers. + +You are ready to use the libraries. Just have a look at the examples and test it out. +The libraries will work for all Arduinos listed above but it will use 2 different libraries. +On Arduino/Mega you can only use baud 115200 for HID due to programming reasons. Its not bad anyways +because its the fastest baud and you want fast HID recognition. You still can use any other baud for +normal sketches without HID. + +For Arduino Mega2560 I recommend the nightly IDE. See Issue on Github. +``` +https://github.com/arduino/Arduino/issues/1071 +http://downloads.arduino.cc/arduino-avr-toolchain-nightly-gcc-4.8.1-linux32.tgz +http://downloads.arduino.cc/arduino-avr-toolchain-nightly-gcc-4.8.1-linux64.tgz +http://downloads.arduino.cc/arduino-avr-toolchain-nightly-gcc-4.8.1-macosx.zip +http://downloads.arduino.cc/arduino-avr-toolchain-nightly-gcc-4.8.1-windows.zip +``` + +This library wouldnt be possible without +======================================== + +[Lufa 140302 from Dean Camera](http://www.fourwalledcubicle.com/LUFA.php) +[Darran's HID Projects] (https://github.com/harlequin-tech/arduino-usb) +[Connor's Joystick for the Leonardo](http://www.imaginaryindustries.com/blog/?p=80) +[Stefan Jones Multimedia Keys Example](http://stefanjones.ca/blog/arduino-leonardo-remote-multimedia-keys/) +[Athanasios Douitsis Multimedia Keys Example](https://github.com/aduitsis/ardumultimedia) +[The Original Arduino Sources](https://github.com/arduino/Arduino/tree/master/hardware/arduino/firmwares/atmegaxxu2/arduino-usbserial) +A lot of searching through the web +The awesome official Arduino IRC chat! +[The NicoHood Protocol ^.^](https://github.com/NicoHood/NicoHoodProtocol) + +For donations please contact me on my blog :) + +Todo +==== +Micro/Leonardo library +License!!! +Remove debug leds +Add more devices +Add ICSP Programmer function +Add rumble support +Add Xbox Support +Add Midi Support +Add Report Out function (for Keyboard Leds etc) +To deactivate the HID function bridge Pin x with x + +Known Bugs +========== +HID only works with baud 115200 because there is no "programming finished" indicator. If you dont use HID you can still choose the baud of your choice + +System Wakeup is currently not working for Arduino Uno/Mega. + +Not tested on the 8u2 + +If you get a checksum Error after Uploading please message me and send me the whole project. +Same if your Arduino crashes and dont want to upload sketches anymore (Replug usb fixes this). +These bugs occured while devoloping the bootloader and should be fixed. Just in case it happens again I noted it here. + +Version History +=============== +``` +1.0 Beta Release (03.06.2014) +``` + +Licence and Copyright +===================== +If you use this library for any cool project let me know! + +``` +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +``` + +For Developers +============== +If you deactivate some reports it can occur that windows will cause problems and recognize it as different device. +While developing i had that much trouble that i had to change the PID. No way to repair the broken windows driver settings. +So be careful if you change the source on your own with important PIDs. +Therefore uninstall the divers for any device or just dont touch the HID reports. + +You need to install avr-gcc for compiling +``` +sudo apt-get install avr-gcc +``` + +To uninstall the drivers on windows you need [registrar](http://www.resplendence.com/registrar). +Delete these entrys (my gamepad driver with the PID was still broken. If you know how to fix this message me): +``` +HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_03EB&PID_4E48 +HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_03EB&PID_4E48&MI_00 +HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_03EB&PID_4E48&MI_02 +``` + diff --git a/examples/AdvancedHID/AdvancedHID.ino b/examples/AdvancedHID/AdvancedHID.ino new file mode 100644 index 0000000..72e8106 --- /dev/null +++ b/examples/AdvancedHID/AdvancedHID.ino @@ -0,0 +1,125 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Advanced HID example +*/ + +// The protocol ist still needed for Uno/Mega here +#include +#include + +const int pinLed = 13; +const int pinButton = 8; + +// see HID_Reports.h for all data structures +HID_GamepadReport_Data_t Gamepadreport; + +void setup() { + pinMode(pinLed, OUTPUT); + pinMode(pinButton, INPUT_PULLUP); + + // Starts Serial at baud 115200. end just ends the Serial + // Make sure to end your special HIDs before, this does not clear them! + // You need this baud for the HID library but still can use other bauds + // without HID functions. + HID.begin(); + + // Sends a clean report to the host. This is important because + // the 16u2 of the Uno/Mega is not turned off while programming + // so you want to start with a clear report to avoid strange bugs. + // its exactly the same like the end() function. + // You can also unplug the device if anything goes wrong. + // To prevent the 16u2 to send more reports just pull the Serial TX (pin1) low + // or see readme for turning off HID functions. + // If you did anything wrong (keyboard is doing weird stuff) + // just logout (no shutdown needed). + memset(&Gamepadreport, 0, sizeof(Gamepadreport)); + HID.sendReport(HID_REPORTID_Gamepad1Report, &Gamepadreport, sizeof(Gamepadreport)); + pressRawKeyboard(0, 0); +} + +void loop() { + // press a button and demonstrate Joystick actions + if (!digitalRead(pinButton)) { + digitalWrite(pinLed, HIGH); + + // This demo is actually made for advanced users to show them how they can write an own report. + // This might be useful for a Gamepad or a especially Keyboard if you only use one key, + // because the library has a lot of code for simple use + + // count with buttons binary + static uint32_t count = 0; + Gamepadreport.whole32[0] = count++; + + // move x/y Axis to a new position (16bit) + Gamepadreport.whole16[2] = (random(0xFFFF)); + + // functions before only set the values + // this writes the report to the host + HID.sendReport(HID_REPORTID_Gamepad1Report, &Gamepadreport, sizeof(Gamepadreport)); + + + // press STRG + ALT + DEL on keyboard (see usb documentation) + //pressRawKeyboard(0, 4); //modifiers + 4 + //pressRawKeyboard(0, 29); //modifiers + z + pressRawKeyboard(RAW_KEYBOARD_LEFT_CTRL | RAW_KEYBOARD_LEFT_ALT , RAW_KEYBOARD_DELETE); //modifiers + key + pressRawKeyboard(0, 0); // release! Important + + // simple debounce + delay(300); + digitalWrite(pinLed, LOW); + } +} + +void pressRawKeyboard(uint8_t modifiers, uint8_t key) { + uint8_t keys[8] = { modifiers, 0, key, 0, 0, 0, 0, 0 }; //modifiers, reserved, key[0] + HID.sendReport(HID_REPORTID_KeyboardReport, keys, sizeof(keys)); +} + +/* +See Hut1_12v2.pdf Chapter 10 (Page 53) for more Keys +(especially a-z, a=0x04 z=29) +Definitions: + +RAW_KEYBOARD_LEFT_CTRL +RAW_KEYBOARD_LEFT_SHIFT +RAW_KEYBOARD_LEFT_ALT +RAW_KEYBOARD_LEFT_GUI +RAW_KEYBOARD_RIGHT_CTRL +RAW_KEYBOARD_RIGHT_SHIFT +RAW_KEYBOARD_RIGHT_ALT +RAW_KEYBOARD_RIGHT_GUI + +RAW_KEYBOARD_UP_ARROW +RAW_KEYBOARD_DOWN_ARROW +RAW_KEYBOARD_LEFT_ARROW +RAW_KEYBOARD_RIGHT_ARROW +RAW_KEYBOARD_SPACEBAR +RAW_KEYBOARD_BACKSPACE +RAW_KEYBOARD_TAB +RAW_KEYBOARD_RETURN +RAW_KEYBOARD_ESC +RAW_KEYBOARD_INSERT +RAW_KEYBOARD_DELETE +RAW_KEYBOARD_PAGE_UP +RAW_KEYBOARD_PAGE_DOWN +RAW_KEYBOARD_HOME +RAW_KEYBOARD_END +RAW_KEYBOARD_CAPS_LOCK +RAW_KEYBOARD_F1 +RAW_KEYBOARD_F2 +RAW_KEYBOARD_F3 +RAW_KEYBOARD_F4 +RAW_KEYBOARD_F5 +RAW_KEYBOARD_F6 +RAW_KEYBOARD_F7 +RAW_KEYBOARD_F8 +RAW_KEYBOARD_F9 +RAW_KEYBOARD_F10 +RAW_KEYBOARD_F11 +RAW_KEYBOARD_F12 +RAW_KEYBOARD_PRINT +RAW_KEYBOARD_SCROLL_LOCK +RAW_KEYBOARD_PAUSE +*/ diff --git a/examples/Gamepad/Gamepad.ino b/examples/Gamepad/Gamepad.ino new file mode 100644 index 0000000..4564819 --- /dev/null +++ b/examples/Gamepad/Gamepad.ino @@ -0,0 +1,91 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Gamepad example +*/ + +// The protocol ist still needed for Uno/Mega here +#include +#include + +const int pinLed = 13; +const int pinButton = 8; + +void setup() { + pinMode(pinLed, OUTPUT); + pinMode(pinButton, INPUT_PULLUP); + + // Starts Serial at baud 115200. end just ends the Serial + // Make sure to end your special HIDs before, this does not clear them! + // You need this baud for the HID library but still can use other bauds + // without HID functions. + HID.begin(); + + // Sends a clean report to the host. This is important because + // the 16u2 of the Uno/Mega is not turned off while programming + // so you want to start with a clear report to avoid strange bugs. + // its exactly the same like the end() function. + // You can also unplug the device if anything goes wrong. + // To prevent the 16u2 to send more reports just pull the Serial TX (pin1) low + // or see readme for turning off HID functions. + // If you did anything wrong (keyboard is doing weird stuff) + // just logout (no shutdown needed). + Gamepad1.begin(); +} + +void loop() { + // press a button and demonstrate Gamepad actions + if (!digitalRead(pinButton)) { + digitalWrite(pinLed, HIGH); + + // press button 1-32 and reset (34 becaue its written later) + static uint8_t count = 1; + Gamepad1.press(count++); + if (count == 34) { + Gamepad1.releaseAll(); + count = 1; + } + + // move x/y Axis to a new position (16bit) + Gamepad1.xAxis(random(0xFFFF)); + Gamepad1.yAxis(analogRead(A0) << 6); + + // go through all dPad positions + // values: 0-8 (0==centred) + static uint8_t dpad1 = 0; + Gamepad1.dPad1(dpad1++); + if (dpad1 == 9) dpad1 = 0; + static int8_t dpad2 = 0; + Gamepad1.dPad2(dpad2--); + if (dpad2 == -1) dpad2 = 8; + + // functions before only set the values + // this writes the report to the host + Gamepad1.write(); + + // simple debounce + delay(300); + digitalWrite(pinLed, LOW); + } +} + +/* +Prototypes: + +void begin(void); +void end(void); +void write(void); +void press(uint8_t b); +void release(uint8_t b); +void releaseAll(void); +void buttons(uint32_t b); +void xAxis(uint16_t a); +void yAxis(uint16_t a); +void zAxis(uint16_t a); +void rxAxis(uint16_t a); +void ryAxis(uint16_t a); +void rzAxis(uint16_t a); +void dPad1(uint8_t d); +void dPad2(uint8_t d); +*/ diff --git a/examples/Joystick/Joystick.ino b/examples/Joystick/Joystick.ino new file mode 100644 index 0000000..16c5c46 --- /dev/null +++ b/examples/Joystick/Joystick.ino @@ -0,0 +1,77 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Joystick example +*/ + +// The protocol ist still needed for Uno/Mega here +#include +#include + +const int pinLed = 13; +const int pinButton = 8; + +void setup() { + pinMode(pinLed, OUTPUT); + pinMode(pinButton, INPUT_PULLUP); + + // Starts Serial at baud 115200. end just ends the Serial + // Make sure to end your special HIDs before, this does not clear them! + // You need this baud for the HID library but still can use other bauds + // without HID functions. + HID.begin(); + + // Sends a clean report to the host. This is important because + // the 16u2 of the Uno/Mega is not turned off while programming + // so you want to start with a clear report to avoid strange bugs. + // its exactly the same like the end() function. + // You can also unplug the device if anything goes wrong. + // To prevent the 16u2 to send more reports just pull the Serial TX (pin1) low + // or see readme for turning off HID functions. + // If you did anything wrong (keyboard is doing weird stuff) + // just logout (no shutdown needed). + Joystick1.begin(); +} + +void loop() { + // press a button and demonstrate Joystick actions + if (!digitalRead(pinButton)) { + digitalWrite(pinLed, HIGH); + + // press button 1-2 and reset + static uint8_t count = 0; + if (++count == 3) { + count = 0; + Joystick1.releaseAll(); + } + else + Joystick1.press(count); + + // move x/y Axis to a new position (10bit) + Joystick1.xAxis(random(1023)); + Joystick1.yAxis(analogRead(A0)); + + // functions before only set the values + // this writes the report to the host + Joystick1.write(); + + // simple debounce + delay(300); + digitalWrite(pinLed, LOW); + } +} + +/* +Prototypes: + +void begin(void); +void end(void); +void write(void); +void press(uint8_t b); +void release(uint8_t b); +void releaseAll(void); +void xAxis(uint16_t a); +void yAxis(uint16_t a); + +*/ diff --git a/examples/Keyboard/Keyboard.ino b/examples/Keyboard/Keyboard.ino new file mode 100644 index 0000000..0395d8c --- /dev/null +++ b/examples/Keyboard/Keyboard.ino @@ -0,0 +1,105 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Keyboard example +*/ + +// The protocol ist still needed for Uno/Mega here +#include +#include + +const int pinLed = 13; +const int pinButton = 8; + +void setup() { + pinMode(pinLed, OUTPUT); + pinMode(pinButton, INPUT_PULLUP); + + // Starts Serial at baud 115200. end just ends the Serial + // Make sure to end your special HIDs before, this does not clear them! + // You need this baud for the HID library but still can use other bauds + // without HID functions. + HID.begin(); + + // Sends a clean report to the host. This is important because + // the 16u2 of the Uno/Mega is not turned off while programming + // so you want to start with a clear report to avoid strange bugs. + // its exactly the same like the end() function. + // You can also unplug the device if anything goes wrong. + // To prevent the 16u2 to send more reports just pull the Serial TX (pin1) low + // or see readme for turning off HID functions. + // If you did anything wrong (keyboard is doing weird stuff) + // just logout (no shutdown needed). + Keyboard.begin(); +} + +void loop() { + // press a button to write some text to your pc + if (!digitalRead(pinButton)) { + digitalWrite(pinLed, HIGH); + + // Same use as the official library, pretty much self explaining + Keyboard.println("This message was sent with my Arduino."); + Serial.println("Serial port is still working and not glitching out"); + + // you can press any key, see list below + static uint8_t count = 0; + if (++count == 10) { + Keyboard.press(KEY_LEFT_CTRL); + Keyboard.press(KEY_LEFT_ALT); + Keyboard.press(KEY_DELETE); + Keyboard.releaseAll(); + count = 0; + } + + // simple debounce + delay(300); + digitalWrite(pinLed, LOW); + } +} + +/* +Definitions: + +KEY_LEFT_CTRL +KEY_LEFT_SHIFT +KEY_LEFT_ALT +KEY_LEFT_GUI +KEY_RIGHT_CTRL +KEY_RIGHT_SHIFT +KEY_RIGHT_ALT +KEY_RIGHT_GUI + +KEY_UP_ARROW +KEY_DOWN_ARROW +KEY_LEFT_ARROW +KEY_RIGHT_ARROW +KEY_BACKSPACE +KEY_TAB +KEY_RETURN +KEY_ESC +KEY_INSERT +KEY_DELETE +KEY_PAGE_UP +KEY_PAGE_DOWN +KEY_HOME +KEY_END +KEY_CAPS_LOCK +KEY_F1 +KEY_F2 +KEY_F3 +KEY_F4 +KEY_F5 +KEY_F6 +KEY_F7 +KEY_F8 +KEY_F9 +KEY_F10 +KEY_F11 +KEY_F12 + +KEY_PRINT +KEY_SCROLL_LOCK +KEY_PAUSE +*/ diff --git a/examples/Media/Media.ino b/examples/Media/Media.ino new file mode 100644 index 0000000..ae757d9 --- /dev/null +++ b/examples/Media/Media.ino @@ -0,0 +1,74 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Media example +*/ + +// The protocol ist still needed for Uno/Mega here +#include +#include + +const int pinLed = 13; +const int pinButton = 8; + +void setup() { + pinMode(pinLed, OUTPUT); + pinMode(pinButton, INPUT_PULLUP); + + // Starts Serial at baud 115200. end just ends the Serial + // Make sure to end your special HIDs before, this does not clear them! + // You need this baud for the HID library but still can use other bauds + // without HID functions. + HID.begin(); + + // Sends a clean report to the host. This is important because + // the 16u2 of the Uno/Mega is not turned off while programming + // so you want to start with a clear report to avoid strange bugs. + // its exactly the same like the end() function. + // You can also unplug the device if anything goes wrong. + // To prevent the 16u2 to send more reports just pull the Serial TX (pin1) low + // or see readme for turning off HID functions. + // If you did anything wrong (keyboard is doing weird stuff) + // just logout (no shutdown needed). + Media.begin(); +} + +void loop() { + // press a button to play/pause music player + if (!digitalRead(pinButton)) { + digitalWrite(pinLed, HIGH); + + // See list below for more definitions or the official usb documentation + Media.write(MEDIA_PLAY_PAUSE); + + // simple debounce + delay(300); + digitalWrite(pinLed, LOW); + } +} + +/* +Definitions: + +MEDIA_FAST_FORWARD +MEDIA_REWIND +MEDIA_NEXT +MEDIA_PREVIOUS +MEDIA_STOP +MEDIA_PLAY_PAUSE + +MEDIA_VOLUME_MUTE +MEDIA_VOLUME_UP +MEDIA_VOLUME_DOWN + +MEDIA_EMAIL_READER +MEDIA_CALCULATOR +MEDIA_EXPLORER + +MEDIA_BROWSER_HOME +MEDIA_BROWSER_BACK +MEDIA_BROWSER_FORWARD +MEDIA_BROWSER_REFRESH +MEDIA_BROWSER_BOOKMARKS +*/ diff --git a/examples/Mouse/Mouse.ino b/examples/Mouse/Mouse.ino new file mode 100644 index 0000000..048c9e0 --- /dev/null +++ b/examples/Mouse/Mouse.ino @@ -0,0 +1,61 @@ +/* +Copyright (c) 2014 NicoHood + See the readme for credit to other people. + + Mouse example + */ + +// The protocol ist still needed for Uno/Mega here +#include +#include + +const int pinLed = 13; +const int pinButton = 8; + +void setup() { + pinMode(pinLed, OUTPUT); + pinMode(pinButton, INPUT_PULLUP); + + // Starts Serial at baud 115200. end just ends the Serial + // Make sure to end your special HIDs before, this does not clear them! + // You need this baud for the HID library but still can use other bauds + // without HID functions. + HID.begin(); + + // Sends a clean report to the host. This is important because + // the 16u2 of the Uno/Mega is not turned off while programming + // so you want to start with a clear report to avoid strange bugs. + // its exactly the same like the end() function. + // You can also unplug the device if anything goes wrong. + // To prevent the 16u2 to send more reports just pull the Serial TX (pin1) low + // or see readme for turning off HID functions. + // If you did anything wrong (keyboard is doing weird stuff) + // just logout (no shutdown needed). + Mouse.begin(); +} + +void loop() { + // press a button to click with mouse + if (!digitalRead(pinButton)) { + digitalWrite(pinLed, HIGH); + + // Same use as the official library, pretty much self explaining + Mouse.click(); + Serial.println("Serial port is still working and not glitching out"); + + // simple debounce + delay(300); + digitalWrite(pinLed, LOW); + } +} + +/* +Definitions: + + MOUSE_LEFT + MOUSE_RIGHT + MOUSE_MIDDLE + MOUSE_PREV + MOUSE_NEXT + */ + diff --git a/examples/System/System.ino b/examples/System/System.ino new file mode 100644 index 0000000..6151722 --- /dev/null +++ b/examples/System/System.ino @@ -0,0 +1,62 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +System example +*/ + +// The protocol ist still needed for Uno/Mega here +#include +#include + +const int pinLed = 13; +const int pinButton = 8; + +void setup() { + pinMode(pinLed, OUTPUT); + pinMode(pinButton, INPUT_PULLUP); + + // Starts Serial at baud 115200. end just ends the Serial + // Make sure to end your special HIDs before, this does not clear them! + // You need this baud for the HID library but still can use other bauds + // without HID functions. + HID.begin(); + + // Sends a clean report to the host. This is important because + // the 16u2 of the Uno/Mega is not turned off while programming + // so you want to start with a clear report to avoid strange bugs. + // its exactly the same like the end() function. + // You can also unplug the device if anything goes wrong. + // To prevent the 16u2 to send more reports just pull the Serial TX (pin1) low + // or see readme for turning off HID functions. + // If you did anything wrong (keyboard is doing weird stuff) + // just logout (no shutdown needed). + System.begin(); +} + +void loop() { + // press a button to put pc into standby mode/wake up + if (!digitalRead(pinButton)) { + digitalWrite(pinLed, HIGH); + + // See list below for more definitions or the official usb documentation + static bool on = true; + if (on) + System.write(SYSTEM_SLEEP); + else + // System Wakeup is currently not working for Arduino Uno/Mega. + System.write(SYSTEM_WAKE_UP); + + // simple debounce + delay(300); + digitalWrite(pinLed, LOW); + } +} + +/* +Definitions: + +SYSTEM_POWER_DOWN +SYSTEM_SLEEP +SYSTEM_WAKE_UP +*/ diff --git a/keywords.txt b/keywords.txt new file mode 100644 index 0000000..6c86cc6 --- /dev/null +++ b/keywords.txt @@ -0,0 +1,174 @@ +####################################### +# Syntax Coloring Map For HID +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +begin KEYWORD2 +end KEYWORD2 +click KEYWORD2 +move KEYWORD2 +write KEYWORD2 +press KEYWORD2 +isPressed KEYWORD2 +releaseAll KEYWORD2 +xAxis KEYWORD2 +yAxis KEYWORD2 +zAxis KEYWORD2 +rxAxis KEYWORD2 +ryAxis KEYWORD2 +rzAxis KEYWORD2 +dPad1 KEYWORD2 +dPad2 KEYWORD2 +sendReport KEYWORD2 + +####################################### +# Classes (KEYWORD3) +####################################### + +HID KEYWORD3 +Mouse KEYWORD3 +Keyboard KEYWORD3 +Media KEYWORD3 +System KEYWORD3 +Gamepad1 KEYWORD3 +Gamepad2 KEYWORD3 +Joystick1 KEYWORD3 +Joystick2 KEYWORD3 + +####################################### +# Instances (KEYWORD2) +####################################### + +####################################### +# Constants (LITERAL1) +####################################### + +#Mouse + +MOUSE_LEFT LITERAL1 +MOUSE_RIGHT LITERAL1 +MOUSE_MIDDLE LITERAL1 +MOUSE_PREV LITERAL1 +MOUSE_NEXT LITERAL1 + +#Keyboard + +KEY_LEFT_CTRL LITERAL1 +KEY_LEFT_SHIFT LITERAL1 +KEY_LEFT_ALT LITERAL1 +KEY_LEFT_GUI LITERAL1 +KEY_RIGHT_CTRL LITERAL1 +KEY_RIGHT_SHIFT LITERAL1 +KEY_RIGHT_ALT LITERAL1 +KEY_RIGHT_GUI LITERAL1 + +KEY_UP_ARROW LITERAL1 +KEY_DOWN_ARROW LITERAL1 +KEY_LEFT_ARROW LITERAL1 +KEY_RIGHT_ARROW LITERAL1 +KEY_BACKSPACE LITERAL1 +KEY_TAB LITERAL1 +KEY_RETURN LITERAL1 +KEY_ESC LITERAL1 +KEY_INSERT LITERAL1 +KEY_DELETE LITERAL1 +KEY_PAGE_UP LITERAL1 +KEY_PAGE_DOWN LITERAL1 +KEY_HOME LITERAL1 +KEY_END LITERAL1 +KEY_CAPS_LOCK LITERAL1 +KEY_F1 LITERAL1 +KEY_F2 LITERAL1 +KEY_F3 LITERAL1 +KEY_F4 LITERAL1 +KEY_F5 LITERAL1 +KEY_F6 LITERAL1 +KEY_F7 LITERAL1 +KEY_F8 LITERAL1 +KEY_F9 LITERAL1 +KEY_F10 LITERAL1 +KEY_F11 LITERAL1 +KEY_F12 LITERAL1 + +KEY_PRINT LITERAL1 +KEY_SCROLL_LOCK LITERAL1 +KEY_PAUSE LITERAL1 + +#Raw Keyboard definitions + +RAW_KEYBOARD_LEFT_CTRL LITERAL1 +RAW_KEYBOARD_LEFT_SHIFT LITERAL1 +RAW_KEYBOARD_LEFT_ALT LITERAL1 +RAW_KEYBOARD_LEFT_GUI LITERAL1 +RAW_KEYBOARD_RIGHT_CTRL LITERAL1 +RAW_KEYBOARD_RIGHT_SHIFT LITERAL1 +RAW_KEYBOARD_RIGHT_ALT LITERAL1 +RAW_KEYBOARD_RIGHT_GUI LITERAL1 + +RAW_KEYBOARD_UP_ARROW LITERAL1 +RAW_KEYBOARD_DOWN_ARROW LITERAL1 +RAW_KEYBOARD_LEFT_ARROW LITERAL1 +RAW_KEYBOARD_RIGHT_ARROW LITERAL1 +RAW_KEYBOARD_SPACEBAR LITERAL1 +RAW_KEYBOARD_BACKSPACE LITERAL1 +RAW_KEYBOARD_TAB LITERAL1 +RAW_KEYBOARD_RETURN LITERAL1 +RAW_KEYBOARD_ESC LITERAL1 +RAW_KEYBOARD_INSERT LITERAL1 +RAW_KEYBOARD_DELETE LITERAL1 +RAW_KEYBOARD_PAGE_UP LITERAL1 +RAW_KEYBOARD_PAGE_DOWN LITERAL1 +RAW_KEYBOARD_HOME LITERAL1 +RAW_KEYBOARD_END LITERAL1 +RAW_KEYBOARD_CAPS_LOCK LITERAL1 +RAW_KEYBOARD_F1 LITERAL1 +RAW_KEYBOARD_F2 LITERAL1 +RAW_KEYBOARD_F3 LITERAL1 +RAW_KEYBOARD_F4 LITERAL1 +RAW_KEYBOARD_F5 LITERAL1 +RAW_KEYBOARD_F6 LITERAL1 +RAW_KEYBOARD_F7 LITERAL1 +RAW_KEYBOARD_F8 LITERAL1 +RAW_KEYBOARD_F9 LITERAL1 +RAW_KEYBOARD_F10 LITERAL1 +RAW_KEYBOARD_F11 LITERAL1 +RAW_KEYBOARD_F12 LITERAL1 +RAW_KEYBOARD_PRINT LITERAL1 +RAW_KEYBOARD_SCROLL_LOCK LITERAL1 +RAW_KEYBOARD_PAUSE LITERAL1 + +#Media + +MEDIA_FAST_FORWARD LITERAL1 +MEDIA_REWIND LITERAL1 +MEDIA_NEXT LITERAL1 +MEDIA_PREVIOUS LITERAL1 +MEDIA_STOP LITERAL1 +MEDIA_PLAY_PAUSE LITERAL1 + +MEDIA_VOLUME_MUTE LITERAL1 +MEDIA_VOLUME_UP LITERAL1 +MEDIA_VOLUME_DOWN LITERAL1 + +MEDIA_EMAIL_READER LITERAL1 +MEDIA_CALCULATOR LITERAL1 +MEDIA_EXPLORER LITERAL1 + +MEDIA_BROWSER_HOME LITERAL1 +MEDIA_BROWSER_BACK LITERAL1 +MEDIA_BROWSER_FORWARD LITERAL1 +MEDIA_BROWSER_REFRESH LITERAL1 +MEDIA_BROWSER_BOOKMARKS LITERAL1 + +#System + +SYSTEM_POWER_DOWN LITERAL1 +SYSTEM_SLEEP LITERAL1 +SYSTEM_WAKE_UP LITERAL1