initial
commit
58fe6ef3b1
@ -0,0 +1,8 @@
|
||||
depends
|
||||
.pio
|
||||
.vscode
|
||||
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
Binary file not shown.
@ -0,0 +1,300 @@
|
||||
:100000000C9446030C9465030C9465030C946503EF
|
||||
:100010000C9465030C9465030C9465030C946503C0
|
||||
:100020000C9465030C9402040C9465030C94650312
|
||||
:100030000C9465030C9465030C9465030C946503A0
|
||||
:100040000C9465030C9465030C9465030C94650390
|
||||
:100050000C9439040C9465040C9465030C946503AA
|
||||
:100060000C9465030C9465030C9465030C94650370
|
||||
:100070000C9465030C9465030C9465030C94650360
|
||||
:100080000C9465030C9465030C9465030000000058
|
||||
:100090000000003E4551453E003E6B6F6B3E001C2C
|
||||
:1000A0003E7C3E1C00183C7E3C180030367F3630CB
|
||||
:1000B00000185C7E5C1800000000000000000000DA
|
||||
:1000C0000000000000000000000000000000003000
|
||||
:1000D000484A360E00062979290600000000000073
|
||||
:1000E00000607E0A353F002A1C361C2A00007F3E35
|
||||
:1000F0001C0800081C3E7F000014367F36140000E8
|
||||
:100100005F005F000006097F017F00224D555922E4
|
||||
:100110000060606060000014B6FFB6140004067F43
|
||||
:1001200006040010307F30100008083E1C0800084C
|
||||
:100130001C3E080800784040404000083E083E0849
|
||||
:1001400000303C3F3C3000030F3F0F030000000035
|
||||
:1001500000000000065F06000007030007030024FC
|
||||
:100160007E247E2400242B6A12000063130864633B
|
||||
:1001700000364956205000000703000000003E41B1
|
||||
:1001800000000000413E000000083E1C3E08000840
|
||||
:10019000083E08080000E0600000000808080808A1
|
||||
:1001A000000060600000002010080402003E514979
|
||||
:1001B000453E0000427F400000625149494600220E
|
||||
:1001C00049494936001814127F10002F4949493116
|
||||
:1001D000003C4A494930000171090503003649498C
|
||||
:1001E000493600064949291E00006C6C00000000D9
|
||||
:1001F000EC6C000000081422410000242424242474
|
||||
:10020000000041221408000201590906003E415D28
|
||||
:10021000551E007E1111117E007F49494936003E6E
|
||||
:1002200041414122007F4141413E007F49494941CE
|
||||
:10023000007F09090901003E4149497A007F080809
|
||||
:10024000087F0000417F410000304040403F007F78
|
||||
:1002500008142241007F40404040007F0204027F9A
|
||||
:10026000007F0204087F003E4141413E007F0909B2
|
||||
:100270000906003E4151215E007F090919660026EA
|
||||
:10028000494949320001017F0101003F4040403FA0
|
||||
:10029000001F2040201F003F403C403F00631408E7
|
||||
:1002A0001463000708700807007149454300000007
|
||||
:1002B0007F414100000204081020000041417F00FE
|
||||
:1002C0000004020102048080808080800000030717
|
||||
:1002D0000000002054545478007F444444380038CF
|
||||
:1002E0004444442800384444447F0038545454085B
|
||||
:1002F00000087E0909000018A4A4A47C007F04045F
|
||||
:1003000078000000007D4000004080847D00007F78
|
||||
:10031000102844000000007F4000007C041804788E
|
||||
:10032000007C0404780000384444443800FC444411
|
||||
:1003300044380038444444FC00447844040800082D
|
||||
:100340005454542000043E442400003C40207C00CF
|
||||
:10035000001C2040201C003C6030603C006C1010F1
|
||||
:100360006C00009CA0603C00006454544C000008E9
|
||||
:100370003E414100000000770000000041413E087E
|
||||
:10038000000201020100003C2623263C001EA1E1E0
|
||||
:100390002112003D40207D000038545455090020B2
|
||||
:1003A00055555578002055545578002055555478AA
|
||||
:1003B000002057555778001CA2E2221400385555EA
|
||||
:1003C0005508003855545508003855555408000054
|
||||
:1003D000017C41000000017D41000000017C4000E3
|
||||
:1003E00000702924297000782F252F78007C545420
|
||||
:1003F00055450034547C5458007E097F49490038E3
|
||||
:100400004545390000384544390000394544380035
|
||||
:10041000003C41217D00003D41207C00009CA1600A
|
||||
:100420003D00003D42423D00003C41403D008070A7
|
||||
:100430006858380400483E494962007E615D433F88
|
||||
:100440000022140814220040887E0902002054551E
|
||||
:1004500055780000007D4100003844453900003CDB
|
||||
:1004600040217D00007A090A7100007A112279008A
|
||||
:1004700000085555555E004E51514E000030484D14
|
||||
:1004800040203E415D4B553E04040404041C00170B
|
||||
:10049000084C6A50001708342A780000307D30007C
|
||||
:1004A0000008140008140014080014084411441132
|
||||
:1004B0004411AA55AA55AA55BBEEBBEEBBEE0000EF
|
||||
:1004C00000FF0000080808FF0000007028252970C0
|
||||
:1004D0000070292529700070292528703E415D553E
|
||||
:1004E000413E0AFB00FF000000FF00FF00000AFA87
|
||||
:1004F00002FE00000A0B080F00000018246624000A
|
||||
:1005000000292A7C2A29080808F800000000000FAA
|
||||
:1005100008080808080F0808080808F80808000074
|
||||
:1005200000FF0808080808080808080808FF080865
|
||||
:1005300000205655567900702A252A71000F080BA5
|
||||
:100540000A0A00FE02FA0A0A0A0B080B0A0A0AFA49
|
||||
:1005500002FA0A0A00FF00FB0A0A0A0A0A0A0A0A41
|
||||
:100560000AFB00FB0A0A005D2222225D0022555987
|
||||
:10057000300000087F49413E007C55555544007CC1
|
||||
:1005800055545544007C5555544400000007000064
|
||||
:100590000000447D45000000457D45000000457C8D
|
||||
:1005A00045000808080F0000000000F80808FFFFD9
|
||||
:1005B000FFFFFFFFF0F0F0F0F0F000000077000028
|
||||
:1005C0000000457D44000F0F0F0F0F0F003C42430A
|
||||
:1005D0003D0000FE4A4A3400003C43433D00003DDC
|
||||
:1005E00043423C000032494A3100003A4546390056
|
||||
:1005F00000FC20201C0000FEAA28100000FFA524FB
|
||||
:100600001800003C40413D00003C41413D00003DA0
|
||||
:1006100041403C00009CA0613D00000408710904B9
|
||||
:1006200000000202020000000703000000000808AA
|
||||
:1006300008000000242E240000242424242405176C
|
||||
:100640000A342A780006097F017F00224D5559227D
|
||||
:100650000008082A08080000081818000006090900
|
||||
:10066000060000000800080000000800000000026A
|
||||
:100670000F00000000090F05000000090D0A00002E
|
||||
:10068000003C3C3C3C0000000000000011241FBE68
|
||||
:10069000CFEFD0E4DEBFCDBF11E0A0E0B1E0EAE4EF
|
||||
:1006A000F2E100E00BBF02C007900D92A635B10742
|
||||
:1006B000D9F725E0A6E5B1E001C01D92AC3BB20739
|
||||
:1006C000E1F70E94C1050C9423090C940000FC0181
|
||||
:1006D0001082758364837383628341834783468377
|
||||
:1006E0000895FC0180818823B9F0A281B3819D0126
|
||||
:1006F0002F5F3F4F8C919681915019F49181291B66
|
||||
:1007000031093383228396832FB7F89490819150D7
|
||||
:1007100090832FBF90E008958FEF9FEF0895FC0125
|
||||
:10072000908181819817B8F4A481B5819D012F5FD4
|
||||
:100730003F4F6C938781815019F48181281B3109C7
|
||||
:100740008783358324839FB7F89480818F5F80836C
|
||||
:100750009FBF81E0089580E0089587B18C7F87B9BD
|
||||
:1007600088B1836088B983E08093B80087E0809384
|
||||
:10077000B10082E0809370008DE78093B30078949D
|
||||
:1007800008958AE08093560184EA8093BC0004C0F7
|
||||
:100790008091BC0087FD04C0809156018111F8CF83
|
||||
:1007A00080915601882329F08091B900887F90E0DC
|
||||
:1007B00008958FEF9FEF08959AE0909356018093EC
|
||||
:1007C000BB0084E88093BC0004C08091BC0087FD1E
|
||||
:1007D00004C0809156018111F8CF80915601882381
|
||||
:1007E00029F08091B900887F90E008958FEF9FEF06
|
||||
:1007F00008950C94DC038AE08093560184E9809389
|
||||
:10080000BC0008951F920F920FB60F9211248F9380
|
||||
:100810008091B30083588093B30080915601882360
|
||||
:1008200029F0809156018150809356018F910F904D
|
||||
:100830000FBE0F901F9018958FB7F89427E630E001
|
||||
:100840003093C5002093C40098E99093C10090ECC8
|
||||
:100850009093C0008FBF40E16CEA71E084EA91E0C0
|
||||
:100860000E94670340E464E671E08CE591E00C943B
|
||||
:1008700067031F920F920FB60F9211240BB60F92BF
|
||||
:100880002F933F934F935F936F937F938F939F9398
|
||||
:10089000AF93BF93EF93FF936091C60084EA91E01A
|
||||
:1008A0000E948F03FF91EF91BF91AF919F918F9124
|
||||
:1008B0007F916F915F914F913F912F910F900BBE60
|
||||
:1008C0000F900FBE0F901F9018951F920F920FB6AA
|
||||
:1008D0000F9211240BB60F922F933F934F935F9378
|
||||
:1008E0006F937F938F939F93AF93BF93EF93FF93F8
|
||||
:1008F00080915C01811118C08091C1008F7D80932F
|
||||
:10090000C100FF91EF91BF91AF919F918F917F9126
|
||||
:100910006F915F914F913F912F910F900BBE0F9070
|
||||
:100920000FBE0F901F9018958CE591E00E94710307
|
||||
:100930008093C600E6CF8091570180FD0DC084B141
|
||||
:10094000806A84B980E58CBD81E08DBD81E090E056
|
||||
:10095000909358018093570108958EBD0DB407FE02
|
||||
:10096000FDCF0895249A2C9A0C949B04BF92CF92A9
|
||||
:10097000DF92EF92FF920F931F93CF93DF93BFB657
|
||||
:10098000F8948CE3C82E85E0D82E97E0E92EF12C60
|
||||
:100990000AC081E0E81AF10880E8C81AD1088FEF90
|
||||
:1009A000E816F80621F180915B0190E00E2C02C060
|
||||
:1009B000959587950A94E2F780FFEBCF4698479884
|
||||
:1009C0008E2D806B0E94AD0480E10E94AD0480E01A
|
||||
:1009D0000E94AD04479A860100581F4FE601899195
|
||||
:1009E0000E94AD04C017D107D1F7469AD2CF10921A
|
||||
:1009F0005B01BFBEDF91CF911F910F91FF90EF90F0
|
||||
:100A0000DF90CF90BF900895ECEBF1E0CF018058DC
|
||||
:100A10009F4F1192E817F907E1F785E0EC3BF807E3
|
||||
:100A2000A9F78FEF80935B010C94B6048A3091F1A3
|
||||
:100A30008D3069F13091590120915A0196E0899FDA
|
||||
:100A4000F0011124E457FF4F86E0289FD0011124C4
|
||||
:100A500090E8399FA00DB11D1124A454BE4F86E02B
|
||||
:100A600094919D93815031968111FACF81E090E06D
|
||||
:100A700001C0880F3A95EAF790915B01892B80932A
|
||||
:100A80005B01243170F42F5F20935A010895109276
|
||||
:100A90005A01089580915901873018F48F5F80932F
|
||||
:100AA00059010895CF93DF93EC019881992339F090
|
||||
:100AB0002196892F0E94160589918111FBCFDF9124
|
||||
:100AC000CF91089580935A016093590108950E942F
|
||||
:100AD000C10384EC0E94F90381E10E94DC0380E001
|
||||
:100AE0000E94DC0380E00E94DC0380E00E94DC03C3
|
||||
:100AF00080E00E94DC0380E00E94DC030C94FB0396
|
||||
:100B0000CF930E949B0487B1806C87B9CFB7F894CC
|
||||
:100B10004798469882EE0E94AD0483EA0E94AD0495
|
||||
:100B200081E80E94AD0488E00E94AD0480EA0E9442
|
||||
:100B3000AD0488EC0E94AD0485E20E94AD048FE212
|
||||
:100B40000E94AD048FEA0E94AD04469A479A0E9423
|
||||
:100B50000405CFBF0E94AD030E946705CF910C949E
|
||||
:100B6000B204CF93C82F0E94C10384EC0E94F90302
|
||||
:100B700085E10E94DC038C2F0E94DC03CF910C9452
|
||||
:100B8000FB03CF93DF93CDB7DEB764970FB6F8942E
|
||||
:100B9000DEBF0FBECDBF81B1877081B982B1886FD2
|
||||
:100BA00082B98FE084B985B18F6085B90E941C0439
|
||||
:100BB0000E948005789484E00E94B10581E0C12CF8
|
||||
:100BC000D12C76019E012F5F3F4F490190E0A92E65
|
||||
:100BD00091E0B92E0FC010E0813021F19FEFC91ACA
|
||||
:100BE000D90AE90AF90A8FE99FE00197F1F700C0F5
|
||||
:100BF0000000812F11E00399EECF882331F02FEF11
|
||||
:100C0000C21AD20AE20AF20AEECF3FEF89EF90E071
|
||||
:100C1000315080409040E1F700C00000C12CD12C41
|
||||
:100C20007601EDCF2FEF39EF80E02150304080404A
|
||||
:100C3000E1F700C000000E94040560E080E00E942F
|
||||
:100C40006205FF92EF92DF92CF92BF92AF929F9296
|
||||
:100C50008F920E943A06C4010E9452050E94B60477
|
||||
:100C60000FB6F894DEBF0FBECDBFC12CD12C7601DC
|
||||
:100C7000C394B9CF0F931F93CF93DF93CDB7DEB754
|
||||
:100C80002E970FB6F894DEBF0FBECDBF0D891E891B
|
||||
:100C900086E08C831A8309838FEF9FE79E838D8381
|
||||
:100CA000AE01475E5F4F6F89788DCE0101960E943D
|
||||
:100CB0006906EF81F885E00FF11F10822E960FB6BE
|
||||
:100CC000F894DEBF0FBECDBFDF91CF911F910F9182
|
||||
:100CD00008952F923F924F925F926F927F928F92E0
|
||||
:100CE0009F92AF92BF92CF92DF92EF92FF920F93BB
|
||||
:100CF0001F93CF93DF93CDB7DEB72B970FB6F89442
|
||||
:100D0000DEBF0FBECDBF6C017B018A01FC011782E3
|
||||
:100D10001682838181FFCCC1CE0101963C01F60190
|
||||
:100D20009381F70193FD859193FF81917F01882342
|
||||
:100D300009F4BAC1853239F493FD859193FF81910D
|
||||
:100D40007F01853229F4B60190E00E948908E7CF3F
|
||||
:100D5000912C212C312CFFE1F315D8F08B3279F056
|
||||
:100D600038F4803279F08332A1F4232D20611DC044
|
||||
:100D70008D3261F0803369F4232D216016C0832DFC
|
||||
:100D80008260382EE32DE4603E2E2AC0F32DF860F9
|
||||
:100D90001DC037FC2DC020ED280F2A3040F08E32C8
|
||||
:100DA000B9F436FC81C1232D2064322E19C036FEE1
|
||||
:100DB00006C08AE0989E200D1124922E11C0EAE010
|
||||
:100DC0002E9E200D1124222EF32DF0623F2E08C0FE
|
||||
:100DD0008C3621F4832D8068382E02C0883641F489
|
||||
:100DE000F70193FD859193FF81917F018111B3CF2D
|
||||
:100DF000982F9F7D9554933028F40C5F1F4F9FE3ED
|
||||
:100E000099830DC0833631F0833771F0833509F053
|
||||
:100E100059C021C0F801808189830E5F1F4F88244B
|
||||
:100E20008394912C530113C02801F2E04F0E511C02
|
||||
:100E3000F801A080B18036FE03C0692D70E002C0C9
|
||||
:100E40006FEF7FEFC5010E947E084C018201F32DF8
|
||||
:100E5000FF773F2E16C0280122E0420E511CF801F8
|
||||
:100E6000A080B18036FE03C0692D70E002C06FEF34
|
||||
:100E70007FEFC5010E9473084C01F32DF0683F2EEF
|
||||
:100E8000820133FC1BC0822D90E088169906B0F4D5
|
||||
:100E9000B60180E290E00E9489082A94F4CFF5011F
|
||||
:100EA00037FC859137FE81915F01B60190E00E9489
|
||||
:100EB000890821102A9421E0821A91088114910452
|
||||
:100EC00071F7E8C0843611F0893641F5F80137FE34
|
||||
:100ED00007C060817181828193810C5F1F4F08C0C0
|
||||
:100EE00060817181072E000C880B990B0E5F1F4FDC
|
||||
:100EF000F32DFF763F2E97FF09C090958095709552
|
||||
:100F000061957F4F8F4F9F4FF0683F2E2AE030E072
|
||||
:100F1000A3010E94C508882E861845C0853731F484
|
||||
:100F2000232D2F7EB22E2AE030E025C0932D997F0D
|
||||
:100F3000B92E8F36C1F018F4883579F0B5C08037F6
|
||||
:100F400019F0883721F0B0C0E92FE061BE2EB4FE61
|
||||
:100F50000DC0FB2DF460BF2E09C034FE0AC0292F3E
|
||||
:100F60002660B22E06C028E030E005C020E130E067
|
||||
:100F700002C020E132E0F801B7FE07C06081718154
|
||||
:100F8000828193810C5F1F4F06C06081718180E078
|
||||
:100F900090E00E5F1F4FA3010E94C508882E86189F
|
||||
:100FA000FB2DFF773F2E36FE0DC0232D2E7FA22E68
|
||||
:100FB000891458F434FE0BC032FC09C0832D8E7E98
|
||||
:100FC000A82E05C0B82CA32C03C0B82C01C0B92C86
|
||||
:100FD000A4FE0FC0FE01E80DF11D8081803321F4D5
|
||||
:100FE0009A2D997EA92E09C0A2FE06C0B394B3948F
|
||||
:100FF00004C08A2D867809F0B394A3FC11C0A0FE2A
|
||||
:1010000006C0B21488F4280C922C9B180EC0B2149F
|
||||
:1010100060F4B60180E290E00E948908B394F7CFB3
|
||||
:10102000B21418F42B1802C0982C212CA4FE10C066
|
||||
:10103000B60180E390E00E948908A2FE17C0A1FCDF
|
||||
:1010400003C088E790E002C088E590E0B6010CC0DC
|
||||
:101050008A2D867859F0A1FE02C08BE201C080E2A1
|
||||
:10106000A7FC8DE2B60190E00E948908891438F44B
|
||||
:10107000B60180E390E00E9489089A94F7CF8A94A1
|
||||
:10108000F301E80DF11D8081B60190E00E9489080E
|
||||
:101090008110F5CF222009F442CEB60180E290E023
|
||||
:1010A0000E9489082A94F6CFF6018681978102C0B2
|
||||
:1010B0008FEF9FEF2B960FB6F894DEBF0FBECDBF1C
|
||||
:1010C000DF91CF911F910F91FF90EF90DF90CF9024
|
||||
:1010D000BF90AF909F908F907F906F905F904F9058
|
||||
:1010E0003F902F900895FC010590615070400110D1
|
||||
:1010F000D8F7809590958E0F9F1F0895FC01615041
|
||||
:10110000704001900110D8F7809590958E0F9F1F29
|
||||
:1011100008950F931F93CF93DF93FB01238121FD4C
|
||||
:1011200003C08FEF9FEF2CC022FF16C0468157816E
|
||||
:10113000248135814217530744F4A081B1819D0178
|
||||
:101140002F5F3F4F318320838C93268137812F5F20
|
||||
:101150003F4F3783268314C08B01EC01FB010084D1
|
||||
:10116000F185E02D0995892BE1F6D80116968D9130
|
||||
:101170009C911797019617969C938E931697CE0184
|
||||
:10118000DF91CF911F910F910895FA01AA2728307E
|
||||
:1011900051F1203181F1E8946F936E7F6E5F7F4F44
|
||||
:1011A0008F4F9F4FAF4FB1E03ED0B4E03CD0670FC0
|
||||
:1011B000781F891F9A1FA11D680F791F8A1F911D13
|
||||
:1011C000A11D6A0F711D811D911DA11D20D009F463
|
||||
:1011D00068943F912AE0269F11243019305D3193A5
|
||||
:1011E000DEF6CF010895462F4770405D4193B3E08E
|
||||
:1011F0000FD0C9F7F6CF462F4F70405D4A3318F035
|
||||
:10120000495D31FD4052419302D0A9F7EACFB4E0E5
|
||||
:10121000A6959795879577956795BA95C9F700979D
|
||||
:101220006105710508959B01AC010A2E069457953E
|
||||
:10123000479537952795BA95C9F7620F731F841F95
|
||||
:0A124000951FA01D0895F894FFCF3C
|
||||
:10124A0074696D653A202564004A6F79737469631D
|
||||
:10125A006B2055702E0D0A004A6F79737469636B9F
|
||||
:10126A0020446F776E2E0D0A004A6F797374696392
|
||||
:10127A006B204C6566742E0D0A004A6F7973746987
|
||||
:10128A00636B2052696768742E0D0A004578697489
|
||||
:06129A002E0D0A0A0000FF
|
||||
:00000001FF
|
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,59 @@
|
||||
TARGET = main
|
||||
SRCS := $(shell find ../../dmm-libs-master/src/ -name '*.c') $(shell find src/ -name '*.c')
|
||||
FILES = $(SRCS:%.c=%) #main uart avrIOhelper/io-helper #uart#hier alle c-Datein reinschreiben, trennung durch " " und ohne .c-Endung
|
||||
MCU = atmega1284
|
||||
PROGC = m1284
|
||||
CC = avr-gcc
|
||||
#TOOL = stk500 -P /dev/ttyUSB0
|
||||
TOOL = atmelice
|
||||
#TOOL = avrispmkii
|
||||
#TOOL = usbasp-clone
|
||||
|
||||
BUILDDIR = Builds
|
||||
|
||||
DEFINES = -DF_CPU=16000000UL -I include/ -I ../../dmm-libs-master/include/
|
||||
|
||||
CFLAGS =-mmcu=$(MCU) -O2 -Wall -Wpedantic $(DEFINES) -std=c99 -ffunction-sections -fdata-sections
|
||||
LDFLAGS =-mmcu=$(MCU) -Wl,--gc-sections
|
||||
|
||||
LDFILES = $(foreach FILE,$(FILES),$(BUILDDIR)/$(FILE).o)
|
||||
|
||||
all: clean $(BUILDDIR)/$(TARGET).elf
|
||||
|
||||
$(BUILDDIR)/%.o: %.c
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -c $< -o $(BUILDDIR)/$*.o
|
||||
|
||||
$(BUILDDIR)/$(TARGET).elf: $(LDFILES)
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(LDFLAGS) $(LDFILES) -o $(BUILDDIR)/$(TARGET).elf
|
||||
|
||||
$(BUILDDIR)/$(TARGET).hex : $(BUILDDIR)/$(TARGET).elf
|
||||
avr-objcopy -j .data -j .text -O ihex $< $@
|
||||
|
||||
fuse:
|
||||
avrdude -p $(PROGC) -c $(TOOL) -U lfuse:w:0xE8:m -U hfuse:w:0xD1:m
|
||||
|
||||
load: $(BUILDDIR)/$(TARGET).hex
|
||||
avrdude -p $(PROGC) -c $(TOOL) -U flash:w:$(BUILDDIR)/$(TARGET).hex -v -B 4MHz
|
||||
|
||||
program: clean load
|
||||
|
||||
reset:
|
||||
avrdude -p $(PROGC) -c $(TOOL)
|
||||
|
||||
size: $(BUILDDIR)/$(TARGET).elf
|
||||
avr-size -C --mcu=$(MCU) $(BUILDDIR)/$(TARGET).elf
|
||||
|
||||
.PHONY=clean
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)
|
||||
|
||||
|
||||
#Fuse m1284p external Osz. Long startuptime
|
||||
# avrdude -c usbasp-clone -p m1284p -U lfuse:w:0xff:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
|
||||
|
||||
#Fuse m1284p internal Osz. Long startuptime
|
||||
# avrdude -c usbasp-clone -p m1284p -U lfuse:w:0xe2:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
|
||||
|
||||
|
||||
@ -0,0 +1,161 @@
|
||||
# DMM Demo
|
||||
|
||||
Beispielprojekt zur Demonstration der wesentlichen Funktionen des DMM-Boards.
|
||||
Wird auch zur Installation des Bootloaders und Test nach der Inbetriebnahme
|
||||
eingesetzt.
|
||||
|
||||
## Anleitung
|
||||
|
||||
### Build-System und Entwicklungsumgebung
|
||||
|
||||
Als plattformübergreifendes Build-System Dient das
|
||||
[PlatformIO](https://platformio.org/). Diese steht sowohl als
|
||||
Kommandozeilen-Tool, als auch als [Erweiterung](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide)
|
||||
zum [Visual Studio Code](https://code.visualstudio.com/).
|
||||
(auch unter Linux und MacOS verfügbar!)
|
||||
|
||||
Nutzt man das VSCode, so können nach der Installation der Erweiterung die unten
|
||||
aufgeführten Befehle auch *ohne Installation der PIO im Betriebssystem* in den
|
||||
Terminals innerhalb der IDE genutzt werden. Für die Betriebssystemweite Installation
|
||||
siehe Anleitung unter [PlatformIO Core (CLI)](https://docs.platformio.org/en/latest/core/installation.html).
|
||||
|
||||
*Nur Linux:* zur Programmierung des Bootloaders mit JTAGICE muss dieser
|
||||
für nicht-root Nutzer per udev-Regel freigegeben werden. Erstelle dazu Datei
|
||||
`/etc/udev/rules.d/99-jtagice3.rules` mit:
|
||||
```
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2140", MODE="0666"
|
||||
```
|
||||
|
||||
### Auschecken und bauen
|
||||
Es sollte sichergestellt sein, dass [Git](https://git-scm.com/) installiert und
|
||||
der [eigene SSH-Schlüssel im GitLab-Profil hinterlegt](https://docs.gitlab.com/ee/ssh/)
|
||||
ist. Für Git-Anfänger finden sich im Internet zahlreiche Anleitungen, zum Beispiel
|
||||
[diese](https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/).
|
||||
|
||||
*GUI:* VSCode unterstützt Git direkt und kann nach der Einrichtung als GUI
|
||||
genutzt werden.
|
||||
|
||||
Auschecken:
|
||||
```
|
||||
$ git clone git@git.rz.tu-bs.de:emg/lehre/dmm/dmm-demo.git
|
||||
$ cd dmm-demo
|
||||
```
|
||||
|
||||
Es sind dre PlatformIO-Environments definiert:
|
||||
* `release` wird standardmäßig
|
||||
genutzt und ist auf die Programmierung per Bootloader ausgelegt.
|
||||
* `debug` wird
|
||||
für das Debugging mittels avr-stub genutzt.
|
||||
* `jtag` wird zum Aufspielen des Bootloaders mittels externem
|
||||
JTAGICE3 Programmer genutzt.
|
||||
|
||||
> **In `debug` darf daher kein UART genutzt werden, da es zur Kommunikation mit
|
||||
> GDB dient**. Entsprechende Programmteile müssen gegebenenfalls mit
|
||||
>`#ifndef GDBSTUB` deaktiviert werden!
|
||||
|
||||
Bauen von `release`:
|
||||
```
|
||||
$ pio run -e release
|
||||
```
|
||||
|
||||
Bauen von `debug`:
|
||||
```
|
||||
$ pio run -e debug
|
||||
|
||||
```
|
||||
Wenn man `-e <environment>` weglässt, wird immer `debug` gebaut, da dies die
|
||||
Standartkonfiguration ist, die von dem Debugger von VSCode genutzt werden soll.
|
||||
|
||||
Die für die DMM-Projekte vorgesehenen
|
||||
[Bibliotheken](git@git.rz.tu-bs.de:emg/lehre/dmm/dmm-libs.git) sowie die
|
||||
Toolchain werden durch `pio run` automatisch heruntergeladen und müssen nicht
|
||||
extra installiert werden. Die Bibliotheken werden dabei im Ordner
|
||||
`dmm-demo/depends` hinterlegt.
|
||||
|
||||
### Programmierung & Nutzung
|
||||
|
||||
*GUI*: die hier aufgeführten Befehle können auch aus dem PlatformIO-Toolbar des
|
||||
VSCode per Mausklick ausgeführt werden.
|
||||
#### Aufspielen des Bootloaders
|
||||
|
||||
Auf einem neuen Board muss zunächst mittels JTAGICE3 ein Bootloader aufgespielt
|
||||
werden. Dazu wird es mit dem JTAG-Header verbunden (Polung beachten!).
|
||||
```
|
||||
$ pio run -t bootloader -e jtag
|
||||
```
|
||||
|
||||
> Sollte es beim Aufruf zum Fehler `TypeError: expected str, bytes or
|
||||
> os.PathLike object, not NoneType ...
|
||||
> join(platform.get_package_dir("tool-avrdude"), "avrdude.conf")`
|
||||
> kommen, kann dieser durch einmaliges Aufrufen von
|
||||
> `$ pio run -t upload -e jtag`
|
||||
> vor der Installation des Bootloaders behoben werden.
|
||||
|
||||
#### Aufspielen des Programms
|
||||
|
||||
Das Board muss per USB verbunden und Bootloader gestarted werden.
|
||||
**Zum Start des Bootloaders den Joystick in Richtung unten halten, Reset-Taste
|
||||
drücken und den Joystick loslassen. Die Aktivierung des Bootloaders erkennt man
|
||||
an dreimaligem Blinken und anschließendem Dauerleuchten der LED4 auf dem Board**.
|
||||
```
|
||||
$ pio run -e release -t upload
|
||||
```
|
||||
Anschließend Reset-Taste drücken um das Programm zu starten.
|
||||
|
||||
#### UART-Kommunikation
|
||||
|
||||
Ein Teil des Demos beschäftigt sich mit Kommunikation über einen virtuellen
|
||||
SerialPort via USB. Der `COMx` (Windows) oder `/dev/ttyUSBx` (Linux) Port wird
|
||||
von PlattformIO automatisch erkannt. Dies geschieht anhand des `hwid` Parameters
|
||||
unter `boards/emgdmm_v3.json`, der den VID/PID des FTDI-Chips des DMM-Boards
|
||||
angibt. Ein Terminal kann somit einfach geöffnet werden:
|
||||
```
|
||||
$ pio device monitor
|
||||
```
|
||||
|
||||
Beim Drücken des Joystick im entsprechenden Teil des Demos wird nun eine Meldung
|
||||
angezeigt.
|
||||
|
||||
#### Unit-Test
|
||||
|
||||
Die Demo enthält im Ordner `tests` einen Beispiel zur Ausführung von Unit-Tests
|
||||
auf dem Mikrocontroller. Dazu muss wie oben beschrieben der Bootloader aktiviert
|
||||
werden.
|
||||
```
|
||||
$ pio test
|
||||
```
|
||||
Nach dem Befehl wird eine Firmware auf das Board heruntergeladen, die bei der
|
||||
Ausführung per UART (wie auch bei `pio device monitor`) die Ergebnisse der
|
||||
Tests im Terminal ausgibt.
|
||||
|
||||
#### Debugging mit avr-stub
|
||||
|
||||
Normallerweise ist zum Debuggen (also Setzen von Breakpoints und Auslesen der
|
||||
Register) ein JTAG-Adapter notwendig. PlattformIO kann
|
||||
mittels einer [Bibliothek](https://github.com/jdolinay/avr_debug) die Funktion
|
||||
der Hardware-Debugger unter Inkaufnahme einiger Nachteile teilweise ersetzen.
|
||||
Die Kommunikation erfolgt dabei per UART, der nicht mehr im eigenen Programm
|
||||
genutzt werden kann.
|
||||
Die Konfiguration `debug` bindet die nötige Bibliothek ein, und schaltet
|
||||
Optimierung über das Setzen von `build_type` aus und definiert `GDBSTUB`. Am
|
||||
Anfang des programms muss `debug_init()` aus `avr8-stub.h` aufgerufen werden.
|
||||
|
||||
Debugging wird in VScode mittels "Run & Debug" Tab gestartet. Vorher muss
|
||||
der Bootloader aktiv sein.
|
||||
|
||||
Zu beachten ist:
|
||||
* Beakpoints funktionieren nur in Programmteilen, wo Interrupts aktiviert
|
||||
sind. **Das setzen eines Breakpoints innerhalb einer Interruptroutine führt
|
||||
immer zum Aufhängen des Programms**.
|
||||
* Breakpoints werden über das Neuschreiben vom Flash gesetzt. Dies hat einen
|
||||
Verschleiß zufolge, da der Flash nur für 10000 Schreibzyklen ausgelegt ist.
|
||||
Das "Steppen" einzelner Befehle ist daher sparsam zu verwenden.
|
||||
* Der Debugger nutzt den Watchdog-Interrupt, daher darf WDT nicht vom Programm
|
||||
genutzt werden. Außerdem können die gelegentlichen Interrupts die Timings
|
||||
beeinflussen.
|
||||
|
||||
> **TODO:** aktuell muss der Port des Debuggers manuell in `platformio.ini`
|
||||
> unter `debug_port` gesetzt werden!
|
||||
> (z.B. `/dev/ttyUSBx` unter Linux oder `COMx` unter Windows).
|
||||
> Für automatisches Auflösen des Ports siehe
|
||||
> [Issue 253](https://github.com/platformio/platform-atmelavr/issues/253).
|
||||
@ -0,0 +1,40 @@
|
||||
{
|
||||
"build": {
|
||||
"f_cpu": "16000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x0403",
|
||||
"0x6001"
|
||||
]
|
||||
],
|
||||
"mcu": "atmega1284p"
|
||||
},
|
||||
"platforms": [
|
||||
"atmelavr"
|
||||
],
|
||||
"name": "EMG DMM Board",
|
||||
"upload": {
|
||||
"maximum_ram_size": 16384,
|
||||
"maximum_size": 130048,
|
||||
"protocol": "arduino",
|
||||
"require_upload_port": true
|
||||
},
|
||||
"bootloader": {
|
||||
"file": "boards/optiboot_atmega1284p_dmm.hex",
|
||||
"lfuse": "0xFF",
|
||||
"hfuse": "0x9C",
|
||||
"efuse": "0xFC",
|
||||
"lock_bits": "0xFF"
|
||||
},
|
||||
"debug": {
|
||||
"simavr_target": "atmega1284p",
|
||||
"avr-stub": {
|
||||
"speed": 115200
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"speed": 115200
|
||||
},
|
||||
"url": "https://www.emg.tu-bs.de/lehre/vl/vl_dmm_d.html",
|
||||
"vendor": "EMG, TU Braunschweig"
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
:020000021000EC
|
||||
:10FC000001C020C1112484B7882391F00E98169A60
|
||||
:10FC100090B1282F2A70223011F496FF09C081FF7D
|
||||
:10FC200002C097EF94BF282E80E0F7D00C9400001C
|
||||
:10FC300085E08093810082E08093C00088E180931A
|
||||
:10FC4000C10086E08093C20080E18093C40080E020
|
||||
:10FC5000E4D0239A86E020E33CEF91E030938500E6
|
||||
:10FC60002093840096BBB09BFECF1B9AA895409131
|
||||
:10FC7000C00047FD02C0815089F743E0B42EAA249A
|
||||
:10FC8000A39451E1752EBDD0813471F4BAD0C82F40
|
||||
:10FC9000CAD081E0C23821F088E0C13809F083E0A1
|
||||
:10FCA000A9D080E1A7D0EFCF823419F484E1C3D08A
|
||||
:10FCB000F8CF853411F485E0FACF853581F4A1D0F1
|
||||
:10FCC000082F9FD0182F87FF07C08BB781608BBF8D
|
||||
:10FCD000000F111FA8D0E5CF8BB78E7FF8CF8635E8
|
||||
:10FCE00081F48FD08D3459F48CD0CBB78AD0C170C9
|
||||
:10FCF000880F8C2B8BBF81E09ED080E0D1CF83E03A
|
||||
:10FD0000FBCF843609F046C07CD0E82EF12CFE2CC7
|
||||
:10FD1000EE2477D0E82A75D0682EE701C12CDD24C7
|
||||
:10FD2000D39446018FEFC81AD80A6BD0F4018083B0
|
||||
:10FD30002197B9F778D0F5E46F120DC0FE01F39565
|
||||
:10FD4000EC16FD0609F4ADCF6081CE01800F911F46
|
||||
:10FD500091D02196F3CFF801B7BEE89507B600FC25
|
||||
:10FD6000FDCFFE01E00FF11FDE01B3958D919C9157
|
||||
:10FD70000C01A7BEE89511242296EC16FD0689F722
|
||||
:10FD800085E0F80187BFE89507B600FCFDCF77BE98
|
||||
:10FD9000E89587CF8437F9F434D0C82FD0E0DC2F32
|
||||
:10FDA000CC272FD0C82B2DD0D82E3DD07801F5E40C
|
||||
:10FDB000DF120AC0C70156D01DD021978FEFE81A75
|
||||
:10FDC000F80A2097B9F76DCFF70187917F0112D01C
|
||||
:10FDD0002197D1F766CF853739F425D08EE10AD047
|
||||
:10FDE00087E908D085E05CCF813509F073CF88E0E2
|
||||
:10FDF00014D070CF9091C00095FFFCCF8093C600C7
|
||||
:10FE000008958091C00087FFFCCF8091C00084FDE1
|
||||
:10FE100001C0A8958091C6000895E0E6F0E098E161
|
||||
:10FE2000908380830895EDDF803219F088E0F5DF5C
|
||||
:10FE3000FFCF84E1DFCFCF93C82FE3DFC150E9F7D5
|
||||
:10FE4000CF91F1CFFC010A0167BFE895112407B6F5
|
||||
:10FE500000FCFDCF667029F0452B19F481E187BFC6
|
||||
:10FE6000E8950895F999FECF92BD81BDF89A99273A
|
||||
:10FE700080B50895262FF999FECF1FBA92BD81BD96
|
||||
:10FE800020BD0FB6F894FA9AF99A0FBE019608951C
|
||||
:10FE900056657273696F6E3D382E31004F5054496C
|
||||
:10FEA000424F4F545F435553544F4D5645523D308A
|
||||
:10FEB000004465766963653D61746D6567613132E3
|
||||
:10FEC00038347000465F4350553D31363030303065
|
||||
:10FED00030304C00424947424F4F543D310042754B
|
||||
:10FEE000696C743A41707220313820323032313AC4
|
||||
:10FEF00032323A30333A303000554152543D3000BE
|
||||
:10FF0000424155445F524154453D313135323030E4
|
||||
:10FF1000004C45443D4233004C45445F53544152EC
|
||||
:0CFF2000545F464C41534845533D3300AC
|
||||
:02FFFE000108F8
|
||||
:040000031000FC00ED
|
||||
:00000001FF
|
||||
@ -0,0 +1,39 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
@ -0,0 +1,43 @@
|
||||
#ifndef MUSIC_H_
|
||||
#define MUSIC_H_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t tone;
|
||||
uint16_t duration;
|
||||
} MUSIC_Note;
|
||||
|
||||
#define MUSIC_END { 0, 0 }
|
||||
#define MUSIC_IS_END(_note_) (!((_note_).tone) && !((_note_).duration))
|
||||
|
||||
#define MUSIC_A4 440
|
||||
#define MUSIC_B4 494
|
||||
#define MUSIC_C4 262
|
||||
#define MUSIC_D4 293
|
||||
#define MUSIC_E4 330
|
||||
#define MUSIC_F4 349
|
||||
#define MUSIC_G4 392
|
||||
|
||||
#define MUSIC_A5 880
|
||||
#define MUSIC_B5 988
|
||||
#define MUSIC_C5 523
|
||||
#define MUSIC_D5 587
|
||||
#define MUSIC_E5 659
|
||||
#define MUSIC_F5 698
|
||||
#define MUSIC_G5 784
|
||||
|
||||
#define MUSIC_1 1000
|
||||
#define MUSIC_2 (MUSIC_1/2)
|
||||
#define MUSIC_4 (MUSIC_1/4)
|
||||
#define MUSIC_8 (MUSIC_1/8)
|
||||
#define MUSIC_16 (MUSIC_1/16)
|
||||
#define MUSIC_32 (MUSIC_1/32)
|
||||
|
||||
|
||||
typedef const MUSIC_Note* MUSIC_Track;
|
||||
extern const MUSIC_Note MUSIC_Tetris[];
|
||||
|
||||
void Music_PlayTrack (MUSIC_Track track);
|
||||
|
||||
|
||||
#endif /* MUSIC_H_ */
|
||||
@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
@ -0,0 +1,55 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
default_envs = debug
|
||||
libdeps_dir = depends
|
||||
|
||||
[env]
|
||||
platform = atmelavr @ ^3.3.0
|
||||
|
||||
board = emgdmm_v3
|
||||
monitor_speed = 9600
|
||||
test_transport = custom
|
||||
test_speed = 115200
|
||||
|
||||
lib_deps =
|
||||
git@git.rz.tu-bs.de:emg/lehre/dmm/dmm-libs.git
|
||||
|
||||
[env:release] ; for flash via bootloader
|
||||
; keep defaults, see board definitions for programming support
|
||||
|
||||
|
||||
[env:debug] ; for debugging using avr-stub, see documentation
|
||||
build_type = debug
|
||||
build_flags =
|
||||
-D DEBUG
|
||||
-D GDBSTUB ; program should disable any own UART use if this is defined
|
||||
-D AVR8_BREAKPOINT_MODE=2
|
||||
|
||||
debug_tool = avr-stub
|
||||
;debug_port = /dev/ttyUSB0 ; Linux Port TODO: this should be infered automagically
|
||||
debug_port = COM6 ; Windows COM Port
|
||||
|
||||
; add GDB stub implementation
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
jdolinay/avr-debugger @ ^1.3
|
||||
|
||||
|
||||
[env:jtag] ; for JTAG bootloader flashing and potentialy debugging once supported
|
||||
build_type = debug
|
||||
build_flags =
|
||||
-D DEBUG
|
||||
|
||||
upload_protocol = jtag3
|
||||
upload_flags = -p, atmega1284, -F ; fix signature error with JTAGICE
|
||||
upload_port = usb
|
||||
|
||||
; Atmel-ICE based AVR debug is not directly supported by PIO as of 04.2020. As not
|
||||
; available at home, not an issue for DMM at the moment.
|
||||
; Potentially solveable by using avarice as a server.
|
||||
; See: https://github.com/platformio/platform-atmelavr/issues/53
|
||||
|
||||
@ -0,0 +1,551 @@
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <util/delay.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#ifdef GDBSTUB
|
||||
#include "avr8-stub.h"
|
||||
#else
|
||||
#include "uart.h"
|
||||
#endif
|
||||
|
||||
#include "lcd.h"
|
||||
#include "twi.h"
|
||||
#include "dataflash.h"
|
||||
#include "music.h"
|
||||
|
||||
#define wait_joy_button() \
|
||||
{ \
|
||||
LCD_GotoXY(20, 7); \
|
||||
LCD_PutChar(0x10); \
|
||||
LCD_Update(); \
|
||||
while (((PINA)&0x08)) \
|
||||
; \
|
||||
while (!((PINA)&0x08)) \
|
||||
; \
|
||||
_delay_ms(20); \
|
||||
while (((PINA)&0x08)) \
|
||||
; \
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
const uint8_t PROGMEM emg_logo[640] =
|
||||
{
|
||||
0x80, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
|
||||
0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
|
||||
0xfc, 0xfc, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xe0, 0x80, 0x00, 0x00, 0xfc,
|
||||
0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xf0, 0xf8, 0xfc, 0xfc,
|
||||
0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
|
||||
0xfc, 0xf8, 0xf8, 0xf0, 0xe0, 0xc0, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc,
|
||||
0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
|
||||
0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xe0, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0,
|
||||
0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
|
||||
0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
|
||||
0xfc, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xe0, 0x80, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf3, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
|
||||
0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf7, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0x1f, 0x07, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x03, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0x07, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0x1f, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xf1, 0xe1, 0xc1, 0xc1, 0x81, 0x81, 0x81, 0x81, 0xc1, 0xc1, 0xc1,
|
||||
0xc1, 0xc1, 0xc1, 0xe1, 0xe1, 0xe1, 0xe1, 0xe1, 0xe1, 0xe1, 0xe1, 0xe1,
|
||||
0xe1, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
|
||||
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xe0,
|
||||
0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
|
||||
0xc0, 0xe0, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x01, 0x07, 0x07, 0x0f, 0x0f, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x0f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x03, 0x07,
|
||||
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
|
||||
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x8f, 0xcf, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
|
||||
0x1f, 0x0f, 0x07, 0x01,
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
void demo_backlight(void);
|
||||
void demo_start(void);
|
||||
void demo_display(void);
|
||||
void demo_show_emg(void);
|
||||
void demo_uart(void);
|
||||
void demo_music(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// set PA3-PA7 as input and activated internal Pull-Up
|
||||
DDRA &= ~((1 << PINA3) | (1 << PINA4) | (1 << PINA5) | (1 << PINA6) | (1 << PINA7)); // Required for DMM Board 2013
|
||||
PORTA |= ((1 << PINA3) | (1 << PINA4) | (1 << PINA5) | (1 << PINA6) | (1 << PINA7)); // Required for DMM Board 2013
|
||||
|
||||
// set PB0-PB3 as output
|
||||
DDRB = 0x0F;
|
||||
// set PB0-PB3 on high-level
|
||||
PORTB |= 0x0F; // Required for DMM Board DMM Board 2013
|
||||
|
||||
#ifdef GDBSTUB
|
||||
debug_init(); // required for debugging via UART
|
||||
#else
|
||||
UART_Init();
|
||||
#endif
|
||||
|
||||
LCD_Init();
|
||||
sei(); // enable interrupts after drivers initialized
|
||||
|
||||
//demo_start();
|
||||
//demo_show_emg();
|
||||
|
||||
//#ifndef GDBSTUB // UART unavailable if used by GDB stub for debugging
|
||||
//demo_uart();
|
||||
//#endif
|
||||
|
||||
//demo_display();
|
||||
//demo_backlight();
|
||||
//demo_music();
|
||||
|
||||
Backlight_LED(BL_GREEN_ON);
|
||||
|
||||
|
||||
//Backlight_Off();
|
||||
//LCD_Clear();
|
||||
|
||||
// loop forever
|
||||
uint32_t counter = 0;
|
||||
uint8_t button_state = 1;
|
||||
uint8_t button_state_old = 1;
|
||||
while (1){
|
||||
button_state = !(PINA & 0x08);
|
||||
|
||||
if( button_state == 1 && button_state_old == 0 ){
|
||||
_delay_ms(20);
|
||||
counter = 0;
|
||||
}
|
||||
if( button_state == 0 && button_state_old == 1 ){
|
||||
_delay_ms(20);
|
||||
|
||||
/* print to LCD */
|
||||
LCD_Clear();
|
||||
LCD_GotoXY(0, 0);
|
||||
char msg[20];
|
||||
sprintf(msg, "time: %d", counter);
|
||||
LCD_PutString(msg);
|
||||
LCD_Update();
|
||||
/* ------------ */
|
||||
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
counter++;
|
||||
button_state_old = button_state;
|
||||
_delay_ms(1);
|
||||
}
|
||||
}
|
||||
|
||||
void demo_start(void)
|
||||
{
|
||||
// Turn on green backlight
|
||||
Backlight_LED(BL_GREEN_ON);
|
||||
|
||||
// Place program memory strings in framebuffer
|
||||
LCD_PutString_P(PSTR("-DMM AVR-Board Demo- \r\n\n"));
|
||||
LCD_PutString_P(PSTR("Always push the \r\n"));
|
||||
LCD_PutString_P(PSTR("joystick button to \r\n"));
|
||||
LCD_PutString_P(PSTR("proceed to the next \r\n"));
|
||||
LCD_PutString_P(PSTR("screen. \r\n\n"));
|
||||
LCD_PutString_P(PSTR("Enjoy the Fuck You! "));
|
||||
|
||||
// Copy framebuffer to display
|
||||
LCD_Update();
|
||||
|
||||
// Wait for joystick button
|
||||
wait_joy_button();
|
||||
}
|
||||
|
||||
void demo_show_emg(void)
|
||||
{
|
||||
// Some counters
|
||||
uint16_t emg_offset = 0;
|
||||
uint8_t fb_x;
|
||||
uint8_t fb_y;
|
||||
|
||||
// Turn on white backlight (red, green and blue)
|
||||
Backlight_LED(BL_RED_ON | BL_GREEN_ON | BL_BLUE_ON);
|
||||
|
||||
// Clear precautionally
|
||||
LCD_Clear();
|
||||
|
||||
// Copy emglogo into framebuffer
|
||||
for (fb_y = 0; fb_y < 5; fb_y++)
|
||||
for (fb_x = 0; fb_x < 128; fb_x++)
|
||||
lcd_framebuffer[fb_y][fb_x] = pgm_read_byte(&emg_logo[emg_offset++]);
|
||||
|
||||
// Mark pages 0-4 for update
|
||||
lcd_frameupdate = 0x1f;
|
||||
|
||||
// Add some text
|
||||
LCD_GotoXY(0, 5);
|
||||
LCD_PutString_P(PSTR(" Institut f\x81r Messt. \r\n"));
|
||||
LCD_PutString_P(PSTR(" und Grundlagen der \r\n"));
|
||||
LCD_PutString_P(PSTR(" Elektrotechnik \r\n"));
|
||||
|
||||
// And copy framebuffer to display
|
||||
LCD_Update();
|
||||
|
||||
wait_joy_button();
|
||||
}
|
||||
|
||||
#ifndef GDBSTUB
|
||||
void demo_uart(void)
|
||||
{
|
||||
unsigned char loop = 1;
|
||||
signed int c;
|
||||
char buffer[10];
|
||||
|
||||
LCD_Clear();
|
||||
Backlight_LED(BL_BLUE_ON);
|
||||
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("UART-Demonstration \r\n\n"));
|
||||
LCD_PutString_P(PSTR("Setup your terminal: \r\n"));
|
||||
LCD_PutString_P(PSTR("9600 Baud, 8N1 \r\n"));
|
||||
LCD_PutString_P(PSTR("Use joystick to send \r\n"));
|
||||
LCD_PutString_P(PSTR("some strings. \r\n"));
|
||||
|
||||
LCD_GotoXY(20, 7);
|
||||
LCD_PutChar(0x10);
|
||||
|
||||
LCD_Update();
|
||||
|
||||
while ((!((PINA)&0x08)))
|
||||
;
|
||||
_delay_ms(20);
|
||||
while (!((PINA)&0x08))
|
||||
;
|
||||
|
||||
while (loop)
|
||||
{
|
||||
// Get net character from uart fifo
|
||||
c = UART_GetChar();
|
||||
|
||||
// c = -1 means fifo empty
|
||||
if (c > -1)
|
||||
{
|
||||
// wipe last lcd line
|
||||
LCD_WipeLine(7);
|
||||
|
||||
LCD_GotoXY(0, 7);
|
||||
LCD_PutString_P(PSTR("RX-ASCII-Code: "));
|
||||
// Convert interger to ascii
|
||||
itoa(c, buffer, 10);
|
||||
|
||||
LCD_PutString(buffer);
|
||||
LCD_GotoXY(20, 7);
|
||||
LCD_PutChar(0x10);
|
||||
LCD_Update();
|
||||
_delay_ms(10);
|
||||
}
|
||||
|
||||
_delay_ms(20);
|
||||
while (!((PINA)&0xF8))
|
||||
; // Different to DMM 2012 and before
|
||||
|
||||
switch (((PINA)&0xF8))
|
||||
{
|
||||
case 0x78:
|
||||
// Joystick Up
|
||||
UART_PutString("Joystick Up.\r\n");
|
||||
break;
|
||||
case 0xB8:
|
||||
// Joystick Down
|
||||
UART_PutString("Joystick Down.\r\n");
|
||||
break;
|
||||
case 0xD8:
|
||||
// Joystick Left
|
||||
UART_PutString("Joystick Left.\r\n");
|
||||
break;
|
||||
case 0xE8:
|
||||
// Joystick Right
|
||||
UART_PutString("Joystick Right.\r\n");
|
||||
break;
|
||||
case 0xF0:
|
||||
// Joystick Button
|
||||
UART_PutString("Exit.\r\n\n");
|
||||
loop = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
_delay_ms(200);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void demo_music(void)
|
||||
{
|
||||
LCD_Clear();
|
||||
Backlight_LED(BL_RED_ON);
|
||||
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Let's dance!\r\n\n"));
|
||||
LCD_PutString_P(PSTR("(Finest PWM sounds!)\r\n\n"));
|
||||
LCD_Update();
|
||||
|
||||
Music_PlayTrack(MUSIC_Tetris);
|
||||
|
||||
LCD_PutString_P(PSTR("OK, that's enough...\r\n\n"));
|
||||
LCD_Update();
|
||||
|
||||
wait_joy_button();
|
||||
}
|
||||
|
||||
void demo_display(void)
|
||||
{
|
||||
// switch white backlight on
|
||||
Backlight_LED(BL_RED_ON | BL_GREEN_ON | BL_BLUE_ON);
|
||||
|
||||
// clear display
|
||||
LCD_Clear();
|
||||
|
||||
// talking to the user
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Set some pixels."));
|
||||
|
||||
LCD_DrawPixel(10, 10, 1);
|
||||
LCD_DrawPixel(12, 44, 1);
|
||||
LCD_DrawPixel(111, 62, 1);
|
||||
LCD_DrawPixel(101, 22, 1);
|
||||
LCD_Update();
|
||||
|
||||
wait_joy_button();
|
||||
|
||||
// one display page requires 8 pages in dataflash
|
||||
LCD_SavePage(0);
|
||||
LCD_WipeLine(0);
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Connecting."));
|
||||
|
||||
LCD_DrawLine(10, 10, 12, 44, 1);
|
||||
LCD_DrawLine(12, 44, 111, 62, 1);
|
||||
LCD_DrawLine(111, 62, 101, 22, 1);
|
||||
LCD_DrawLine(101, 22, 10, 10, 1);
|
||||
LCD_Update();
|
||||
|
||||
wait_joy_button();
|
||||
|
||||
// first display page was stored at flash page 0
|
||||
// second display page will start at 8
|
||||
LCD_SavePage(8);
|
||||
LCD_WipeLine(0);
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Adding circles."));
|
||||
|
||||
LCD_DrawCircle(64, 32, 10, 1);
|
||||
LCD_DrawCircle(70, 30, 20, 1);
|
||||
LCD_Update();
|
||||
|
||||
wait_joy_button();
|
||||
|
||||
// talking to the user
|
||||
LCD_SavePage(16);
|
||||
LCD_Clear();
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Clear/Set/XOR Demo."));
|
||||
|
||||
for (unsigned int fill = 0; fill < 128; fill++)
|
||||
LCD_DrawLine(fill, 10, fill, 53, (fill / 8) & 1);
|
||||
|
||||
// Clear
|
||||
LCD_DrawLine(0, 20, 127, 20, 0);
|
||||
|
||||
// Set
|
||||
LCD_DrawLine(0, 30, 127, 30, 1);
|
||||
|
||||
// XOR
|
||||
LCD_DrawLine(0, 40, 127, 40, 2);
|
||||
|
||||
LCD_Update();
|
||||
|
||||
wait_joy_button();
|
||||
|
||||
// talking to the user
|
||||
LCD_SavePage(24);
|
||||
LCD_Clear();
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Use the joystick to\r\n"));
|
||||
LCD_PutString_P(PSTR("recall the last\r\n"));
|
||||
LCD_PutString_P(PSTR("screens. Again,\r\n"));
|
||||
LCD_PutString_P(PSTR("button means exit.\r\n"));
|
||||
LCD_Update();
|
||||
|
||||
unsigned char loop = 1;
|
||||
|
||||
while (loop)
|
||||
{
|
||||
// wait
|
||||
while ((!((PINA)&0xF8)))
|
||||
; // Different to DMM 2012 and before
|
||||
_delay_ms(300);
|
||||
while (!((PINA)&0xF8))
|
||||
; // Different to DMM 2012 and before
|
||||
|
||||
switch ((~PINA) & 0xF8) // Different to DMM 2012 and before
|
||||
{
|
||||
case 0x80:
|
||||
// UP
|
||||
LCD_LoadPage(0);
|
||||
LCD_WipeLine(0);
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Screen 1"));
|
||||
LCD_Update();
|
||||
break;
|
||||
case 0x40:
|
||||
// DOWN
|
||||
LCD_LoadPage(24);
|
||||
LCD_WipeLine(0);
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Screen 4"));
|
||||
LCD_Update();
|
||||
break;
|
||||
case 0x20:
|
||||
// LEFT
|
||||
LCD_LoadPage(8);
|
||||
LCD_WipeLine(0);
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Screen 2"));
|
||||
LCD_Update();
|
||||
break;
|
||||
case 0x10:
|
||||
// RIGHT
|
||||
LCD_LoadPage(16);
|
||||
LCD_WipeLine(0);
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Screen 3"));
|
||||
LCD_Update();
|
||||
break;
|
||||
case 0x08:
|
||||
// BUTTON
|
||||
loop = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// talking to the user
|
||||
LCD_Clear();
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Push button for\r\n"));
|
||||
LCD_PutString_P(PSTR("next demonstration.\r\n"));
|
||||
|
||||
wait_joy_button();
|
||||
}
|
||||
|
||||
void demo_backlight(void)
|
||||
{
|
||||
unsigned char led_active = 0x80;
|
||||
|
||||
// white backlight
|
||||
Backlight_LED(BL_RED_ON | BL_GREEN_ON | BL_BLUE_ON);
|
||||
|
||||
LCD_Clear();
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR("Use the joystick to\r\n"));
|
||||
LCD_PutString_P(PSTR("toggle the backlight\r\n"));
|
||||
LCD_PutString_P(PSTR("on the next screen."));
|
||||
LCD_Update();
|
||||
|
||||
wait_joy_button();
|
||||
|
||||
// no backlight
|
||||
Backlight_Off();
|
||||
|
||||
LCD_Clear();
|
||||
LCD_GotoXY(0, 0);
|
||||
LCD_PutString_P(PSTR(" Red \r\n"));
|
||||
LCD_PutString_P(PSTR(" \r\n"));
|
||||
LCD_PutString_P(PSTR(" \x18 \r\n"));
|
||||
LCD_PutString_P(PSTR(" Green \x1b Exit \x1a Blue \r\n"));
|
||||
LCD_PutString_P(PSTR(" \x19 \r\n"));
|
||||
LCD_PutString_P(PSTR(" \r\n"));
|
||||
LCD_PutString_P(PSTR(" Toggle \r\n"));
|
||||
LCD_PutString_P(PSTR(" all \x10\r\n"));
|
||||
LCD_Update();
|
||||
|
||||
while (!((PINA)&0x08))
|
||||
;
|
||||
_delay_ms(20);
|
||||
while (!((PINA)&0x08))
|
||||
;
|
||||
|
||||
while (led_active & 0x80)
|
||||
{
|
||||
|
||||
while ((~(PINA)&0xF8))
|
||||
; // Different to DMM 2012 and before
|
||||
_delay_ms(300);
|
||||
while (!((PINA)&0xF8))
|
||||
; // Different to DMM 2012 and before
|
||||
|
||||
switch ((~PINA) & 0xF8) // Different to DMM 2012 and before
|
||||
{
|
||||
case 0x08:
|
||||
// Button -> Exit
|
||||
led_active = 0x00;
|
||||
|
||||
break;
|
||||
case 0x80:
|
||||
// Up -> Toggle Red
|
||||
led_active ^= 0x01;
|
||||
break;
|
||||
case 0x20:
|
||||
// Up -> Toggle Green
|
||||
led_active ^= 0x04;
|
||||
break;
|
||||
case 0x10:
|
||||
// Up -> Toggle Blue
|
||||
led_active ^= 0x10;
|
||||
break;
|
||||
case 0x40:
|
||||
// Up -> Toggle All
|
||||
led_active ^= 0x15;
|
||||
break;
|
||||
}
|
||||
|
||||
while (!(PINA & 0xf8))
|
||||
;
|
||||
|
||||
Backlight_LED(led_active & 0x15);
|
||||
|
||||
PORTB &= ~0x0f;
|
||||
if (led_active & 0x01)
|
||||
PORTB |= 0x01;
|
||||
if (led_active & 0x04)
|
||||
PORTB |= 0x02;
|
||||
if (led_active & 0x10)
|
||||
PORTB |= 0x04;
|
||||
}
|
||||
|
||||
LCD_Clear();
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
#include <stdint.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <util/delay.h>
|
||||
#include <util/atomic.h>
|
||||
|
||||
#include "music.h"
|
||||
|
||||
/* Sine lookup table for the PWM generator (pp = 32) */
|
||||
static const PROGMEM unsigned char sine_lookup[]={
|
||||
0x10,0x13,0x16,0x19,0x1b,0x1d,0x1f,0x20,
|
||||
0x20,0x20,0x1f,0x1d,0x1b,0x19,0x16,0x13,
|
||||
0x10,0x0d,0x0a,0x07,0x05,0x03,0x01,0x00,
|
||||
0x00,0x00,0x01,0x03,0x05,0x07,0x0a,0x0d
|
||||
};
|
||||
|
||||
const MUSIC_Note MUSIC_Tetris[] = {
|
||||
{ MUSIC_E5, MUSIC_4 },
|
||||
{ MUSIC_B4, MUSIC_8 },
|
||||
{ MUSIC_C5, MUSIC_8 },
|
||||
{ MUSIC_D5, MUSIC_4 },
|
||||
{ MUSIC_C5, MUSIC_8 },
|
||||
{ MUSIC_D5, MUSIC_8 },
|
||||
|
||||
{ MUSIC_A4, MUSIC_4 },
|
||||
{ MUSIC_A4, MUSIC_8 },
|
||||
{ MUSIC_C5, MUSIC_8 },
|
||||
{ MUSIC_E5, MUSIC_4 },
|
||||
{ MUSIC_D5, MUSIC_8 },
|
||||
{ MUSIC_C5, MUSIC_8 },
|
||||
|
||||
{ MUSIC_B4, MUSIC_4 + MUSIC_8 },
|
||||
{ MUSIC_C5, MUSIC_8 },
|
||||
{ MUSIC_D5, MUSIC_4 },
|
||||
{ MUSIC_E5, MUSIC_4 },
|
||||
|
||||
{ MUSIC_C5, MUSIC_4 },
|
||||
{ MUSIC_A4, MUSIC_4 },
|
||||
{ MUSIC_A4, MUSIC_8 },
|
||||
|
||||
MUSIC_END };
|
||||
|
||||
static void delay_ms(uint16_t delay);
|
||||
static void pwm_init (void);
|
||||
static void pwm_deinit (void);
|
||||
static void pwm_gen(uint16_t tone, uint16_t periods);
|
||||
|
||||
void Music_PlayTrack (MUSIC_Track track)
|
||||
{
|
||||
pwm_init();
|
||||
|
||||
while (!MUSIC_IS_END(*track)) {
|
||||
|
||||
if (track->tone == 0) {
|
||||
delay_ms(track->duration);
|
||||
} else {
|
||||
uint16_t periods = (uint32_t)track->duration * (uint32_t)track->tone / 1000;
|
||||
pwm_gen(track->tone, periods);
|
||||
|
||||
delay_ms(MUSIC_32 / 2);
|
||||
}
|
||||
|
||||
++track;
|
||||
}
|
||||
|
||||
pwm_deinit();
|
||||
}
|
||||
|
||||
static void delay_ms(uint16_t delay)
|
||||
{
|
||||
while (delay--)
|
||||
_delay_ms(1);
|
||||
}
|
||||
|
||||
void pwm_init (void)
|
||||
{
|
||||
//setup PWM timer
|
||||
DDRD |= _BV(PIND5); // speaker pin => output
|
||||
TCCR1A = _BV(COM1A1) | _BV(COM1A0) | _BV(WGM10); //set on match
|
||||
TCCR1B = _BV(CS10) | _BV(WGM12); //fast PWM (8 bit), clk/1 source
|
||||
|
||||
//setup sample timer (CTC Mode)
|
||||
TCCR3A = 0;
|
||||
TCCR3B = _BV(CS30) | _BV(WGM32); // clk/1
|
||||
}
|
||||
|
||||
void pwm_deinit (void)
|
||||
{
|
||||
TCCR1A = 0;
|
||||
TCCR1B = 0;
|
||||
TCCR3A = 0;
|
||||
TCCR3B = 0;
|
||||
}
|
||||
|
||||
void pwm_gen(uint16_t tone, uint16_t periods)
|
||||
{
|
||||
//calculate single sine sample duration
|
||||
OCR3A = F_CPU / tone / sizeof(sine_lookup) - 1;
|
||||
|
||||
for (uint16_t period=0; period < periods; ++period) {
|
||||
for (uint8_t spl=0; spl < sizeof(sine_lookup); ++spl) {
|
||||
//wait for timer ready for next spl
|
||||
loop_until_bit_is_set(TIFR3, OCF1A);
|
||||
TIFR3 = _BV(OCF1A); //clear OCF
|
||||
|
||||
OCR1A = pgm_read_byte(sine_lookup + spl) + 0x70;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
|
||||
This directory is intended for PIO Unit Testing and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PIO Unit Testing:
|
||||
- https://docs.platformio.org/page/plus/unit-testing.html
|
||||
@ -0,0 +1,41 @@
|
||||
#include <stdint.h>
|
||||
#include <unity.h>
|
||||
#include <util/delay.h>
|
||||
#include "fifo.h"
|
||||
|
||||
#include "unittest_transport.h"
|
||||
|
||||
void test_fifo(void)
|
||||
{
|
||||
uint8_t buf[3];
|
||||
fifo_t f;
|
||||
fifo_init(&f, buf, sizeof(buf));
|
||||
fifo_put(&f, 0x11);
|
||||
fifo_put(&f, 0x22);
|
||||
fifo_put(&f, 0x33);
|
||||
|
||||
TEST_ASSERT_EQUAL(0x11, fifo_get_nowait(&f));
|
||||
TEST_ASSERT_EQUAL(0x22, fifo_get_nowait(&f));
|
||||
TEST_ASSERT_EQUAL(0x33, fifo_get_nowait(&f));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// NOTE!!! Wait for >2 secs
|
||||
// if board doesn't support software reset via Serial.DTR/RTS
|
||||
_delay_ms(2000);
|
||||
|
||||
DDRB |= 0x2;
|
||||
PORTB &= ~0x2;
|
||||
|
||||
UNITY_BEGIN(); // IMPORTANT LINE!
|
||||
RUN_TEST(test_fifo);
|
||||
UNITY_END(); // stop unit testing
|
||||
|
||||
PORTB |= 0x2;
|
||||
DDRB |= 0x4;
|
||||
PORTB &= ~0x4;
|
||||
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
#ifndef UNITTEST_TRANSPORT_H
|
||||
#define UNITTEST_TRANSPORT_H
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <stdint.h>
|
||||
#include "uart.h"
|
||||
|
||||
void unittest_uart_begin()
|
||||
{
|
||||
// Set Baudrate according to datasheet (16MHz -> 115200 Baud, U2X=1)
|
||||
UBRR0 = 0x10;
|
||||
UCSR0B |= (1<<TXEN0);
|
||||
|
||||
// Reset Complete-Flags
|
||||
UCSR0A = (1 << RXC0) | (1 << TXC0) | (1 << U2X0);
|
||||
}
|
||||
|
||||
void unittest_uart_putchar(char c)
|
||||
{
|
||||
loop_until_bit_is_set(UCSR0A, UDRE0);
|
||||
UDR0 = c;
|
||||
}
|
||||
|
||||
void unittest_uart_flush()
|
||||
{
|
||||
}
|
||||
|
||||
void unittest_uart_end()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,26 @@
|
||||
# For PCBs designed using KiCad: http://www.kicad-pcb.org/
|
||||
# Format documentation: http://kicad-pcb.org/help/file-formats/
|
||||
|
||||
# Temporary files
|
||||
*.000
|
||||
*.bak
|
||||
*.bck
|
||||
*.kicad_pcb-bak
|
||||
*.sch-bak
|
||||
*~
|
||||
_autosave-*
|
||||
*.tmp
|
||||
*-save.pro
|
||||
*-save.kicad_pcb
|
||||
fp-info-cache
|
||||
|
||||
# Netlist files (exported from Eeschema)
|
||||
*.net
|
||||
|
||||
# Autorouter files (exported from Pcbnew)
|
||||
*.dsn
|
||||
*.ses
|
||||
|
||||
# Exported BOM files
|
||||
#*.xml
|
||||
#*.csv
|
||||
@ -0,0 +1,4 @@
|
||||
# Projektspezifische Hardware
|
||||
|
||||
Die EDA/CAD-Dateien und BOM von Erweiterungsplatinen.
|
||||
Präferierte EDA-Software: [KiCad](https://kicad-pcb.org/).
|
||||
@ -0,0 +1,42 @@
|
||||
# DMM-Demo
|
||||
|
||||
Zum Flashen des Bootloaders und des Demonstrationsprojektes siehe
|
||||
[Firmware/README.md](https://teach.emg.ing.tu-bs.de/git/dmm/dmm-demo/-/tree/master/Firmware)
|
||||
|
||||
Die Dokumentation ist in diesem README zu hinterlegen. Das Einfügen von Bildern
|
||||
aus der Git-Repository ist erwünscht, diese sollten aber nicht zu groß sein.
|
||||
Bei der Struktur kann grob am nachfolgenden Template orientiert werden.
|
||||
|
||||
# Name des Projektes
|
||||
|
||||
Eigene Beschreibung des Projektes.
|
||||
|
||||
### Gruppenmitglieder
|
||||
* Dr.-Ing. Martin Oehler
|
||||
* Dipl.-Ing. Timo Klingeberg
|
||||
* Christof Wehrmann, M.Sc.
|
||||
* Ilya Elenskiy, M.Sc. (@ilyelens)
|
||||
|
||||
>>>
|
||||
**Aufgabenstellung des emg:**
|
||||
|
||||
Es ist mit dem DMM-Board XYZ zu implementieren...
|
||||
>>>
|
||||
|
||||
### Aufgabenverteilung
|
||||
@ilyelens: PlatformIO eindrichten, PWM-Demonstration.
|
||||
...
|
||||
|
||||
### Zeitplan
|
||||
...
|
||||
|
||||
## Dokumentation
|
||||
### Hardware
|
||||
Bauteilliste, Dokumentation, ...
|
||||
|
||||
### Software
|
||||
Dokumentation
|
||||
|
||||
## Ergebnisse
|
||||
|
||||
Bilder oder Auswertungen vom Tests, ggf. Link zum Video usw.
|
||||
@ -0,0 +1,3 @@
|
||||
# Präsentation
|
||||
|
||||
Hier soll die Präsentation (ggf. mit LaTeX Code) hinterlegt werden.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue