fixed crlf for project
This commit is contained in:
@@ -1,325 +1,325 @@
|
||||
:100000000C9463000C948B000C948B000C948B006C
|
||||
:100010000C948B000C948B000C948B000C948B0034
|
||||
:100020000C948B000C948B000C948B000C948B0024
|
||||
:100030000C948B000C948B000C948B000C948B0014
|
||||
:100040000C948F050C948B000C9423060C948B005D
|
||||
:100050000C948B000C948B000C948B000C948B00F4
|
||||
:100060000C948B000C948B000000000024002700EF
|
||||
:100070002A0000000000250028002B0000000000DE
|
||||
:1000800023002600290004040404040404040202DA
|
||||
:100090000202020203030303030301020408102007
|
||||
:1000A0004080010204081020010204081020000012
|
||||
:1000B0000007000201000003040600000000000029
|
||||
:1000C000000090043B0711241FBECFEFD8E0DEBF35
|
||||
:1000D000CDBF11E0A0E0B1E0E6EFF3E102C0059092
|
||||
:1000E0000D92AA33B107D9F712E0AAE3B1E001C03B
|
||||
:1000F0001D92A13FB107E1F710E0C6ECD0E004C0CB
|
||||
:100100002297FE010E94F509C23CD107C9F70E945F
|
||||
:100110001C060C94F9090C9400000F931F93CF93C5
|
||||
:10012000DF938C01EB01009731F46115710519F42F
|
||||
:1001300020E030E038C081E090E06EE070E00E94A6
|
||||
:10014000CB02FC019C01009771F180E8838320972A
|
||||
:1001500071F0D387C28781E883838091E702909111
|
||||
:10016000E802892B21F4F093E802E093E7020115FD
|
||||
:100170001105C9F011870087838182608383809194
|
||||
:10018000E9029091EA02892B71F4F093EA02E0937C
|
||||
:10019000E9028091EB029091EC02892B21F4F0931B
|
||||
:1001A000EC02E093EB02C901DF91CF911F910F9117
|
||||
:1001B0000895A0E0B0E0EFEDF0E00C94CC09FE0172
|
||||
:1001C0003596619171918091E9029091EA02AF01B7
|
||||
:1001D0000E94EE002096E2E00C94E809ABE0B0E06B
|
||||
:1001E000E4EFF0E00C94BC093C012B015A01FC0146
|
||||
:1001F00017821682838181FD03C06FEF7FEFC6C136
|
||||
:100200009AE0892E1E010894211C311CF3012381E0
|
||||
:10021000F20123FD859123FF81912F01882309F4A9
|
||||
:10022000B2C1853239F423FD859123FF81912F01DD
|
||||
:10023000853229F490E0B3010E940604E7CF982F9D
|
||||
:10024000FF24EE249924FFE1FF15D0F09B3269F0E2
|
||||
:100250009C3228F4903259F0933291F40EC09D32C2
|
||||
:1002600049F0903369F441E024C052E0F52A84E07B
|
||||
:10027000F82A28C098E0F92A25C0E0E1FE2A22C029
|
||||
:10028000F7FC29C0892F80538A3070F4F6FE05C030
|
||||
:10029000989C902C1124980E15C0E89CE02C1124F9
|
||||
:1002A000E80EF0E2FF2A0EC09E3229F4F6FC6BC184
|
||||
:1002B00040E4F42A07C09C3619F450E8F52A02C03D
|
||||
:1002C000983649F4F20123FD959123FF91912F0176
|
||||
:1002D000992309F0B8CF892F8554833018F08052C4
|
||||
:1002E000833038F444E050E0A40EB51E5FE3598338
|
||||
:1002F0000FC0933631F0933779F0933509F056C03B
|
||||
:1003000020C0F5018081898342E050E0A40EB51E33
|
||||
:10031000610101E010E012C0F501C080D180F6FC5F
|
||||
:1003200003C06FEF7FEF02C0692D70E042E050E044
|
||||
:10033000A40EB51EC6010E94FB038C015FE7F522E7
|
||||
:1003400014C0F501C080D180F6FC03C06FEF7FEFD1
|
||||
:1003500002C0692D70E042E050E0A40EB51EC60157
|
||||
:100360000E94E9038C0150E8F52AF3FE07C01AC089
|
||||
:1003700080E290E0B3010E940604EA948E2D90E0A2
|
||||
:1003800008171907A8F30EC0F601F7FC8591F7FED0
|
||||
:1003900081916F0190E0B3010E940604E110EA949C
|
||||
:1003A000015010400115110579F7EAC0943611F09B
|
||||
:1003B000993669F5F7FE08C0F50120813181428147
|
||||
:1003C000538184E090E00AC0F501808191819C0115
|
||||
:1003D000442737FD4095542F82E090E0A80EB91EC7
|
||||
:1003E0009FE6F92257FF09C0509540953095219519
|
||||
:1003F0003F4F4F4F5F4FE0E8FE2ACA01B901A1010C
|
||||
:100400002AE030E00E943204D82ED21840C095373E
|
||||
:1004100029F41F2D1F7E2AE030E01DC01F2D197FFB
|
||||
:100420009F3661F0903720F4983509F0ACC00FC0CA
|
||||
:10043000903739F0983709F0A6C004C028E030E0C2
|
||||
:100440000AC0106114FD146020E130E004C014FD06
|
||||
:10045000166020E132E017FF08C0F501608171816C
|
||||
:100460008281938144E050E008C0F5018081918150
|
||||
:10047000BC0180E090E042E050E0A40EB51EA10176
|
||||
:100480000E943204D82ED2188FE7F82EF122F6FE01
|
||||
:100490000BC05EEFF522D91438F4F4FE07C0F2FC6D
|
||||
:1004A00005C08FEEF82202C01D2D01C0192DF4FEEB
|
||||
:1004B0000DC0FE01ED0DF11D8081803319F499EE20
|
||||
:1004C000F92208C01F5FF2FE05C003C08F2D867899
|
||||
:1004D00009F01F5F0F2DF3FC14C0F0FE0FC01E15B6
|
||||
:1004E00010F09D2C0BC09D2C9E0C911A1E2D06C049
|
||||
:1004F00080E290E0B3010E9406041F5F1E15C0F366
|
||||
:1005000004C01E1510F4E11A01C0EE2404FF0FC050
|
||||
:1005100080E390E0B3010E94060402FF1DC001FDCC
|
||||
:1005200003C088E790E00EC088E590E00BC0802F04
|
||||
:10053000867891F001FF02C08BE201C080E2F7FCF7
|
||||
:100540008DE290E0B3010E94060406C080E390E0D3
|
||||
:10055000B3010E9406049A94D914C0F3DA94F1010D
|
||||
:10056000ED0DF11D808190E0B3010E940604DD20B5
|
||||
:10057000A9F706C080E290E0B3010E940604EA9465
|
||||
:10058000EE20C1F743CEF30166817781CB012B9634
|
||||
:10059000E2E10C94D8090F931F93CF93DF93689FE8
|
||||
:1005A0008001699F100D789F100D1124C8010E94D1
|
||||
:1005B000E702EC01009729F060E070E0A8010E94DA
|
||||
:1005C000F403CE01DF91CF911F910F910895CF9346
|
||||
:1005D000DF93BC018230910510F462E070E0A091DD
|
||||
:1005E000EF02B091F002ED01E0E0F0E040E050E019
|
||||
:1005F00021C0888199818617970769F48A819B8138
|
||||
:10060000309719F09383828304C09093F002809313
|
||||
:10061000EF02FE0134C06817790738F4411551051F
|
||||
:1006200019F08417950708F4AC01FE018A819B81BB
|
||||
:100630009C01E9012097E9F641155105A9F1CA018C
|
||||
:10064000861B970B049708F4BA01E0E0F0E02AC09B
|
||||
:100650008D919C91119784179507F9F4641775078C
|
||||
:1006600081F412968D919C911397309719F0938392
|
||||
:10067000828304C09093F0028093EF02FD013296D2
|
||||
:100680004CC0CA01861B970BFD01E80FF91F61934F
|
||||
:10069000719302978D939C9340C0FD018281938159
|
||||
:1006A0009C01D9011097A1F68091ED029091EE0284
|
||||
:1006B000892B41F480912301909124019093EE02C3
|
||||
:1006C0008093ED024091250150912601411551057D
|
||||
:1006D00041F44DB75EB78091210190912201481BF2
|
||||
:1006E000590B2091ED023091EE02CA01821B930B4F
|
||||
:1006F0008617970780F0AB014E5F5F4F8417950711
|
||||
:1007000050F0420F531F5093EE024093ED02F90157
|
||||
:100710006193719302C0E0E0F0E0CF01DF91CF91EF
|
||||
:100720000895CF93DF93009709F450C0EC0122970E
|
||||
:100730001B821A82A091EF02B091F002109709F18A
|
||||
:1007400040E050E0AC17BD0708F1BB83AA83FE016F
|
||||
:1007500021913191E20FF31FAE17BF0779F48D910C
|
||||
:100760009C911197280F391F2E5F3F4F39832883A3
|
||||
:1007700012968D919C9113979B838A834115510505
|
||||
:1007800071F4D093F002C093EF0220C012968D91C5
|
||||
:100790009C911397AD01009711F0DC01D3CFFA01C2
|
||||
:1007A000D383C28321913191E20FF31FCE17DF076C
|
||||
:1007B00069F488819981280F391F2E5F3F4FFA0114
|
||||
:1007C000318320838A819B8193838283DF91CF91C0
|
||||
:1007D0000895FC010590615070400110D8F7809594
|
||||
:1007E00090958E0F9F1F0895DC0101C06D934150BD
|
||||
:1007F0005040E0F70895FC016150704001900110F5
|
||||
:10080000D8F7809590958E0F9F1F08950F931F9393
|
||||
:10081000CF93DF938C01EB018B8181FF1BC082FFA3
|
||||
:100820000DC02E813F818C819D812817390764F48A
|
||||
:10083000E881F9810193F983E88306C0E885F985A9
|
||||
:10084000802F0995892B31F48E819F8101969F839A
|
||||
:100850008E8302C00FEF1FEFC801DF91CF911F9170
|
||||
:100860000F910895FA01AA27283051F1203181F122
|
||||
:10087000E8946F936E7F6E5F7F4F8F4F9F4FAF4FA8
|
||||
:10088000B1E03ED0B4E03CD0670F781F891F9A1FBB
|
||||
:10089000A11D680F791F8A1F911DA11D6A0F711D6F
|
||||
:1008A000811D911DA11D20D009F468943F912AE07B
|
||||
:1008B000269F11243019305D3193DEF6CF01089563
|
||||
:1008C000462F4770405D4193B3E00FD0C9F7F6CF94
|
||||
:1008D000462F4F70405D4A3318F0495D31FD40525C
|
||||
:1008E000419302D0A9F7EACFB4E0A69597958795F2
|
||||
:1008F00077956795BA95C9F70097610571050895D1
|
||||
:100900009B01AC010A2E069457954795379527957C
|
||||
:10091000BA95C9F7620F731F841F951FA01D089514
|
||||
:100920008AE391E068E049E00E9475070895FF922C
|
||||
:100930000F931F93CF93DF9380E8E7E4F1E0DF01AB
|
||||
:100940001D928A95E9F704E610E021C08AE391E060
|
||||
:100950006F2D0E94F2078AE391E00E94840880E8EC
|
||||
:1009600090E00E94D7058AE391E00E947C078AE329
|
||||
:1009700091E00E944608882329F088819981019698
|
||||
:10098000998388832297FA94BFEFFB16F9F60150FA
|
||||
:100990001040EFEF0F3F1E0729F0C5E4D2E08FE7CC
|
||||
:1009A000F82ED4CFC7E4D1E000E011E000D000D0B1
|
||||
:1009B000ADB7BEB712961C930E931197899199917A
|
||||
:1009C0008F70907014969C938E9313970E94D90009
|
||||
:1009D0000F900F900F900F90B2E0C734DB0731F704
|
||||
:1009E00000D083E091E0EDB7FEB7928381830E944F
|
||||
:1009F000D9000F900F90DF91CF911F910F91FF9031
|
||||
:100A0000089580E895E060E070E00E948D00089510
|
||||
:100A10000F931F93CF93DF9384ED92E040E051EE6C
|
||||
:100A200060E070E00E9454060E94010500D086E05C
|
||||
:100A300091E0EDB7FEB7928381830E94D9000F90B9
|
||||
:100A40000F908AE391E00E944B088AE391E060E016
|
||||
:100A50000E94E8078AE391E00E9484088AE391E01B
|
||||
:100A60000E947C07C0E0D0E000E011E000D000D0A0
|
||||
:100A7000EDB7FEB712830183CE0124E095958795EB
|
||||
:100A80002A95E1F7948383830E94D90021960F90E1
|
||||
:100A90000F900F900F90C038D10541F700D083E040
|
||||
:100AA00091E0EDB7FEB7928381830E94D900C0E048
|
||||
:100AB000D0E00F900F9000D000D0EDB7FEB70183CB
|
||||
:100AC0001283CE018F709070948383830E94D9002B
|
||||
:100AD00021960F900F900F900F90C038D10559F7C5
|
||||
:100AE00000D083E091E0EDB7FEB7928381830E944E
|
||||
:100AF000D9000F900F90DF91CF911F910F91089522
|
||||
:100B00000F931F93082F84ED92E0602F0E94280717
|
||||
:100B1000112707FD1095C8011F910F9108951F928D
|
||||
:100B20000F920FB60F9211242F933F938F939F93A1
|
||||
:100B3000AF93BF9380914B0290914C02A0914D02D4
|
||||
:100B4000B0914E0230914F020196A11DB11D232F8D
|
||||
:100B50002D5F2D3720F02D570196A11DB11D20933B
|
||||
:100B60004F0280934B0290934C02A0934D02B0939E
|
||||
:100B70004E028091470290914802A0914902B091A3
|
||||
:100B80004A020196A11DB11D80934702909348022D
|
||||
:100B9000A0934902B0934A02BF91AF919F918F9168
|
||||
:100BA0003F912F910F900FBE0F901F9018950197B6
|
||||
:100BB00039F0880F991F880F991F02970197F1F755
|
||||
:100BC0000895789484B5826084BD84B5816084BDC5
|
||||
:100BD00085B5826085BD85B5816085BDEEE6F0E0B6
|
||||
:100BE000808181608083E1E8F0E010828081826012
|
||||
:100BF0008083808181608083E0E8F0E08081816093
|
||||
:100C00008083E1EBF0E0808184608083E0EBF0E0C2
|
||||
:100C1000808181608083EAE7F0E080818460808366
|
||||
:100C20008081826080838081816080838081806810
|
||||
:100C300080831092C10008950E94E1050E9408057A
|
||||
:100C40000E949704FDCF1F920F920FB60F921124AE
|
||||
:100C50002F933F934F938F939F93EF93FF934091E5
|
||||
:100C6000C600E091D002F091D10231969F012F771A
|
||||
:100C7000307031978091D2029091D30228173907B2
|
||||
:100C800039F0E05BFD4F40833093D1022093D002D6
|
||||
:100C9000FF91EF919F918F914F913F912F910F90E5
|
||||
:100CA0000FBE0F901F901895AF92BF92DF92EF92F8
|
||||
:100CB000FF920F931F93CF93DF93EC017A018B0187
|
||||
:100CC000DD24403081EE580780E0680780E0780737
|
||||
:100CD00011F0DD24D39491E0A92EB12CE885F9859B
|
||||
:100CE000DD2069F0C5010A8802C0880F991F0A94A7
|
||||
:100CF000E2F7808360E079E08DE390E005C0108248
|
||||
:100D000060E874E88EE190E0A80197010E949A09DA
|
||||
:100D10002150304040405040569547953795279593
|
||||
:100D200080E12030380720F0DD2011F0DD24D6CF1F
|
||||
:100D3000EC81FD813083EE81FF812083EA85FB8594
|
||||
:100D4000208141E050E0CA010E8402C0880F991F43
|
||||
:100D50000A94E2F7282B2083EA85FB852081CA01CB
|
||||
:100D60000F8402C0880F991F0A94E2F7282B208372
|
||||
:100D7000EA85FB858081088802C0440F551F0A94CC
|
||||
:100D8000E2F7842B8083DF91CF911F910F91FF9029
|
||||
:100D9000EF90DF90BF90AF900895DC011296ED9137
|
||||
:100DA000FC911397E058FF4F2191319180819181FF
|
||||
:100DB000281B390B2F773070C9010895DC0112967A
|
||||
:100DC000ED91FC911397EE57FF4F20813181929165
|
||||
:100DD0008291E058F0408217930719F42FEF3FEF0C
|
||||
:100DE00005C0E20FF31F8081282F30E0C90108956C
|
||||
:100DF000DC011296ED91FC911397DF01AE57BF4FC6
|
||||
:100E00002D913C911197E058FF4F80819181E058DE
|
||||
:100E1000F0408217930719F42FEF3FEF0BC0E20F5A
|
||||
:100E2000F31F80812F5F3F4F2F7730702D933C93BE
|
||||
:100E3000282F30E0C9010895DC011296ED91FC9154
|
||||
:100E40001397EE57FF4F808191819293829308957B
|
||||
:100E5000FC01A085B18521898C9190E0022E02C011
|
||||
:100E6000959587950A94E2F780FFF6CF0484F5857F
|
||||
:100E7000E02D608308958BE291E09093D5028093FA
|
||||
:100E8000D40280E592E09093D7028093D60285EC5D
|
||||
:100E900090E09093D9028093D80284EC90E09093F4
|
||||
:100EA000DB028093DA0280EC90E09093DD02809385
|
||||
:100EB000DC0281EC90E09093DF028093DE0286EC0E
|
||||
:100EC00090E09093E1028093E00284E08093E2025C
|
||||
:100ED00083E08093E30287E08093E40285E08093DF
|
||||
:100EE000E50281E08093E6020895FC01608341837E
|
||||
:100EF00080E2828313820895FC01808160E00E9479
|
||||
:100F0000CD080895FF920F931F938C01F62E80E079
|
||||
:100F10000E94650985E00E946A09F80181816F2DB0
|
||||
:100F20000E94CD081F910F91FF9008951F93CF93BA
|
||||
:100F3000DF93EC0160E070E00E94820781EE8EBDDD
|
||||
:100F40000DB407FEFDCF1EB5CE0161E070E00E943A
|
||||
:100F50008207812FDF91CF911F9108951F93CF9327
|
||||
:100F6000DF93EC0160E070E00E94820782EE8EBDAC
|
||||
:100F70000DB407FEFDCF1EB5CE0161E070E00E940A
|
||||
:100F80008207812FDF91CF911F9108950F931F93B7
|
||||
:100F9000CF93DF93EC01162F042F60E070E00E94E6
|
||||
:100FA00082071F7110621EBD0DB407FEFDCF1EB576
|
||||
:100FB0000EBD0DB407FEFDCF8EB5CE0161E070E031
|
||||
:100FC0000E948207812FDF91CF911F910F91089589
|
||||
:100FD000662319F061E04FE302C061E040E00E9447
|
||||
:100FE000C6070895462F603808F04FE765E00E9475
|
||||
:100FF000C6070895EF92FF920F931F93CF93DF934D
|
||||
:101000007C01162FEA01022F60E070E00E94820747
|
||||
:101010001F7110621EBD0DB407FEFDCF1EB508C0C6
|
||||
:1010200088818EBD0DB407FEFDCF21968EB501508F
|
||||
:101030000023B1F7C70161E070E00E948207812FB1
|
||||
:10104000DF91CF911F910F91FF90EF9008951F9323
|
||||
:10105000CF93DF93EC01162F60E070E00E948207CF
|
||||
:101060001F711EBD0DB407FEFDCF8EB58FEF8EBD77
|
||||
:101070000DB407FEFDCF1EB5CE0161E070E00E9409
|
||||
:101080008207812FDF91CF911F91089569E00E941F
|
||||
:101090002708817008950F931F938C01FC018081B4
|
||||
:1010A00061E00E94A708F801818161E00E94A70821
|
||||
:1010B000F801808160E00E94CD08C80161E070E025
|
||||
:1010C0000E9482070E947B0981E00E945C0980E007
|
||||
:1010D0000E94650985E00E946A09C80164E04FEF3B
|
||||
:1010E0000E94C607C80167E040E70E94C607C80122
|
||||
:1010F0000E94AE07C8010E949607C80161E00E94E5
|
||||
:10110000F2071F910F9108950F931F938C0160E0D8
|
||||
:101110004BE00E94C607C80167E040E70E94C6078F
|
||||
:10112000A8014B5F5F4FC8016AE025E00E94FA0703
|
||||
:10113000C8010E94AE07F801808161E00E94CD08DD
|
||||
:1011400082E890E00E94D7051F910F910895482FE3
|
||||
:1011500050E0CA0186569F4FFC0124914A575F4FC9
|
||||
:10116000FA0184918823C1F0E82FF0E0EE0FFF1F11
|
||||
:10117000E859FF4FA591B491662341F49FB7F894C5
|
||||
:101180008C91209582238C939FBF08959FB7F894EC
|
||||
:101190008C91822B8C939FBF0895482F50E0CA01F9
|
||||
:1011A00082559F4FFC012491CA0186569F4FFC0136
|
||||
:1011B00034914A575F4FFA019491992309F444C03E
|
||||
:1011C000222351F1233071F0243028F42130A1F092
|
||||
:1011D000223011F514C02630B1F02730C1F0243090
|
||||
:1011E000D9F404C0809180008F7703C08091800083
|
||||
:1011F0008F7D8093800010C084B58F7702C084B546
|
||||
:101200008F7D84BD09C08091B0008F7703C080912D
|
||||
:10121000B0008F7D8093B000E92FF0E0EE0FFF1F4C
|
||||
:10122000EE58FF4FA591B491662341F49FB7F8940F
|
||||
:101230008C91309583238C939FBF08959FB7F8942A
|
||||
:101240008C91832B8C939FBF08950F931F93CF9303
|
||||
:10125000DF938C01EB0109C02196D801ED91FC913F
|
||||
:101260000190F081E02DC801099568816623A1F7FE
|
||||
:10127000DF91CF911F910F910895EF92FF920F93FD
|
||||
:101280001F93CF93DF938C017B01EA010CC0D70140
|
||||
:101290006D917D01D801ED91FC910190F081E02DDF
|
||||
:1012A000C80109952197209791F7DF91CF911F9160
|
||||
:1012B0000F91FF90EF900895882319F48CB5806208
|
||||
:1012C00002C08CB58F7D8CBD08959CB5937F982B03
|
||||
:1012D0009CBD08952CB5382F33702C7F322B3CBD2C
|
||||
:1012E0002DB590E0959587959595879581702E7F82
|
||||
:1012F000822B8DBD08958DE061E00E94A7088BE0F0
|
||||
:1013000061E00E94A7088AE061E00E94A7088DE0E2
|
||||
:1013100060E00E94CD088BE060E00E94CD088AE08A
|
||||
:1013200061E00E94CD088CB580618CBD8CB5806475
|
||||
:101330008CBD0895A1E21A2EAA1BBB1BFD010DC096
|
||||
:10134000AA1FBB1FEE1FFF1FA217B307E407F50775
|
||||
:1013500020F0A21BB30BE40BF50B661F771F881F51
|
||||
:10136000991F1A9469F760957095809590959B01E7
|
||||
:10137000AC01BD01CF0108952F923F924F925F9231
|
||||
:101380006F927F928F929F92AF92BF92CF92DF9295
|
||||
:10139000EF92FF920F931F93CF93DF93CDB7DEB7FA
|
||||
:1013A000CA1BDB0B0FB6F894DEBF0FBECDBF09948E
|
||||
:1013B0002A88398848885F846E847D848C849B84E5
|
||||
:1013C000AA84B984C884DF80EE80FD800C811B81F3
|
||||
:1013D000AA81B981CE0FD11D0FB6F894DEBF0FBE22
|
||||
:1013E000CDBFED010895EE0FFF1F0590F491E02DA4
|
||||
:0613F0000994F894FFCF00
|
||||
:1013F6002578000A0D000A0D524632342F657861B1
|
||||
:101406006D706C65732F7363616E6E65722F0A0D56
|
||||
:10141600002000F102000000000000280725093D19
|
||||
:0A14260009CD06F806DE061C0700DB
|
||||
:00000001FF
|
||||
:100000000C9463000C948B000C948B000C948B006C
|
||||
:100010000C948B000C948B000C948B000C948B0034
|
||||
:100020000C948B000C948B000C948B000C948B0024
|
||||
:100030000C948B000C948B000C948B000C948B0014
|
||||
:100040000C948F050C948B000C9423060C948B005D
|
||||
:100050000C948B000C948B000C948B000C948B00F4
|
||||
:100060000C948B000C948B000000000024002700EF
|
||||
:100070002A0000000000250028002B0000000000DE
|
||||
:1000800023002600290004040404040404040202DA
|
||||
:100090000202020203030303030301020408102007
|
||||
:1000A0004080010204081020010204081020000012
|
||||
:1000B0000007000201000003040600000000000029
|
||||
:1000C000000090043B0711241FBECFEFD8E0DEBF35
|
||||
:1000D000CDBF11E0A0E0B1E0E6EFF3E102C0059092
|
||||
:1000E0000D92AA33B107D9F712E0AAE3B1E001C03B
|
||||
:1000F0001D92A13FB107E1F710E0C6ECD0E004C0CB
|
||||
:100100002297FE010E94F509C23CD107C9F70E945F
|
||||
:100110001C060C94F9090C9400000F931F93CF93C5
|
||||
:10012000DF938C01EB01009731F46115710519F42F
|
||||
:1001300020E030E038C081E090E06EE070E00E94A6
|
||||
:10014000CB02FC019C01009771F180E8838320972A
|
||||
:1001500071F0D387C28781E883838091E702909111
|
||||
:10016000E802892B21F4F093E802E093E7020115FD
|
||||
:100170001105C9F011870087838182608383809194
|
||||
:10018000E9029091EA02892B71F4F093EA02E0937C
|
||||
:10019000E9028091EB029091EC02892B21F4F0931B
|
||||
:1001A000EC02E093EB02C901DF91CF911F910F9117
|
||||
:1001B0000895A0E0B0E0EFEDF0E00C94CC09FE0172
|
||||
:1001C0003596619171918091E9029091EA02AF01B7
|
||||
:1001D0000E94EE002096E2E00C94E809ABE0B0E06B
|
||||
:1001E000E4EFF0E00C94BC093C012B015A01FC0146
|
||||
:1001F00017821682838181FD03C06FEF7FEFC6C136
|
||||
:100200009AE0892E1E010894211C311CF3012381E0
|
||||
:10021000F20123FD859123FF81912F01882309F4A9
|
||||
:10022000B2C1853239F423FD859123FF81912F01DD
|
||||
:10023000853229F490E0B3010E940604E7CF982F9D
|
||||
:10024000FF24EE249924FFE1FF15D0F09B3269F0E2
|
||||
:100250009C3228F4903259F0933291F40EC09D32C2
|
||||
:1002600049F0903369F441E024C052E0F52A84E07B
|
||||
:10027000F82A28C098E0F92A25C0E0E1FE2A22C029
|
||||
:10028000F7FC29C0892F80538A3070F4F6FE05C030
|
||||
:10029000989C902C1124980E15C0E89CE02C1124F9
|
||||
:1002A000E80EF0E2FF2A0EC09E3229F4F6FC6BC184
|
||||
:1002B00040E4F42A07C09C3619F450E8F52A02C03D
|
||||
:1002C000983649F4F20123FD959123FF91912F0176
|
||||
:1002D000992309F0B8CF892F8554833018F08052C4
|
||||
:1002E000833038F444E050E0A40EB51E5FE3598338
|
||||
:1002F0000FC0933631F0933779F0933509F056C03B
|
||||
:1003000020C0F5018081898342E050E0A40EB51E33
|
||||
:10031000610101E010E012C0F501C080D180F6FC5F
|
||||
:1003200003C06FEF7FEF02C0692D70E042E050E044
|
||||
:10033000A40EB51EC6010E94FB038C015FE7F522E7
|
||||
:1003400014C0F501C080D180F6FC03C06FEF7FEFD1
|
||||
:1003500002C0692D70E042E050E0A40EB51EC60157
|
||||
:100360000E94E9038C0150E8F52AF3FE07C01AC089
|
||||
:1003700080E290E0B3010E940604EA948E2D90E0A2
|
||||
:1003800008171907A8F30EC0F601F7FC8591F7FED0
|
||||
:1003900081916F0190E0B3010E940604E110EA949C
|
||||
:1003A000015010400115110579F7EAC0943611F09B
|
||||
:1003B000993669F5F7FE08C0F50120813181428147
|
||||
:1003C000538184E090E00AC0F501808191819C0115
|
||||
:1003D000442737FD4095542F82E090E0A80EB91EC7
|
||||
:1003E0009FE6F92257FF09C0509540953095219519
|
||||
:1003F0003F4F4F4F5F4FE0E8FE2ACA01B901A1010C
|
||||
:100400002AE030E00E943204D82ED21840C095373E
|
||||
:1004100029F41F2D1F7E2AE030E01DC01F2D197FFB
|
||||
:100420009F3661F0903720F4983509F0ACC00FC0CA
|
||||
:10043000903739F0983709F0A6C004C028E030E0C2
|
||||
:100440000AC0106114FD146020E130E004C014FD06
|
||||
:10045000166020E132E017FF08C0F501608171816C
|
||||
:100460008281938144E050E008C0F5018081918150
|
||||
:10047000BC0180E090E042E050E0A40EB51EA10176
|
||||
:100480000E943204D82ED2188FE7F82EF122F6FE01
|
||||
:100490000BC05EEFF522D91438F4F4FE07C0F2FC6D
|
||||
:1004A00005C08FEEF82202C01D2D01C0192DF4FEEB
|
||||
:1004B0000DC0FE01ED0DF11D8081803319F499EE20
|
||||
:1004C000F92208C01F5FF2FE05C003C08F2D867899
|
||||
:1004D00009F01F5F0F2DF3FC14C0F0FE0FC01E15B6
|
||||
:1004E00010F09D2C0BC09D2C9E0C911A1E2D06C049
|
||||
:1004F00080E290E0B3010E9406041F5F1E15C0F366
|
||||
:1005000004C01E1510F4E11A01C0EE2404FF0FC050
|
||||
:1005100080E390E0B3010E94060402FF1DC001FDCC
|
||||
:1005200003C088E790E00EC088E590E00BC0802F04
|
||||
:10053000867891F001FF02C08BE201C080E2F7FCF7
|
||||
:100540008DE290E0B3010E94060406C080E390E0D3
|
||||
:10055000B3010E9406049A94D914C0F3DA94F1010D
|
||||
:10056000ED0DF11D808190E0B3010E940604DD20B5
|
||||
:10057000A9F706C080E290E0B3010E940604EA9465
|
||||
:10058000EE20C1F743CEF30166817781CB012B9634
|
||||
:10059000E2E10C94D8090F931F93CF93DF93689FE8
|
||||
:1005A0008001699F100D789F100D1124C8010E94D1
|
||||
:1005B000E702EC01009729F060E070E0A8010E94DA
|
||||
:1005C000F403CE01DF91CF911F910F910895CF9346
|
||||
:1005D000DF93BC018230910510F462E070E0A091DD
|
||||
:1005E000EF02B091F002ED01E0E0F0E040E050E019
|
||||
:1005F00021C0888199818617970769F48A819B8138
|
||||
:10060000309719F09383828304C09093F002809313
|
||||
:10061000EF02FE0134C06817790738F4411551051F
|
||||
:1006200019F08417950708F4AC01FE018A819B81BB
|
||||
:100630009C01E9012097E9F641155105A9F1CA018C
|
||||
:10064000861B970B049708F4BA01E0E0F0E02AC09B
|
||||
:100650008D919C91119784179507F9F4641775078C
|
||||
:1006600081F412968D919C911397309719F0938392
|
||||
:10067000828304C09093F0028093EF02FD013296D2
|
||||
:100680004CC0CA01861B970BFD01E80FF91F61934F
|
||||
:10069000719302978D939C9340C0FD018281938159
|
||||
:1006A0009C01D9011097A1F68091ED029091EE0284
|
||||
:1006B000892B41F480912301909124019093EE02C3
|
||||
:1006C0008093ED024091250150912601411551057D
|
||||
:1006D00041F44DB75EB78091210190912201481BF2
|
||||
:1006E000590B2091ED023091EE02CA01821B930B4F
|
||||
:1006F0008617970780F0AB014E5F5F4F8417950711
|
||||
:1007000050F0420F531F5093EE024093ED02F90157
|
||||
:100710006193719302C0E0E0F0E0CF01DF91CF91EF
|
||||
:100720000895CF93DF93009709F450C0EC0122970E
|
||||
:100730001B821A82A091EF02B091F002109709F18A
|
||||
:1007400040E050E0AC17BD0708F1BB83AA83FE016F
|
||||
:1007500021913191E20FF31FAE17BF0779F48D910C
|
||||
:100760009C911197280F391F2E5F3F4F39832883A3
|
||||
:1007700012968D919C9113979B838A834115510505
|
||||
:1007800071F4D093F002C093EF0220C012968D91C5
|
||||
:100790009C911397AD01009711F0DC01D3CFFA01C2
|
||||
:1007A000D383C28321913191E20FF31FCE17DF076C
|
||||
:1007B00069F488819981280F391F2E5F3F4FFA0114
|
||||
:1007C000318320838A819B8193838283DF91CF91C0
|
||||
:1007D0000895FC010590615070400110D8F7809594
|
||||
:1007E00090958E0F9F1F0895DC0101C06D934150BD
|
||||
:1007F0005040E0F70895FC016150704001900110F5
|
||||
:10080000D8F7809590958E0F9F1F08950F931F9393
|
||||
:10081000CF93DF938C01EB018B8181FF1BC082FFA3
|
||||
:100820000DC02E813F818C819D812817390764F48A
|
||||
:10083000E881F9810193F983E88306C0E885F985A9
|
||||
:10084000802F0995892B31F48E819F8101969F839A
|
||||
:100850008E8302C00FEF1FEFC801DF91CF911F9170
|
||||
:100860000F910895FA01AA27283051F1203181F122
|
||||
:10087000E8946F936E7F6E5F7F4F8F4F9F4FAF4FA8
|
||||
:10088000B1E03ED0B4E03CD0670F781F891F9A1FBB
|
||||
:10089000A11D680F791F8A1F911DA11D6A0F711D6F
|
||||
:1008A000811D911DA11D20D009F468943F912AE07B
|
||||
:1008B000269F11243019305D3193DEF6CF01089563
|
||||
:1008C000462F4770405D4193B3E00FD0C9F7F6CF94
|
||||
:1008D000462F4F70405D4A3318F0495D31FD40525C
|
||||
:1008E000419302D0A9F7EACFB4E0A69597958795F2
|
||||
:1008F00077956795BA95C9F70097610571050895D1
|
||||
:100900009B01AC010A2E069457954795379527957C
|
||||
:10091000BA95C9F7620F731F841F951FA01D089514
|
||||
:100920008AE391E068E049E00E9475070895FF922C
|
||||
:100930000F931F93CF93DF9380E8E7E4F1E0DF01AB
|
||||
:100940001D928A95E9F704E610E021C08AE391E060
|
||||
:100950006F2D0E94F2078AE391E00E94840880E8EC
|
||||
:1009600090E00E94D7058AE391E00E947C078AE329
|
||||
:1009700091E00E944608882329F088819981019698
|
||||
:10098000998388832297FA94BFEFFB16F9F60150FA
|
||||
:100990001040EFEF0F3F1E0729F0C5E4D2E08FE7CC
|
||||
:1009A000F82ED4CFC7E4D1E000E011E000D000D0B1
|
||||
:1009B000ADB7BEB712961C930E931197899199917A
|
||||
:1009C0008F70907014969C938E9313970E94D90009
|
||||
:1009D0000F900F900F900F90B2E0C734DB0731F704
|
||||
:1009E00000D083E091E0EDB7FEB7928381830E944F
|
||||
:1009F000D9000F900F90DF91CF911F910F91FF9031
|
||||
:100A0000089580E895E060E070E00E948D00089510
|
||||
:100A10000F931F93CF93DF9384ED92E040E051EE6C
|
||||
:100A200060E070E00E9454060E94010500D086E05C
|
||||
:100A300091E0EDB7FEB7928381830E94D9000F90B9
|
||||
:100A40000F908AE391E00E944B088AE391E060E016
|
||||
:100A50000E94E8078AE391E00E9484088AE391E01B
|
||||
:100A60000E947C07C0E0D0E000E011E000D000D0A0
|
||||
:100A7000EDB7FEB712830183CE0124E095958795EB
|
||||
:100A80002A95E1F7948383830E94D90021960F90E1
|
||||
:100A90000F900F900F90C038D10541F700D083E040
|
||||
:100AA00091E0EDB7FEB7928381830E94D900C0E048
|
||||
:100AB000D0E00F900F9000D000D0EDB7FEB70183CB
|
||||
:100AC0001283CE018F709070948383830E94D9002B
|
||||
:100AD00021960F900F900F900F90C038D10559F7C5
|
||||
:100AE00000D083E091E0EDB7FEB7928381830E944E
|
||||
:100AF000D9000F900F90DF91CF911F910F91089522
|
||||
:100B00000F931F93082F84ED92E0602F0E94280717
|
||||
:100B1000112707FD1095C8011F910F9108951F928D
|
||||
:100B20000F920FB60F9211242F933F938F939F93A1
|
||||
:100B3000AF93BF9380914B0290914C02A0914D02D4
|
||||
:100B4000B0914E0230914F020196A11DB11D232F8D
|
||||
:100B50002D5F2D3720F02D570196A11DB11D20933B
|
||||
:100B60004F0280934B0290934C02A0934D02B0939E
|
||||
:100B70004E028091470290914802A0914902B091A3
|
||||
:100B80004A020196A11DB11D80934702909348022D
|
||||
:100B9000A0934902B0934A02BF91AF919F918F9168
|
||||
:100BA0003F912F910F900FBE0F901F9018950197B6
|
||||
:100BB00039F0880F991F880F991F02970197F1F755
|
||||
:100BC0000895789484B5826084BD84B5816084BDC5
|
||||
:100BD00085B5826085BD85B5816085BDEEE6F0E0B6
|
||||
:100BE000808181608083E1E8F0E010828081826012
|
||||
:100BF0008083808181608083E0E8F0E08081816093
|
||||
:100C00008083E1EBF0E0808184608083E0EBF0E0C2
|
||||
:100C1000808181608083EAE7F0E080818460808366
|
||||
:100C20008081826080838081816080838081806810
|
||||
:100C300080831092C10008950E94E1050E9408057A
|
||||
:100C40000E949704FDCF1F920F920FB60F921124AE
|
||||
:100C50002F933F934F938F939F93EF93FF934091E5
|
||||
:100C6000C600E091D002F091D10231969F012F771A
|
||||
:100C7000307031978091D2029091D30228173907B2
|
||||
:100C800039F0E05BFD4F40833093D1022093D002D6
|
||||
:100C9000FF91EF919F918F914F913F912F910F90E5
|
||||
:100CA0000FBE0F901F901895AF92BF92DF92EF92F8
|
||||
:100CB000FF920F931F93CF93DF93EC017A018B0187
|
||||
:100CC000DD24403081EE580780E0680780E0780737
|
||||
:100CD00011F0DD24D39491E0A92EB12CE885F9859B
|
||||
:100CE000DD2069F0C5010A8802C0880F991F0A94A7
|
||||
:100CF000E2F7808360E079E08DE390E005C0108248
|
||||
:100D000060E874E88EE190E0A80197010E949A09DA
|
||||
:100D10002150304040405040569547953795279593
|
||||
:100D200080E12030380720F0DD2011F0DD24D6CF1F
|
||||
:100D3000EC81FD813083EE81FF812083EA85FB8594
|
||||
:100D4000208141E050E0CA010E8402C0880F991F43
|
||||
:100D50000A94E2F7282B2083EA85FB852081CA01CB
|
||||
:100D60000F8402C0880F991F0A94E2F7282B208372
|
||||
:100D7000EA85FB858081088802C0440F551F0A94CC
|
||||
:100D8000E2F7842B8083DF91CF911F910F91FF9029
|
||||
:100D9000EF90DF90BF90AF900895DC011296ED9137
|
||||
:100DA000FC911397E058FF4F2191319180819181FF
|
||||
:100DB000281B390B2F773070C9010895DC0112967A
|
||||
:100DC000ED91FC911397EE57FF4F20813181929165
|
||||
:100DD0008291E058F0408217930719F42FEF3FEF0C
|
||||
:100DE00005C0E20FF31F8081282F30E0C90108956C
|
||||
:100DF000DC011296ED91FC911397DF01AE57BF4FC6
|
||||
:100E00002D913C911197E058FF4F80819181E058DE
|
||||
:100E1000F0408217930719F42FEF3FEF0BC0E20F5A
|
||||
:100E2000F31F80812F5F3F4F2F7730702D933C93BE
|
||||
:100E3000282F30E0C9010895DC011296ED91FC9154
|
||||
:100E40001397EE57FF4F808191819293829308957B
|
||||
:100E5000FC01A085B18521898C9190E0022E02C011
|
||||
:100E6000959587950A94E2F780FFF6CF0484F5857F
|
||||
:100E7000E02D608308958BE291E09093D5028093FA
|
||||
:100E8000D40280E592E09093D7028093D60285EC5D
|
||||
:100E900090E09093D9028093D80284EC90E09093F4
|
||||
:100EA000DB028093DA0280EC90E09093DD02809385
|
||||
:100EB000DC0281EC90E09093DF028093DE0286EC0E
|
||||
:100EC00090E09093E1028093E00284E08093E2025C
|
||||
:100ED00083E08093E30287E08093E40285E08093DF
|
||||
:100EE000E50281E08093E6020895FC01608341837E
|
||||
:100EF00080E2828313820895FC01808160E00E9479
|
||||
:100F0000CD080895FF920F931F938C01F62E80E079
|
||||
:100F10000E94650985E00E946A09F80181816F2DB0
|
||||
:100F20000E94CD081F910F91FF9008951F93CF93BA
|
||||
:100F3000DF93EC0160E070E00E94820781EE8EBDDD
|
||||
:100F40000DB407FEFDCF1EB5CE0161E070E00E943A
|
||||
:100F50008207812FDF91CF911F9108951F93CF9327
|
||||
:100F6000DF93EC0160E070E00E94820782EE8EBDAC
|
||||
:100F70000DB407FEFDCF1EB5CE0161E070E00E940A
|
||||
:100F80008207812FDF91CF911F9108950F931F93B7
|
||||
:100F9000CF93DF93EC01162F042F60E070E00E94E6
|
||||
:100FA00082071F7110621EBD0DB407FEFDCF1EB576
|
||||
:100FB0000EBD0DB407FEFDCF8EB5CE0161E070E031
|
||||
:100FC0000E948207812FDF91CF911F910F91089589
|
||||
:100FD000662319F061E04FE302C061E040E00E9447
|
||||
:100FE000C6070895462F603808F04FE765E00E9475
|
||||
:100FF000C6070895EF92FF920F931F93CF93DF934D
|
||||
:101000007C01162FEA01022F60E070E00E94820747
|
||||
:101010001F7110621EBD0DB407FEFDCF1EB508C0C6
|
||||
:1010200088818EBD0DB407FEFDCF21968EB501508F
|
||||
:101030000023B1F7C70161E070E00E948207812FB1
|
||||
:10104000DF91CF911F910F91FF90EF9008951F9323
|
||||
:10105000CF93DF93EC01162F60E070E00E948207CF
|
||||
:101060001F711EBD0DB407FEFDCF8EB58FEF8EBD77
|
||||
:101070000DB407FEFDCF1EB5CE0161E070E00E9409
|
||||
:101080008207812FDF91CF911F91089569E00E941F
|
||||
:101090002708817008950F931F938C01FC018081B4
|
||||
:1010A00061E00E94A708F801818161E00E94A70821
|
||||
:1010B000F801808160E00E94CD08C80161E070E025
|
||||
:1010C0000E9482070E947B0981E00E945C0980E007
|
||||
:1010D0000E94650985E00E946A09C80164E04FEF3B
|
||||
:1010E0000E94C607C80167E040E70E94C607C80122
|
||||
:1010F0000E94AE07C8010E949607C80161E00E94E5
|
||||
:10110000F2071F910F9108950F931F938C0160E0D8
|
||||
:101110004BE00E94C607C80167E040E70E94C6078F
|
||||
:10112000A8014B5F5F4FC8016AE025E00E94FA0703
|
||||
:10113000C8010E94AE07F801808161E00E94CD08DD
|
||||
:1011400082E890E00E94D7051F910F910895482FE3
|
||||
:1011500050E0CA0186569F4FFC0124914A575F4FC9
|
||||
:10116000FA0184918823C1F0E82FF0E0EE0FFF1F11
|
||||
:10117000E859FF4FA591B491662341F49FB7F894C5
|
||||
:101180008C91209582238C939FBF08959FB7F894EC
|
||||
:101190008C91822B8C939FBF0895482F50E0CA01F9
|
||||
:1011A00082559F4FFC012491CA0186569F4FFC0136
|
||||
:1011B00034914A575F4FFA019491992309F444C03E
|
||||
:1011C000222351F1233071F0243028F42130A1F092
|
||||
:1011D000223011F514C02630B1F02730C1F0243090
|
||||
:1011E000D9F404C0809180008F7703C08091800083
|
||||
:1011F0008F7D8093800010C084B58F7702C084B546
|
||||
:101200008F7D84BD09C08091B0008F7703C080912D
|
||||
:10121000B0008F7D8093B000E92FF0E0EE0FFF1F4C
|
||||
:10122000EE58FF4FA591B491662341F49FB7F8940F
|
||||
:101230008C91309583238C939FBF08959FB7F8942A
|
||||
:101240008C91832B8C939FBF08950F931F93CF9303
|
||||
:10125000DF938C01EB0109C02196D801ED91FC913F
|
||||
:101260000190F081E02DC801099568816623A1F7FE
|
||||
:10127000DF91CF911F910F910895EF92FF920F93FD
|
||||
:101280001F93CF93DF938C017B01EA010CC0D70140
|
||||
:101290006D917D01D801ED91FC910190F081E02DDF
|
||||
:1012A000C80109952197209791F7DF91CF911F9160
|
||||
:1012B0000F91FF90EF900895882319F48CB5806208
|
||||
:1012C00002C08CB58F7D8CBD08959CB5937F982B03
|
||||
:1012D0009CBD08952CB5382F33702C7F322B3CBD2C
|
||||
:1012E0002DB590E0959587959595879581702E7F82
|
||||
:1012F000822B8DBD08958DE061E00E94A7088BE0F0
|
||||
:1013000061E00E94A7088AE061E00E94A7088DE0E2
|
||||
:1013100060E00E94CD088BE060E00E94CD088AE08A
|
||||
:1013200061E00E94CD088CB580618CBD8CB5806475
|
||||
:101330008CBD0895A1E21A2EAA1BBB1BFD010DC096
|
||||
:10134000AA1FBB1FEE1FFF1FA217B307E407F50775
|
||||
:1013500020F0A21BB30BE40BF50B661F771F881F51
|
||||
:10136000991F1A9469F760957095809590959B01E7
|
||||
:10137000AC01BD01CF0108952F923F924F925F9231
|
||||
:101380006F927F928F929F92AF92BF92CF92DF9295
|
||||
:10139000EF92FF920F931F93CF93DF93CDB7DEB7FA
|
||||
:1013A000CA1BDB0B0FB6F894DEBF0FBECDBF09948E
|
||||
:1013B0002A88398848885F846E847D848C849B84E5
|
||||
:1013C000AA84B984C884DF80EE80FD800C811B81F3
|
||||
:1013D000AA81B981CE0FD11D0FB6F894DEBF0FBE22
|
||||
:1013E000CDBFED010895EE0FFF1F0590F491E02DA4
|
||||
:0613F0000994F894FFCF00
|
||||
:1013F6002578000A0D000A0D524632342F657861B1
|
||||
:101406006D706C65732F7363616E6E65722F0A0D56
|
||||
:10141600002000F102000000000000280725093D19
|
||||
:0A14260009CD06F806DE061C0700DB
|
||||
:00000001FF
|
||||
|
||||
+651
-651
File diff suppressed because it is too large
Load Diff
+194
-194
@@ -1,194 +1,194 @@
|
||||
#ifndef UART_H
|
||||
#define UART_H
|
||||
/************************************************************************
|
||||
Title: Interrupt UART library with receive/transmit circular buffers
|
||||
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
||||
File: $Id: uart.h,v 1.8.2.1 2007/07/01 11:14:38 peter Exp $
|
||||
Software: AVR-GCC 4.1, AVR Libc 1.4
|
||||
Hardware: any AVR with built-in UART, tested on AT90S8515 & ATmega8 at 4 Mhz
|
||||
License: GNU General Public License
|
||||
Usage: see Doxygen manual
|
||||
|
||||
LICENSE:
|
||||
Copyright (C) 2006 Peter Fleury
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* @defgroup pfleury_uart UART Library
|
||||
* @code #include <uart.h> @endcode
|
||||
*
|
||||
* @brief Interrupt UART library using the built-in UART with transmit and receive circular buffers.
|
||||
*
|
||||
* This library can be used to transmit and receive data through the built in UART.
|
||||
*
|
||||
* An interrupt is generated when the UART has finished transmitting or
|
||||
* receiving a byte. The interrupt handling routines use circular buffers
|
||||
* for buffering received and transmitted data.
|
||||
*
|
||||
* The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE constants define
|
||||
* the size of the circular buffers in bytes. Note that these constants must be a power of 2.
|
||||
* You may need to adapt this constants to your target and your application by adding
|
||||
* CDEFS += -DUART_RX_BUFFER_SIZE=nn -DUART_RX_BUFFER_SIZE=nn to your Makefile.
|
||||
*
|
||||
* @note Based on Atmel Application Note AVR306
|
||||
* @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
|
||||
*/
|
||||
|
||||
/**@{*/
|
||||
|
||||
|
||||
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
|
||||
#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** constants and macros
|
||||
*/
|
||||
|
||||
/** @brief UART Baudrate Expression
|
||||
* @param xtalcpu system clock in Mhz, e.g. 4000000L for 4Mhz
|
||||
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||
*/
|
||||
#define UART_BAUD_SELECT(baudRate,xtalCpu) ((xtalCpu)/((baudRate)*16l)-1)
|
||||
|
||||
/** @brief UART Baudrate Expression for ATmega double speed mode
|
||||
* @param xtalcpu system clock in Mhz, e.g. 4000000L for 4Mhz
|
||||
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||
*/
|
||||
#define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) (((xtalCpu)/((baudRate)*8l)-1)|0x8000)
|
||||
|
||||
|
||||
/** Size of the circular receive buffer, must be power of 2 */
|
||||
#ifndef UART_RX_BUFFER_SIZE
|
||||
#define UART_RX_BUFFER_SIZE 32
|
||||
#endif
|
||||
/** Size of the circular transmit buffer, must be power of 2 */
|
||||
#ifndef UART_TX_BUFFER_SIZE
|
||||
#define UART_TX_BUFFER_SIZE 32
|
||||
#endif
|
||||
|
||||
/* test if the size of the circular buffers fits into SRAM */
|
||||
#if ( (UART_RX_BUFFER_SIZE+UART_TX_BUFFER_SIZE) >= (RAMEND-0x60 ) )
|
||||
#error "size of UART_RX_BUFFER_SIZE + UART_TX_BUFFER_SIZE larger than size of SRAM"
|
||||
#endif
|
||||
|
||||
/*
|
||||
** high byte error return code of uart_getc()
|
||||
*/
|
||||
#define UART_FRAME_ERROR 0x0800 /* Framing Error by UART */
|
||||
#define UART_OVERRUN_ERROR 0x0400 /* Overrun condition by UART */
|
||||
#define UART_BUFFER_OVERFLOW 0x0200 /* receive ringbuffer overflow */
|
||||
#define UART_NO_DATA 0x0100 /* no receive data available */
|
||||
|
||||
|
||||
/*
|
||||
** function prototypes
|
||||
*/
|
||||
|
||||
/**
|
||||
@brief Initialize UART and set baudrate
|
||||
@param baudrate Specify baudrate using macro UART_BAUD_SELECT()
|
||||
@return none
|
||||
*/
|
||||
extern void uart_init(unsigned int baudrate);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get received byte from ringbuffer
|
||||
*
|
||||
* Returns in the lower byte the received character and in the
|
||||
* higher byte the last receive error.
|
||||
* UART_NO_DATA is returned when no data is available.
|
||||
*
|
||||
* @param void
|
||||
* @return lower byte: received byte from ringbuffer
|
||||
* @return higher byte: last receive status
|
||||
* - \b 0 successfully received data from UART
|
||||
* - \b UART_NO_DATA
|
||||
* <br>no receive data available
|
||||
* - \b UART_BUFFER_OVERFLOW
|
||||
* <br>Receive ringbuffer overflow.
|
||||
* We are not reading the receive buffer fast enough,
|
||||
* one or more received character have been dropped
|
||||
* - \b UART_OVERRUN_ERROR
|
||||
* <br>Overrun condition by UART.
|
||||
* A character already present in the UART UDR register was
|
||||
* not read by the interrupt handler before the next character arrived,
|
||||
* one or more received characters have been dropped.
|
||||
* - \b UART_FRAME_ERROR
|
||||
* <br>Framing Error by UART
|
||||
*/
|
||||
extern unsigned int uart_getc(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Put byte to ringbuffer for transmitting via UART
|
||||
* @param data byte to be transmitted
|
||||
* @return none
|
||||
*/
|
||||
extern void uart_putc(unsigned char data);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Put string to ringbuffer for transmitting via UART
|
||||
*
|
||||
* The string is buffered by the uart library in a circular buffer
|
||||
* and one character at a time is transmitted to the UART using interrupts.
|
||||
* Blocks if it can not write the whole string into the circular buffer.
|
||||
*
|
||||
* @param s string to be transmitted
|
||||
* @return none
|
||||
*/
|
||||
extern void uart_puts(const char *s );
|
||||
|
||||
|
||||
/**
|
||||
* @brief Put string from program memory to ringbuffer for transmitting via UART.
|
||||
*
|
||||
* The string is buffered by the uart library in a circular buffer
|
||||
* and one character at a time is transmitted to the UART using interrupts.
|
||||
* Blocks if it can not write the whole string into the circular buffer.
|
||||
*
|
||||
* @param s program memory string to be transmitted
|
||||
* @return none
|
||||
* @see uart_puts_P
|
||||
*/
|
||||
extern void uart_puts_p(const char *s );
|
||||
|
||||
/**
|
||||
* @brief Macro to automatically put a string constant into program memory
|
||||
*/
|
||||
#define uart_puts_P(__s) uart_puts_p(PSTR(__s))
|
||||
|
||||
|
||||
|
||||
/** @brief Initialize USART1 (only available on selected ATmegas) @see uart_init */
|
||||
extern void uart1_init(unsigned int baudrate);
|
||||
/** @brief Get received byte of USART1 from ringbuffer. (only available on selected ATmega) @see uart_getc */
|
||||
extern unsigned int uart1_getc(void);
|
||||
/** @brief Put byte to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_putc */
|
||||
extern void uart1_putc(unsigned char data);
|
||||
/** @brief Put string to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_puts */
|
||||
extern void uart1_puts(const char *s );
|
||||
/** @brief Put string from program memory to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_puts_p */
|
||||
extern void uart1_puts_p(const char *s );
|
||||
/** @brief Macro to automatically put a string constant into program memory */
|
||||
#define uart1_puts_P(__s) uart1_puts_p(PSTR(__s))
|
||||
|
||||
/**@}*/
|
||||
|
||||
#include "uart.c"
|
||||
#endif // UART_H
|
||||
|
||||
#ifndef UART_H
|
||||
#define UART_H
|
||||
/************************************************************************
|
||||
Title: Interrupt UART library with receive/transmit circular buffers
|
||||
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
||||
File: $Id: uart.h,v 1.8.2.1 2007/07/01 11:14:38 peter Exp $
|
||||
Software: AVR-GCC 4.1, AVR Libc 1.4
|
||||
Hardware: any AVR with built-in UART, tested on AT90S8515 & ATmega8 at 4 Mhz
|
||||
License: GNU General Public License
|
||||
Usage: see Doxygen manual
|
||||
|
||||
LICENSE:
|
||||
Copyright (C) 2006 Peter Fleury
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* @defgroup pfleury_uart UART Library
|
||||
* @code #include <uart.h> @endcode
|
||||
*
|
||||
* @brief Interrupt UART library using the built-in UART with transmit and receive circular buffers.
|
||||
*
|
||||
* This library can be used to transmit and receive data through the built in UART.
|
||||
*
|
||||
* An interrupt is generated when the UART has finished transmitting or
|
||||
* receiving a byte. The interrupt handling routines use circular buffers
|
||||
* for buffering received and transmitted data.
|
||||
*
|
||||
* The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE constants define
|
||||
* the size of the circular buffers in bytes. Note that these constants must be a power of 2.
|
||||
* You may need to adapt this constants to your target and your application by adding
|
||||
* CDEFS += -DUART_RX_BUFFER_SIZE=nn -DUART_RX_BUFFER_SIZE=nn to your Makefile.
|
||||
*
|
||||
* @note Based on Atmel Application Note AVR306
|
||||
* @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
|
||||
*/
|
||||
|
||||
/**@{*/
|
||||
|
||||
|
||||
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
|
||||
#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** constants and macros
|
||||
*/
|
||||
|
||||
/** @brief UART Baudrate Expression
|
||||
* @param xtalcpu system clock in Mhz, e.g. 4000000L for 4Mhz
|
||||
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||
*/
|
||||
#define UART_BAUD_SELECT(baudRate,xtalCpu) ((xtalCpu)/((baudRate)*16l)-1)
|
||||
|
||||
/** @brief UART Baudrate Expression for ATmega double speed mode
|
||||
* @param xtalcpu system clock in Mhz, e.g. 4000000L for 4Mhz
|
||||
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||
*/
|
||||
#define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) (((xtalCpu)/((baudRate)*8l)-1)|0x8000)
|
||||
|
||||
|
||||
/** Size of the circular receive buffer, must be power of 2 */
|
||||
#ifndef UART_RX_BUFFER_SIZE
|
||||
#define UART_RX_BUFFER_SIZE 32
|
||||
#endif
|
||||
/** Size of the circular transmit buffer, must be power of 2 */
|
||||
#ifndef UART_TX_BUFFER_SIZE
|
||||
#define UART_TX_BUFFER_SIZE 32
|
||||
#endif
|
||||
|
||||
/* test if the size of the circular buffers fits into SRAM */
|
||||
#if ( (UART_RX_BUFFER_SIZE+UART_TX_BUFFER_SIZE) >= (RAMEND-0x60 ) )
|
||||
#error "size of UART_RX_BUFFER_SIZE + UART_TX_BUFFER_SIZE larger than size of SRAM"
|
||||
#endif
|
||||
|
||||
/*
|
||||
** high byte error return code of uart_getc()
|
||||
*/
|
||||
#define UART_FRAME_ERROR 0x0800 /* Framing Error by UART */
|
||||
#define UART_OVERRUN_ERROR 0x0400 /* Overrun condition by UART */
|
||||
#define UART_BUFFER_OVERFLOW 0x0200 /* receive ringbuffer overflow */
|
||||
#define UART_NO_DATA 0x0100 /* no receive data available */
|
||||
|
||||
|
||||
/*
|
||||
** function prototypes
|
||||
*/
|
||||
|
||||
/**
|
||||
@brief Initialize UART and set baudrate
|
||||
@param baudrate Specify baudrate using macro UART_BAUD_SELECT()
|
||||
@return none
|
||||
*/
|
||||
extern void uart_init(unsigned int baudrate);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get received byte from ringbuffer
|
||||
*
|
||||
* Returns in the lower byte the received character and in the
|
||||
* higher byte the last receive error.
|
||||
* UART_NO_DATA is returned when no data is available.
|
||||
*
|
||||
* @param void
|
||||
* @return lower byte: received byte from ringbuffer
|
||||
* @return higher byte: last receive status
|
||||
* - \b 0 successfully received data from UART
|
||||
* - \b UART_NO_DATA
|
||||
* <br>no receive data available
|
||||
* - \b UART_BUFFER_OVERFLOW
|
||||
* <br>Receive ringbuffer overflow.
|
||||
* We are not reading the receive buffer fast enough,
|
||||
* one or more received character have been dropped
|
||||
* - \b UART_OVERRUN_ERROR
|
||||
* <br>Overrun condition by UART.
|
||||
* A character already present in the UART UDR register was
|
||||
* not read by the interrupt handler before the next character arrived,
|
||||
* one or more received characters have been dropped.
|
||||
* - \b UART_FRAME_ERROR
|
||||
* <br>Framing Error by UART
|
||||
*/
|
||||
extern unsigned int uart_getc(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Put byte to ringbuffer for transmitting via UART
|
||||
* @param data byte to be transmitted
|
||||
* @return none
|
||||
*/
|
||||
extern void uart_putc(unsigned char data);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Put string to ringbuffer for transmitting via UART
|
||||
*
|
||||
* The string is buffered by the uart library in a circular buffer
|
||||
* and one character at a time is transmitted to the UART using interrupts.
|
||||
* Blocks if it can not write the whole string into the circular buffer.
|
||||
*
|
||||
* @param s string to be transmitted
|
||||
* @return none
|
||||
*/
|
||||
extern void uart_puts(const char *s );
|
||||
|
||||
|
||||
/**
|
||||
* @brief Put string from program memory to ringbuffer for transmitting via UART.
|
||||
*
|
||||
* The string is buffered by the uart library in a circular buffer
|
||||
* and one character at a time is transmitted to the UART using interrupts.
|
||||
* Blocks if it can not write the whole string into the circular buffer.
|
||||
*
|
||||
* @param s program memory string to be transmitted
|
||||
* @return none
|
||||
* @see uart_puts_P
|
||||
*/
|
||||
extern void uart_puts_p(const char *s );
|
||||
|
||||
/**
|
||||
* @brief Macro to automatically put a string constant into program memory
|
||||
*/
|
||||
#define uart_puts_P(__s) uart_puts_p(PSTR(__s))
|
||||
|
||||
|
||||
|
||||
/** @brief Initialize USART1 (only available on selected ATmegas) @see uart_init */
|
||||
extern void uart1_init(unsigned int baudrate);
|
||||
/** @brief Get received byte of USART1 from ringbuffer. (only available on selected ATmega) @see uart_getc */
|
||||
extern unsigned int uart1_getc(void);
|
||||
/** @brief Put byte to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_putc */
|
||||
extern void uart1_putc(unsigned char data);
|
||||
/** @brief Put string to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_puts */
|
||||
extern void uart1_puts(const char *s );
|
||||
/** @brief Put string from program memory to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_puts_p */
|
||||
extern void uart1_puts_p(const char *s );
|
||||
/** @brief Macro to automatically put a string constant into program memory */
|
||||
#define uart1_puts_P(__s) uart1_puts_p(PSTR(__s))
|
||||
|
||||
/**@}*/
|
||||
|
||||
#include "uart.c"
|
||||
#endif // UART_H
|
||||
|
||||
|
||||
+252
-252
@@ -1,252 +1,252 @@
|
||||
/*
|
||||
Vera Arduino library is used to communicate sensor data to your Vera receiver sketch using RF24 library.
|
||||
The maximum amount of transferrable data is 336 characters from a sensor to receiver.
|
||||
|
||||
Created by Henrik Ekblad <henrik.ekblad@gmail.com>
|
||||
Version 1.0
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
modification by axillent@gmail.com to run on pure AVR
|
||||
*/
|
||||
|
||||
#include "VeraAVR.h"
|
||||
#include <avr/eeprom.h>
|
||||
#include <util/delay.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
uint8_t ee_radio_id EEMEM = 255;
|
||||
|
||||
struct {
|
||||
uint16_t radioId;
|
||||
uint16_t relayId;
|
||||
message_s msg; // Buffer for incoming messages.
|
||||
char convBuffer[20];
|
||||
} _veraavr_data;
|
||||
|
||||
/*uint8_t VeraAVR_eeprom_radioid() {
|
||||
return eeprom_read_byte(&ee_radio_id);
|
||||
}*/
|
||||
/*static void VeraAVR_delay_ms(uint16_t delay) {
|
||||
for(; delay >= 50; delay -= 50) {
|
||||
_delay_ms(50);
|
||||
wdt_reset();
|
||||
}
|
||||
wdt_reset();
|
||||
}*/
|
||||
|
||||
void VeraAVR_begin(uint16_t _radioId) {
|
||||
VeraAVR_begin2(_radioId, GATEWAY_ADDRESS);
|
||||
}
|
||||
|
||||
void VeraAVR_begin2(uint16_t _radioId, uint16_t _relayId) {
|
||||
_veraavr_data.radioId = _radioId;
|
||||
_veraavr_data.relayId = _relayId;
|
||||
// Start up the radio library
|
||||
nrf24_begin();
|
||||
nrf24_enableDynamicPayloads();
|
||||
nrf24_setAutoAck(1) ;
|
||||
nrf24_setRetries(15, 15);
|
||||
nrf24_setChannel(VERA_CHANNEL);
|
||||
nrf24_setDataRate(RF24_1MBPS);
|
||||
nrf24_setCRCLength(RF24_CRC_16);
|
||||
if (_veraavr_data.radioId == GATEWAY_ADDRESS) {
|
||||
nrf24_openReadingPipe(1, BASE_RADIO_ID);
|
||||
} else {
|
||||
if (_veraavr_data.radioId == AUTO) {
|
||||
_veraavr_data.radioId = eeprom_read_byte(&ee_radio_id);
|
||||
if (_veraavr_data.radioId == 0xFFF || _veraavr_data.radioId == 0x00) {
|
||||
// No radio id has been fetched yet. EEPROM is unwritten.
|
||||
// Request new id from Vera. Use radio address 255 temporarily.
|
||||
//nrf24_openReadingPipe(0,0); // Don't listen to other nodes
|
||||
nrf24_openReadingPipe(1, BASE_RADIO_ID+_veraavr_data.radioId);
|
||||
nrf24_openWritingPipe(BASE_RADIO_ID);
|
||||
_veraavr_data.radioId = atoi(VeraAVR_getConfiguration(V_REQUEST_ID));
|
||||
// Write id to EEPROM
|
||||
if (_veraavr_data.radioId == AUTO) { // Vera will return 255 if all sensor id are taken
|
||||
// wait a minute before possible wdt reset
|
||||
for(uint8_t i=0; i < 120; i++) {
|
||||
wdt_reset();
|
||||
_delay_ms(500);
|
||||
}
|
||||
// wait for a while ot until wdt reset
|
||||
while (1) {}
|
||||
} else {
|
||||
eeprom_write_byte(&ee_radio_id, _veraavr_data.radioId);
|
||||
}
|
||||
}
|
||||
}
|
||||
//eeprom_write_byte(&ee_radio_id, _veraavr_data.radioId);
|
||||
nrf24_openReadingPipe(1, BASE_RADIO_ID+_veraavr_data.radioId);
|
||||
}
|
||||
nrf24_startListening();
|
||||
wdt_reset();
|
||||
}
|
||||
|
||||
uint8_t VeraAVR_sendDataGW(uint8_t childId, messageType messageType, uint8_t type, const char *data) {
|
||||
return VeraAVR_sendData(_veraavr_data.radioId, _veraavr_data.relayId, GATEWAY_ADDRESS, childId, messageType, type, data);
|
||||
}
|
||||
|
||||
uint8_t VeraAVR_sendData(uint16_t from, uint16_t next, uint16_t to, uint8_t childId, messageType messageType, uint8_t type, const char *data) {
|
||||
uint8_t ok = 0;
|
||||
if (strlen(data) < sizeof(_veraavr_data.msg.data)) {
|
||||
_veraavr_data.msg.header.version = PROTOCOL_VERSION;
|
||||
_veraavr_data.msg.header.binary = 0;
|
||||
_veraavr_data.msg.header.from = from;
|
||||
_veraavr_data.msg.header.to = to;
|
||||
_veraavr_data.msg.header.childId = childId;
|
||||
_veraavr_data.msg.header.messageType = messageType;
|
||||
_veraavr_data.msg.header.type = type;
|
||||
|
||||
strncpy(_veraavr_data.msg.data, data, sizeof(_veraavr_data.msg.data)-1);
|
||||
_veraavr_data.msg.header.crc = VeraAVR_crc8Message(_veraavr_data.msg);
|
||||
|
||||
|
||||
nrf24_stopListening();
|
||||
nrf24_openWritingPipe(BASE_RADIO_ID + next);
|
||||
uint8_t retry = 5;
|
||||
do {
|
||||
ok = nrf24_write(&_veraavr_data.msg, min(MAX_MESSAGE_LENGTH, sizeof(_veraavr_data.msg.header) + strlen(_veraavr_data.msg.data) + 1));
|
||||
wdt_reset();
|
||||
}
|
||||
while ( !ok && --retry );
|
||||
nrf24_startListening();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void VeraAVR_sendVariable_char(uint8_t childId, uint8_t variableType,
|
||||
const char *value) {
|
||||
VeraAVR_sendDataGW(childId, M_VARIABLE, variableType, value);
|
||||
}
|
||||
|
||||
void VeraAVR_sendVariable_float(uint8_t childId, uint8_t variableType, float value, int decimals) {
|
||||
VeraAVR_sendVariable_char(childId, variableType, dtostrf(value,2,decimals,_veraavr_data.convBuffer));
|
||||
}
|
||||
|
||||
void VeraAVR_sendVariable_int(uint8_t childId, uint8_t variableType, int value) {
|
||||
VeraAVR_sendVariable_char(childId, variableType, itoa(value, _veraavr_data.convBuffer, 10));
|
||||
}
|
||||
void VeraAVR_sendVariable_long(uint8_t childId, uint8_t variableType, long value) {
|
||||
VeraAVR_sendVariable_char(childId, variableType, ltoa(value, _veraavr_data.convBuffer, 10));
|
||||
}
|
||||
|
||||
void VeraAVR_requestStatus(uint8_t childId, uint8_t variableType) {
|
||||
VeraAVR_sendDataGW(childId, M_STATUS, variableType, "");
|
||||
}
|
||||
|
||||
char* VeraAVR_getStatus(uint8_t childId, uint8_t variableType) {
|
||||
while (1) {
|
||||
VeraAVR_requestStatus(childId, variableType);
|
||||
uint8_t i = 0;
|
||||
while (i < 100) { // 5 seconds timeout before re-sending status request
|
||||
while (VeraAVR_messageAvailable()) {
|
||||
// Check that it is right type of message and not a routing message
|
||||
if ((_veraavr_data.msg.header.messageType == M_REQUEST_STATUS_RESPONSE) &&
|
||||
(_veraavr_data.msg.header.type == variableType) &&
|
||||
(_veraavr_data.msg.header.to == childId)) {
|
||||
return _veraavr_data.msg.data;
|
||||
}
|
||||
}
|
||||
_delay_ms(50);
|
||||
wdt_reset();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void VeraAVR_requestConfiguration(uint8_t variableType) {
|
||||
VeraAVR_requestStatus(NODE_CHILD_ID, variableType);
|
||||
}
|
||||
|
||||
char* VeraAVR_getConfiguration(uint8_t variableType) {
|
||||
return VeraAVR_getStatus(NODE_CHILD_ID, variableType);
|
||||
}
|
||||
|
||||
unsigned long VeraAVR_getTime() {
|
||||
return atol(VeraAVR_getConfiguration(V_TIME));
|
||||
}
|
||||
|
||||
void VeraAVR_sendSensorPresentation(uint8_t childId, uint8_t sensorType) {
|
||||
VeraAVR_sendDataGW(childId, M_PRESENTATION, sensorType, LIBRARY_VERSION);
|
||||
}
|
||||
|
||||
|
||||
uint8_t VeraAVR_messageAvailable() {
|
||||
while (nrf24_available()) {
|
||||
VeraAVR_readMessage();
|
||||
// Check that message was addressed for me. Could be a message from some other sensor
|
||||
// as we«re automatically listening to pipe 0 (our writing pipe) where all sensors
|
||||
// send their data
|
||||
if (_veraavr_data.msg.header.to == _veraavr_data.radioId && VeraAVR_validate() == VALIDATE_OK)
|
||||
return 1;
|
||||
wdt_reset();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
message_s VeraAVR_waitForMessage() {
|
||||
while (1) {
|
||||
if (VeraAVR_messageAvailable()) {
|
||||
return _veraavr_data.msg;
|
||||
}
|
||||
wdt_reset();
|
||||
}
|
||||
}
|
||||
|
||||
message_s VeraAVR_getMessage() {
|
||||
return _veraavr_data.msg;
|
||||
}
|
||||
|
||||
|
||||
message_s VeraAVR_readMessage() {
|
||||
uint8_t len = nrf24_getDynamicPayloadSize();
|
||||
//uint8_t done =
|
||||
nrf24_read(&_veraavr_data.msg, len);
|
||||
// Make sure string gets terminated ok.
|
||||
_veraavr_data.msg.data[sizeof(_veraavr_data.msg.data)-1] = '\0';
|
||||
return _veraavr_data.msg;
|
||||
}
|
||||
|
||||
/*
|
||||
* calculate CRC8 on message_s data taking care of data structure and protocol version
|
||||
*/
|
||||
uint8_t VeraAVR_crc8Message(message_s var_msg) {
|
||||
struct {
|
||||
message_s msg;
|
||||
uint8_t protocol_version;
|
||||
} crc_data;
|
||||
memcpy(&crc_data, &var_msg, sizeof(var_msg));
|
||||
crc_data.protocol_version = PROTOCOL_VERSION;
|
||||
// some clean up needed for repeated result
|
||||
crc_data.msg.header.crc = 0;
|
||||
// fill unused space by zeroes for string data only
|
||||
if(!crc_data.msg.header.binary) {
|
||||
uint8_t len = strlen(crc_data.msg.data);
|
||||
if(len < sizeof(crc_data.msg.data)-1) {
|
||||
memset(&crc_data.msg.data[len], 0, sizeof(crc_data.msg.data) - 1 - len);
|
||||
}
|
||||
}
|
||||
return crc8((uint8_t*)&crc_data, (uint8_t)sizeof(crc_data));
|
||||
}
|
||||
/*
|
||||
* true if message is consistent *
|
||||
*/
|
||||
uint8_t VeraAVR_checkCRCMessage(message_s var_msg) {
|
||||
return (var_msg.header.crc == VeraAVR_crc8Message(var_msg))?1:0;
|
||||
}
|
||||
uint8_t VeraAVR_checkCRC() {
|
||||
return VeraAVR_checkCRCMessage(_veraavr_data.msg);
|
||||
}
|
||||
|
||||
uint8_t VeraAVR_validate() {
|
||||
uint8_t crc_check = VeraAVR_checkCRC();
|
||||
uint8_t version_check = (_veraavr_data.msg.header.version == PROTOCOL_VERSION);
|
||||
if(crc_check && version_check) return VALIDATE_OK;
|
||||
if(!crc_check) return VALIDATE_BAD_CRC;
|
||||
return VALIDATE_BAD_VERSION;
|
||||
}
|
||||
/*
|
||||
Vera Arduino library is used to communicate sensor data to your Vera receiver sketch using RF24 library.
|
||||
The maximum amount of transferrable data is 336 characters from a sensor to receiver.
|
||||
|
||||
Created by Henrik Ekblad <henrik.ekblad@gmail.com>
|
||||
Version 1.0
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
modification by axillent@gmail.com to run on pure AVR
|
||||
*/
|
||||
|
||||
#include "VeraAVR.h"
|
||||
#include <avr/eeprom.h>
|
||||
#include <util/delay.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
uint8_t ee_radio_id EEMEM = 255;
|
||||
|
||||
struct {
|
||||
uint16_t radioId;
|
||||
uint16_t relayId;
|
||||
message_s msg; // Buffer for incoming messages.
|
||||
char convBuffer[20];
|
||||
} _veraavr_data;
|
||||
|
||||
/*uint8_t VeraAVR_eeprom_radioid() {
|
||||
return eeprom_read_byte(&ee_radio_id);
|
||||
}*/
|
||||
/*static void VeraAVR_delay_ms(uint16_t delay) {
|
||||
for(; delay >= 50; delay -= 50) {
|
||||
_delay_ms(50);
|
||||
wdt_reset();
|
||||
}
|
||||
wdt_reset();
|
||||
}*/
|
||||
|
||||
void VeraAVR_begin(uint16_t _radioId) {
|
||||
VeraAVR_begin2(_radioId, GATEWAY_ADDRESS);
|
||||
}
|
||||
|
||||
void VeraAVR_begin2(uint16_t _radioId, uint16_t _relayId) {
|
||||
_veraavr_data.radioId = _radioId;
|
||||
_veraavr_data.relayId = _relayId;
|
||||
// Start up the radio library
|
||||
nrf24_begin();
|
||||
nrf24_enableDynamicPayloads();
|
||||
nrf24_setAutoAck(1) ;
|
||||
nrf24_setRetries(15, 15);
|
||||
nrf24_setChannel(VERA_CHANNEL);
|
||||
nrf24_setDataRate(RF24_1MBPS);
|
||||
nrf24_setCRCLength(RF24_CRC_16);
|
||||
if (_veraavr_data.radioId == GATEWAY_ADDRESS) {
|
||||
nrf24_openReadingPipe(1, BASE_RADIO_ID);
|
||||
} else {
|
||||
if (_veraavr_data.radioId == AUTO) {
|
||||
_veraavr_data.radioId = eeprom_read_byte(&ee_radio_id);
|
||||
if (_veraavr_data.radioId == 0xFFF || _veraavr_data.radioId == 0x00) {
|
||||
// No radio id has been fetched yet. EEPROM is unwritten.
|
||||
// Request new id from Vera. Use radio address 255 temporarily.
|
||||
//nrf24_openReadingPipe(0,0); // Don't listen to other nodes
|
||||
nrf24_openReadingPipe(1, BASE_RADIO_ID+_veraavr_data.radioId);
|
||||
nrf24_openWritingPipe(BASE_RADIO_ID);
|
||||
_veraavr_data.radioId = atoi(VeraAVR_getConfiguration(V_REQUEST_ID));
|
||||
// Write id to EEPROM
|
||||
if (_veraavr_data.radioId == AUTO) { // Vera will return 255 if all sensor id are taken
|
||||
// wait a minute before possible wdt reset
|
||||
for(uint8_t i=0; i < 120; i++) {
|
||||
wdt_reset();
|
||||
_delay_ms(500);
|
||||
}
|
||||
// wait for a while ot until wdt reset
|
||||
while (1) {}
|
||||
} else {
|
||||
eeprom_write_byte(&ee_radio_id, _veraavr_data.radioId);
|
||||
}
|
||||
}
|
||||
}
|
||||
//eeprom_write_byte(&ee_radio_id, _veraavr_data.radioId);
|
||||
nrf24_openReadingPipe(1, BASE_RADIO_ID+_veraavr_data.radioId);
|
||||
}
|
||||
nrf24_startListening();
|
||||
wdt_reset();
|
||||
}
|
||||
|
||||
uint8_t VeraAVR_sendDataGW(uint8_t childId, messageType messageType, uint8_t type, const char *data) {
|
||||
return VeraAVR_sendData(_veraavr_data.radioId, _veraavr_data.relayId, GATEWAY_ADDRESS, childId, messageType, type, data);
|
||||
}
|
||||
|
||||
uint8_t VeraAVR_sendData(uint16_t from, uint16_t next, uint16_t to, uint8_t childId, messageType messageType, uint8_t type, const char *data) {
|
||||
uint8_t ok = 0;
|
||||
if (strlen(data) < sizeof(_veraavr_data.msg.data)) {
|
||||
_veraavr_data.msg.header.version = PROTOCOL_VERSION;
|
||||
_veraavr_data.msg.header.binary = 0;
|
||||
_veraavr_data.msg.header.from = from;
|
||||
_veraavr_data.msg.header.to = to;
|
||||
_veraavr_data.msg.header.childId = childId;
|
||||
_veraavr_data.msg.header.messageType = messageType;
|
||||
_veraavr_data.msg.header.type = type;
|
||||
|
||||
strncpy(_veraavr_data.msg.data, data, sizeof(_veraavr_data.msg.data)-1);
|
||||
_veraavr_data.msg.header.crc = VeraAVR_crc8Message(_veraavr_data.msg);
|
||||
|
||||
|
||||
nrf24_stopListening();
|
||||
nrf24_openWritingPipe(BASE_RADIO_ID + next);
|
||||
uint8_t retry = 5;
|
||||
do {
|
||||
ok = nrf24_write(&_veraavr_data.msg, min(MAX_MESSAGE_LENGTH, sizeof(_veraavr_data.msg.header) + strlen(_veraavr_data.msg.data) + 1));
|
||||
wdt_reset();
|
||||
}
|
||||
while ( !ok && --retry );
|
||||
nrf24_startListening();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void VeraAVR_sendVariable_char(uint8_t childId, uint8_t variableType,
|
||||
const char *value) {
|
||||
VeraAVR_sendDataGW(childId, M_VARIABLE, variableType, value);
|
||||
}
|
||||
|
||||
void VeraAVR_sendVariable_float(uint8_t childId, uint8_t variableType, float value, int decimals) {
|
||||
VeraAVR_sendVariable_char(childId, variableType, dtostrf(value,2,decimals,_veraavr_data.convBuffer));
|
||||
}
|
||||
|
||||
void VeraAVR_sendVariable_int(uint8_t childId, uint8_t variableType, int value) {
|
||||
VeraAVR_sendVariable_char(childId, variableType, itoa(value, _veraavr_data.convBuffer, 10));
|
||||
}
|
||||
void VeraAVR_sendVariable_long(uint8_t childId, uint8_t variableType, long value) {
|
||||
VeraAVR_sendVariable_char(childId, variableType, ltoa(value, _veraavr_data.convBuffer, 10));
|
||||
}
|
||||
|
||||
void VeraAVR_requestStatus(uint8_t childId, uint8_t variableType) {
|
||||
VeraAVR_sendDataGW(childId, M_STATUS, variableType, "");
|
||||
}
|
||||
|
||||
char* VeraAVR_getStatus(uint8_t childId, uint8_t variableType) {
|
||||
while (1) {
|
||||
VeraAVR_requestStatus(childId, variableType);
|
||||
uint8_t i = 0;
|
||||
while (i < 100) { // 5 seconds timeout before re-sending status request
|
||||
while (VeraAVR_messageAvailable()) {
|
||||
// Check that it is right type of message and not a routing message
|
||||
if ((_veraavr_data.msg.header.messageType == M_REQUEST_STATUS_RESPONSE) &&
|
||||
(_veraavr_data.msg.header.type == variableType) &&
|
||||
(_veraavr_data.msg.header.to == childId)) {
|
||||
return _veraavr_data.msg.data;
|
||||
}
|
||||
}
|
||||
_delay_ms(50);
|
||||
wdt_reset();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void VeraAVR_requestConfiguration(uint8_t variableType) {
|
||||
VeraAVR_requestStatus(NODE_CHILD_ID, variableType);
|
||||
}
|
||||
|
||||
char* VeraAVR_getConfiguration(uint8_t variableType) {
|
||||
return VeraAVR_getStatus(NODE_CHILD_ID, variableType);
|
||||
}
|
||||
|
||||
unsigned long VeraAVR_getTime() {
|
||||
return atol(VeraAVR_getConfiguration(V_TIME));
|
||||
}
|
||||
|
||||
void VeraAVR_sendSensorPresentation(uint8_t childId, uint8_t sensorType) {
|
||||
VeraAVR_sendDataGW(childId, M_PRESENTATION, sensorType, LIBRARY_VERSION);
|
||||
}
|
||||
|
||||
|
||||
uint8_t VeraAVR_messageAvailable() {
|
||||
while (nrf24_available()) {
|
||||
VeraAVR_readMessage();
|
||||
// Check that message was addressed for me. Could be a message from some other sensor
|
||||
// as we«re automatically listening to pipe 0 (our writing pipe) where all sensors
|
||||
// send their data
|
||||
if (_veraavr_data.msg.header.to == _veraavr_data.radioId && VeraAVR_validate() == VALIDATE_OK)
|
||||
return 1;
|
||||
wdt_reset();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
message_s VeraAVR_waitForMessage() {
|
||||
while (1) {
|
||||
if (VeraAVR_messageAvailable()) {
|
||||
return _veraavr_data.msg;
|
||||
}
|
||||
wdt_reset();
|
||||
}
|
||||
}
|
||||
|
||||
message_s VeraAVR_getMessage() {
|
||||
return _veraavr_data.msg;
|
||||
}
|
||||
|
||||
|
||||
message_s VeraAVR_readMessage() {
|
||||
uint8_t len = nrf24_getDynamicPayloadSize();
|
||||
//uint8_t done =
|
||||
nrf24_read(&_veraavr_data.msg, len);
|
||||
// Make sure string gets terminated ok.
|
||||
_veraavr_data.msg.data[sizeof(_veraavr_data.msg.data)-1] = '\0';
|
||||
return _veraavr_data.msg;
|
||||
}
|
||||
|
||||
/*
|
||||
* calculate CRC8 on message_s data taking care of data structure and protocol version
|
||||
*/
|
||||
uint8_t VeraAVR_crc8Message(message_s var_msg) {
|
||||
struct {
|
||||
message_s msg;
|
||||
uint8_t protocol_version;
|
||||
} crc_data;
|
||||
memcpy(&crc_data, &var_msg, sizeof(var_msg));
|
||||
crc_data.protocol_version = PROTOCOL_VERSION;
|
||||
// some clean up needed for repeated result
|
||||
crc_data.msg.header.crc = 0;
|
||||
// fill unused space by zeroes for string data only
|
||||
if(!crc_data.msg.header.binary) {
|
||||
uint8_t len = strlen(crc_data.msg.data);
|
||||
if(len < sizeof(crc_data.msg.data)-1) {
|
||||
memset(&crc_data.msg.data[len], 0, sizeof(crc_data.msg.data) - 1 - len);
|
||||
}
|
||||
}
|
||||
return crc8((uint8_t*)&crc_data, (uint8_t)sizeof(crc_data));
|
||||
}
|
||||
/*
|
||||
* true if message is consistent *
|
||||
*/
|
||||
uint8_t VeraAVR_checkCRCMessage(message_s var_msg) {
|
||||
return (var_msg.header.crc == VeraAVR_crc8Message(var_msg))?1:0;
|
||||
}
|
||||
uint8_t VeraAVR_checkCRC() {
|
||||
return VeraAVR_checkCRCMessage(_veraavr_data.msg);
|
||||
}
|
||||
|
||||
uint8_t VeraAVR_validate() {
|
||||
uint8_t crc_check = VeraAVR_checkCRC();
|
||||
uint8_t version_check = (_veraavr_data.msg.header.version == PROTOCOL_VERSION);
|
||||
if(crc_check && version_check) return VALIDATE_OK;
|
||||
if(!crc_check) return VALIDATE_BAD_CRC;
|
||||
return VALIDATE_BAD_VERSION;
|
||||
}
|
||||
|
||||
+157
-157
@@ -1,157 +1,157 @@
|
||||
/*
|
||||
Vera Arduino library is used to communicate sensor data to your Vera receiver sketch using RF24 library.
|
||||
|
||||
Created by Henrik Ekblad <henrik.ekblad@gmail.com>
|
||||
Version 1.0
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
modification by axillent@gmail.com to run on pure AVR
|
||||
|
||||
before running this you need to configure properly RF24-avrlib
|
||||
*/
|
||||
|
||||
#ifndef Vera_h
|
||||
#define Vera_h
|
||||
|
||||
#include <RF24/nRF24L01.h>
|
||||
#include <RF24/RF24.h>
|
||||
#include <RF24/RF24_config.h>
|
||||
#include <crc8/crc8.h>
|
||||
|
||||
#define LIBRARY_VERSION "1.2+"
|
||||
#define PROTOCOL_VERSION 1
|
||||
#define BAUD_RATE 115200
|
||||
#define AUTO 0xFFF // Id 4095 is reserved for auto initialization of radioId.
|
||||
#define NODE_CHILD_ID 0xFF // Node child id is always created for when a new sensor is detected
|
||||
|
||||
#define VERA_CHANNEL 76
|
||||
|
||||
// This is the radioId for Vera receiver sketch (where all sensors should send their data).
|
||||
// This is also act as base value for sensor radioId
|
||||
#define BASE_RADIO_ID 0xABCDABC000LL
|
||||
#define GATEWAY_ADDRESS ((uint16_t)0)
|
||||
|
||||
#define MAX_MESSAGE_LENGTH 32
|
||||
|
||||
#define CRC8INIT 0x00
|
||||
#define CRC8POLY 0x18 //0X18 = X^8+X^5+X^4+X^0
|
||||
|
||||
typedef enum { M_PRESENTATION = 0, M_VARIABLE, M_STATUS, M_CUSTOM, M_GATEWAY_MESSAGE, M_REQUEST_STATUS_RESPONSE } messageType;
|
||||
|
||||
// Adding new variable- and device types should be done at the end of enum
|
||||
typedef enum { V_TEMP,V_HUM, V_LIGHT, V_DIMMER, V_PRESSURE, V_FORECAST, V_RAIN, V_RAINRATE, V_WIND, V_GUST,
|
||||
V_DIRECTION, V_UV, V_WEIGHT, V_DISTANCE, V_IMPEDANCE, V_BATTERY_LEVEL, V_BATTERY_DATE,
|
||||
V_ARMED, V_TRIPPED, V_LAST_TRIP, V_WATT, V_KWH, V_SCENE_ON, V_SCENE_OFF, V_HEATER,
|
||||
V_HEATER_SW, V_LIGHT_LEVEL, V_VAR1, V_VAR2, V_VAR3, V_VAR4, V_VAR5, V_TIME, V_VERSION,
|
||||
V_REQUEST_ID, V_INCLUSION_MODE, V_INCLUSION_COUNT, V_INCLUSION_RESULT, V_NEIGHBORS,
|
||||
V_RELAY_MODE, V_LAST_UPDATE} variable;
|
||||
|
||||
typedef enum { S_DOOR, S_MOTION, S_SMOKE, S_LIGHT, S_DIMMER, S_COVER, S_TEMP, S_HUM, S_BARO, S_WIND,
|
||||
S_RAIN, S_UV, S_WEIGHT, S_POWER, S_HEATER, S_DISTANCE, S_LIGHT_LEVEL, S_ARDUINO_NODE} senosr;
|
||||
|
||||
// result of validate()
|
||||
enum { VALIDATE_OK=0, VALIDATE_BAD_CRC, VALIDATE_BAD_VERSION };
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t crc : 8; // 8 bits crc
|
||||
uint8_t version : 3; // 3 bits protocol version
|
||||
uint8_t binary : 1; // 1 bit. Data is binary and should be encoded when sent to vera
|
||||
uint16_t from : 12; // 12 bits. RadioId of sender node
|
||||
uint16_t to : 12; // 12 bits. RadioId of destination node
|
||||
uint8_t childId : 8; // 1 byte. Up to MAX_CHILD_DEVICES child sensors per radioId
|
||||
uint8_t messageType : 4; // 4 bits. Type of message. See messageType
|
||||
uint8_t type : 8; // 8 bits. variableType or deviceType depending on messageType
|
||||
} header_s;
|
||||
|
||||
typedef struct {
|
||||
header_s header;
|
||||
char data[MAX_MESSAGE_LENGTH - sizeof(header_s) + 1]; // Each message can transfer a payload. Add one extra byte for \0
|
||||
} message_s;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Begin operation of the vera library
|
||||
*
|
||||
* Call this in setup(), before calling any other vera library methods.
|
||||
*/
|
||||
void VeraAVR_begin(uint16_t _radioId);
|
||||
void VeraAVR_begin2(uint16_t _radioId, uint16_t _relayId);
|
||||
|
||||
/**
|
||||
* Sends a variable change to vera
|
||||
*
|
||||
* @param childId The child id for which to update variable. Value can be 0-127.
|
||||
* @param variableType The variableType to update
|
||||
* @param value New value of the variable
|
||||
*/
|
||||
void VeraAVR_sendVariable_char (uint8_t childId, uint8_t variableType, const char *value);
|
||||
void VeraAVR_sendVariable_float (uint8_t childId, uint8_t variableType, float value, int decimals);
|
||||
void VeraAVR_sendVariable_long(uint8_t childId, uint8_t variableType, long value);
|
||||
void VeraAVR_sendVariable_int(uint8_t childId, uint8_t variableType, int value);
|
||||
|
||||
/**
|
||||
* Requests status for a vera variable (sent from an actuator)
|
||||
*
|
||||
* @param childId The unique child id for the different sensors connected to this arduino. 0-127.
|
||||
* @param variableType The variableType to update
|
||||
*/
|
||||
void VeraAVR_requestStatus (uint8_t childId, uint8_t variableType);
|
||||
|
||||
/**
|
||||
* Requests configuration parameter
|
||||
*
|
||||
* @param variableType The variableType to fetch
|
||||
*/
|
||||
void VeraAVR_requestConfiguration(uint8_t variableType);
|
||||
char * VeraAVR_getConfiguration(uint8_t variableType);
|
||||
/**
|
||||
* Fetches time from vera
|
||||
*/
|
||||
unsigned long VeraAVR_getTime();
|
||||
/*
|
||||
* The arduino must send a presentation of all the sensors connected before any variable changes will be registrered on Vera side.
|
||||
* Usually it's good to present all sensors when Arduino starts up (setup).
|
||||
* Waits until all data has been transmitted and acknowledged by Vera receiver (retries RESEND_PRESENTATION times).
|
||||
*
|
||||
* @param childId The unique child id for the different sensors connected to this arduino. 0-254.
|
||||
* @param sensorType Sensor types to create. They will be numbered from 0 up to 127.
|
||||
*/
|
||||
void VeraAVR_sendSensorPresentation (uint8_t childId, uint8_t sensorType);
|
||||
|
||||
/**
|
||||
* Registers this arduino device as a relay. This requires this node to call
|
||||
* api methods regularly to relay messages that could be passing this node and
|
||||
* answer to any neighbor-discovery messages.
|
||||
* Basically all api methods relays messages (waitForMessage, messageAvailable, ..)
|
||||
* When this method is called vera will be informed that this node acts as relay.
|
||||
*/
|
||||
void VeraAVR_registerNodeAsRelay();
|
||||
/**
|
||||
* Busy waits until there is a message available to be read (used for actuators, like relays)
|
||||
*/
|
||||
message_s VeraAVR_waitForVeraMessage(void);
|
||||
/**
|
||||
* Returns true if there is a message addressed for this node is available to be read (used by VeraGateway)
|
||||
*/
|
||||
uint8_t VeraAVR_messageAvailable();
|
||||
/**
|
||||
* Returns the last received message
|
||||
*/
|
||||
message_s VeraAVR_getMessage();
|
||||
uint8_t sendData(uint16_t from, uint16_t next, uint16_t to, uint8_t childId, messageType messageType, uint8_t type, const char *data);
|
||||
uint8_t VeraAVR_validate();
|
||||
uint8_t VeraAVR_crc8Message(message_s);
|
||||
uint8_t VeraAVR_checkCRCMessage(message_s);
|
||||
uint8_t VeraAVR_checkCRC();
|
||||
message_s VeraAVR_readMessage(void);
|
||||
uint8_t VeraAVR_sendDataGW(uint8_t childId, messageType messageType, uint8_t type, const char *data);
|
||||
uint8_t VeraAVR_sendData(uint16_t from, uint16_t next, uint16_t to, uint8_t childId, messageType messageType, uint8_t type, const char *data);
|
||||
|
||||
#include "VeraAVR.c"
|
||||
|
||||
#endif
|
||||
/*
|
||||
Vera Arduino library is used to communicate sensor data to your Vera receiver sketch using RF24 library.
|
||||
|
||||
Created by Henrik Ekblad <henrik.ekblad@gmail.com>
|
||||
Version 1.0
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
modification by axillent@gmail.com to run on pure AVR
|
||||
|
||||
before running this you need to configure properly RF24-avrlib
|
||||
*/
|
||||
|
||||
#ifndef Vera_h
|
||||
#define Vera_h
|
||||
|
||||
#include <RF24/nRF24L01.h>
|
||||
#include <RF24/RF24.h>
|
||||
#include <RF24/RF24_config.h>
|
||||
#include <crc8/crc8.h>
|
||||
|
||||
#define LIBRARY_VERSION "1.2+"
|
||||
#define PROTOCOL_VERSION 1
|
||||
#define BAUD_RATE 115200
|
||||
#define AUTO 0xFFF // Id 4095 is reserved for auto initialization of radioId.
|
||||
#define NODE_CHILD_ID 0xFF // Node child id is always created for when a new sensor is detected
|
||||
|
||||
#define VERA_CHANNEL 76
|
||||
|
||||
// This is the radioId for Vera receiver sketch (where all sensors should send their data).
|
||||
// This is also act as base value for sensor radioId
|
||||
#define BASE_RADIO_ID 0xABCDABC000LL
|
||||
#define GATEWAY_ADDRESS ((uint16_t)0)
|
||||
|
||||
#define MAX_MESSAGE_LENGTH 32
|
||||
|
||||
#define CRC8INIT 0x00
|
||||
#define CRC8POLY 0x18 //0X18 = X^8+X^5+X^4+X^0
|
||||
|
||||
typedef enum { M_PRESENTATION = 0, M_VARIABLE, M_STATUS, M_CUSTOM, M_GATEWAY_MESSAGE, M_REQUEST_STATUS_RESPONSE } messageType;
|
||||
|
||||
// Adding new variable- and device types should be done at the end of enum
|
||||
typedef enum { V_TEMP,V_HUM, V_LIGHT, V_DIMMER, V_PRESSURE, V_FORECAST, V_RAIN, V_RAINRATE, V_WIND, V_GUST,
|
||||
V_DIRECTION, V_UV, V_WEIGHT, V_DISTANCE, V_IMPEDANCE, V_BATTERY_LEVEL, V_BATTERY_DATE,
|
||||
V_ARMED, V_TRIPPED, V_LAST_TRIP, V_WATT, V_KWH, V_SCENE_ON, V_SCENE_OFF, V_HEATER,
|
||||
V_HEATER_SW, V_LIGHT_LEVEL, V_VAR1, V_VAR2, V_VAR3, V_VAR4, V_VAR5, V_TIME, V_VERSION,
|
||||
V_REQUEST_ID, V_INCLUSION_MODE, V_INCLUSION_COUNT, V_INCLUSION_RESULT, V_NEIGHBORS,
|
||||
V_RELAY_MODE, V_LAST_UPDATE} variable;
|
||||
|
||||
typedef enum { S_DOOR, S_MOTION, S_SMOKE, S_LIGHT, S_DIMMER, S_COVER, S_TEMP, S_HUM, S_BARO, S_WIND,
|
||||
S_RAIN, S_UV, S_WEIGHT, S_POWER, S_HEATER, S_DISTANCE, S_LIGHT_LEVEL, S_ARDUINO_NODE} senosr;
|
||||
|
||||
// result of validate()
|
||||
enum { VALIDATE_OK=0, VALIDATE_BAD_CRC, VALIDATE_BAD_VERSION };
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t crc : 8; // 8 bits crc
|
||||
uint8_t version : 3; // 3 bits protocol version
|
||||
uint8_t binary : 1; // 1 bit. Data is binary and should be encoded when sent to vera
|
||||
uint16_t from : 12; // 12 bits. RadioId of sender node
|
||||
uint16_t to : 12; // 12 bits. RadioId of destination node
|
||||
uint8_t childId : 8; // 1 byte. Up to MAX_CHILD_DEVICES child sensors per radioId
|
||||
uint8_t messageType : 4; // 4 bits. Type of message. See messageType
|
||||
uint8_t type : 8; // 8 bits. variableType or deviceType depending on messageType
|
||||
} header_s;
|
||||
|
||||
typedef struct {
|
||||
header_s header;
|
||||
char data[MAX_MESSAGE_LENGTH - sizeof(header_s) + 1]; // Each message can transfer a payload. Add one extra byte for \0
|
||||
} message_s;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Begin operation of the vera library
|
||||
*
|
||||
* Call this in setup(), before calling any other vera library methods.
|
||||
*/
|
||||
void VeraAVR_begin(uint16_t _radioId);
|
||||
void VeraAVR_begin2(uint16_t _radioId, uint16_t _relayId);
|
||||
|
||||
/**
|
||||
* Sends a variable change to vera
|
||||
*
|
||||
* @param childId The child id for which to update variable. Value can be 0-127.
|
||||
* @param variableType The variableType to update
|
||||
* @param value New value of the variable
|
||||
*/
|
||||
void VeraAVR_sendVariable_char (uint8_t childId, uint8_t variableType, const char *value);
|
||||
void VeraAVR_sendVariable_float (uint8_t childId, uint8_t variableType, float value, int decimals);
|
||||
void VeraAVR_sendVariable_long(uint8_t childId, uint8_t variableType, long value);
|
||||
void VeraAVR_sendVariable_int(uint8_t childId, uint8_t variableType, int value);
|
||||
|
||||
/**
|
||||
* Requests status for a vera variable (sent from an actuator)
|
||||
*
|
||||
* @param childId The unique child id for the different sensors connected to this arduino. 0-127.
|
||||
* @param variableType The variableType to update
|
||||
*/
|
||||
void VeraAVR_requestStatus (uint8_t childId, uint8_t variableType);
|
||||
|
||||
/**
|
||||
* Requests configuration parameter
|
||||
*
|
||||
* @param variableType The variableType to fetch
|
||||
*/
|
||||
void VeraAVR_requestConfiguration(uint8_t variableType);
|
||||
char * VeraAVR_getConfiguration(uint8_t variableType);
|
||||
/**
|
||||
* Fetches time from vera
|
||||
*/
|
||||
unsigned long VeraAVR_getTime();
|
||||
/*
|
||||
* The arduino must send a presentation of all the sensors connected before any variable changes will be registrered on Vera side.
|
||||
* Usually it's good to present all sensors when Arduino starts up (setup).
|
||||
* Waits until all data has been transmitted and acknowledged by Vera receiver (retries RESEND_PRESENTATION times).
|
||||
*
|
||||
* @param childId The unique child id for the different sensors connected to this arduino. 0-254.
|
||||
* @param sensorType Sensor types to create. They will be numbered from 0 up to 127.
|
||||
*/
|
||||
void VeraAVR_sendSensorPresentation (uint8_t childId, uint8_t sensorType);
|
||||
|
||||
/**
|
||||
* Registers this arduino device as a relay. This requires this node to call
|
||||
* api methods regularly to relay messages that could be passing this node and
|
||||
* answer to any neighbor-discovery messages.
|
||||
* Basically all api methods relays messages (waitForMessage, messageAvailable, ..)
|
||||
* When this method is called vera will be informed that this node acts as relay.
|
||||
*/
|
||||
void VeraAVR_registerNodeAsRelay();
|
||||
/**
|
||||
* Busy waits until there is a message available to be read (used for actuators, like relays)
|
||||
*/
|
||||
message_s VeraAVR_waitForVeraMessage(void);
|
||||
/**
|
||||
* Returns true if there is a message addressed for this node is available to be read (used by VeraGateway)
|
||||
*/
|
||||
uint8_t VeraAVR_messageAvailable();
|
||||
/**
|
||||
* Returns the last received message
|
||||
*/
|
||||
message_s VeraAVR_getMessage();
|
||||
uint8_t sendData(uint16_t from, uint16_t next, uint16_t to, uint8_t childId, messageType messageType, uint8_t type, const char *data);
|
||||
uint8_t VeraAVR_validate();
|
||||
uint8_t VeraAVR_crc8Message(message_s);
|
||||
uint8_t VeraAVR_checkCRCMessage(message_s);
|
||||
uint8_t VeraAVR_checkCRC();
|
||||
message_s VeraAVR_readMessage(void);
|
||||
uint8_t VeraAVR_sendDataGW(uint8_t childId, messageType messageType, uint8_t type, const char *data);
|
||||
uint8_t VeraAVR_sendData(uint16_t from, uint16_t next, uint16_t to, uint8_t childId, messageType messageType, uint8_t type, const char *data);
|
||||
|
||||
#include "VeraAVR.c"
|
||||
|
||||
#endif
|
||||
|
||||
+63
-63
@@ -1,63 +1,63 @@
|
||||
/* please read copyright-notice at EOF */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define CRC8INIT 0x00
|
||||
#define CRC8POLY 0x18 //0X18 = X^8+X^5+X^4+X^0
|
||||
|
||||
uint8_t crc8( uint8_t *data, uint16_t number_of_bytes_in_data )
|
||||
{
|
||||
uint8_t crc;
|
||||
uint16_t loop_count;
|
||||
uint8_t bit_counter;
|
||||
uint8_t b;
|
||||
uint8_t feedback_bit;
|
||||
|
||||
crc = CRC8INIT;
|
||||
|
||||
for (loop_count = 0; loop_count != number_of_bytes_in_data; loop_count++)
|
||||
{
|
||||
b = data[loop_count];
|
||||
|
||||
bit_counter = 8;
|
||||
do {
|
||||
feedback_bit = (crc ^ b) & 0x01;
|
||||
|
||||
if ( feedback_bit == 0x01 ) {
|
||||
crc = crc ^ CRC8POLY;
|
||||
}
|
||||
crc = (crc >> 1) & 0x7F;
|
||||
if ( feedback_bit == 0x01 ) {
|
||||
crc = crc | 0x80;
|
||||
}
|
||||
|
||||
b = b >> 1;
|
||||
bit_counter--;
|
||||
|
||||
} while (bit_counter > 0);
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
/*
|
||||
This code is from Colin O'Flynn - Copyright (c) 2002
|
||||
only minor changes by M.Thomas 9/2004
|
||||
|
||||
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.
|
||||
*/
|
||||
/* please read copyright-notice at EOF */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define CRC8INIT 0x00
|
||||
#define CRC8POLY 0x18 //0X18 = X^8+X^5+X^4+X^0
|
||||
|
||||
uint8_t crc8( uint8_t *data, uint16_t number_of_bytes_in_data )
|
||||
{
|
||||
uint8_t crc;
|
||||
uint16_t loop_count;
|
||||
uint8_t bit_counter;
|
||||
uint8_t b;
|
||||
uint8_t feedback_bit;
|
||||
|
||||
crc = CRC8INIT;
|
||||
|
||||
for (loop_count = 0; loop_count != number_of_bytes_in_data; loop_count++)
|
||||
{
|
||||
b = data[loop_count];
|
||||
|
||||
bit_counter = 8;
|
||||
do {
|
||||
feedback_bit = (crc ^ b) & 0x01;
|
||||
|
||||
if ( feedback_bit == 0x01 ) {
|
||||
crc = crc ^ CRC8POLY;
|
||||
}
|
||||
crc = (crc >> 1) & 0x7F;
|
||||
if ( feedback_bit == 0x01 ) {
|
||||
crc = crc | 0x80;
|
||||
}
|
||||
|
||||
b = b >> 1;
|
||||
bit_counter--;
|
||||
|
||||
} while (bit_counter > 0);
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
/*
|
||||
This code is from Colin O'Flynn - Copyright (c) 2002
|
||||
only minor changes by M.Thomas 9/2004
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
+42
-42
@@ -1,42 +1,42 @@
|
||||
#ifndef CRC8_H_
|
||||
#define CRC8_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t crc8( uint8_t* data, uint16_t number_of_bytes_in_data );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "crc8.c"
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
This is based on code from :
|
||||
|
||||
Copyright (c) 2002 Colin O'Flynn
|
||||
|
||||
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 CRC8_H_
|
||||
#define CRC8_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t crc8( uint8_t* data, uint16_t number_of_bytes_in_data );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "crc8.c"
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
This is based on code from :
|
||||
|
||||
Copyright (c) 2002 Colin O'Flynn
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
#include <spi.h>
|
||||
#include <ds1305.h>
|
||||
|
||||
#define DS1305_PIN 4
|
||||
#define LED_PIN 3
|
||||
|
||||
// following two methods required by DS1305 library to select/deselect device
|
||||
void select_ds1305(void)
|
||||
{
|
||||
digitalWrite(DS1305_PIN, HIGH);
|
||||
}
|
||||
|
||||
void deselect_ds1305(void)
|
||||
{
|
||||
digitalWrite(DS1305_PIN, LOW);
|
||||
}
|
||||
|
||||
// flash led that's connected to pin 3
|
||||
void flash_led(void)
|
||||
{
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
for (int i=0; i<10; i++) {
|
||||
digitalWrite(LED_PIN, i%2==0);
|
||||
delay(50);
|
||||
}
|
||||
}
|
||||
|
||||
// called when pin INT0 goes from 1 to 0
|
||||
ISR(INT0_vect)
|
||||
{
|
||||
// get alarm value to clear alarm interrupt flag on DS1305
|
||||
DS1305_DATETIME alarm;
|
||||
get_alarm0(&alarm);
|
||||
flash_led();
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
// flash LED at start to indicate were about to start
|
||||
flash_led();
|
||||
flash_led();
|
||||
|
||||
// pin used to enable DS1305
|
||||
pinMode(DS1305_PIN, OUTPUT);
|
||||
|
||||
// Make sure ADC is unselected and setup spi
|
||||
deselect_ds1305();
|
||||
setup_spi(SPI_MODE_1, SPI_MSB, SPI_NO_INTERRUPT, SPI_MSTR_CLK16);
|
||||
set_control(0);
|
||||
|
||||
// set current date/time to Thursday 06/05/09 20:32:30
|
||||
DS1305_DATETIME current = {0x30, 0x32, 0x20, 0x05, 0x06, 0x05, 0x09};
|
||||
set_time(¤t);
|
||||
|
||||
// change the value of alarm to the required time/granularity:
|
||||
// raise alarm every day (at 20:32:00):
|
||||
// DS1305_DATETIME alarm = {0x00, 0x32, 0x20, 0x00 | DS1305_ALARM_SET};
|
||||
// raise alarm every minute (when seconds = 00):
|
||||
// DS1305_DATETIME alarm = {0x00, 0x32 | DS1305_ALARM_SET,
|
||||
// 0x20 | DS1305_ALARM_SET, 0x05 | DS1305_ALARM_SET};
|
||||
// raise alarm every second:
|
||||
DS1305_DATETIME alarm = {0x55 | DS1305_ALARM_SET, 0x32 | DS1305_ALARM_SET,
|
||||
0x20 | DS1305_ALARM_SET, 0x05 | DS1305_ALARM_SET};
|
||||
set_alarm0(&alarm);
|
||||
// turn on timer and make alarm0 lower INT0 pin when alarm is triggered
|
||||
set_control(DS1305_EOSC | DS1305_INTCN | DS1305_AIE0);
|
||||
|
||||
// raise interrupt when INT0 pin falls (pin PD0 at AT90usbXXX, pin PD2 on ATmegaXXX (arduino pin 2))
|
||||
// the code in ISR(INT0_vect) above will be called
|
||||
EICRA = (1<<ISC01) | (0<<ISC00);
|
||||
// enable interrupts
|
||||
EIMSK = (1<<INT0);
|
||||
sei();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// do nothing - all action happens in interrupt
|
||||
}
|
||||
#include <spi.h>
|
||||
#include <ds1305.h>
|
||||
|
||||
#define DS1305_PIN 4
|
||||
#define LED_PIN 3
|
||||
|
||||
// following two methods required by DS1305 library to select/deselect device
|
||||
void select_ds1305(void)
|
||||
{
|
||||
digitalWrite(DS1305_PIN, HIGH);
|
||||
}
|
||||
|
||||
void deselect_ds1305(void)
|
||||
{
|
||||
digitalWrite(DS1305_PIN, LOW);
|
||||
}
|
||||
|
||||
// flash led that's connected to pin 3
|
||||
void flash_led(void)
|
||||
{
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
for (int i=0; i<10; i++) {
|
||||
digitalWrite(LED_PIN, i%2==0);
|
||||
delay(50);
|
||||
}
|
||||
}
|
||||
|
||||
// called when pin INT0 goes from 1 to 0
|
||||
ISR(INT0_vect)
|
||||
{
|
||||
// get alarm value to clear alarm interrupt flag on DS1305
|
||||
DS1305_DATETIME alarm;
|
||||
get_alarm0(&alarm);
|
||||
flash_led();
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
// flash LED at start to indicate were about to start
|
||||
flash_led();
|
||||
flash_led();
|
||||
|
||||
// pin used to enable DS1305
|
||||
pinMode(DS1305_PIN, OUTPUT);
|
||||
|
||||
// Make sure ADC is unselected and setup spi
|
||||
deselect_ds1305();
|
||||
setup_spi(SPI_MODE_1, SPI_MSB, SPI_NO_INTERRUPT, SPI_MSTR_CLK16);
|
||||
set_control(0);
|
||||
|
||||
// set current date/time to Thursday 06/05/09 20:32:30
|
||||
DS1305_DATETIME current = {0x30, 0x32, 0x20, 0x05, 0x06, 0x05, 0x09};
|
||||
set_time(¤t);
|
||||
|
||||
// change the value of alarm to the required time/granularity:
|
||||
// raise alarm every day (at 20:32:00):
|
||||
// DS1305_DATETIME alarm = {0x00, 0x32, 0x20, 0x00 | DS1305_ALARM_SET};
|
||||
// raise alarm every minute (when seconds = 00):
|
||||
// DS1305_DATETIME alarm = {0x00, 0x32 | DS1305_ALARM_SET,
|
||||
// 0x20 | DS1305_ALARM_SET, 0x05 | DS1305_ALARM_SET};
|
||||
// raise alarm every second:
|
||||
DS1305_DATETIME alarm = {0x55 | DS1305_ALARM_SET, 0x32 | DS1305_ALARM_SET,
|
||||
0x20 | DS1305_ALARM_SET, 0x05 | DS1305_ALARM_SET};
|
||||
set_alarm0(&alarm);
|
||||
// turn on timer and make alarm0 lower INT0 pin when alarm is triggered
|
||||
set_control(DS1305_EOSC | DS1305_INTCN | DS1305_AIE0);
|
||||
|
||||
// raise interrupt when INT0 pin falls (pin PD0 at AT90usbXXX, pin PD2 on ATmegaXXX (arduino pin 2))
|
||||
// the code in ISR(INT0_vect) above will be called
|
||||
EICRA = (1<<ISC01) | (0<<ISC00);
|
||||
// enable interrupts
|
||||
EIMSK = (1<<INT0);
|
||||
sei();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// do nothing - all action happens in interrupt
|
||||
}
|
||||
|
||||
+111
-111
@@ -1,111 +1,111 @@
|
||||
This directory contains a simple AVR spi helper library that should
|
||||
run on most AVR microcontrollers which support SPI.
|
||||
|
||||
The code is further described at:
|
||||
http://www.rocketnumbernine.com/2009/04/26/using-spi-on-an-avr-1/ (basics & ADC)
|
||||
http://www.rocketnumbernine.com/2009/05/12/using-spi-on-an-avr-2/ (RTC)
|
||||
|
||||
Any comments/questions to <andrew@rocketnumbernine.com>
|
||||
|
||||
Make sure viewing this text in a fixed width font for the tables and diagrams
|
||||
|
||||
|
||||
----------------------------------
|
||||
Arduino
|
||||
----------------------------------
|
||||
The Arduino Directory contains all code required to run on the Arduino.
|
||||
Simply copy the Arduino/SPI and Arduino/DS1305 directories to the
|
||||
"hardware/libraries" directory of your Arduino IDE installation and
|
||||
restart the Arduino IDE. Once restarted there should be
|
||||
"Sketch->Import Library->SPI" and "Sketch->Import Library->DS1305" menu
|
||||
entries which can be used to include the spi header files into your project.
|
||||
"File->Sketchbook->Examples->Library SPI" contains 3 example projects
|
||||
|
||||
|
||||
----------------------------------
|
||||
AVR GCC
|
||||
----------------------------------
|
||||
To use, just copy spi.h and spi.c (and ds1305.c and ds1305.h if using
|
||||
the DS1305 Real Time Clock chip) to your own project and compile.
|
||||
|
||||
Makefile.mf - 'standard' generated make file from AVR GCC
|
||||
Makefile - Makefile "make examples" will make example programs below:
|
||||
|
||||
spi-test-adc.c MC3201 Analogue to Digital convertor example
|
||||
spi-test-rtc.c DS1305 - Real-Time-Clock/Alarm example
|
||||
spi-test-masterslave.c Master/Slave communication example
|
||||
|
||||
|
||||
----------------------------------
|
||||
PINS
|
||||
----------------------------------
|
||||
Following are the AVR pins used in the circuits below
|
||||
|
||||
ATmegaXXX Arduino AT90usbXXX
|
||||
MISO PB4 12 PB3
|
||||
MOSI PB3 11 PB2
|
||||
SCK PB5 13 PB1
|
||||
SS PB2 10 PB0
|
||||
|
||||
INT0 PD2 2 PD0
|
||||
|
||||
|
||||
----------------------------------
|
||||
MC3201 12-bit ADC Circuit
|
||||
----------------------------------
|
||||
See http://ww1.microchip.com/downloads/en/DeviceDoc/21290D.pdf for full details.
|
||||
|
||||
+-----------------+
|
||||
| MC3201 |
|
||||
+5V [| Vref Vdd |] +5V
|
||||
| |
|
||||
Analogue In [| IN+ CLK |] AVR SCK
|
||||
| |
|
||||
Ground [| IN- Dout |] AVR MOSI
|
||||
| |
|
||||
Ground [| Vss ^CS |] AVR CE
|
||||
+-----------------+
|
||||
|
||||
|
||||
For testing purposes "Analogue In" can be connected to the middle wire
|
||||
of a potentiometer with one outer wire being connected to +5 and the
|
||||
other to Ground. A 1uF Capacitor should be placed between the analogue
|
||||
input and ground, and +5V and ground as close to the chip as possible,
|
||||
but in a pinch the circuit will likely work without.
|
||||
|
||||
|
||||
MOSI/SLCK/CE to the relevant pin on the AVR (MISO is not used) - see above.
|
||||
|
||||
----------------------------------
|
||||
DS1305 Real Time Clock Circuit
|
||||
----------------------------------
|
||||
See http://datasheets.maxim-ic.com/en/ds/DS1305.pdf for full details.
|
||||
|
||||
Without a battery the following connections can be used:
|
||||
|
||||
+-----------------+
|
||||
| DS1305 |
|
||||
Ground [| Vcc2 Vcc1 |] +5V
|
||||
| |
|
||||
Ground [| Vbat ^PF |] Not Connected
|
||||
| |
|
||||
Crystal [| X1 Vccif |] +5V
|
||||
| |
|
||||
Crystal [| X2 SDO |] AVR MISO
|
||||
| |
|
||||
Not Connected [| N.C. SDI |] AVR MOSI
|
||||
| |
|
||||
AVR INT0 [| INT0 SLCK |] AVR SLCK
|
||||
| |
|
||||
Not Connected [| INT1 CE |] AVR CE
|
||||
| |
|
||||
Ground [| GND SERMODE |] +5V
|
||||
+-----------------+
|
||||
|
||||
|
||||
MISO/MOSI/SLCK/CE/INT0 to the relevant pin on the AVR - see above.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
This directory contains a simple AVR spi helper library that should
|
||||
run on most AVR microcontrollers which support SPI.
|
||||
|
||||
The code is further described at:
|
||||
http://www.rocketnumbernine.com/2009/04/26/using-spi-on-an-avr-1/ (basics & ADC)
|
||||
http://www.rocketnumbernine.com/2009/05/12/using-spi-on-an-avr-2/ (RTC)
|
||||
|
||||
Any comments/questions to <andrew@rocketnumbernine.com>
|
||||
|
||||
Make sure viewing this text in a fixed width font for the tables and diagrams
|
||||
|
||||
|
||||
----------------------------------
|
||||
Arduino
|
||||
----------------------------------
|
||||
The Arduino Directory contains all code required to run on the Arduino.
|
||||
Simply copy the Arduino/SPI and Arduino/DS1305 directories to the
|
||||
"hardware/libraries" directory of your Arduino IDE installation and
|
||||
restart the Arduino IDE. Once restarted there should be
|
||||
"Sketch->Import Library->SPI" and "Sketch->Import Library->DS1305" menu
|
||||
entries which can be used to include the spi header files into your project.
|
||||
"File->Sketchbook->Examples->Library SPI" contains 3 example projects
|
||||
|
||||
|
||||
----------------------------------
|
||||
AVR GCC
|
||||
----------------------------------
|
||||
To use, just copy spi.h and spi.c (and ds1305.c and ds1305.h if using
|
||||
the DS1305 Real Time Clock chip) to your own project and compile.
|
||||
|
||||
Makefile.mf - 'standard' generated make file from AVR GCC
|
||||
Makefile - Makefile "make examples" will make example programs below:
|
||||
|
||||
spi-test-adc.c MC3201 Analogue to Digital convertor example
|
||||
spi-test-rtc.c DS1305 - Real-Time-Clock/Alarm example
|
||||
spi-test-masterslave.c Master/Slave communication example
|
||||
|
||||
|
||||
----------------------------------
|
||||
PINS
|
||||
----------------------------------
|
||||
Following are the AVR pins used in the circuits below
|
||||
|
||||
ATmegaXXX Arduino AT90usbXXX
|
||||
MISO PB4 12 PB3
|
||||
MOSI PB3 11 PB2
|
||||
SCK PB5 13 PB1
|
||||
SS PB2 10 PB0
|
||||
|
||||
INT0 PD2 2 PD0
|
||||
|
||||
|
||||
----------------------------------
|
||||
MC3201 12-bit ADC Circuit
|
||||
----------------------------------
|
||||
See http://ww1.microchip.com/downloads/en/DeviceDoc/21290D.pdf for full details.
|
||||
|
||||
+-----------------+
|
||||
| MC3201 |
|
||||
+5V [| Vref Vdd |] +5V
|
||||
| |
|
||||
Analogue In [| IN+ CLK |] AVR SCK
|
||||
| |
|
||||
Ground [| IN- Dout |] AVR MOSI
|
||||
| |
|
||||
Ground [| Vss ^CS |] AVR CE
|
||||
+-----------------+
|
||||
|
||||
|
||||
For testing purposes "Analogue In" can be connected to the middle wire
|
||||
of a potentiometer with one outer wire being connected to +5 and the
|
||||
other to Ground. A 1uF Capacitor should be placed between the analogue
|
||||
input and ground, and +5V and ground as close to the chip as possible,
|
||||
but in a pinch the circuit will likely work without.
|
||||
|
||||
|
||||
MOSI/SLCK/CE to the relevant pin on the AVR (MISO is not used) - see above.
|
||||
|
||||
----------------------------------
|
||||
DS1305 Real Time Clock Circuit
|
||||
----------------------------------
|
||||
See http://datasheets.maxim-ic.com/en/ds/DS1305.pdf for full details.
|
||||
|
||||
Without a battery the following connections can be used:
|
||||
|
||||
+-----------------+
|
||||
| DS1305 |
|
||||
Ground [| Vcc2 Vcc1 |] +5V
|
||||
| |
|
||||
Ground [| Vbat ^PF |] Not Connected
|
||||
| |
|
||||
Crystal [| X1 Vccif |] +5V
|
||||
| |
|
||||
Crystal [| X2 SDO |] AVR MISO
|
||||
| |
|
||||
Not Connected [| N.C. SDI |] AVR MOSI
|
||||
| |
|
||||
AVR INT0 [| INT0 SLCK |] AVR SLCK
|
||||
| |
|
||||
Not Connected [| INT1 CE |] AVR CE
|
||||
| |
|
||||
Ground [| GND SERMODE |] +5V
|
||||
+-----------------+
|
||||
|
||||
|
||||
MISO/MOSI/SLCK/CE/INT0 to the relevant pin on the AVR - see above.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user