diff --git a/Bootup Logo/Logos/001_TS80.hex b/Bootup Logo/Logos/001_TS80.hex
new file mode 100644
index 00000000..61939dce
--- /dev/null
+++ b/Bootup Logo/Logos/001_TS80.hex
@@ -0,0 +1,258 @@
+:020000040800F2
+:10F8000055AA0DF07FFFD5AB7DEA7F7E7F7FFF7F1E
+:10F81000FFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFF78
+:10F820007F7FBFBFDFBFEFDF0FEFEF0FAFAFAFAF38
+:10F83000EFEFAFAFAFAFAFAF0FEF6FEFAFAFAFAFB8
+:10F84000AFAF2FAFAFAFAFAFAFAF6FAF6FEFAFAF88
+:10F85000AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFB8
+:10F86000EF6FFF1FFDFFFAFDF7FAF7F7F7F7FAF76B
+:10F87000FAFAFAFAFAFAFAFAFAFAFAFAFAFAF0FAF2
+:10F88000F7F7EFEFDFEFBFDF80BFBF80AAAAAAAA1A
+:10F89000BFBFAAAAAAAAAAAA80BFB0BFADAFAAAA90
+:10F8A000ADAFA2AAADAAAAAFADAAB0AFB0BFAFAF7D
+:10F8B000AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF58
+:10F8C000BFB0FFC00000000000000000000000000A
+:10F8D0000000000000000000000000000000000028
+:10F8E0000000000000000000000000000000000018
+:10F8F0000000000000000000000000000000000008
+:10F9000000000000000000000000000000000000F7
+:10F9100000000000000000000000000000000000E7
+:10F9200000000000000000000000000000000000D7
+:10F9300000000000000000000000000000000000C7
+:10F9400000000000000000000000000000000000B7
+:10F9500000000000000000000000000000000000A7
+:10F960000000000000000000000000000000000097
+:10F970000000000000000000000000000000000087
+:10F980000000000000000000000000000000000077
+:10F990000000000000000000000000000000000067
+:10F9A0000000000000000000000000000000000057
+:10F9B0000000000000000000000000000000000047
+:10F9C0000000000000000000000000000000000037
+:10F9D0000000000000000000000000000000000027
+:10F9E0000000000000000000000000000000000017
+:10F9F0000000000000000000000000000000000007
+:10FA000000000000000000000000000000000000F6
+:10FA100000000000000000000000000000000000E6
+:10FA200000000000000000000000000000000000D6
+:10FA300000000000000000000000000000000000C6
+:10FA400000000000000000000000000000000000B6
+:10FA500000000000000000000000000000000000A6
+:10FA60000000000000000000000000000000000096
+:10FA70000000000000000000000000000000000086
+:10FA80000000000000000000000000000000000076
+:10FA90000000000000000000000000000000000066
+:10FAA0000000000000000000000000000000000056
+:10FAB0000000000000000000000000000000000046
+:10FAC0000000000000000000000000000000000036
+:10FAD0000000000000000000000000000000000026
+:10FAE0000000000000000000000000000000000016
+:10FAF0000000000000000000000000000000000006
+:10FB000000000000000000000000000000000000F5
+:10FB100000000000000000000000000000000000E5
+:10FB200000000000000000000000000000000000D5
+:10FB300000000000000000000000000000000000C5
+:10FB400000000000000000000000000000000000B5
+:10FB500000000000000000000000000000000000A5
+:10FB60000000000000000000000000000000000095
+:10FB70000000000000000000000000000000000085
+:10FB80000000000000000000000000000000000075
+:10FB90000000000000000000000000000000000065
+:10FBA0000000000000000000000000000000000055
+:10FBB0000000000000000000000000000000000045
+:10FBC0000000000000000000000000000000000035
+:10FBD0000000000000000000000000000000000025
+:10FBE0000000000000000000000000000000000015
+:10FBF0000000000000000000000000000000000005
+:10F8000055AA0DF07FFFD5AB7DEA7F7E7F7FFF7F1E
+:10F81000FFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFF78
+:10F820007F7FBFBFDFBFEFDF0FEFEF0FAFAFAFAF38
+:10F83000EFEFAFAFAFAFAFAF0FEF6FEFAFAFAFAFB8
+:10F84000AFAF2FAFAFAFAFAFAFAF6FAF6FEFAFAF88
+:10F85000AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFB8
+:10F86000EF6FFF1FFDFFFAFDF7FAF7F7F7F7FAF76B
+:10F87000FAFAFAFAFAFAFAFAFAFAFAFAFAFAF0FAF2
+:10F88000F7F7EFEFDFEFBFDF80BFBF80AAAAAAAA1A
+:10F89000BFBFAAAAAAAAAAAA80BFB0BFADAFAAAA90
+:10F8A000ADAFA2AAADAAAAAFADAAB0AFB0BFAFAF7D
+:10F8B000AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF58
+:10F8C000BFB0FFC00000000000000000000000000A
+:10F8D0000000000000000000000000000000000028
+:10F8E0000000000000000000000000000000000018
+:10F8F0000000000000000000000000000000000008
+:10F9000000000000000000000000000000000000F7
+:10F9100000000000000000000000000000000000E7
+:10F9200000000000000000000000000000000000D7
+:10F9300000000000000000000000000000000000C7
+:10F9400000000000000000000000000000000000B7
+:10F9500000000000000000000000000000000000A7
+:10F960000000000000000000000000000000000097
+:10F970000000000000000000000000000000000087
+:10F980000000000000000000000000000000000077
+:10F990000000000000000000000000000000000067
+:10F9A0000000000000000000000000000000000057
+:10F9B0000000000000000000000000000000000047
+:10F9C0000000000000000000000000000000000037
+:10F9D0000000000000000000000000000000000027
+:10F9E0000000000000000000000000000000000017
+:10F9F0000000000000000000000000000000000007
+:10FA000000000000000000000000000000000000F6
+:10FA100000000000000000000000000000000000E6
+:10FA200000000000000000000000000000000000D6
+:10FA300000000000000000000000000000000000C6
+:10FA400000000000000000000000000000000000B6
+:10FA500000000000000000000000000000000000A6
+:10FA60000000000000000000000000000000000096
+:10FA70000000000000000000000000000000000086
+:10FA80000000000000000000000000000000000076
+:10FA90000000000000000000000000000000000066
+:10FAA0000000000000000000000000000000000056
+:10FAB0000000000000000000000000000000000046
+:10FAC0000000000000000000000000000000000036
+:10FAD0000000000000000000000000000000000026
+:10FAE0000000000000000000000000000000000016
+:10FAF0000000000000000000000000000000000006
+:10FB000000000000000000000000000000000000F5
+:10FB100000000000000000000000000000000000E5
+:10FB200000000000000000000000000000000000D5
+:10FB300000000000000000000000000000000000C5
+:10FB400000000000000000000000000000000000B5
+:10FB500000000000000000000000000000000000A5
+:10FB60000000000000000000000000000000000095
+:10FB70000000000000000000000000000000000085
+:10FB80000000000000000000000000000000000075
+:10FB90000000000000000000000000000000000065
+:10FBA0000000000000000000000000000000000055
+:10FBB0000000000000000000000000000000000045
+:10FBC0000000000000000000000000000000000035
+:10FBD0000000000000000000000000000000000025
+:10FBE0000000000000000000000000000000000015
+:10FBF0000000000000000000000000000000000005
+:10F8000055AA0DF07FFFD5AB7DEA7F7E7F7FFF7F1E
+:10F81000FFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFF78
+:10F820007F7FBFBFDFBFEFDF0FEFEF0FAFAFAFAF38
+:10F83000EFEFAFAFAFAFAFAF0FEF6FEFAFAFAFAFB8
+:10F84000AFAF2FAFAFAFAFAFAFAF6FAF6FEFAFAF88
+:10F85000AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFB8
+:10F86000EF6FFF1FFDFFFAFDF7FAF7F7F7F7FAF76B
+:10F87000FAFAFAFAFAFAFAFAFAFAFAFAFAFAF0FAF2
+:10F88000F7F7EFEFDFEFBFDF80BFBF80AAAAAAAA1A
+:10F89000BFBFAAAAAAAAAAAA80BFB0BFADAFAAAA90
+:10F8A000ADAFA2AAADAAAAAFADAAB0AFB0BFAFAF7D
+:10F8B000AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF58
+:10F8C000BFB0FFC00000000000000000000000000A
+:10F8D0000000000000000000000000000000000028
+:10F8E0000000000000000000000000000000000018
+:10F8F0000000000000000000000000000000000008
+:10F9000000000000000000000000000000000000F7
+:10F9100000000000000000000000000000000000E7
+:10F9200000000000000000000000000000000000D7
+:10F9300000000000000000000000000000000000C7
+:10F9400000000000000000000000000000000000B7
+:10F9500000000000000000000000000000000000A7
+:10F960000000000000000000000000000000000097
+:10F970000000000000000000000000000000000087
+:10F980000000000000000000000000000000000077
+:10F990000000000000000000000000000000000067
+:10F9A0000000000000000000000000000000000057
+:10F9B0000000000000000000000000000000000047
+:10F9C0000000000000000000000000000000000037
+:10F9D0000000000000000000000000000000000027
+:10F9E0000000000000000000000000000000000017
+:10F9F0000000000000000000000000000000000007
+:10FA000000000000000000000000000000000000F6
+:10FA100000000000000000000000000000000000E6
+:10FA200000000000000000000000000000000000D6
+:10FA300000000000000000000000000000000000C6
+:10FA400000000000000000000000000000000000B6
+:10FA500000000000000000000000000000000000A6
+:10FA60000000000000000000000000000000000096
+:10FA70000000000000000000000000000000000086
+:10FA80000000000000000000000000000000000076
+:10FA90000000000000000000000000000000000066
+:10FAA0000000000000000000000000000000000056
+:10FAB0000000000000000000000000000000000046
+:10FAC0000000000000000000000000000000000036
+:10FAD0000000000000000000000000000000000026
+:10FAE0000000000000000000000000000000000016
+:10FAF0000000000000000000000000000000000006
+:10FB000000000000000000000000000000000000F5
+:10FB100000000000000000000000000000000000E5
+:10FB200000000000000000000000000000000000D5
+:10FB300000000000000000000000000000000000C5
+:10FB400000000000000000000000000000000000B5
+:10FB500000000000000000000000000000000000A5
+:10FB60000000000000000000000000000000000095
+:10FB70000000000000000000000000000000000085
+:10FB80000000000000000000000000000000000075
+:10FB90000000000000000000000000000000000065
+:10FBA0000000000000000000000000000000000055
+:10FBB0000000000000000000000000000000000045
+:10FBC0000000000000000000000000000000000035
+:10FBD0000000000000000000000000000000000025
+:10FBE0000000000000000000000000000000000015
+:10FBF0000000000000000000000000000000000005
+:10F8000055AA0DF07FFFD5AB7DEA7F7E7F7FFF7F1E
+:10F81000FFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFF78
+:10F820007F7FBFBFDFBFEFDF0FEFEF0FAFAFAFAF38
+:10F83000EFEFAFAFAFAFAFAF0FEF6FEFAFAFAFAFB8
+:10F84000AFAF2FAFAFAFAFAFAFAF6FAF6FEFAFAF88
+:10F85000AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFB8
+:10F86000EF6FFF1FFDFFFAFDF7FAF7F7F7F7FAF76B
+:10F87000FAFAFAFAFAFAFAFAFAFAFAFAFAFAF0FAF2
+:10F88000F7F7EFEFDFEFBFDF80BFBF80AAAAAAAA1A
+:10F89000BFBFAAAAAAAAAAAA80BFB0BFADAFAAAA90
+:10F8A000ADAFA2AAADAAAAAFADAAB0AFB0BFAFAF7D
+:10F8B000AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF58
+:10F8C000BFB0FFC00000000000000000000000000A
+:10F8D0000000000000000000000000000000000028
+:10F8E0000000000000000000000000000000000018
+:10F8F0000000000000000000000000000000000008
+:10F9000000000000000000000000000000000000F7
+:10F9100000000000000000000000000000000000E7
+:10F9200000000000000000000000000000000000D7
+:10F9300000000000000000000000000000000000C7
+:10F9400000000000000000000000000000000000B7
+:10F9500000000000000000000000000000000000A7
+:10F960000000000000000000000000000000000097
+:10F970000000000000000000000000000000000087
+:10F980000000000000000000000000000000000077
+:10F990000000000000000000000000000000000067
+:10F9A0000000000000000000000000000000000057
+:10F9B0000000000000000000000000000000000047
+:10F9C0000000000000000000000000000000000037
+:10F9D0000000000000000000000000000000000027
+:10F9E0000000000000000000000000000000000017
+:10F9F0000000000000000000000000000000000007
+:10FA000000000000000000000000000000000000F6
+:10FA100000000000000000000000000000000000E6
+:10FA200000000000000000000000000000000000D6
+:10FA300000000000000000000000000000000000C6
+:10FA400000000000000000000000000000000000B6
+:10FA500000000000000000000000000000000000A6
+:10FA60000000000000000000000000000000000096
+:10FA70000000000000000000000000000000000086
+:10FA80000000000000000000000000000000000076
+:10FA90000000000000000000000000000000000066
+:10FAA0000000000000000000000000000000000056
+:10FAB0000000000000000000000000000000000046
+:10FAC0000000000000000000000000000000000036
+:10FAD0000000000000000000000000000000000026
+:10FAE0000000000000000000000000000000000016
+:10FAF0000000000000000000000000000000000006
+:10FB000000000000000000000000000000000000F5
+:10FB100000000000000000000000000000000000E5
+:10FB200000000000000000000000000000000000D5
+:10FB300000000000000000000000000000000000C5
+:10FB400000000000000000000000000000000000B5
+:10FB500000000000000000000000000000000000A5
+:10FB60000000000000000000000000000000000095
+:10FB70000000000000000000000000000000000085
+:10FB80000000000000000000000000000000000075
+:10FB90000000000000000000000000000000000065
+:10FBA0000000000000000000000000000000000055
+:10FBB0000000000000000000000000000000000045
+:10FBC0000000000000000000000000000000000035
+:10FBD0000000000000000000000000000000000025
+:10FBE0000000000000000000000000000000000015
+:10FBF0000000000000000000000000000000000005
+:00000001FF
diff --git a/Bootup Logo/Logos/001_TS80.png b/Bootup Logo/Logos/001_TS80.png
new file mode 100644
index 00000000..c3322812
Binary files /dev/null and b/Bootup Logo/Logos/001_TS80.png differ
diff --git a/Development Resources/TS80-Bootloader.hex b/Development Resources/TS80-Bootloader.hex
new file mode 100644
index 00000000..af1767e4
--- /dev/null
+++ b/Development Resources/TS80-Bootloader.hex
@@ -0,0 +1,515 @@
+:020000040800F2
+:2000000020310020E52E00088D2E00088F2E0008912E0008932E0008952E00080000000071
+:20002000000000000000000000000000972E0008992E0008000000009B2E00089D2E000880
+:20004000252F0008292F00082D2F0008312F0008352F0008392F00083D2F0008412F000850
+:20006000452F0008492F00084D2F0008512F0008552F0008592F00085D2F0008612F000830
+:20008000652F0008692F00086D2F0008712F00089F2E0008792F00087D2F0008812F0008E7
+:2000A000852F0008892F00088D2F0008912F0008952F0008992F00089D2F0008A12F0008F0
+:2000C000A52F0008A92F0008AD2F0008B12F0008B52F0008B92F0008BD2F0008C12F0008D0
+:2000E000C52F0008C92F0008CD2F0008D12F0008D52F0008D92F0008DD2F0008E12F0008B0
+:20010000E52F0008E92F0008ED2F0008F12F0008F52F0008F92F0008FD2F0008013000088E
+:2001200005300008093000080D3000081130000870B500F08FFEDFF8144804F510553C350F
+:200140000146284600F016FC4FF40051204600F0D1FE04F200464FF4B0720FF650213046A2
+:2001600000F0F2FE0B222946304600F0EDFE0FF6CC4518222946204600F0E6FE1822294610
+:2001800004F5007000F0E0FEDFF8C407C4F81604A0220FF6783104F5C06000F0D5FE5022F2
+:2001A0000FF6084104F5006000F0CEFE40220FF64C4104F5206000F0C7FE42F20C20011940
+:2001C0000022CA760A774A7602518A600A61CA6070BD70B50C46DFF87467B4F5805F03D1F8
+:2001E00000F044F830460EE0B4F5205F04D100F03DF806F5007006E0B4F5804F07D100F0BC
+:2002000035F806F58060BDE8704000F08DBEB4F51A4F2AD300F02AF806F5C06000F084FE98
+:200220004FF40072314606F508503C3000F08CFE42F2272085196978B9B9DFF81817098856
+:20024000825D32B9B4F52A4F00D271B100F0A2F90AE0012A09D111B1B4F51C4F02D2B4F5F1
+:200260002C4F02D300F08BFA687070BD4FF400720146704710B50446080004D14FF4007260
+:200280000FF228713DE0DFF8C416B0F5805F08BF4FF4007235D0B0F5205F04D14FF4007243
+:2002A00001F500712DE0B0F5804F04D14FF4007201F5806125E0B0F5004F05D100F02DF811
+:2002C000A0220FF648211CE0B0F5024F05D100F024F850220FF6D42113E06FF402421218EA
+:2002E00041F2FF739A4205D200F017F840220FF60C3106E0B0F51A4F08D34FF4007201F589
+:20030000C0612046BDE8104000F00EBE4FF400712046BDE8104000F053BE4FF4007120467B
+:2003200000F04EBE2DE9F84F4FF02008DFF81C5642F227277C194FF4085908EB050000F20F
+:200340000046002030733078E52818BF002800F0E580F07A202840F0E180307A482826D137
+:20036000707A452804BFB07A582840F0D08000F0DDF800207855607820B102280DD00428AB
+:2003800006D010E05220307244207072592009E0452030725220707204E04E2030724F201D
+:2003A00070725420B072F07D401CF075B4E041285AD1707A442804BFB07A52285BD100F096
+:2003C000B5F800207855607049F805004FF0020A95F80006302804BF95F8010678281ED151
+:2003E0000AEB050090F80006A0F13001C9B20A2922BFA0F14101C9B2062922BFA0F16101D3
+:20040000C9B206290BD259F805104FEA011B49F805B000F0DAF9584449F8050003E0607844
+:2004200040F0040060700AF1010ABAF10A0FCFDB6078A0B959F80500DFF81C15884202D316
+:2004400000F00FFD18B94E2030724F2004E001207855532030724520707254205BE045200E
+:2004600030725220707256E0422820D1707A492804BFB07A4E284AD100F058F8785D28B926
+:200480004E2030724F207072542004E052203072442070725920B072785D022804BF0020CC
+:2004A0007855785D012837D10220785534E053280DD1707A452804BFB07A542827D1785D80
+:2004C00060BB5520307253207072452023E0522805D1707A44281AD1B07A59280EE0552886
+:2004E00005D1707A532812D1B07A452806E0452806D1707A52280AD1B07A522807D10DE075
+:200500004E2801BF707A4F28B07A542806D04520307252207072B0720320607008F1200837
+:20052000B8F5007FFFF609AFBDE8F18FB07EF17E00EB01200005000DDFF8181408804FF434
+:200540007A7000F041BD70B542F20C25DFF8FC63AC19207F03281BD100F0F5FD0028FBD1B2
+:2005600000F03FFD4FF4C87000F02EFD012000F038FD00F0F5FD002020776076A060A8510B
+:20058000DFF8D00300210180E07E022808BFE17670BD00002DE9F04742F20424DFF8AC53BD
+:2005A00066190020F060306900EB0509F068401942F2242A0AEB050742F2292879780E29D9
+:2005C00056D8DFE801F0080C131B1F2C324146595F757B838A0090F800063A2874E000F006
+:2005E000CBF80001B0770020306173E096F81E8000F0C2F84044B077B07F5DE000F0BCF87B
+:2006000000010AE054F8058000F0B6F8404460516059F17F4118F177000260515AE000F084
+:20062000ABF800010AF8050054E01AF8058000F0A3F840440AF8050060591AF8051008182E
+:200640006051F07F081837E000F096F80001707740E096F81D8000F08FF840447077F07F41
+:20066000717F0818F0777878401C7870B07F002876D17878801C72E000F07EF8000108F8EC
+:20068000090027E018F809A000F076F8504408F809003069F17F421918F802205118F1772F
+:2006A000401C3061B17F884214D27878401E56E000F060F808EB0010F0770BE000F05AF80A
+:2006C0004044F077F07F002846D103E090F800060D2841D17878401C41E090F800060A289C
+:2006E0003AD10020F870707F042805D17879B979090401EB00607060707F012837D068BBE8
+:2007000060597168081860519349884201D202202EE0002001E03069801C30613069B17F3D
+:2007200088421BD26159401800F03BFD31694A1960590818491CB37F994218F8021008BF97
+:2007400041F47F4104D04244527801EB022189B200F016FD0428DED0042009E00020787044
+:20076000F068401CF060B0F5007FFFF41CAF0020BDE8F08796F81F8090F8000625E0F8B5EA
+:200780000024724D05F508564FF408577859F168081800F006FD601990F8001690F8010699
+:2007A00001EB002189B27859F268101800F0E8FCF168891CF160042801D00420F2BDA41CEB
+:2007C000B4F5007FE2D30020F2BD10B585B0044600A80FF2C411112200F0B6FBA4F16100E1
+:2007E000C0B21A2838BF203C002000A9415CE4B2A14204D0401CC0B21028F6D3002005B09B
+:2008000010BD2DE9F04142F21824504D6619534F327A2AB940023860480278600120307248
+:20082000307A012831D1605978B905F5005839684046FFF71FFD40229821404600F0C6FC1B
+:200840004FF4E070605140200CE040229821B868401900F5005000F0B9FC605940386051A8
+:20086000B8684030B8604021012000F05AFD3021012000F0E0FC38684030386078684038C9
+:2008800078603748816840398160786838B96051B860386033480321017000203072BDE815
+:2008A000F0812DE9F04142F21C24284D6259403266192D4F33792BB94002386048027860E3
+:2008C00001203071307901282FD1002027490AE05B1903F5005310F801C083F800C0401CEB
+:2008E00063595B1C635163599342F1D3DFF88080B8F800003968411839607A68101A7860BE
+:20090000C00507D100206051A1F5007105F50050FFF75FFC12488168B8F80020891A816030
+:200920004FF44051022000F097FC786800281EBF0C480078042806D100206051012100F0A7
+:2009400057FE00203071BDE8F0810000EC010020188DDD40102D002000400008D82C0020D3
+:20096000C82C0020942C0020E42C0020342C0020962C00201C2221FA02F303F00F030A2B69
+:20098000ACBF3733303300F8013B121F53B2002BF1D50021017070473031323334353637DF
+:2009A000383941424344454600000000EB3C904D53444F53352E3000020108000200020052
+:2009C00010F80C00010001000000000000000000000029A298E46C4E4F204E414D45202030
+:2009E0002020464154313220202033C98ED1BCF07B8ED9B800208EC0FCBD007C384E247DAE
+:200A0000248BC199E83C01721C83EB3A66A11C7C26663B07268A57FC750680CA028856025B
+:200A200080C31073EB33C98A461098F7661603461C13561E03460E13D18B7611608946FCBA
+:200A40008956FEB82000F7E68B5E0B03C348F7F30146FC114EFE61BF0000E8E600723926B9
+:200A6000382D741760B10BBEA17DF3A66174324E740983C7203BFB72E6EBDCA0FB7DB47D1B
+:200A80008BF0AC9840740C487413B40EBB0700CD10EBEFA0FD7DEBE6A0FC7DEBE1CD16CD4D
+:200AA00019268B551A52B001BB0000E83B0072E85B8A5624BE0B7C8BFCC746F03D7DC746D3
+:200AC000F4297D8CD9894EF2894EF6C606967DCBEA030000200FB6C8668B46F86603461C43
+:200AE000668BD066C1EA10EB5E0FB6C84A4A8A460D32E4F7E20346FC1356FEEB4A52500655
+:200B0000536A016A10918B4618969233D2F7F691F7F64287CAF7761A8AF28AE8C0CC020AEB
+:200B2000CCB80102807E020E7504B4428BF48A5624CD136161720B40750142035E0B4975ED
+:200B400006F8C341BB000060666A00EBB04E544C44522020202020200D0A52656D6F766544
+:200B6000206469736B73206F72206F74686572206D656469612EFF0D0A4469736B2065720E
+:200B8000726F72FF0D0A507265737320616E79206B657920746F20726573746172740D0ACF
+:200BA00000000000000000ACCBD855AA4446552056335F34325F44080000000000000000EF
+:200BC00000008A5A794500000000000042200049006E0066006F000F007272006D006100C4
+:200BE000740069006F0000006E00000001530079007300740065000F00726D0020005600BE
+:200C00006F006C00750000006D00650053595354454D7E3120202016005E63705D455D4533
+:200C2000000064705D45020000000000412E005F002E00540072000F007F610073006800B0
+:200C40006500730000000000FFFFFFFF7E3120202020202054524122004A8A5A794579459E
+:200C600000008A5A7945050000100000E552415348457E3145464D1200478A5A7945794525
+:200C800000008A5A7945040000000000412E0054007200610073000F002568006500730031
+:200CA0000000FFFFFFFF0000FFFFFFFF5452415348457E312020201200478A5A79457945AD
+:200CC00000008A5A7945040000000000412E0066007300650076000F00DA65006E0074001B
+:200CE0007300640000000000FFFFFFFF46534556454E7E3120202012004D8A5A794579458C
+:200D000000008A5A79450D00000000002E2020202020202020202010005E63705D455D4531
+:200D2000000064705D450200000000002E2E20202020202020202010005E63705D455D453A
+:200D4000000064705D4500000000000042470075006900640000000F00FFFFFFFFFFFFFF4A
+:200D6000FFFFFFFFFFFF0000FFFFFFFF0149006E006400650078000F00FF65007200560049
+:200D80006F006C00750000006D006500494E444558457E3120202020007263705D455D45BC
+:200DA000000064705D4503004C0000007B00380031004200320031003700330033002D001B
+:200DC00036003800440039002D0034003000350039002D0041003500370033002D004500AA
+:200DE000410030004400320033003200450039003300320031007D00000000002E20202088
+:200E0000202020202020203200478A5A7945794500008A5A79450400000000002E2E2020D7
+:200E2000202020202020201000478A5A7945794500008A5A7945000000000000F8FFFFFF84
+:200E4000FFFFFF6F0007800009A0000BC000FFFFFFFF0F00234801684268511880684018F9
+:200E6000704710B5FFF7F6FF1F490C6800F006F8844201D1012010BD002010BD0A231B4A3C
+:200E800001461B48FFE7F0B503F11506C3F14304C3F151050A330EE0C0EB40105F1003EB86
+:200EA00097774FEAA70CA3EB8C07FF0021FA07F7FFB238185B1C1BB2B342EDDB0DE0C0EB65
+:200EC0004010631004EB93739B10A4EB8301C90022FA01F1C9B20818641C24B2AC42EEDB1D
+:200EE000F0BD0000E8F7FF1FFC3F0008011020D502DEC0DE002200F0BDBB10B450F8041BCC
+:200F000081B102681218001D50F8043BDC0744BFA9F10104E31852F8044B43F8044B091F9C
+:200F2000F9D1EBE710BC704762B38B0708D0521E11F8013B00F8013B00F024808B07F6D13D
+:200F4000830740F0208000BF103A07D330B4B1E83810103AA0E83810F9D230BC530724BF81
+:200F6000B1E80810A0E8081044BF51F8043B40F8043BD20724BF31F8022B20F8022B44BFC4
+:200F80000B7803707047083A07D3B1E80810083A40F8043B40F804CBF7D25307E4E750F8E1
+:200FA000041B61B150F8042BD30744BFA9F101039A18002342F8043B091FFAD1EFE7704740
+:200FC000002200F071BB000000214FF6FF7302E04D4A1360491C40F2DC5242439142F7D328
+:200FE00070474A494FF400620A614FF480520A61002808680AD120F4404040F440500860E4
+:20100000086820F4402040F4403009E020F4804040F430400860086820F4802040F43020D7
+:201020000860704780F308887047704738B500F06BFB102000F0E0FB354C207820B10220D6
+:2010400000F0D4FB082502E000F0D0FB002531484168314A11434160016841F08071016064
+:20106000012000F06AFB012000F06AFB392000F094FB0028FAD0207800B1022000F063FB01
+:2010800000F068FBA842FBD10121142000F06AFB012140F20C6000F06EFB01214FF400001E
+:2010A00000F072FB207820B10120BDE8324000F056BB31BD80B501464FF0006000F047FCF5
+:2010C0004FF4A06000F012FC14208DF8000002208DF8010000208DF8020001208DF803001E
+:2010E00000A800F008FC01BD0C484FF6FF71C1600B4A02600B4A42600B48C1600B49016095
+:201100004FF08831416070470C10014004080140E8010020001002400A846800000801403B
+:201120008888880884B4BB8B000C0140884883440948012101600021016041604FF4E05142
+:20114000064A118005E0044801210160002141600321016000207047405C0040142D00209F
+:201160000448C0610221017203490162034A426208680047A02C0020D800002030010020E0
+:2011800038B504460D46104800F0A0FB05281CBF342000F07AFB29462046BDE8344000F043
+:2011A0005BBB10B50446A0050CD1074800F08EFB05281CBF342000F068FB2046BDE81040B6
+:2011C00000F02EBB10BD0000A086010010B5490001F1804101F5C041521C521009E010F8C9
+:2011E000013B10F8014B43EA042321F8023B891C521EF4D110BD490001F1804101F5C0411B
+:20120000521C521004E051F8043B20F8023B521EF9D170474FF6F8710840DFF89011086076
+:20122000704710B5DFF8882152F8203048F68F142340194324E010B5DFF8742152F82030A9
+:2012400048F6BF742340CC0648BF83F01003890648BF83F020030FE010B5DFF8542152F8E5
+:2012600020304BF68F742340CC0448BF83F48053890448BF83F4005343F4004141F08001CE
+:2012800042F8201010BDDFF8281151F820204BF68F731A4082F4405242F4004209E0DFF8A1
+:2012A000101151F8202048F68F631A4042F40042FFE742F0800241F820207047DFF8F010E1
+:2012C00051F8202052040AD551F8202048F68F731A4042F4404242F0800241F82020704791
+:2012E000334951F8202052060AD551F8202048F68F731A4042F4004242F0C00241F82020AA
+:20130000704738E0294A126892B202EBC000294A37E03BE02549096889B201EBC000254947
+:201320003AE0224A126892B202EBC000224A2AE01E4A126892B202EBC000204A02EB4000DC
+:201340003F2909D34A091F23194208BF521E1204910941F4004105E04A08C90748BF521C80
+:2013600012049109016070471049096889B201EBC000124914E00D4A126892B202EBC000E3
+:201380000F4A4908490042F8101070470749096889B201EBC0000A4951F8100080B270470C
+:2013A00051F810008005800D70470000505C0040005C004008600040046000400C6000408B
+:2013C000006000400106090C41EA10207047000080B5964890F82010022909D018D3042958
+:2013E00002D00ED3052913D1002180F820100CE0C17B28290CD1816A406ABDE8044000F09B
+:20140000FEBA0121002000F0F3F84FF440512BE101BD38B5854CE57B0220FFF7A5FF60849B
+:201420000246D8218248FFF7E6FE94F8200010B1012803D00AE0BDE8314013E02A2D06D13D
+:20144000A16A606ABDE8344000F003BB022000F0F9F82421052000F0CDFA00210220BDE8E4
+:201460003440C5E010B5714C628C1AB170492046FFF76AFD6F4861684160A1688160608CA5
+:201480001F2806D0022000F0DDF8002020601A218DE0E27B282A18BF2A2A0FD1607CA17C4D
+:2014A000090441EA0060E17C40EA0120217D08436062A07DE17D41EA0020A06220685E494A
+:2014C000884270D15D480068617B884204D3A07B401EC0B2102804D3022000F0B3F824217B
+:2014E00065E0606AA16A002A49D0032A2BD0082A18BF0A2A53D0122A29D0152A4FD01A2A30
+:201500002DD01B2A27D01D2A49D01E2A23D0232A2DD0252A2FD0282A35D02A2A37D02F2A54
+:2015200039D0552A3BD05A2A1DD0882A18BF8A2A35D08F2A18BF9E2A31D0A82A1CBFAA2A8B
+:20154000AF2A2CD02FE0BDE8104000F04BBABDE8104000F011BABDE8104000F04FBABDE87A
+:20156000104000F037BABDE8104000F037BABDE8104000F010BABDE8104000F01BBABDE856
+:20158000104000F0A5BABDE8104000F038BABDE8104000F05EBABDE8104000F083BABDE811
+:2015A000104000F09ABA022000F04CF82021052000F020FA00210120BDE8104018E010B5DD
+:2015C0000C4622469821FFF701FE21460120FFF7A8FE30210120FFF72EFE1448032180F8F3
+:2015E000201014488168091B81600021017310BD10B50C460F4B1249196018730D22982157
+:201600001846FFF7E3FD0D210120FFF78AFE0748052180F8201044B1042180F82010302199
+:201620000120BDE81040FFF706BE10BD742C0020342C0020C82C002055534243002D00203F
+:201640005553425380B518B1022807D00AD301BD10210120BDE80440FFF7EDBD1021012086
+:20166000FFF7E9FD4FF480510220BDE80440FFF7F3BD000000B500BF130096469446103943
+:2016800028BFA0E80C50FAD85FEA417C28BF0CC048BF40F8042BC90728BF20F8022B48BF83
+:2016A00000F8012B00BD0000401810F0030308D0C91A1FD3DB0748BF00F8012D28BF20F830
+:2016C000022D130030B414461546103928BF20E93C00FAD8490728BF20E90C0048BF40F85D
+:2016E000042D890028BF20F8022D48BF00F8012D30BC7047C91818BF00F8012DCB0728BF9B
+:2017000000F8012D704700002E48016841F00101016041682C4A1140416001682B4A114039
+:201720000160016821F480210160416821F4FE0141604FF41F0181607047254908607047E2
+:2017400025490860704723490A68920850EA8200086070471F48006800F00C0070471F49BF
+:20176000086070471E4A0029116814BF084321EA0000106070471B4A0029116814BF0843CB
+:2017800021EA000010607047174A0029116814BF084321EA00001060704700214209094B04
+:2017A000012A08BF1A6803D0022A0CBF1A6A5A6A012300F01F0003FA00F0024218BF012146
+:2017C00008467047001002400000FFF8FFFFF6FE000042420410024060004242D8004242AF
+:2017E00014100240181002401C100240DFF8C4100A6802F0380206E0DFF8B8100A6822F059
+:2018000010020A600A68104308607047FFE7DFF8A800DFF8A8100160DFF8A4100160704770
+:2018200038B5054600F015F804280DD1DFF89440206840F002002060656000F006F8216848
+:2018400041F6FD721140216032BD206840F0400020604FF4302039E070B504460D4600F04B
+:2018600011F804280CD1174E306840F001003060258000F007F8316841F6FE7211403160E2
+:2018800070BD08804FF4005020E00F490860704704200D490A68D20701D5012070470A68A4
+:2018A000520701D5022070470968C90648BF03207047000000200240042002402301674567
+:2018C000AB89EFCD102002400C20024010B5FFE70446FFF7DDFF03E02CB1FFF7D9FF641E61
+:2018E0000128F9D004B9052010BD00001B4908431B490860704770B503781A460121C478B7
+:20190000ECB1174B1B6803F4E063C3F5E0631B0A4478C3F10405AC4085780F2626FA03F33E
+:201920002B4023431B010F4C1355007842110E4B00F01F0001FA00F043F8220070BD5011EE
+:201940000A4A03F01F03994042F8201070BD084A1140084307490860704700000000FA0552
+:201960000CED00E000E400E000E100E080E100E080FFFF1F08ED00E07449087CC00702D577
+:201980007348052105E00FF2E410C97C252928BF2421FFF714BE6F48002181800221817117
+:2019A0000021C1714172022181720021C1720C21FFF705BE6848002101800F218170FF213E
+:2019C000C17000218180022181710021C1710821FFF7F5BD04216148FFF7F1BD0821604838
+:2019E000FFF7EDBD5948C17C132928BF12215D48FFF7E5BD5B4A90701173704769E070B588
+:201A000004460D46584E3078C0B92A462146282000F076F8C8B14D48007B000603D502205C
+:201A2000307029460CE00220FFF70CFE00F00EF801210120BDE87040FFF7DABD022804D16F
+:201A40002046BDE87040FEF7DCBE70BD24210520D0E710B5444C2278EAB90A4601462A207B
+:201A600000F04EF8E8B13948007B000608D4012020704FF440510220BDE81040FFF7ECBB80
+:201A80000020FFF7DFFDFFF7E1FF00210120BDE81040FFF7ADBD012A04BFBDE81040FEF70F
+:201AA00000BF10BD80B52948816829B9007C400702D40121002006E00220FFF7C3FDFFF79A
+:201AC000C5FF00210120FFE7BDE80440FFF790BD00BF01210020FFF78BBD80B51B4881682E
+:201AE00009B9002004E0007B00064CBF00200220FFF7A8FD2021FFF7AAFF00210120E3E7CB
+:201B000080B55118B1F5805F09D92A2804BF0220FFF798FD0020FFF795FD21210BE00B49D5
+:201B20008968B1EB422F0ED02A280CBF02200020FFF788FD2421FFF78AFF00210120FFF7F3
+:201B400057FD002002BD012002BD0000742C0020EC2C0020BC010020F42C0020E401002058
+:201B6000D8010020A8010020942C002000800202200000005669727475616C204446552019
+:201B80004469736B20202020202020202020202010B5DFF8884700B92BE000F096F8006825
+:201BA000804720680A3010BD80B5DFF870070068C178DFF86C2752788A420CD38278002AA8
+:201BC00004BF8288002A06D1817200F07EF840688047002002BD022002BD10B5DFF83C4790
+:201BE00000B906E000F071F88068804720680C3010BD206801210182002010BD10B5DFF8F7
+:201C00001C472068C1784079DFF8182712689269904721688A7A92B1002804BF0879002821
+:201C20000DD1887858B900F050F8C068804720684179C1722068C1780173002010BD0220D5
+:201C400010BD1CB5DFF8D416096810B90220088239E0DFF8D44600202080087800227F2331
+:201C6000184215D1487A81064CBF42F0020102F0FD0121702178400654BF01F0FE0041F008
+:201C80000100207000F021F800698047204616BD00F07F03012BF9D000F07F00022812D15E
+:201CA000487900F00F0142F0010200F088FA05D500F030001028E5D12270E3E700F44050F4
+:201CC000B0F5805FF7E7002016BDDFF8600600687047F8B5DFF844060068017811F07F0123
+:201CE00004D1417A01F0DF0141724FE0022901BF41880029017900294AD1417921F08005B6
+:201D0000DFF82C460A0654F825204CBF02F0300202F44052DFF808361B789D4238D2002A67
+:201D20001CBF807A002833D0080654F825000BD500F03000102825D12846FFF7D1FA302176
+:201D40002846FFF778FA1DE000F44050B0F5805F18D148F280064BF68F7745B900F0BDFA13
+:201D60002068384080F44050304320600AE02846FFF7A4FA54F82500384080F44050304320
+:201D800044F82500FFF7A1FF406980470020F2BD0220F2BD38B5DFF884050268537923F0A6
+:201DA0008000DFF88C151C0651F820404CBF04F0300404F44054DFF868552D78A84206D2A6
+:201DC000558825B9002C1CBF927A002A01D1022032BD48F280021B0651F8203005D548F69A
+:201DE000BF74234083F0100304E04BF68F74234083F480531A4341F82020FFF766FF8069D8
+:201E00008047002032BD80B5DFF810050068417A41F020014172FFF758FFC0698047002046
+:201E200002BDDFF8F8241268538A20B98888C01A108200207047086818187047F8B5DFF892
+:201E4000DC54286800F110042688A168080018BF002E14D0A088864288BF0646304688474D
+:201E600007462088801B20806088301860800020FFF750FA324601463846FFF7BCF9DFF803
+:201E8000B464208850B1DFF8B0044FF44051018000210020FFF745FA3020308028682188F2
+:201EA000A288914228BF032101D211B105210172F1BD06210172DFF88404006880B2DFF8D4
+:201EC0008014002241F8102030203080F1BD2DE9F843DFF84844206800F110063188DFF862
+:201EE0005454002904BF007A042816D1DFF85404017801290DD1DFF84414096889B2DFF85F
+:201F00004024002342F8113030212980042703702CE007271020288028E0B6F8048088450E
+:201F200005D30427414588BF4146884600E002274046B168884781460020FFF7EAF94246BD
+:201F400001464846FFF742F941460020FFF7E9F93088A0EB08003080708840447080302045
+:201F60002880DFF8D4034FF44051018020680772BDE8F18338B5DFF8A44320684578017833
+:201F80007F22114238D1092D02D1FFF70DFE47E0052D1BD1C17880294FD28178002901BF10
+:201FA00081880029807A002847D10620DFF88C13096889B2DFF88823002342F81130DFF876
+:201FC000741330220A802168087231BD032D08D1C178012904BF8088002823D1FFF713FF52
+:201FE0001EE0012D04BFC17801291BD18188C9B9407A80060DD415E001F07F00012804D194
+:020000040800F2
+:202000000B2D0FD1FFF7FAFD0AE002280AD1012D02D1FFF75EFE03E0032D03D1FFF7BAFEE4
+:202020000028C2D02846BF49096849698847032808BF0920C7D00028B7D00820C3E738B55E
+:20204000B64D28684178B74C062913D101787F2211422AD18078012802D12068C16968E0C8
+:20206000022802D12068016A63E003281DD12068416A5EE000293DD14188002904BFC1886E
+:20208000022912D1017981B901787F22114204BF8288002A2CD001F07F02012A10D100F0B0
+:2020A00089F810B92868807A10BB28684078216809698847032845D128680921017231BD13
+:2020C00001F07F010229F0D1407900F00F0100F0700200F074F84CBF00F0300000F440507D
+:2020E0008F4B1B789942E0D2002ADED10028DCD095491EE0082905D100787F210842D4D14F
+:20210000924916E00A2902BF017801F07F010129CBD1817A0029C8D04188002901BF017962
+:202120000029C1880129C0D100F044F80028BCD187490800B9D028680022428281610020B8
+:202140008847002029680A8A4FF6FF739A4208BF092004D0022818BF002A02D10820087274
+:2021600031BD087800061ED5C88800902368009C944202D2009808820FE082420DD293F808
+:202180002C00704C824238BF002005D392FBF0F500FB152008B90120207093F82C008882CF
+:2021A000BDE8314093E60320087263484FF44051018031BD002140792268926910475C4BA8
+:2021C000000653F82100704738B55C48006880B2604931F81000400000F1804000F5C040E3
+:2021E0004E4C21680A7A092A14D010F8012B0A70216810F8012B4A70851C35F8040BFFF729
+:20220000E1F8216848802888FFF7DCF821688880A888C8802068012101722068C08810B95B
+:20222000FFF7A8FE01E0FFF70AFFBDE831403EE010B53A4C2068017A022918BF042904D19C
+:20224000FFF745FE2068007A14E0062911D14178052902BF01787F22114206D1C07800F02A
+:2022600042F8FFF732FD006A80472E48006880688047082017E010B5284C2068007A0228BD
+:2022800018BF04280ED0032818BF052804D1FFF7D5FD2068007A06E0072803D121480068D5
+:2022A000C0688047082021680872BDE8104080B500F013F819480068017A082906D11E492C
+:2022C0004FF480520A801B4910220A80007A092801D1012002BD002002BD1F4890F82C10D8
+:2022E0000020FFF725B870B50D4909780022104B48F68F760BE0D4B253F824503540254322
+:2023000045F4004545F0800543F82450521C8A42F1D340F080001149086070BDBC2C002031
+:20232000E0010020C02C0020082D0020C42C0020005C00400E2D00200C2D0020505C0040EF
+:2023400004600040172D0020431C0008911B0008DB1B000808600040D80000204C5C0040D4
+:2023600070470000F8B58478303CE4B20A2C38BF2246C478303CE4B20A2C38BF234600781A
+:202380003038C0B20A2838BF01460024534818250FF2A016271805FB014C1CF806C087F85B
+:2023A00060C005FB024C1CF806C087F890C005FB034C1CF806C087F8A8C0641C182CE9DB6E
+:2023C00000240C2201460C206043C0B200F004F8641C082CF5DBF1BD70B504460D461646E7
+:2023E000002100F04BF8761C2946F0B200F035F805460121204600F041F82946F0B2BDE817
+:2024000070402AE03749086037483C2202700968C9B2334800F09AB910B58CB000A80FF277
+:20242000DC013022FEF790FD2E2200F03CF82F4C4FF48071204600F006FA0220FEF7C4FD9A
+:202440004FF48071204600F0FCF90220FEF7BCFD2E20FFF7D7FF0CB010BD10B50C4620490A
+:2024600040220A70012203E014F8013B5354521C8242F9DBFFF7C6FF204610BD30B583B07F
+:2024800000AA0FF2A80330CB30C28DF80500012904BFB1208DF80100082200F004F80820ED
+:2024A000FFF7B0FF37BD00A90D48FEF73DBD10B500212020FFF7E2FF094C00F019F88020A3
+:2024C000FFF7A0FF01212020FFF7D8FF00F010F88020BDE8104095E700000000000000200F
+:2024E00034260020FC2C0020162D002000080140402020707F21601CFEF762BD80AE80D5CB
+:20250000805280A8800F80C880D38000804080A1808D801480DA8002808180E080D980F18E
+:2025200080DB803080A480A680AF000080B080218020807F00E010080810E00000000000B7
+:20254000000F102020100F0000000000001010F800000000000000000020203F2020000026
+:2025600000000000007008080888700000000000003028242221300000000000003008882C
+:2025800088483000000000000018202020110E00000000000000C02010F8000000000000BC
+:2025A00000070424243F24000000000000F8088888080800000000000019212020110E00AC
+:2025C0000000000000E010888818000000000000000F112020110E0000000000003808081C
+:2025E000C8380800000000000000003F000000000000000000708808088870000000000094
+:20260000001C222121221C000000000000E010080810E000000000000000312222110F0077
+:20262000000000000000000000000000000000000030300000000000000000007047424AF7
+:20264000012903D10146104600F0FBB819B90146104600F0F8B8704780B501210820FFF701
+:202660008AF8C020ADF8000014208DF8030003208DF8020000A9344800F07EF800F00EF86C
+:2026800000F055F800F056F800F057F8002100F04FF800F052F800F001F801BD00214020C6
+:2026A000CDE780B5FFF7FAFF002100F041F800F044F800F03FF800F040F800F038F800F06D
+:2026C0003CF8FFF7EBFF0520BDE80240B6E738B50446082508E000F02BF800F02EF800F0D8
+:2026E00029F800F02AF864002846451EC0B230B1FFF7D4FF20064CBF01210021EBE7FFF71A
+:20270000CDFF00F014F8FF2400F017F800F017F848B900F00FF800F010F8FFF7BFFF00F03C
+:202720000CF8012032BD641EEED1002032BD0121802084E70121402081E705207EE78021F3
+:20274000014800F077B80000000C014070B504460D461646FFF780FF7000C0B201E014F862
+:20276000010BFFF7B4FF2846451EC0B20028F6D1BDE8704095E700002DE9F0410022CC78F4
+:2027800004F00F03E40644BF8C7823430C8801250F26E7B217B3D0F800C005FA02F7BE4606
+:2027A0000EEA0408F04514D14FEA820E06FA0EF82CEA080C03FA0EFE4EEA0C0C91F803E03D
+:2027C000BEF1280F08BF476103D0BEF1480F08BF0761521C082AE0D3C0F800C0B4F5807F29
+:2027E00026D3D0F804C0002202F1080705FA07F7BE460EEA0408F04515D14FEA820E06FA47
+:202800000EF82CEA080C03FA0EFE4EEA0C0C91F803E0BEF1280F08BF476191F803E0BEF153
+:20282000480F08BF0761521C082ADDD3C0F804C0BDE8F08100228068084218BF012210468C
+:2028400070470161704741617047000080B500F0F8F88B48006800218172FEF769FC8948C0
+:20286000002141604FF40441874A1180016087480021016001BD10B58548002181728048CE
+:2028800000688449C97941720020FEF7C3FC4FF400710020FEF7C5FC20210020FEF7CBFC93
+:2028A00018210020FEF72EFD7B4C00F042F858210020FEF726FD0020FEF7F1FC0020FEF7E6
+:2028C000E2FC00210120FEF7ACFC98210120FEF718FD20210120FEF7AEFC00210120FEF71F
+:2028E000BBFC00210220FEF79CFCD8210220FEF709FD94F82C100220FEF71AFD4FF4405171
+:202900000220FEF7A9FC00210220FEF794FC00F010F80020FEF7B7FC0020FFF7E4FC5B48DA
+:20292000012101605D485E4901605E480021017010BD94F82C100020FEF7FABC50480068CF
+:20294000807A00B9704780B55048052101600120FEF7C6FC0220FEF7B1FC524800210170F1
+:2029600001BD4E4800684E4988421CBF0220FEF769BE704745480421016070477047704732
+:2029800080B53F4909680A7802F07F02212A08BFFE280BD14888002801BF88880028C888C0
+:2029A000012803D10FF28900020001D1022002BD88610020488200F03BF8002002BD80B5D1
+:2029C0002F4909680A7802F07F02212A08BFFF2815D14888002804BF888800280FD1C888D7
+:2029E00068B90120FEF77CFC0220FEF767FC2B482B4901602B4800210170002002BD022060
+:202A000002BD00290CBF0028022070472649FFF708BA2649FFF705BA19490968C978062974
+:202A200001DB00207047224A02EBC101FFF7F9B928B91348006801210182002070471D489B
+:202A400070471D4801684268806801B9704710B51A4B99700C0A1C710C0C9C71090E197251
+:202A60009A72110A1973110C9973110E19749874010A1975010C9975000E187610BD0000A5
+:202A8000BC2C0020405C0040142D0020042D0020A02C0020E42C0008D8000020742C0020E4
+:202AA00055534243942C0020C8010020D001002008010020002D0020E8F7FF1F5401002047
+:202AC0002DE9F84F0020ADF8000040F68F7848F60F7B48F28006444F444CDFF81491DFF899
+:202AE00014A14BF6BF7525E054F82010ADF80010BDF8001009040BD554F8201008EA010154
+:202B000044F820103C4901EB800050F8040C8047BDF8000000060DD599F8000054F820108F
+:202B20000BEA010144F82010344901EB800050F8040C8047606CAAF80000000452D5BAF8DF
+:202B4000000010F00F0089F80000CDD120683880388800F030007880388800F44050388033
+:202B60002068284080F4005080F0200030432060BAF80000C006206805D40BEA00002060D0
+:202B8000FFF756FB16E0ADF80000BDF80000000506D5206808EA00002060FFF715FB09E0D5
+:202BA000BDF800000004C5D5206808EA00002060FFF761FB206828403988C90448BF80F47D
+:202BC00080503988890448BF80F400507988C90648BF80F010007988890648BF80F020008E
+:202BE00030432060BDE8F18F0C2D0020005C0040182D0020122D00208C01002070010020C6
+:202C00002E48016841F00101016041682C4A1140416001682B4A11400160016821F4802181
+:202C20000160416821F4FE0141604FF41F0181600021026842F4803202600268491C920358
+:202C400002D4B1F5A06FF8D10168890330D51E490A6842F010020A600A68920892000A6097
+:202C60000A6842F002020A604168416041684160416841F480614160416821F47C11416062
+:202C8000416841F4E8114160016841F08071016001688901FCD541688908890041604168FF
+:202CA00041F002014160416801F00C010829FAD106484FF000610160704700000010024044
+:202CC0000000FFF8FFFFF6FE0020024008ED00E0120100020000004083042057000201027C
+:202CE0000301000009022000010100C0320904000002080650040705810240000007050263
+:202D000002400000040309042603530054004D006900630072006F0065006C0065006300FA
+:202D2000740072006F006E0069006300730000002603530054004D003300320020004D00A2
+:202D40006100730073002000530074006F007200610067006500000010035300540020005D
+:202D60004D00610073007300FEF760F9FEF7BCF91A48006880070ED5FEF773F8184801686A
+:202D8000184A1140B1F1005F04D144680068FEF749F9A047FEE70A20FEF716F90020FEF750
+:202DA00020F9C820FEF710F90120FEF71AF90020FEF780F9FEF7D4F9FDF7BAF9FFF72CFBD7
+:202DC000FFF775FB0FF22000FFF7CCFAFEF71EFDFDF7A8FAFDF7B7FBF8E70000080C014030
+:202DE000004000080000FF2F332E34350000000070B50D4C0D4D286820800D4E20883188CF
+:202E00000840400505D50B48406880474FF6FF302860208831880840000444BFBDE8704088
+:202E2000FFF74EBE70BD0000122D0020445C0040142D0020D8000020FEF7CABAFEF7E9BABA
+:202E400010B5074979441831064C7C44163404E0081D0A68511888470146A142F8D110BD88
+:202E6000080000002800000037E1FFFF302B0000EC0100200000000083E0FFFFEC01000056
+:202E80009401000000000020000000007047FEE7FEE7FEE7FEE77047704770477047FFF760
+:202EA000A7BF000000F009F8002801D0FFF7C8FF0020FFF759FF00F002F80120704700F0E5
+:202EC00001B800000746384600F002F8FBE70000C046C046024A11001820ABBEFBE700BFF7
+:202EE000260002000148804701480047012C0008F52E0008C046C046C046C046FFF7D2FFCB
+:202F0000FFF7C4BFFFF7C3BFFFF7C2BFFFF7C1BFFFF7C0BFFFF7BFBFFFF7BEBFFFF7BDBF05
+:202F2000FFF7BCBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBF3B
+:202F4000FFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFD9
+:202F6000FFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF793BFFFF7FEBFFFF7FEBF24
+:202F8000FFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBF99
+:202FA000FFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBF79
+:202FC000FFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBF59
+:202FE000FFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBF39
+:20300000FFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBFFFF7FEBF04FC040404040C0810E000001D
+:20302000407F404040406020180F000004FC8484848484E40C100000407F40000000000394
+:203040000000000004FC04000000000004FC0400001F204040404040201F000000000000AA
+:20306000606000000000000000000000606000000000000000780404040404887800000044
+:20308000006050484442414070000000000000000000000000000000006060000000000001
+:2030A0000000000000E018080404040818E00000000F302040404020300F0000000000087E
+:2030C00008FC00000000000000000040407F4040400000000000000000000000000000002D
+:2030E0000000000000000000000000004D280008772800087D2900087F290008812900089C
+:20310000BF290008032A00080D2A0008132A0008192A00080000000040000000042D000842
+:2031200004000000082D000826000000302D000826000000540100201A000000582D000881
+:2031400010000000612300083D2900086123000861230008612300086329000861230008A1
+:2031600061230008752900081A03530054004D003300320031003000000000000000000046
+:2031800000000000392E000861230008612300086123000861230008612300086123000878
+:2031A000612300083D2E0008612300086123000861230008612300086123000870000000E4
+:2031C0000000000A000000000000000000000000000000080000000002000000D02C0008D7
+:2031E00012000000E42C000820000000000600000000000003010000030000000100000077
+:20320000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCE
+:20322000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAE
+:20324000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8E
+:20326000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6E
+:20328000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4E
+:2032A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2E
+:2032C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0E
+:2032E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEE
+:20330000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCD
+:20332000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAD
+:20334000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8D
+:20336000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6D
+:20338000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4D
+:2033A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2D
+:2033C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0D
+:2033E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFED
+:20340000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC
+:20342000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAC
+:20344000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8C
+:20346000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C
+:20348000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4C
+:2034A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2C
+:2034C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0C
+:2034E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC
+:20350000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCB
+:20352000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAB
+:20354000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8B
+:20356000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6B
+:20358000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4B
+:2035A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2B
+:2035C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0B
+:2035E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEB
+:20360000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCA
+:20362000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAA
+:20364000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8A
+:20366000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6A
+:20368000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4A
+:2036A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2A
+:2036C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0A
+:2036E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEA
+:20370000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9
+:20372000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9
+:20374000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF89
+:20376000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF69
+:20378000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF49
+:2037A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF29
+:2037C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF09
+:2037E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9
+:20380000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8
+:20382000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA8
+:20384000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF88
+:20386000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF68
+:20388000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF48
+:2038A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF28
+:2038C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF08
+:2038E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8
+:20390000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7
+:20392000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA7
+:20394000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF87
+:20396000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF67
+:20398000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF47
+:2039A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27
+:2039C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF07
+:2039E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE7
+:203A0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC6
+:203A2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA6
+:203A4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF86
+:203A6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF66
+:203A8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF46
+:203AA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF26
+:203AC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF06
+:203AE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE6
+:203B0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC5
+:203B2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA5
+:203B4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF85
+:203B6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF65
+:203B8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF45
+:203BA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF25
+:203BC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF05
+:203BE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5
+:203C0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC4
+:203C2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA4
+:203C4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF84
+:203C6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF64
+:203C8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF44
+:203CA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF24
+:203CC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF04
+:203CE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE4
+:203D0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC3
+:203D2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA3
+:203D4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF83
+:203D6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF63
+:203D8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF43
+:203DA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF23
+:203DC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF03
+:203DE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE3
+:203E0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC2
+:203E2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA2
+:203E4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF82
+:203E6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF62
+:203E8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF42
+:203EA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF22
+:203EC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02
+:203EE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE2
+:203F0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC1
+:203F2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA1
+:203F4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF81
+:203F6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF61
+:203F8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF41
+:203FA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF21
+:203FC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF01
+:203FE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE1
+:00000001FF
diff --git a/Development Resources/TS80/TS80.ioc b/Development Resources/TS80/TS80.ioc
new file mode 100644
index 00000000..e0f3de48
--- /dev/null
+++ b/Development Resources/TS80/TS80.ioc
@@ -0,0 +1,348 @@
+#MicroXplorer Configuration settings - do not modify
+ADC1.Channel-31\#ChannelRegularConversion=ADC_CHANNEL_4
+ADC1.Channel-32\#ChannelInjectedConversion=ADC_CHANNEL_2
+ADC1.Channel-33\#ChannelInjectedConversion=ADC_CHANNEL_2
+ADC1.Channel-34\#ChannelInjectedConversion=ADC_CHANNEL_2
+ADC1.Channel-35\#ChannelInjectedConversion=ADC_CHANNEL_2
+ADC1.ContinuousConvMode=DISABLE
+ADC1.DataAlign=ADC_DATAALIGN_RIGHT
+ADC1.DiscontinuousConvMode=DISABLE
+ADC1.EnableAnalogWatchDog=false
+ADC1.EnableRegularConversion=ENABLE
+ADC1.ExternalTrigConv=ADC_SOFTWARE_START
+ADC1.ExternalTrigInjecConv=ADC_INJECTED_SOFTWARE_START
+ADC1.IPParameters=Rank-31\#ChannelRegularConversion,Channel-31\#ChannelRegularConversion,SamplingTime-31\#ChannelRegularConversion,NbrOfConversionFlag,master,Rank-32\#ChannelInjectedConversion,Channel-32\#ChannelInjectedConversion,SamplingTime-32\#ChannelInjectedConversion,InjectedOffset-32\#ChannelInjectedConversion,Rank-33\#ChannelInjectedConversion,Channel-33\#ChannelInjectedConversion,SamplingTime-33\#ChannelInjectedConversion,InjectedOffset-33\#ChannelInjectedConversion,Rank-34\#ChannelInjectedConversion,Channel-34\#ChannelInjectedConversion,SamplingTime-34\#ChannelInjectedConversion,InjectedOffset-34\#ChannelInjectedConversion,Rank-35\#ChannelInjectedConversion,Channel-35\#ChannelInjectedConversion,SamplingTime-35\#ChannelInjectedConversion,InjectedOffset-35\#ChannelInjectedConversion,InjNumberOfConversion,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,ExternalTrigConv,ExternalTrigInjecConv,InjectedConvMode,EnableAnalogWatchDog
+ADC1.InjNumberOfConversion=4
+ADC1.InjectedConvMode=None
+ADC1.InjectedOffset-32\#ChannelInjectedConversion=0
+ADC1.InjectedOffset-33\#ChannelInjectedConversion=0
+ADC1.InjectedOffset-34\#ChannelInjectedConversion=0
+ADC1.InjectedOffset-35\#ChannelInjectedConversion=0
+ADC1.NbrOfConversion=1
+ADC1.NbrOfConversionFlag=1
+ADC1.Rank-31\#ChannelRegularConversion=1
+ADC1.Rank-32\#ChannelInjectedConversion=1
+ADC1.Rank-33\#ChannelInjectedConversion=2
+ADC1.Rank-34\#ChannelInjectedConversion=3
+ADC1.Rank-35\#ChannelInjectedConversion=4
+ADC1.SamplingTime-31\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC1.SamplingTime-32\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC1.SamplingTime-33\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC1.SamplingTime-34\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC1.SamplingTime-35\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC1.ScanConvMode=ADC_SCAN_ENABLE
+ADC1.master=1
+ADC2.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_3
+ADC2.Channel-1\#ChannelInjectedConversion=ADC_CHANNEL_3
+ADC2.Channel-2\#ChannelInjectedConversion=ADC_CHANNEL_3
+ADC2.Channel-3\#ChannelInjectedConversion=ADC_CHANNEL_3
+ADC2.Channel-4\#ChannelInjectedConversion=ADC_CHANNEL_3
+ADC2.ContinuousConvMode=DISABLE
+ADC2.DataAlign=ADC_DATAALIGN_RIGHT
+ADC2.DiscontinuousConvMode=DISABLE
+ADC2.EnableAnalogWatchDog=false
+ADC2.EnableRegularConversion=ENABLE
+ADC2.ExternalTrigConv=ADC_SOFTWARE_START
+ADC2.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,Rank-1\#ChannelInjectedConversion,Channel-1\#ChannelInjectedConversion,SamplingTime-1\#ChannelInjectedConversion,InjectedOffset-1\#ChannelInjectedConversion,Rank-2\#ChannelInjectedConversion,Channel-2\#ChannelInjectedConversion,SamplingTime-2\#ChannelInjectedConversion,InjectedOffset-2\#ChannelInjectedConversion,Rank-3\#ChannelInjectedConversion,Channel-3\#ChannelInjectedConversion,SamplingTime-3\#ChannelInjectedConversion,InjectedOffset-3\#ChannelInjectedConversion,Rank-4\#ChannelInjectedConversion,Channel-4\#ChannelInjectedConversion,SamplingTime-4\#ChannelInjectedConversion,InjectedOffset-4\#ChannelInjectedConversion,InjNumberOfConversion,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,ExternalTrigConv,EnableAnalogWatchDog
+ADC2.InjNumberOfConversion=0
+ADC2.InjectedOffset-1\#ChannelInjectedConversion=0
+ADC2.InjectedOffset-2\#ChannelInjectedConversion=0
+ADC2.InjectedOffset-3\#ChannelInjectedConversion=0
+ADC2.InjectedOffset-4\#ChannelInjectedConversion=0
+ADC2.NbrOfConversion=1
+ADC2.NbrOfConversionFlag=1
+ADC2.Rank-0\#ChannelRegularConversion=1
+ADC2.Rank-1\#ChannelInjectedConversion=1
+ADC2.Rank-2\#ChannelInjectedConversion=2
+ADC2.Rank-3\#ChannelInjectedConversion=3
+ADC2.Rank-4\#ChannelInjectedConversion=4
+ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.SamplingTime-1\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.SamplingTime-2\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.SamplingTime-3\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.SamplingTime-4\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.ScanConvMode=ADC_SCAN_DISABLE
+Dma.I2C1_RX.0.Direction=DMA_PERIPH_TO_MEMORY
+Dma.I2C1_RX.0.Instance=DMA1_Channel7
+Dma.I2C1_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
+Dma.I2C1_RX.0.MemInc=DMA_MINC_ENABLE
+Dma.I2C1_RX.0.Mode=DMA_NORMAL
+Dma.I2C1_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
+Dma.I2C1_RX.0.PeriphInc=DMA_PINC_DISABLE
+Dma.I2C1_RX.0.Priority=DMA_PRIORITY_MEDIUM
+Dma.I2C1_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
+Dma.I2C1_TX.1.Direction=DMA_MEMORY_TO_PERIPH
+Dma.I2C1_TX.1.Instance=DMA1_Channel6
+Dma.I2C1_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
+Dma.I2C1_TX.1.MemInc=DMA_MINC_ENABLE
+Dma.I2C1_TX.1.Mode=DMA_NORMAL
+Dma.I2C1_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
+Dma.I2C1_TX.1.PeriphInc=DMA_PINC_DISABLE
+Dma.I2C1_TX.1.Priority=DMA_PRIORITY_MEDIUM
+Dma.I2C1_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
+Dma.Request0=I2C1_RX
+Dma.Request1=I2C1_TX
+Dma.RequestsNb=2
+FREERTOS.FootprintOK=true
+FREERTOS.INCLUDE_vTaskDelete=0
+FREERTOS.IPParameters=Tasks01,configTICK_RATE_HZ,configMAX_PRIORITIES,configMINIMAL_STACK_SIZE,configTOTAL_HEAP_SIZE,INCLUDE_vTaskDelete,FootprintOK
+FREERTOS.Tasks01=GUITask,0,512,StartGUITask,Default,NULL,Dynamic,NULL,NULL;PIDTask,0,256,StartPIDTask,Default,NULL,Dynamic,NULL,NULL;ROTTask,-2,256,StartRotationTask,Default,NULL,Dynamic,NULL,NULL
+FREERTOS.configMAX_PRIORITIES=4
+FREERTOS.configMINIMAL_STACK_SIZE=256
+FREERTOS.configTICK_RATE_HZ=100
+FREERTOS.configTOTAL_HEAP_SIZE=10240
+File.Version=6
+I2C1.DutyCycle=I2C_DUTYCYCLE_2
+I2C1.I2C_Mode=I2C_Fast
+I2C1.IPParameters=I2C_Mode,DutyCycle
+IWDG.IPParameters=Prescaler
+IWDG.Prescaler=IWDG_PRESCALER_256
+KeepUserPlacement=false
+Mcu.Family=STM32F1
+Mcu.IP0=ADC1
+Mcu.IP1=ADC2
+Mcu.IP10=TIM3
+Mcu.IP2=DMA
+Mcu.IP3=FREERTOS
+Mcu.IP4=I2C1
+Mcu.IP5=IWDG
+Mcu.IP6=NVIC
+Mcu.IP7=RCC
+Mcu.IP8=SYS
+Mcu.IP9=TIM2
+Mcu.IPNb=11
+Mcu.Name=STM32F103T(8-B)Ux
+Mcu.Package=VFQFPN36
+Mcu.Pin0=PA0-WKUP
+Mcu.Pin1=PA2
+Mcu.Pin10=PA11
+Mcu.Pin11=PA12
+Mcu.Pin12=PA13
+Mcu.Pin13=PA14
+Mcu.Pin14=PA15
+Mcu.Pin15=PB3
+Mcu.Pin16=PB4
+Mcu.Pin17=PB5
+Mcu.Pin18=PB6
+Mcu.Pin19=PB7
+Mcu.Pin2=PA3
+Mcu.Pin20=VP_FREERTOS_VS_ENABLE
+Mcu.Pin21=VP_IWDG_VS_IWDG
+Mcu.Pin22=VP_SYS_VS_ND
+Mcu.Pin23=VP_SYS_VS_tim1
+Mcu.Pin24=VP_TIM2_VS_ClockSourceINT
+Mcu.Pin25=VP_TIM2_VS_no_output1
+Mcu.Pin26=VP_TIM2_VS_no_output3
+Mcu.Pin27=VP_TIM3_VS_ClockSourceINT
+Mcu.Pin28=VP_TIM3_VS_no_output4
+Mcu.Pin3=PA4
+Mcu.Pin4=PA6
+Mcu.Pin5=PB0
+Mcu.Pin6=PB1
+Mcu.Pin7=PA8
+Mcu.Pin8=PA9
+Mcu.Pin9=PA10
+Mcu.PinsNb=29
+Mcu.ThirdPartyNb=0
+Mcu.UserConstants=
+Mcu.UserName=STM32F103T8Ux
+MxCube.Version=4.26.0
+MxDb.Version=DB.4.0.260
+NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true
+NVIC.DMA1_Channel6_IRQn=true\:5\:0\:false\:false\:true\:true\:true
+NVIC.DMA1_Channel7_IRQn=true\:5\:0\:false\:false\:true\:true\:true
+NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:true
+NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true
+NVIC.I2C1_ER_IRQn=true\:5\:0\:false\:false\:true\:true\:true
+NVIC.I2C1_EV_IRQn=true\:5\:0\:false\:false\:true\:true\:true
+NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:true
+NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:true
+NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:true
+NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
+NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:true
+NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:true
+NVIC.TIM1_UP_IRQn=true\:0\:0\:false\:false\:true\:false\:true
+NVIC.TimeBase=TIM1_UP_IRQn
+NVIC.TimeBaseIP=TIM1
+NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true
+PA0-WKUP.GPIOParameters=GPIO_Label
+PA0-WKUP.GPIO_Label=RM
+PA0-WKUP.Locked=true
+PA0-WKUP.Signal=GPIO_Output
+PA10.GPIOParameters=GPIO_Label
+PA10.GPIO_Label=QC_DM_11K
+PA10.Locked=true
+PA10.Signal=GPIO_Output
+PA11.GPIOParameters=GPIO_Label
+PA11.GPIO_Label=USB_DM
+PA11.Locked=true
+PA11.Signal=GPIO_Analog
+PA12.GPIOParameters=GPIO_Label
+PA12.GPIO_Label=USB_DP
+PA12.Locked=true
+PA12.Signal=GPIO_Analog
+PA13.GPIOParameters=GPIO_Label
+PA13.GPIO_Label=QC_DP_SENSE
+PA13.Locked=true
+PA13.Signal=GPIO_Input
+PA14.GPIOParameters=GPIO_Label
+PA14.GPIO_Label=QC_DM_SENSE
+PA14.Locked=true
+PA14.Signal=GPIO_Input
+PA15.GPIOParameters=GPIO_Label
+PA15.GPIO_Label=OLED_RESET
+PA15.Locked=true
+PA15.Signal=GPIO_Output
+PA2.GPIOParameters=GPIO_Label
+PA2.GPIO_Label=ADC_VIN
+PA2.Locked=true
+PA2.Signal=ADCx_IN2
+PA3.GPIOParameters=GPIO_Label
+PA3.GPIO_Label=ADC_TIP
+PA3.Locked=true
+PA3.Signal=ADCx_IN3
+PA4.GPIOParameters=GPIO_Label
+PA4.GPIO_Label=ADC_TMP36
+PA4.Locked=true
+PA4.Signal=ADCx_IN4
+PA6.GPIOParameters=GPIO_Label
+PA6.GPIO_Label=PWM Out
+PA6.Locked=true
+PA6.Signal=S_TIM3_CH1
+PA8.GPIOParameters=GPIO_Label
+PA8.GPIO_Label=QC_DM_3K
+PA8.Locked=true
+PA8.Signal=GPIO_Output
+PA9.GPIOParameters=GPIO_Label
+PA9.GPIO_Label=MODEL_SEL
+PA9.Locked=true
+PA9.Signal=GPIO_Input
+PB0.GPIOParameters=GPIO_Label
+PB0.GPIO_Label=KEY_A
+PB0.Locked=true
+PB0.Signal=GPIO_Input
+PB1.GPIOParameters=GPIO_Label
+PB1.GPIO_Label=KEY_B
+PB1.Locked=true
+PB1.Signal=GPIO_Input
+PB3.GPIOParameters=GPIO_Label
+PB3.GPIO_Label=QC_DP_3K
+PB3.Locked=true
+PB3.Signal=GPIO_Output
+PB4.GPIOParameters=GPIO_Label
+PB4.GPIO_Label=IMU_INT2
+PB4.Locked=true
+PB4.Signal=GPXTI4
+PB5.GPIOParameters=GPIO_Label
+PB5.GPIO_Label=IMU_INT1
+PB5.Locked=true
+PB5.Signal=GPXTI5
+PB6.GPIOParameters=GPIO_Label
+PB6.GPIO_Label=SCL
+PB6.Mode=I2C
+PB6.Signal=I2C1_SCL
+PB7.GPIOParameters=GPIO_Label
+PB7.GPIO_Label=SDA
+PB7.Mode=I2C
+PB7.Signal=I2C1_SDA
+PCC.Checker=false
+PCC.Line=STM32F103
+PCC.MCU=STM32F103T(8-B)Ux
+PCC.PartNumber=STM32F103T8Ux
+PCC.Seq0=0
+PCC.Series=STM32F1
+PCC.Temperature=25
+PCC.Vdd=3.3
+PinOutPanel.RotationAngle=0
+ProjectManager.AskForMigrate=true
+ProjectManager.BackupPrevious=false
+ProjectManager.CompilerOptimize=3
+ProjectManager.ComputerToolchain=false
+ProjectManager.CoupleFile=false
+ProjectManager.CustomerFirmwarePackage=
+ProjectManager.DefaultFWLocation=true
+ProjectManager.DeletePrevious=true
+ProjectManager.DeviceId=STM32F103T8Ux
+ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.6.1
+ProjectManager.FreePins=true
+ProjectManager.HalAssertFull=false
+ProjectManager.HeapSize=0x200
+ProjectManager.KeepUserCode=true
+ProjectManager.LastFirmware=true
+ProjectManager.LibraryCopy=1
+ProjectManager.MainLocation=Src
+ProjectManager.PreviousToolchain=SW4STM32
+ProjectManager.ProjectBuild=false
+ProjectManager.ProjectFileName=TS80.ioc
+ProjectManager.ProjectName=TS80
+ProjectManager.StackSize=0x400
+ProjectManager.TargetToolchain=SW4STM32
+ProjectManager.ToolChainLocation=
+ProjectManager.UnderRoot=false
+ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-MX_I2C1_Init-I2C1-false-HAL-true,4-SystemClock_Config-RCC-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_IWDG_Init-IWDG-false-HAL-true,7-MX_TIM2_Init-TIM2-false-HAL-true,8-MX_ADC1_Init-ADC1-false-HAL-true,9-MX_ADC2_Init-ADC2-false-HAL-true
+RCC.ADCFreqValue=8000000
+RCC.ADCPresc=RCC_ADCPCLK2_DIV8
+RCC.AHBFreq_Value=64000000
+RCC.APB1CLKDivider=RCC_HCLK_DIV16
+RCC.APB1Freq_Value=4000000
+RCC.APB1TimFreq_Value=8000000
+RCC.APB2Freq_Value=64000000
+RCC.APB2TimFreq_Value=64000000
+RCC.FCLKCortexFreq_Value=64000000
+RCC.FamilyName=M
+RCC.HCLKFreq_Value=64000000
+RCC.IPParameters=ADCFreqValue,ADCPresc,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,USBPrescaler
+RCC.MCOFreq_Value=64000000
+RCC.PLLCLKFreq_Value=64000000
+RCC.PLLMCOFreq_Value=32000000
+RCC.PLLMUL=RCC_PLL_MUL16
+RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSI_DIV2
+RCC.SYSCLKFreq_VALUE=64000000
+RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
+RCC.TimSysFreq_Value=64000000
+RCC.USBFreq_Value=42666666.666666664
+RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5
+SH.ADCx_IN2.0=ADC1_IN2,IN2
+SH.ADCx_IN2.ConfNb=1
+SH.ADCx_IN3.0=ADC1_IN3,IN3
+SH.ADCx_IN3.1=ADC2_IN3,IN3
+SH.ADCx_IN3.ConfNb=2
+SH.ADCx_IN4.0=ADC1_IN4,IN4
+SH.ADCx_IN4.ConfNb=1
+SH.GPXTI4.0=GPIO_EXTI4
+SH.GPXTI4.ConfNb=1
+SH.GPXTI5.0=GPIO_EXTI5
+SH.GPXTI5.ConfNb=1
+SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
+SH.S_TIM3_CH1.ConfNb=1
+TIM2.Channel-PWM\ Generation1\ No\ Output=TIM_CHANNEL_1
+TIM2.Channel-PWM\ Generation3\ No\ Output=TIM_CHANNEL_3
+TIM2.IPParameters=Channel-PWM Generation1 No Output,Channel-PWM Generation3 No Output
+TIM3.Channel-Output\ Compare4\ No\ Output=TIM_CHANNEL_4
+TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
+TIM3.ClockDivision=TIM_CLOCKDIVISION_DIV4
+TIM3.IPParameters=Channel-PWM Generation1 CH1,OCFastMode_PWM-PWM Generation1 CH1,ClockDivision,Prescaler,Period,Channel-Output Compare4 No Output,OCMode_4,Pulse-Output Compare4 No Output
+TIM3.OCFastMode_PWM-PWM\ Generation1\ CH1=TIM_OCFAST_ENABLE
+TIM3.OCMode_4=TIM_OCMODE_ACTIVE
+TIM3.Period=65535
+TIM3.Prescaler=2000
+TIM3.Pulse-Output\ Compare4\ No\ Output=65000
+VP_FREERTOS_VS_ENABLE.Mode=Enabled
+VP_FREERTOS_VS_ENABLE.Signal=FREERTOS_VS_ENABLE
+VP_IWDG_VS_IWDG.Mode=IWDG_Activate
+VP_IWDG_VS_IWDG.Signal=IWDG_VS_IWDG
+VP_SYS_VS_ND.Mode=No_Debug
+VP_SYS_VS_ND.Signal=SYS_VS_ND
+VP_SYS_VS_tim1.Mode=TIM1
+VP_SYS_VS_tim1.Signal=SYS_VS_tim1
+VP_TIM2_VS_ClockSourceINT.Mode=Internal
+VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT
+VP_TIM2_VS_no_output1.Mode=PWM Generation1 No Output
+VP_TIM2_VS_no_output1.Signal=TIM2_VS_no_output1
+VP_TIM2_VS_no_output3.Mode=PWM Generation3 No Output
+VP_TIM2_VS_no_output3.Signal=TIM2_VS_no_output3
+VP_TIM3_VS_ClockSourceINT.Mode=Internal
+VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT
+VP_TIM3_VS_no_output4.Mode=Output Compare4 No Output
+VP_TIM3_VS_no_output4.Signal=TIM3_VS_no_output4
+board=TS100
diff --git a/Translation Editor/make_translation.py b/Translation Editor/make_translation.py
old mode 100755
new mode 100644
diff --git a/Translation Editor/translation_en.json b/Translation Editor/translation_en.json
index f84908cd..68b95585 100644
--- a/Translation Editor/translation_en.json
+++ b/Translation Editor/translation_en.json
@@ -220,5 +220,13 @@
],
"desc": "Advanced calibration using thermocouple on the tip"
}
+ "PowerInput": {
+ "text": "PWRW",
+ "text2": [
+ "Power",
+ "Wattage"
+ ],
+ "desc": "Power Wattage of the power adapter used"
+ },
}
-}
+}
\ No newline at end of file
diff --git a/Translation Editor/translations_def.js b/Translation Editor/translations_def.js
index 65dca0b9..8f01eaea 100644
--- a/Translation Editor/translations_def.js
+++ b/Translation Editor/translations_def.js
@@ -1,227 +1,232 @@
-var def =
-{
- "messages": [
- {
- "id": "SettingsCalibrationDone"
- },
- {
- "id": "SettingsCalibrationWarning"
- },
- {
- "id": "SettingsResetWarning"
- },
- {
- "id": "UVLOWarningString",
- "maxLen": 8
- },
- {
- "id": "UndervoltageString",
- "maxLen": 16
- },
- {
- "id": "InputVoltageString",
- "maxLen": 11,
- "note": "Preferably end with a space"
- },
- {
- "id": "WarningTipTempString",
- "maxLen": 12,
- "note": "Preferably end with a space"
- },
- {
- "id": "BadTipString",
- "maxLen": 8
- },
- {
- "id": "SleepingSimpleString",
- "maxLen": 4
- },
- {
- "id": "SleepingAdvancedString",
- "maxLen": 16
- },
- {
- "id": "WarningSimpleString",
- "maxLen": 4
- },
- {
- "id": "WarningAdvancedString",
- "maxLen": 16
- },
- {
- "id": "SleepingTipAdvancedString",
- "maxLen": 6
- },
- {
- "id": "IdleTipString",
- "lenSum":
- {
- "fields": ["IdleTipString", "IdleSetString"],
- "maxLen": 10
- }
- },
- {
- "id": "IdleSetString",
- "lenSum":
- {
- "fields": ["IdleTipString", "IdleSetString"],
- "maxLen": 10
- },
- "note": "Preferably start with a space"
- },
- {
- "id": "TipDisconnectedString",
- "maxLen": 16
- },
- {
- "id" :"SolderingAdvancedPowerPrompt",
- "maxLen": null
- },
- {
- "id" :"OffString",
- "maxLen": 3
- }
- ],
- "characters": [
- {
- "id": "SettingRightChar",
- "len": 1
- },
- {
- "id": "SettingLeftChar",
- "len": 1
- },
- {
- "id": "SettingAutoChar",
- "len": 1
- },
- {
- "id": "SettingFastChar",
- "len": 1
- },
- {
- "id": "SettingSlowChar",
- "len": 1
- }
- ],
- "menuGroups": [
- {
- "id": "SolderingMenu",
- "maxLen": 11
- },
- {
- "id": "PowerSavingMenu",
- "maxLen": 11
- },
- {
- "id": "UIMenu",
- "maxLen": 11
- },
- {
- "id": "AdvancedMenu",
- "maxLen": 11
- }
- ],
- "menuOptions": [
- {
- "id": "PowerSource",
- "maxLen": 5,
- "maxLen2": 11
- },
- {
- "id": "SleepTemperature",
- "maxLen": 4,
- "maxLen2": 9
- },
- {
- "id": "SleepTimeout",
- "maxLen": 4,
- "maxLen2": 9
- },
- {
- "id": "ShutdownTimeout",
- "maxLen": 5,
- "maxLen2": 11
- },
- {
- "id": "MotionSensitivity",
- "maxLen": 6,
- "maxLen2": 13
- },
- {
- "id": "TemperatureUnit",
- "maxLen": 6,
- "maxLen2": 13
- },
- {
- "id": "AdvancedIdle",
- "maxLen": 6,
- "maxLen2": 13
- },
- {
- "id": "DisplayRotation",
- "maxLen": 6,
- "maxLen2": 13
- },
- {
- "id": "BoostEnabled",
- "maxLen": 6,
- "maxLen2": 13
- },
- {
- "id": "BoostTemperature",
- "maxLen": 4,
- "maxLen2": 9
- },
- {
- "id": "AutoStart",
- "maxLen": 6,
- "maxLen2": 13
- },
- {
- "id": "CooldownBlink",
- "maxLen": 6,
- "maxLen2": 13
- },
- {
- "id": "TemperatureCalibration",
- "maxLen": 8,
- "maxLen2": 16
- },
- {
- "id": "SettingsReset",
- "maxLen": 8,
- "maxLen2": 16
- },
- {
- "id": "VoltageCalibration",
- "maxLen": 8,
- "maxLen2": 16
- },
- {
- "id": "AdvancedSoldering",
- "maxLen": 6,
- "maxLen2": 13
- },
- {
- "id": "ScrollingSpeed",
- "maxLen": 6,
- "maxLen2": 11
- },
- {
- "id": "TipModel",
- "maxLen": 8,
- "maxLen2": 16
- },
- {
- "id": "SimpleCalibrationMode",
- "maxLen": 8,
- "maxLen2": 16
- },
- {
- "id": "AdvancedCalibrationMode",
- "maxLen": 8,
- "maxLen2": 16
- }
- ]
-}
+var def =
+{
+ "messages": [
+ {
+ "id": "SettingsCalibrationDone"
+ },
+ {
+ "id": "SettingsCalibrationWarning"
+ },
+ {
+ "id": "SettingsResetWarning"
+ },
+ {
+ "id": "UVLOWarningString",
+ "maxLen": 8
+ },
+ {
+ "id": "UndervoltageString",
+ "maxLen": 16
+ },
+ {
+ "id": "InputVoltageString",
+ "maxLen": 11,
+ "note": "Preferably end with a space"
+ },
+ {
+ "id": "WarningTipTempString",
+ "maxLen": 12,
+ "note": "Preferably end with a space"
+ },
+ {
+ "id": "BadTipString",
+ "maxLen": 8
+ },
+ {
+ "id": "SleepingSimpleString",
+ "maxLen": 4
+ },
+ {
+ "id": "SleepingAdvancedString",
+ "maxLen": 16
+ },
+ {
+ "id": "WarningSimpleString",
+ "maxLen": 4
+ },
+ {
+ "id": "WarningAdvancedString",
+ "maxLen": 16
+ },
+ {
+ "id": "SleepingTipAdvancedString",
+ "maxLen": 6
+ },
+ {
+ "id": "IdleTipString",
+ "lenSum":
+ {
+ "fields": ["IdleTipString", "IdleSetString"],
+ "maxLen": 10
+ }
+ },
+ {
+ "id": "IdleSetString",
+ "lenSum":
+ {
+ "fields": ["IdleTipString", "IdleSetString"],
+ "maxLen": 10
+ },
+ "note": "Preferably start with a space"
+ },
+ {
+ "id": "TipDisconnectedString",
+ "maxLen": 16
+ },
+ {
+ "id": "SolderingAdvancedPowerPrompt",
+ "maxLen": null
+ },
+ {
+ "id": "OffString",
+ "maxLen": 3
+ }
+ ],
+ "characters": [
+ {
+ "id": "SettingRightChar",
+ "len": 1
+ },
+ {
+ "id": "SettingLeftChar",
+ "len": 1
+ },
+ {
+ "id": "SettingAutoChar",
+ "len": 1
+ },
+ {
+ "id": "SettingFastChar",
+ "len": 1
+ },
+ {
+ "id": "SettingSlowChar",
+ "len": 1
+ }
+ ],
+ "menuGroups": [
+ {
+ "id": "SolderingMenu",
+ "maxLen": 11
+ },
+ {
+ "id": "PowerSavingMenu",
+ "maxLen": 11
+ },
+ {
+ "id": "UIMenu",
+ "maxLen": 11
+ },
+ {
+ "id": "AdvancedMenu",
+ "maxLen": 11
+ }
+ ],
+ "menuOptions": [
+ {
+ "id": "PowerSource",
+ "maxLen": 5,
+ "maxLen2": 11
+ },
+ {
+ "id": "SleepTemperature",
+ "maxLen": 4,
+ "maxLen2": 9
+ },
+ {
+ "id": "SleepTimeout",
+ "maxLen": 4,
+ "maxLen2": 9
+ },
+ {
+ "id": "ShutdownTimeout",
+ "maxLen": 5,
+ "maxLen2": 11
+ },
+ {
+ "id": "MotionSensitivity",
+ "maxLen": 6,
+ "maxLen2": 13
+ },
+ {
+ "id": "TemperatureUnit",
+ "maxLen": 6,
+ "maxLen2": 13
+ },
+ {
+ "id": "AdvancedIdle",
+ "maxLen": 6,
+ "maxLen2": 13
+ },
+ {
+ "id": "DisplayRotation",
+ "maxLen": 6,
+ "maxLen2": 13
+ },
+ {
+ "id": "BoostEnabled",
+ "maxLen": 6,
+ "maxLen2": 13
+ },
+ {
+ "id": "BoostTemperature",
+ "maxLen": 4,
+ "maxLen2": 9
+ },
+ {
+ "id": "AutoStart",
+ "maxLen": 6,
+ "maxLen2": 13
+ },
+ {
+ "id": "CooldownBlink",
+ "maxLen": 6,
+ "maxLen2": 13
+ },
+ {
+ "id": "TemperatureCalibration",
+ "maxLen": 8,
+ "maxLen2": 16
+ },
+ {
+ "id": "SettingsReset",
+ "maxLen": 8,
+ "maxLen2": 16
+ },
+ {
+ "id": "VoltageCalibration",
+ "maxLen": 8,
+ "maxLen2": 16
+ },
+ {
+ "id": "AdvancedSoldering",
+ "maxLen": 6,
+ "maxLen2": 13
+ },
+ {
+ "id": "ScrollingSpeed",
+ "maxLen": 6,
+ "maxLen2": 11
+ },
+ {
+ "id": "TipModel",
+ "maxLen": 8,
+ "maxLen2": 16
+ },
+ {
+ "id": "SimpleCalibrationMode",
+ "maxLen": 8,
+ "maxLen2": 16
+ },
+ {
+ "id": "AdvancedCalibrationMode",
+ "maxLen": 8,
+ "maxLen2": 16
+ },
+ {
+ "id": "PowerInput",
+ "maxLen": 8,
+ "maxLen2": 16
+ }
+ ]
+}
diff --git a/workspace/TS100/HAL_Driver/Inc/stm32f1xx_hal_gpio.h b/workspace/TS100/HAL_Driver/Inc/stm32f1xx_hal_gpio.h
index 3a86cefa..c9c0b5db 100644
--- a/workspace/TS100/HAL_Driver/Inc/stm32f1xx_hal_gpio.h
+++ b/workspace/TS100/HAL_Driver/Inc/stm32f1xx_hal_gpio.h
@@ -250,7 +250,18 @@ void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin);
*/
/* IO operation functions *****************************************************/
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
-void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
+inline void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
+{
+
+ if(PinState != GPIO_PIN_RESET)
+ {
+ GPIOx->BSRR = GPIO_Pin;
+ }
+ else
+ {
+ GPIOx->BSRR = (uint32_t)GPIO_Pin << 16U;
+ }
+}
void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin);
diff --git a/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_gpio.c b/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_gpio.c
index fc080c07..c3238b70 100644
--- a/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_gpio.c
+++ b/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_gpio.c
@@ -479,21 +479,8 @@ GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
* @arg GPIO_BIT_SET: to set the port pin
* @retval None
*/
-void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
-{
- /* Check the parameters */
- assert_param(IS_GPIO_PIN(GPIO_Pin));
- assert_param(IS_GPIO_PIN_ACTION(PinState));
+//void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
- if(PinState != GPIO_PIN_RESET)
- {
- GPIOx->BSRR = GPIO_Pin;
- }
- else
- {
- GPIOx->BSRR = (uint32_t)GPIO_Pin << 16U;
- }
-}
/**
* @brief Toggles the specified GPIO pin
diff --git a/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_tim.c b/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_tim.c
index 85c34c3f..67f01bf0 100644
--- a/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_tim.c
+++ b/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_tim.c
@@ -5,7 +5,7 @@
* @version V1.1.1
* @date 12-May-2017
* @brief TIM HAL module driver
- * This file provides firmware functions to manage the following
+ * This file provides firmware functions to manage the following
* functionalities of the Timer (TIM) peripheral:
* + Time Base Initialization
* + Time Base Start
@@ -19,11 +19,11 @@
* + Time Input Capture Initialization
* + Time Input Capture Channel Configuration
* + Time Input Capture Start
- * + Time Input Capture Start Interruption
+ * + Time Input Capture Start Interruption
* + Time Input Capture Start DMA
* + Time One Pulse Initialization
* + Time One Pulse Channel Configuration
- * + Time One Pulse Start
+ * + Time One Pulse Start
* + Time Encoder Interface Initialization
* + Time Encoder Interface Start
* + Time Encoder Interface Start Interruption
@@ -37,19 +37,19 @@
==============================================================================
[..] The Timer features include:
(#) 16-bit up, down, up/down auto-reload counter.
- (#) 16-bit programmable prescaler allowing dividing (also on the fly) the
+ (#) 16-bit programmable prescaler allowing dividing (also on the fly) the
counter clock frequency either by any factor between 1 and 65536.
(#) Up to 4 independent channels for:
(++) Input Capture
(++) Output Compare
(++) PWM generation (Edge and Center-aligned Mode)
- (++) One-pulse mode output
+ (++) One-pulse mode output
##### How to use this driver #####
==============================================================================
[..]
- (#) Initialize the TIM low level resources by implementing the following functions
- depending from feature used :
+ (#) Initialize the TIM low level resources by implementing the following
+ functions depending from feature used :
(++) Time Base : HAL_TIM_Base_MspInit()
(++) Input Capture : HAL_TIM_IC_MspInit()
(++) Output Compare : HAL_TIM_OC_MspInit()
@@ -60,35 +60,44 @@
(#) Initialize the TIM low level resources :
(##) Enable the TIM interface clock using __HAL_RCC_TIMx_CLK_ENABLE();
(##) TIM pins configuration
- (+++) Enable the clock for the TIM GPIOs using the following function:
+ (+++) Enable the clock for the TIM GPIOs using the following
+ function:
__HAL_RCC_GPIOx_CLK_ENABLE();
- (+++) Configure these TIM pins in Alternate function mode using HAL_GPIO_Init();
+ (+++) Configure these TIM pins in Alternate function mode using
+ HAL_GPIO_Init();
- (#) The external Clock can be configured, if needed (the default clock is the
- internal clock from the APBx), using the following function:
- HAL_TIM_ConfigClockSource, the clock configuration should be done before
- any start function.
+ (#) The external Clock can be configured, if needed (the default clock is
+ the internal clock from the APBx), using the following function:
+ HAL_TIM_ConfigClockSource, the clock configuration should be done
+ before any start function.
- (#) Configure the TIM in the desired functioning mode using one of the
+ (#) Configure the TIM in the desired functioning mode using one of the
Initialization function of this driver:
(++) HAL_TIM_Base_Init: to use the Timer to generate a simple time base
- (++) HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to generate an
- Output Compare signal.
- (++) HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to generate a
- PWM signal.
- (++) HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to measure an
- external signal.
- (++) HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use the Timer
- in One Pulse Mode.
+ (++) HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to
+ generate an Output Compare signal.
+ (++) HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to
+ generate a PWM signal.
+ (++) HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to
+ measure an external signal.
+ (++) HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use
+ the Timer in One Pulse Mode.
(++) HAL_TIM_Encoder_Init: to use the Timer Encoder Interface.
- (#) Activate the TIM peripheral using one of the start functions depending from the feature used:
- (++) Time Base : HAL_TIM_Base_Start(), HAL_TIM_Base_Start_DMA(), HAL_TIM_Base_Start_IT()
- (++) Input Capture : HAL_TIM_IC_Start(), HAL_TIM_IC_Start_DMA(), HAL_TIM_IC_Start_IT()
- (++) Output Compare : HAL_TIM_OC_Start(), HAL_TIM_OC_Start_DMA(), HAL_TIM_OC_Start_IT()
- (++) PWM generation : HAL_TIM_PWM_Start(), HAL_TIM_PWM_Start_DMA(), HAL_TIM_PWM_Start_IT()
- (++) One-pulse mode output : HAL_TIM_OnePulse_Start(), HAL_TIM_OnePulse_Start_IT()
- (++) Encoder mode output : HAL_TIM_Encoder_Start(), HAL_TIM_Encoder_Start_DMA(), HAL_TIM_Encoder_Start_IT().
+ (#) Activate the TIM peripheral using one of the start functions depending
+ from the feature used:
+ (++) Time Base : HAL_TIM_Base_Start(), HAL_TIM_Base_Start_DMA(),
+ HAL_TIM_Base_Start_IT()
+ (++) Input Capture : HAL_TIM_IC_Start(), HAL_TIM_IC_Start_DMA(),
+ HAL_TIM_IC_Start_IT()
+ (++) Output Compare : HAL_TIM_OC_Start(), HAL_TIM_OC_Start_DMA(),
+ HAL_TIM_OC_Start_IT()
+ (++) PWM generation : HAL_TIM_PWM_Start(), HAL_TIM_PWM_Start_DMA(),
+ HAL_TIM_PWM_Start_IT()
+ (++) One-pulse mode output : HAL_TIM_OnePulse_Start(),
+ HAL_TIM_OnePulse_Start_IT()
+ (++) Encoder mode output : HAL_TIM_Encoder_Start(),
+ HAL_TIM_Encoder_Start_DMA(), HAL_TIM_Encoder_Start_IT().
(#) The DMA Burst is managed with the two following functions:
HAL_TIM_DMABurst_WriteStart()
@@ -100,26 +109,33 @@
*
*
© COPYRIGHT(c) 2016 STMicroelectronics
*
- * Redistribution and use in source and binary forms, with or without modification,
+ * Redistribution and use in source and binary forms, with or without
+ modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
+ * 2. Redistributions in binary form must reproduce the above copyright
+ notice,
+ * this list of conditions and the following disclaimer in the
+ documentation
* and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * 3. Neither the name of STMicroelectronics nor the names of its
+ contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
@@ -129,13 +145,13 @@
#include "stm32f1xx_hal.h"
/** @addtogroup STM32F1xx_HAL_Driver
- * @{
- */
+ * @{
+ */
/** @defgroup TIM TIM
- * @brief TIM HAL module driver
- * @{
- */
+ * @brief TIM HAL module driver
+ * @{
+ */
#ifdef HAL_TIM_MODULE_ENABLED
@@ -145,41 +161,45 @@
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup TIM_Private_Functions TIM Private Functions
- * @{
- */
+ * @{
+ */
static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
-static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter);
-static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
- uint32_t TIM_ICFilter);
-static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter);
-static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
- uint32_t TIM_ICFilter);
-static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
- uint32_t TIM_ICFilter);
-static void TIM_ETR_SetConfig(TIM_TypeDef* TIMx, uint32_t TIM_ExtTRGPrescaler,
- uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter);
-static void TIM_ITRx_SetConfig(TIM_TypeDef* TIMx, uint16_t InputTriggerSource);
+static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICFilter);
+static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICSelection, uint32_t TIM_ICFilter);
+static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICFilter);
+static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICSelection, uint32_t TIM_ICFilter);
+static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICSelection, uint32_t TIM_ICFilter);
+static void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler,
+ uint32_t TIM_ExtTRGPolarity,
+ uint32_t ExtTRGFilter);
+static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint16_t InputTriggerSource);
static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma);
static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma);
static void TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
- TIM_SlaveConfigTypeDef * sSlaveConfig);
+ TIM_SlaveConfigTypeDef *sSlaveConfig);
/**
- * @}
- */
+ * @}
+ */
-/* Exported functions ---------------------------------------------------------*/
+/* Exported functions
+ * ---------------------------------------------------------*/
/** @defgroup TIM_Exported_Functions TIM Exported Functions
- * @{
- */
+ * @{
+ */
-/** @defgroup TIM_Exported_Functions_Group1 Time Base functions
- * @brief Time Base functions
+/** @defgroup TIM_Exported_Functions_Group1 Time Base functions
+ * @brief Time Base functions
*
-@verbatim
+@verbatim
==============================================================================
##### Time Base functions #####
==============================================================================
@@ -198,16 +218,14 @@ static void TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
* @{
*/
/**
- * @brief Initializes the TIM Time base Unit according to the specified
- * parameters in the TIM_HandleTypeDef and create the associated handle.
- * @param htim : TIM Base handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM Time base Unit according to the specified
+ * parameters in the TIM_HandleTypeDef and create the associated handle.
+ * @param htim : TIM Base handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim) {
/* Check the TIM handle allocation */
- if(htim == NULL)
- {
+ if (htim == NULL) {
return HAL_ERROR;
}
@@ -217,34 +235,32 @@ HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim)
assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision));
assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload));
- if(htim->State == HAL_TIM_STATE_RESET)
- {
+ if (htim->State == HAL_TIM_STATE_RESET) {
/* Allocate lock resource and initialize it */
htim->Lock = HAL_UNLOCKED;
-
+
/* Init the low level hardware : GPIO, CLOCK, NVIC */
HAL_TIM_Base_MspInit(htim);
}
/* Set the TIM state */
- htim->State= HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Set the Time Base configuration */
TIM_Base_SetConfig(htim->Instance, &htim->Init);
/* Initialize the TIM state*/
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
return HAL_OK;
}
/**
- * @brief DeInitializes the TIM Base peripheral
- * @param htim : TIM Base handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes the TIM Base peripheral
+ * @param htim : TIM Base handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
@@ -266,12 +282,11 @@ HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Initializes the TIM Base MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM Base MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -280,12 +295,11 @@ __weak void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief DeInitializes TIM Base MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes TIM Base MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -293,67 +307,63 @@ __weak void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim)
*/
}
-
/**
- * @brief Starts the TIM Base generation.
- * @param htim : TIM handle
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim)
-{
+ * @brief Starts the TIM Base generation.
+ * @param htim : TIM handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
/* Set the TIM state */
- htim->State= HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Enable the Peripheral */
__HAL_TIM_ENABLE(htim);
/* Change the TIM state*/
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
/* Return function status */
return HAL_OK;
}
/**
- * @brief Stops the TIM Base generation.
- * @param htim : TIM handle
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim)
-{
+ * @brief Stops the TIM Base generation.
+ * @param htim : TIM handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
/* Set the TIM state */
- htim->State= HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Disable the Peripheral */
__HAL_TIM_DISABLE(htim);
/* Change the TIM state*/
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
/* Return function status */
return HAL_OK;
}
/**
- * @brief Starts the TIM Base generation in interrupt mode.
- * @param htim : TIM handle
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim)
-{
+ * @brief Starts the TIM Base generation in interrupt mode.
+ * @param htim : TIM handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
- /* Enable the TIM Update interrupt */
- __HAL_TIM_ENABLE_IT(htim, TIM_IT_UPDATE);
+ /* Enable the TIM Update interrupt */
+ __HAL_TIM_ENABLE_IT(htim, TIM_IT_UPDATE);
- /* Enable the Peripheral */
+ /* Enable the Peripheral */
__HAL_TIM_ENABLE(htim);
/* Return function status */
@@ -361,12 +371,11 @@ HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim)
}
/**
- * @brief Stops the TIM Base generation in interrupt mode.
- * @param htim : TIM handle
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim)
-{
+ * @brief Stops the TIM Base generation in interrupt mode.
+ * @param htim : TIM handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
/* Disable the TIM Update interrupt */
@@ -380,29 +389,24 @@ HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim)
}
/**
- * @brief Starts the TIM Base generation in DMA mode.
- * @param htim : TIM handle
- * @param pData : The source Buffer address.
- * @param Length : The length of data to be transferred from memory to peripheral.
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
-{
+ * @brief Starts the TIM Base generation in DMA mode.
+ * @param htim : TIM handle
+ * @param pData : The source Buffer address.
+ * @param Length : The length of data to be transferred from memory to
+ * peripheral.
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim,
+ uint32_t *pData, uint16_t Length) {
/* Check the parameters */
assert_param(IS_TIM_DMA_INSTANCE(htim->Instance));
- if((htim->State == HAL_TIM_STATE_BUSY))
- {
- return HAL_BUSY;
- }
- else if((htim->State == HAL_TIM_STATE_READY))
- {
- if((pData == 0U) && (Length > 0U))
- {
+ if ((htim->State == HAL_TIM_STATE_BUSY)) {
+ return HAL_BUSY;
+ } else if ((htim->State == HAL_TIM_STATE_READY)) {
+ if ((pData == 0U) && (Length > 0U)) {
return HAL_ERROR;
- }
- else
- {
+ } else {
htim->State = HAL_TIM_STATE_BUSY;
}
}
@@ -410,10 +414,11 @@ HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pDat
htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)pData, (uint32_t)&htim->Instance->ARR, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)pData,
+ (uint32_t)&htim->Instance->ARR, Length);
/* Enable the TIM Update DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_UPDATE);
@@ -426,12 +431,11 @@ HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pDat
}
/**
- * @brief Stops the TIM Base generation in DMA mode.
- * @param htim : TIM handle
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim)
-{
+ * @brief Stops the TIM Base generation in DMA mode.
+ * @param htim : TIM handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_DMA_INSTANCE(htim->Instance));
@@ -449,13 +453,13 @@ HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim)
}
/**
- * @}
- */
+ * @}
+ */
-/** @defgroup TIM_Exported_Functions_Group2 Time Output Compare functions
- * @brief Time Output Compare functions
+/** @defgroup TIM_Exported_Functions_Group2 Time Output Compare functions
+ * @brief Time Output Compare functions
*
-@verbatim
+@verbatim
==============================================================================
##### Time Output Compare functions #####
==============================================================================
@@ -474,16 +478,14 @@ HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim)
* @{
*/
/**
- * @brief Initializes the TIM Output Compare according to the specified
- * parameters in the TIM_HandleTypeDef and create the associated handle.
- * @param htim : TIM Output Compare handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef* htim)
-{
+ * @brief Initializes the TIM Output Compare according to the specified
+ * parameters in the TIM_HandleTypeDef and create the associated handle.
+ * @param htim : TIM Output Compare handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim) {
/* Check the TIM handle allocation */
- if(htim == NULL)
- {
+ if (htim == NULL) {
return HAL_ERROR;
}
@@ -493,38 +495,36 @@ HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef* htim)
assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision));
assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload));
- if(htim->State == HAL_TIM_STATE_RESET)
- {
+ if (htim->State == HAL_TIM_STATE_RESET) {
/* Allocate lock resource and initialize it */
htim->Lock = HAL_UNLOCKED;
-
+
/* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
HAL_TIM_OC_MspInit(htim);
}
/* Set the TIM state */
- htim->State= HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Init the base time for the Output Compare */
- TIM_Base_SetConfig(htim->Instance, &htim->Init);
+ TIM_Base_SetConfig(htim->Instance, &htim->Init);
/* Initialize the TIM state*/
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
return HAL_OK;
}
/**
- * @brief DeInitializes the TIM peripheral
- * @param htim : TIM Output Compare handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes the TIM peripheral
+ * @param htim : TIM Output Compare handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
- htim->State = HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Disable the TIM Peripheral Clock */
__HAL_TIM_DISABLE(htim);
@@ -542,12 +542,11 @@ HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Initializes the TIM Output Compare MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM Output Compare MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -556,12 +555,11 @@ __weak void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief DeInitializes TIM Output Compare MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes TIM Output Compare MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -570,26 +568,24 @@ __weak void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Starts the TIM Output Compare signal generation.
- * @param htim : TIM Output Compare handle
- * @param Channel : TIM Channel to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Starts the TIM Output Compare signal generation.
+ * @param htim : TIM Output Compare handle
+ * @param Channel : TIM Channel to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
/* Enable the Output compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
@@ -602,26 +598,24 @@ HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @brief Stops the TIM Output Compare signal generation.
- * @param htim : TIM handle
- * @param Channel : TIM Channel to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Output Compare signal generation.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channel to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
/* Disable the Output compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Disable the Main Ouput */
__HAL_TIM_MOE_DISABLE(htim);
}
@@ -634,60 +628,50 @@ HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @brief Starts the TIM Output Compare signal generation in interrupt mode.
- * @param htim : TIM OC handle
- * @param Channel : TIM Channel to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Starts the TIM Output Compare signal generation in interrupt mode.
+ * @param htim : TIM OC handle
+ * @param Channel : TIM Channel to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Enable the TIM Capture/Compare 1 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Enable the TIM Capture/Compare 2 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Enable the TIM Capture/Compare 3 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Enable the TIM Capture/Compare 4 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Enable the Output compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
@@ -700,60 +684,50 @@ HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @brief Stops the TIM Output Compare signal generation in interrupt mode.
- * @param htim : TIM Output Compare handle
- * @param Channel : TIM Channel to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Output Compare signal generation in interrupt mode.
+ * @param htim : TIM Output Compare handle
+ * @param Channel : TIM Channel to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Disable the TIM Capture/Compare 1 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Disable the TIM Capture/Compare 2 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Disable the TIM Capture/Compare 3 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Disable the TIM Capture/Compare 4 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Disable the Output compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Disable the Main Ouput */
__HAL_TIM_MOE_DISABLE(htim);
}
@@ -766,113 +740,103 @@ HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @brief Starts the TIM Output Compare signal generation in DMA mode.
- * @param htim : TIM Output Compare handle
- * @param Channel : TIM Channel to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @param pData : The source Buffer address.
- * @param Length : The length of data to be transferred from memory to TIM peripheral
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
-{
+ * @brief Starts the TIM Output Compare signal generation in DMA mode.
+ * @param htim : TIM Output Compare handle
+ * @param Channel : TIM Channel to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @param pData : The source Buffer address.
+ * @param Length : The length of data to be transferred from memory to TIM
+ * peripheral
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim,
+ uint32_t Channel, uint32_t *pData,
+ uint16_t Length) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- if((htim->State == HAL_TIM_STATE_BUSY))
- {
- return HAL_BUSY;
- }
- else if((htim->State == HAL_TIM_STATE_READY))
- {
- if(((uint32_t)pData == 0U) && (Length > 0U))
- {
+ if ((htim->State == HAL_TIM_STATE_BUSY)) {
+ return HAL_BUSY;
+ } else if ((htim->State == HAL_TIM_STATE_READY)) {
+ if (((uint32_t)pData == 0U) && (Length > 0U)) {
return HAL_ERROR;
- }
- else
- {
+ } else {
htim->State = HAL_TIM_STATE_BUSY;
}
}
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData,
+ (uint32_t)&htim->Instance->CCR1, Length);
/* Enable the TIM Capture/Compare 1 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData,
+ (uint32_t)&htim->Instance->CCR2, Length);
/* Enable the TIM Capture/Compare 2 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3,Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData,
+ (uint32_t)&htim->Instance->CCR3, Length);
/* Enable the TIM Capture/Compare 3 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
- /* Set the DMA Period elapsed callback */
+ case TIM_CHANNEL_4: {
+ /* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData,
+ (uint32_t)&htim->Instance->CCR4, Length);
/* Enable the TIM Capture/Compare 4 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Enable the Output compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
@@ -885,60 +849,50 @@ HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel
}
/**
- * @brief Stops the TIM Output Compare signal generation in DMA mode.
- * @param htim : TIM Output Compare handle
- * @param Channel : TIM Channel to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Output Compare signal generation in DMA mode.
+ * @param htim : TIM Output Compare handle
+ * @param Channel : TIM Channel to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Disable the TIM Capture/Compare 1 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Disable the TIM Capture/Compare 2 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Disable the TIM Capture/Compare 3 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Disable the TIM Capture/Compare 4 interrupt */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Disable the Output compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Disable the Main Ouput */
__HAL_TIM_MOE_DISABLE(htim);
}
@@ -954,13 +908,13 @@ HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @}
- */
+ * @}
+ */
-/** @defgroup TIM_Exported_Functions_Group3 Time PWM functions
- * @brief Time PWM functions
+/** @defgroup TIM_Exported_Functions_Group3 Time PWM functions
+ * @brief Time PWM functions
*
-@verbatim
+@verbatim
==============================================================================
##### Time PWM functions #####
==============================================================================
@@ -979,16 +933,14 @@ HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
* @{
*/
/**
- * @brief Initializes the TIM PWM Time Base according to the specified
- * parameters in the TIM_HandleTypeDef and create the associated handle.
- * @param htim : TIM handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM PWM Time Base according to the specified
+ * parameters in the TIM_HandleTypeDef and create the associated handle.
+ * @param htim : TIM handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim) {
/* Check the TIM handle allocation */
- if(htim == NULL)
- {
+ if (htim == NULL) {
return HAL_ERROR;
}
@@ -998,34 +950,32 @@ HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim)
assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision));
assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload));
- if(htim->State == HAL_TIM_STATE_RESET)
- {
+ if (htim->State == HAL_TIM_STATE_RESET) {
/* Allocate lock resource and initialize it */
htim->Lock = HAL_UNLOCKED;
-
+
/* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
HAL_TIM_PWM_MspInit(htim);
}
/* Set the TIM state */
- htim->State= HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Init the base time for the PWM */
TIM_Base_SetConfig(htim->Instance, &htim->Init);
/* Initialize the TIM state*/
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
return HAL_OK;
}
/**
- * @brief DeInitializes the TIM peripheral
- * @param htim : TIM handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes the TIM peripheral
+ * @param htim : TIM handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
@@ -1047,12 +997,11 @@ HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Initializes the TIM PWM MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM PWM MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -1061,12 +1010,11 @@ __weak void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief DeInitializes TIM PWM MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes TIM PWM MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -1075,26 +1023,24 @@ __weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Starts the PWM signal generation.
- * @param htim : TIM handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Starts the PWM signal generation.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
/* Enable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
@@ -1107,26 +1053,24 @@ HAL_StatusTypeDef __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TI
}
/**
- * @brief Stops the PWM signal generation.
- * @param htim : TIM handle
- * @param Channel : TIM Channels to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the PWM signal generation.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channels to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
/* Disable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Disable the Main Ouput */
__HAL_TIM_MOE_DISABLE(htim);
}
@@ -1142,60 +1086,50 @@ HAL_StatusTypeDef __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TI
}
/**
- * @brief Starts the PWM signal generation in interrupt mode.
- * @param htim : TIM handle
- * @param Channel : TIM Channel to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Starts the PWM signal generation in interrupt mode.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channel to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Enable the TIM Capture/Compare 1 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Enable the TIM Capture/Compare 2 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Enable the TIM Capture/Compare 3 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Enable the TIM Capture/Compare 4 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Enable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
@@ -1208,60 +1142,50 @@ HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel
}
/**
- * @brief Stops the PWM signal generation in interrupt mode.
- * @param htim : TIM handle
- * @param Channel : TIM Channels to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the PWM signal generation in interrupt mode.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channels to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Disable the TIM Capture/Compare 1 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Disable the TIM Capture/Compare 2 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Disable the TIM Capture/Compare 3 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Disable the TIM Capture/Compare 4 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Disable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Disable the Main Ouput */
__HAL_TIM_MOE_DISABLE(htim);
}
@@ -1274,113 +1198,103 @@ HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT (TIM_HandleTypeDef *htim, uint32_t Channel
}
/**
- * @brief Starts the TIM PWM signal generation in DMA mode.
- * @param htim : TIM handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @param pData : The source Buffer address.
- * @param Length : The length of data to be transferred from memory to TIM peripheral
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
-{
+ * @brief Starts the TIM PWM signal generation in DMA mode.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @param pData : The source Buffer address.
+ * @param Length : The length of data to be transferred from memory to TIM
+ * peripheral
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim,
+ uint32_t Channel, uint32_t *pData,
+ uint16_t Length) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- if((htim->State == HAL_TIM_STATE_BUSY))
- {
- return HAL_BUSY;
- }
- else if((htim->State == HAL_TIM_STATE_READY))
- {
- if(((uint32_t)pData == 0U) && (Length > 0U))
- {
+ if ((htim->State == HAL_TIM_STATE_BUSY)) {
+ return HAL_BUSY;
+ } else if ((htim->State == HAL_TIM_STATE_READY)) {
+ if (((uint32_t)pData == 0U) && (Length > 0U)) {
return HAL_ERROR;
- }
- else
- {
+ } else {
htim->State = HAL_TIM_STATE_BUSY;
}
}
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData,
+ (uint32_t)&htim->Instance->CCR1, Length);
/* Enable the TIM Capture/Compare 1 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData,
+ (uint32_t)&htim->Instance->CCR2, Length);
/* Enable the TIM Capture/Compare 2 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3,Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData,
+ (uint32_t)&htim->Instance->CCR3, Length);
/* Enable the TIM Output Capture/Compare 3 request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
- /* Set the DMA Period elapsed callback */
+ case TIM_CHANNEL_4: {
+ /* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData,
+ (uint32_t)&htim->Instance->CCR4, Length);
/* Enable the TIM Capture/Compare 4 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Enable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
@@ -1393,60 +1307,50 @@ HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channe
}
/**
- * @brief Stops the TIM PWM signal generation in DMA mode.
- * @param htim : TIM handle
- * @param Channel : TIM Channels to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM PWM signal generation in DMA mode.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channels to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Disable the TIM Capture/Compare 1 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Disable the TIM Capture/Compare 2 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Disable the TIM Capture/Compare 3 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Disable the TIM Capture/Compare 4 interrupt */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Disable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Disable the Main Ouput */
__HAL_TIM_MOE_DISABLE(htim);
}
@@ -1462,13 +1366,13 @@ HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel
}
/**
- * @}
- */
+ * @}
+ */
-/** @defgroup TIM_Exported_Functions_Group4 Time Input Capture functions
- * @brief Time Input Capture functions
+/** @defgroup TIM_Exported_Functions_Group4 Time Input Capture functions
+ * @brief Time Input Capture functions
*
-@verbatim
+@verbatim
==============================================================================
##### Time Input Capture functions #####
==============================================================================
@@ -1487,16 +1391,15 @@ HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel
* @{
*/
/**
- * @brief Initializes the TIM Input Capture Time base according to the specified
- * parameters in the TIM_HandleTypeDef and create the associated handle.
- * @param htim : TIM Input Capture handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM Input Capture Time base according to the
+ * specified parameters in the TIM_HandleTypeDef and create the associated
+ * handle.
+ * @param htim : TIM Input Capture handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim) {
/* Check the TIM handle allocation */
- if(htim == NULL)
- {
+ if (htim == NULL) {
return HAL_ERROR;
}
@@ -1506,34 +1409,32 @@ HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim)
assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision));
assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload));
- if(htim->State == HAL_TIM_STATE_RESET)
- {
+ if (htim->State == HAL_TIM_STATE_RESET) {
/* Allocate lock resource and initialize it */
htim->Lock = HAL_UNLOCKED;
-
+
/* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
HAL_TIM_IC_MspInit(htim);
}
/* Set the TIM state */
- htim->State= HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Init the base time for the input capture */
TIM_Base_SetConfig(htim->Instance, &htim->Init);
/* Initialize the TIM state*/
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
return HAL_OK;
}
/**
- * @brief DeInitializes the TIM peripheral
- * @param htim : TIM Input Capture handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes the TIM peripheral
+ * @param htim : TIM Input Capture handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
@@ -1555,12 +1456,11 @@ HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Initializes the TIM Input Capture MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM Input Capture MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -1569,12 +1469,11 @@ __weak void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief DeInitializes TIM Input Capture MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes TIM Input Capture MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -1583,18 +1482,17 @@ __weak void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Starts the TIM Input Capture measurement.
- * @param htim : TIM Input Capture handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_IC_Start (TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Starts the TIM Input Capture measurement.
+ * @param htim : TIM Input Capture handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
@@ -1609,18 +1507,17 @@ HAL_StatusTypeDef HAL_TIM_IC_Start (TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @brief Stops the TIM Input Capture measurement.
- * @param htim : TIM handle
- * @param Channel : TIM Channels to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Input Capture measurement.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channels to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
@@ -1635,53 +1532,44 @@ HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @brief Starts the TIM Input Capture measurement in interrupt mode.
- * @param htim : TIM Input Capture handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_IC_Start_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Starts the TIM Input Capture measurement in interrupt mode.
+ * @param htim : TIM Input Capture handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Enable the TIM Capture/Compare 1 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Enable the TIM Capture/Compare 2 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Enable the TIM Capture/Compare 3 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Enable the TIM Capture/Compare 4 interrupt */
__HAL_TIM_ENABLE_IT(htim, TIM_IT_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Enable the Input Capture channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
@@ -1694,53 +1582,44 @@ HAL_StatusTypeDef HAL_TIM_IC_Start_IT (TIM_HandleTypeDef *htim, uint32_t Channel
}
/**
- * @brief Stops the TIM Input Capture measurement in interrupt mode.
- * @param htim : TIM handle
- * @param Channel : TIM Channels to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Input Capture measurement in interrupt mode.
+ * @param htim : TIM handle
+ * @param Channel : TIM Channels to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Disable the TIM Capture/Compare 1 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Disable the TIM Capture/Compare 2 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Disable the TIM Capture/Compare 3 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Disable the TIM Capture/Compare 4 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Disable the Input Capture channel */
@@ -1754,108 +1633,103 @@ HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @brief Starts the TIM Input Capture measurement in DMA mode.
- * @param htim : TIM Input Capture handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @param pData : The destination Buffer address.
- * @param Length : The length of data to be transferred from TIM peripheral to memory.
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
-{
+ * @brief Starts the TIM Input Capture measurement in DMA mode.
+ * @param htim : TIM Input Capture handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @param pData : The destination Buffer address.
+ * @param Length : The length of data to be transferred from TIM peripheral to
+ * memory.
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim,
+ uint32_t Channel, uint32_t *pData,
+ uint16_t Length) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance));
- if((htim->State == HAL_TIM_STATE_BUSY))
- {
- return HAL_BUSY;
- }
- else if((htim->State == HAL_TIM_STATE_READY))
- {
- if((pData == 0U) && (Length > 0U))
- {
+ if ((htim->State == HAL_TIM_STATE_BUSY)) {
+ return HAL_BUSY;
+ } else if ((htim->State == HAL_TIM_STATE_READY)) {
+ if ((pData == 0U) && (Length > 0U)) {
return HAL_ERROR;
- }
- else
- {
+ } else {
htim->State = HAL_TIM_STATE_BUSY;
}
}
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1],
+ (uint32_t)&htim->Instance->CCR1, (uint32_t)pData,
+ Length);
/* Enable the TIM Capture/Compare 1 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2],
+ (uint32_t)&htim->Instance->CCR2, (uint32_t)pData,
+ Length);
/* Enable the TIM Capture/Compare 2 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->CCR3, (uint32_t)pData, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3],
+ (uint32_t)&htim->Instance->CCR3, (uint32_t)pData,
+ Length);
/* Enable the TIM Capture/Compare 3 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->CCR4, (uint32_t)pData, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4],
+ (uint32_t)&htim->Instance->CCR4, (uint32_t)pData,
+ Length);
/* Enable the TIM Capture/Compare 4 DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Enable the Input Capture channel */
@@ -1869,54 +1743,45 @@ HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel
}
/**
- * @brief Stops the TIM Input Capture measurement in DMA mode.
- * @param htim : TIM Input Capture handle
- * @param Channel : TIM Channels to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Input Capture measurement in DMA mode.
+ * @param htim : TIM Input Capture handle
+ * @param Channel : TIM Channels to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance));
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Disable the TIM Capture/Compare 1 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Disable the TIM Capture/Compare 2 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Disable the TIM Capture/Compare 3 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Disable the TIM Capture/Compare 4 DMA request */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Disable the Input Capture channel */
@@ -1932,13 +1797,13 @@ HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
return HAL_OK;
}
/**
- * @}
- */
+ * @}
+ */
-/** @defgroup TIM_Exported_Functions_Group5 Time One Pulse functions
- * @brief Time One Pulse functions
+/** @defgroup TIM_Exported_Functions_Group5 Time One Pulse functions
+ * @brief Time One Pulse functions
*
-@verbatim
+@verbatim
==============================================================================
##### Time One Pulse functions #####
==============================================================================
@@ -1957,20 +1822,19 @@ HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
* @{
*/
/**
- * @brief Initializes the TIM One Pulse Time Base according to the specified
- * parameters in the TIM_HandleTypeDef and create the associated handle.
- * @param htim : TIM OnePulse handle
- * @param OnePulseMode : Select the One pulse mode.
- * This parameter can be one of the following values:
- * @arg TIM_OPMODE_SINGLE: Only one pulse will be generated.
- * @arg TIM_OPMODE_REPETITIVE: Repetitive pulses wil be generated.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode)
-{
+ * @brief Initializes the TIM One Pulse Time Base according to the specified
+ * parameters in the TIM_HandleTypeDef and create the associated handle.
+ * @param htim : TIM OnePulse handle
+ * @param OnePulseMode : Select the One pulse mode.
+ * This parameter can be one of the following values:
+ * @arg TIM_OPMODE_SINGLE: Only one pulse will be generated.
+ * @arg TIM_OPMODE_REPETITIVE: Repetitive pulses wil be generated.
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim,
+ uint32_t OnePulseMode) {
/* Check the TIM handle allocation */
- if(htim == NULL)
- {
+ if (htim == NULL) {
return HAL_ERROR;
}
@@ -1981,17 +1845,16 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePul
assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload));
assert_param(IS_TIM_OPM_MODE(OnePulseMode));
- if(htim->State == HAL_TIM_STATE_RESET)
- {
+ if (htim->State == HAL_TIM_STATE_RESET) {
/* Allocate lock resource and initialize it */
htim->Lock = HAL_UNLOCKED;
-
+
/* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
HAL_TIM_OnePulse_MspInit(htim);
}
/* Set the TIM state */
- htim->State= HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Configure the Time base in the One Pulse Mode */
TIM_Base_SetConfig(htim->Instance, &htim->Init);
@@ -2003,18 +1866,17 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePul
htim->Instance->CR1 |= OnePulseMode;
/* Initialize the TIM state*/
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
return HAL_OK;
}
/**
- * @brief DeInitializes the TIM One Pulse
- * @param htim : TIM One Pulse handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes the TIM One Pulse
+ * @param htim : TIM One Pulse handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
@@ -2036,12 +1898,11 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Initializes the TIM One Pulse MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM One Pulse MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -2050,12 +1911,11 @@ __weak void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief DeInitializes TIM One Pulse MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes TIM One Pulse MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -2064,33 +1924,33 @@ __weak void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Starts the TIM One Pulse signal generation.
- * @param htim : TIM One Pulse handle
- * @param OutputChannel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
-{
+ * @brief Starts the TIM One Pulse signal generation.
+ * @param htim : TIM One Pulse handle
+ * @param OutputChannel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim,
+ uint32_t OutputChannel) {
/* Prevent unused argument(s) compilation warning */
UNUSED(OutputChannel);
- /* Enable the Capture compare and the Input Capture channels
- (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
- if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
- if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
- in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together
+ /* Enable the Capture compare and the Input Capture channels
+ (in the OPM Mode the two possible channels that can be used are
+ TIM_CHANNEL_1 and TIM_CHANNEL_2) if TIM_CHANNEL_1 is used as output, the
+ TIM_CHANNEL_2 will be used as input and if TIM_CHANNEL_1 is used as input,
+ the TIM_CHANNEL_2 will be used as output in all combinations, the
+ TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together
- No need to enable the counter, it's enabled automatically by hardware
+ No need to enable the counter, it's enabled automatically by hardware
(the counter starts in response to a stimulus and generate a pulse */
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
@@ -2100,30 +1960,30 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t Outpu
}
/**
- * @brief Stops the TIM One Pulse signal generation.
- * @param htim : TIM One Pulse handle
- * @param OutputChannel : TIM Channels to be disable
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
-{
+ * @brief Stops the TIM One Pulse signal generation.
+ * @param htim : TIM One Pulse handle
+ * @param OutputChannel : TIM Channels to be disable
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim,
+ uint32_t OutputChannel) {
/* Prevent unused argument(s) compilation warning */
UNUSED(OutputChannel);
/* Disable the Capture compare and the Input Capture channels
- (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
- if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
- if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
- in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */
+ (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1
+ and TIM_CHANNEL_2) if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will
+ be used as input and if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will
+ be used as output in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2
+ should be disabled together */
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Disable the Main Ouput */
__HAL_TIM_MOE_DISABLE(htim);
}
@@ -2136,26 +1996,27 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t Output
}
/**
- * @brief Starts the TIM One Pulse signal generation in interrupt mode.
- * @param htim : TIM One Pulse handle
- * @param OutputChannel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
-{
+ * @brief Starts the TIM One Pulse signal generation in interrupt mode.
+ * @param htim : TIM One Pulse handle
+ * @param OutputChannel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim,
+ uint32_t OutputChannel) {
/* Prevent unused argument(s) compilation warning */
UNUSED(OutputChannel);
- /* Enable the Capture compare and the Input Capture channels
- (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
- if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
- if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
- in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together
+ /* Enable the Capture compare and the Input Capture channels
+ (in the OPM Mode the two possible channels that can be used are
+ TIM_CHANNEL_1 and TIM_CHANNEL_2) if TIM_CHANNEL_1 is used as output, the
+ TIM_CHANNEL_2 will be used as input and if TIM_CHANNEL_1 is used as input,
+ the TIM_CHANNEL_2 will be used as output in all combinations, the
+ TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together
- No need to enable the counter, it's enabled automatically by hardware
+ No need to enable the counter, it's enabled automatically by hardware
(the counter starts in response to a stimulus and generate a pulse */
/* Enable the TIM Capture/Compare 1 interrupt */
@@ -2167,8 +2028,7 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t Ou
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
@@ -2178,16 +2038,16 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t Ou
}
/**
- * @brief Stops the TIM One Pulse signal generation in interrupt mode.
- * @param htim : TIM One Pulse handle
- * @param OutputChannel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
-{
+ * @brief Stops the TIM One Pulse signal generation in interrupt mode.
+ * @param htim : TIM One Pulse handle
+ * @param OutputChannel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim,
+ uint32_t OutputChannel) {
/* Prevent unused argument(s) compilation warning */
UNUSED(OutputChannel);
@@ -2197,35 +2057,35 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Out
/* Disable the TIM Capture/Compare 2 interrupt */
__HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
- /* Disable the Capture compare and the Input Capture channels
- (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
- if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
- if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
- in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */
+ /* Disable the Capture compare and the Input Capture channels
+ (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1
+ and TIM_CHANNEL_2) if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will
+ be used as input and if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will
+ be used as output in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2
+ should be disabled together */
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
- if(IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
- {
+ if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Disable the Main Ouput */
__HAL_TIM_MOE_DISABLE(htim);
}
/* Disable the Peripheral */
- __HAL_TIM_DISABLE(htim);
+ __HAL_TIM_DISABLE(htim);
/* Return function status */
return HAL_OK;
}
/**
- * @}
- */
+ * @}
+ */
-/** @defgroup TIM_Exported_Functions_Group6 Time Encoder functions
- * @brief Time Encoder functions
+/** @defgroup TIM_Exported_Functions_Group6 Time Encoder functions
+ * @brief Time Encoder functions
*
-@verbatim
+@verbatim
==============================================================================
##### Time Encoder functions #####
==============================================================================
@@ -2244,20 +2104,20 @@ HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Out
* @{
*/
/**
- * @brief Initializes the TIM Encoder Interface and create the associated handle.
- * @param htim : TIM Encoder Interface handle
- * @param sConfig : TIM Encoder Interface configuration structure
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef* sConfig)
-{
+ * @brief Initializes the TIM Encoder Interface and create the associated
+ * handle.
+ * @param htim : TIM Encoder Interface handle
+ * @param sConfig : TIM Encoder Interface configuration structure
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim,
+ TIM_Encoder_InitTypeDef *sConfig) {
uint32_t tmpsmcr = 0U;
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
/* Check the TIM handle allocation */
- if(htim == NULL)
- {
+ if (htim == NULL) {
return HAL_ERROR;
}
@@ -2276,17 +2136,16 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_Ini
assert_param(IS_TIM_IC_FILTER(sConfig->IC1Filter));
assert_param(IS_TIM_IC_FILTER(sConfig->IC2Filter));
- if(htim->State == HAL_TIM_STATE_RESET)
- {
+ if (htim->State == HAL_TIM_STATE_RESET) {
/* Allocate lock resource and initialize it */
htim->Lock = HAL_UNLOCKED;
-
+
/* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
HAL_TIM_Encoder_MspInit(htim);
}
/* Set the TIM state */
- htim->State= HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
/* Reset the SMS bits */
htim->Instance->SMCR &= ~TIM_SMCR_SMS;
@@ -2310,7 +2169,8 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_Ini
tmpccmr1 &= ~(TIM_CCMR1_CC1S | TIM_CCMR1_CC2S);
tmpccmr1 |= (sConfig->IC1Selection | (sConfig->IC2Selection << 8U));
- /* Set the the Capture Compare 1 and the Capture Compare 2 prescalers and filters */
+ /* Set the the Capture Compare 1 and the Capture Compare 2 prescalers and
+ * filters */
tmpccmr1 &= ~(TIM_CCMR1_IC1PSC | TIM_CCMR1_IC2PSC);
tmpccmr1 &= ~(TIM_CCMR1_IC1F | TIM_CCMR1_IC2F);
tmpccmr1 |= sConfig->IC1Prescaler | (sConfig->IC2Prescaler << 8U);
@@ -2331,19 +2191,17 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_Ini
htim->Instance->CCER = tmpccer;
/* Initialize the TIM state*/
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
return HAL_OK;
}
-
/**
- * @brief DeInitializes the TIM Encoder interface
- * @param htim : TIM Encoder handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes the TIM Encoder interface
+ * @param htim : TIM Encoder handle
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
@@ -2365,12 +2223,11 @@ HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Initializes the TIM Encoder Interface MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
-{
+ * @brief Initializes the TIM Encoder Interface MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -2379,12 +2236,11 @@ __weak void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief DeInitializes TIM Encoder Interface MSP.
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim)
-{
+ * @brief DeInitializes TIM Encoder Interface MSP.
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -2393,38 +2249,34 @@ __weak void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim)
}
/**
- * @brief Starts the TIM Encoder Interface.
- * @param htim : TIM Encoder Interface handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Starts the TIM Encoder Interface.
+ * @param htim : TIM Encoder Interface handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
/* Enable the encoder interface channels */
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
break;
- }
- case TIM_CHANNEL_2:
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
+ }
+ case TIM_CHANNEL_2: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
+ break;
+ }
+ default: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
break;
- }
- default :
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
- break;
}
}
/* Enable the Peripheral */
@@ -2435,39 +2287,36 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channe
}
/**
- * @brief Stops the TIM Encoder Interface.
- * @param htim : TIM Encoder Interface handle
- * @param Channel : TIM Channels to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Encoder Interface.
+ * @param htim : TIM Encoder Interface handle
+ * @param Channel : TIM Channels to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
- assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
+ assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- /* Disable the Input Capture channels 1 and 2
- (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
+ /* Disable the Input Capture channels 1 and 2
+ (in the EncoderInterface the two possible channels that can be used are
+ TIM_CHANNEL_1 and TIM_CHANNEL_2) */
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
break;
- }
- case TIM_CHANNEL_2:
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
+ }
+ case TIM_CHANNEL_2: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
+ break;
+ }
+ default: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
break;
- }
- default :
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
- break;
}
}
@@ -2479,43 +2328,39 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel
}
/**
- * @brief Starts the TIM Encoder Interface in interrupt mode.
- * @param htim : TIM Encoder Interface handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Starts the TIM Encoder Interface in interrupt mode.
+ * @param htim : TIM Encoder Interface handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
/* Enable the encoder interface channels */
/* Enable the capture compare Interrupts 1 and/or 2 */
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
- __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
+ __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
break;
- }
- case TIM_CHANNEL_2:
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
- __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
+ }
+ case TIM_CHANNEL_2: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
+ __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
+ break;
+ }
+ default: {
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
+ TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
+ __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
+ __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
break;
- }
- default :
- {
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
- TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
- __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
- __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
- break;
}
}
@@ -2527,38 +2372,34 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Cha
}
/**
- * @brief Stops the TIM Encoder Interface in interrupt mode.
- * @param htim : TIM Encoder Interface handle
- * @param Channel : TIM Channels to be disabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Encoder Interface in interrupt mode.
+ * @param htim : TIM Encoder Interface handle
+ * @param Channel : TIM Channels to be disabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
/* Disable the Input Capture channels 1 and 2
- (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
- if(Channel == TIM_CHANNEL_1)
- {
+ (in the EncoderInterface the two possible channels that can be used are
+ TIM_CHANNEL_1 and TIM_CHANNEL_2) */
+ if (Channel == TIM_CHANNEL_1) {
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
/* Disable the capture compare Interrupts 1 */
- __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
- }
- else if(Channel == TIM_CHANNEL_2)
- {
+ __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
+ } else if (Channel == TIM_CHANNEL_2) {
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
/* Disable the capture compare Interrupts 2 */
- __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
- }
- else
- {
+ __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
+ } else {
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
@@ -2578,51 +2419,47 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Chan
}
/**
- * @brief Starts the TIM Encoder Interface in DMA mode.
- * @param htim : TIM Encoder Interface handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
- * @param pData1 : The destination Buffer address for IC1.
- * @param pData2 : The destination Buffer address for IC2.
- * @param Length : The length of data to be transferred from TIM peripheral to memory.
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, uint32_t *pData2, uint16_t Length)
-{
+ * @brief Starts the TIM Encoder Interface in DMA mode.
+ * @param htim : TIM Encoder Interface handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
+ * @param pData1 : The destination Buffer address for IC1.
+ * @param pData2 : The destination Buffer address for IC2.
+ * @param Length : The length of data to be transferred from TIM peripheral to
+ * memory.
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim,
+ uint32_t Channel, uint32_t *pData1,
+ uint32_t *pData2, uint16_t Length) {
/* Check the parameters */
assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance));
- if((htim->State == HAL_TIM_STATE_BUSY))
- {
- return HAL_BUSY;
- }
- else if((htim->State == HAL_TIM_STATE_READY))
- {
- if((((pData1 == 0U) || (pData2 == 0U) )) && (Length > 0U))
- {
+ if ((htim->State == HAL_TIM_STATE_BUSY)) {
+ return HAL_BUSY;
+ } else if ((htim->State == HAL_TIM_STATE_READY)) {
+ if ((((pData1 == 0U) || (pData2 == 0U))) && (Length > 0U)) {
return HAL_ERROR;
- }
- else
- {
+ } else {
htim->State = HAL_TIM_STATE_BUSY;
}
}
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t )pData1, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1],
+ (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1,
+ Length);
/* Enable the TIM Input Capture DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
@@ -2632,18 +2469,18 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Ch
/* Enable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2],
+ (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2,
+ Length);
/* Enable the TIM Input Capture DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2);
@@ -2653,30 +2490,32 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Ch
/* Enable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);
- }
- break;
+ } break;
- case TIM_CHANNEL_ALL:
- {
+ case TIM_CHANNEL_ALL: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1],
+ (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1,
+ Length);
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, Length);
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2],
+ (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2,
+ Length);
- /* Enable the Peripheral */
+ /* Enable the Peripheral */
__HAL_TIM_ENABLE(htim);
/* Enable the Capture compare channel */
@@ -2687,49 +2526,44 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Ch
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
/* Enable the TIM Input Capture DMA request */
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Return function status */
return HAL_OK;
}
/**
- * @brief Stops the TIM Encoder Interface in DMA mode.
- * @param htim : TIM Encoder Interface handle
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
- * @retval HAL status
-*/
-HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Stops the TIM Encoder Interface in DMA mode.
+ * @param htim : TIM Encoder Interface handle
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance));
/* Disable the Input Capture channels 1 and 2
- (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
- if(Channel == TIM_CHANNEL_1)
- {
+ (in the EncoderInterface the two possible channels that can be used are
+ TIM_CHANNEL_1 and TIM_CHANNEL_2) */
+ if (Channel == TIM_CHANNEL_1) {
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
/* Disable the capture compare DMA Request 1 */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1);
- }
- else if(Channel == TIM_CHANNEL_2)
- {
+ } else if (Channel == TIM_CHANNEL_2) {
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
/* Disable the capture compare DMA Request 2 */
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2);
- }
- else
- {
+ } else {
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_DISABLE);
@@ -2749,12 +2583,12 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Cha
}
/**
- * @}
- */
-/** @defgroup TIM_Exported_Functions_Group7 TIM IRQ handler management
- * @brief IRQ handler management
+ * @}
+ */
+/** @defgroup TIM_Exported_Functions_Group7 TIM IRQ handler management
+ * @brief IRQ handler management
*
-@verbatim
+@verbatim
==============================================================================
##### IRQ handler management #####
==============================================================================
@@ -2765,29 +2599,24 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Cha
* @{
*/
/**
- * @brief This function handles TIM interrupts requests.
- * @param htim : TIM handle
- * @retval None
- */
-void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
-{
+ * @brief This function handles TIM interrupts requests.
+ * @param htim : TIM handle
+ * @retval None
+ */
+void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim) {
/* Capture compare 1 event */
- if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC1) != RESET)
- {
- if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC1) !=RESET)
- {
+ if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC1) != RESET) {
+ if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC1) != RESET) {
{
__HAL_TIM_CLEAR_IT(htim, TIM_IT_CC1);
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1;
/* Input capture event */
- if((htim->Instance->CCMR1 & TIM_CCMR1_CC1S) != 0x00U)
- {
+ if ((htim->Instance->CCMR1 & TIM_CCMR1_CC1S) != 0x00U) {
HAL_TIM_IC_CaptureCallback(htim);
}
/* Output compare event */
- else
- {
+ else {
HAL_TIM_OC_DelayElapsedCallback(htim);
HAL_TIM_PWM_PulseFinishedCallback(htim);
}
@@ -2796,20 +2625,16 @@ void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
}
}
/* Capture compare 2 event */
- if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC2) != RESET)
- {
- if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC2) !=RESET)
- {
+ if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC2) != RESET) {
+ if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC2) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_IT_CC2);
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2;
/* Input capture event */
- if((htim->Instance->CCMR1 & TIM_CCMR1_CC2S) != 0x00U)
- {
+ if ((htim->Instance->CCMR1 & TIM_CCMR1_CC2S) != 0x00U) {
HAL_TIM_IC_CaptureCallback(htim);
}
/* Output compare event */
- else
- {
+ else {
HAL_TIM_OC_DelayElapsedCallback(htim);
HAL_TIM_PWM_PulseFinishedCallback(htim);
}
@@ -2817,20 +2642,16 @@ void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
}
}
/* Capture compare 3 event */
- if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC3) != RESET)
- {
- if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC3) !=RESET)
- {
+ if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC3) != RESET) {
+ if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC3) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_IT_CC3);
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3;
/* Input capture event */
- if((htim->Instance->CCMR2 & TIM_CCMR2_CC3S) != 0x00U)
- {
+ if ((htim->Instance->CCMR2 & TIM_CCMR2_CC3S) != 0x00U) {
HAL_TIM_IC_CaptureCallback(htim);
}
/* Output compare event */
- else
- {
+ else {
HAL_TIM_OC_DelayElapsedCallback(htim);
HAL_TIM_PWM_PulseFinishedCallback(htim);
}
@@ -2838,20 +2659,16 @@ void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
}
}
/* Capture compare 4 event */
- if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC4) != RESET)
- {
- if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC4) !=RESET)
- {
+ if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC4) != RESET) {
+ if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_CC4) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_IT_CC4);
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4;
/* Input capture event */
- if((htim->Instance->CCMR2 & TIM_CCMR2_CC4S) != 0x00U)
- {
+ if ((htim->Instance->CCMR2 & TIM_CCMR2_CC4S) != 0x00U) {
HAL_TIM_IC_CaptureCallback(htim);
}
/* Output compare event */
- else
- {
+ else {
HAL_TIM_OC_DelayElapsedCallback(htim);
HAL_TIM_PWM_PulseFinishedCallback(htim);
}
@@ -2859,37 +2676,29 @@ void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
}
}
/* TIM Update event */
- if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_UPDATE) != RESET)
- {
- if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_UPDATE) !=RESET)
- {
+ if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_UPDATE) != RESET) {
+ if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_UPDATE) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE);
HAL_TIM_PeriodElapsedCallback(htim);
}
}
/* TIM Break input event */
- if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_BREAK) != RESET)
- {
- if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_BREAK) !=RESET)
- {
+ if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_BREAK) != RESET) {
+ if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_BREAK) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_IT_BREAK);
HAL_TIMEx_BreakCallback(htim);
}
}
/* TIM Trigger detection event */
- if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_TRIGGER) != RESET)
- {
- if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_TRIGGER) !=RESET)
- {
+ if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_TRIGGER) != RESET) {
+ if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_TRIGGER) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_IT_TRIGGER);
HAL_TIM_TriggerCallback(htim);
}
}
/* TIM commutation event */
- if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_COM) != RESET)
- {
- if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_COM) !=RESET)
- {
+ if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_COM) != RESET) {
+ if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_COM) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_FLAG_COM);
HAL_TIMEx_CommutationCallback(htim);
}
@@ -2897,13 +2706,13 @@ void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
}
/**
- * @}
- */
+ * @}
+ */
/** @defgroup TIM_Exported_Functions_Group8 Peripheral Control functions
- * @brief Peripheral Control functions
+ * @brief Peripheral Control functions
*
-@verbatim
+@verbatim
==============================================================================
##### Peripheral Control functions #####
==============================================================================
@@ -2920,20 +2729,21 @@ void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
*/
/**
- * @brief Initializes the TIM Output Compare Channels according to the specified
- * parameters in the TIM_OC_InitTypeDef.
- * @param htim : TIM Output Compare handle
- * @param sConfig : TIM Output Compare configuration structure
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef* sConfig, uint32_t Channel)
-{
+ * @brief Initializes the TIM Output Compare Channels according to the
+ * specified parameters in the TIM_OC_InitTypeDef.
+ * @param htim : TIM Output Compare handle
+ * @param sConfig : TIM Output Compare configuration structure
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim,
+ TIM_OC_InitTypeDef *sConfig,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CHANNELS(Channel));
assert_param(IS_TIM_OC_MODE(sConfig->OCMode));
@@ -2944,42 +2754,33 @@ HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitT
htim->State = HAL_TIM_STATE_BUSY;
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
/* Configure the TIM Channel 1 in Output Compare */
TIM_OC1_SetConfig(htim->Instance, sConfig);
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
/* Configure the TIM Channel 2 in Output Compare */
TIM_OC2_SetConfig(htim->Instance, sConfig);
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
- assert_param(IS_TIM_CC3_INSTANCE(htim->Instance));
+ case TIM_CHANNEL_3: {
+ assert_param(IS_TIM_CC3_INSTANCE(htim->Instance));
/* Configure the TIM Channel 3 in Output Compare */
TIM_OC3_SetConfig(htim->Instance, sConfig);
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
assert_param(IS_TIM_CC4_INSTANCE(htim->Instance));
- /* Configure the TIM Channel 4 in Output Compare */
- TIM_OC4_SetConfig(htim->Instance, sConfig);
- }
- break;
+ /* Configure the TIM Channel 4 in Output Compare */
+ TIM_OC4_SetConfig(htim->Instance, sConfig);
+ } break;
default:
- break;
+ break;
}
htim->State = HAL_TIM_STATE_READY;
@@ -2989,20 +2790,21 @@ HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitT
}
/**
- * @brief Initializes the TIM Input Capture Channels according to the specified
- * parameters in the TIM_IC_InitTypeDef.
- * @param htim : TIM IC handle
- * @param sConfig : TIM Input Capture configuration structure
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef* sConfig, uint32_t Channel)
-{
+ * @brief Initializes the TIM Input Capture Channels according to the specified
+ * parameters in the TIM_IC_InitTypeDef.
+ * @param htim : TIM IC handle
+ * @param sConfig : TIM Input Capture configuration structure
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim,
+ TIM_IC_InitTypeDef *sConfig,
+ uint32_t Channel) {
/* Check the parameters */
assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
assert_param(IS_TIM_IC_POLARITY(sConfig->ICPolarity));
@@ -3014,28 +2816,21 @@ HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitT
htim->State = HAL_TIM_STATE_BUSY;
- if (Channel == TIM_CHANNEL_1)
- {
+ if (Channel == TIM_CHANNEL_1) {
/* TI1 Configuration */
- TIM_TI1_SetConfig(htim->Instance,
- sConfig->ICPolarity,
- sConfig->ICSelection,
- sConfig->ICFilter);
+ TIM_TI1_SetConfig(htim->Instance, sConfig->ICPolarity, sConfig->ICSelection,
+ sConfig->ICFilter);
/* Reset the IC1PSC Bits */
htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
/* Set the IC1PSC value */
htim->Instance->CCMR1 |= sConfig->ICPrescaler;
- }
- else if (Channel == TIM_CHANNEL_2)
- {
+ } else if (Channel == TIM_CHANNEL_2) {
/* TI2 Configuration */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- TIM_TI2_SetConfig(htim->Instance,
- sConfig->ICPolarity,
- sConfig->ICSelection,
+ TIM_TI2_SetConfig(htim->Instance, sConfig->ICPolarity, sConfig->ICSelection,
sConfig->ICFilter);
/* Reset the IC2PSC Bits */
@@ -3043,32 +2838,24 @@ HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitT
/* Set the IC2PSC value */
htim->Instance->CCMR1 |= (sConfig->ICPrescaler << 8U);
- }
- else if (Channel == TIM_CHANNEL_3)
- {
+ } else if (Channel == TIM_CHANNEL_3) {
/* TI3 Configuration */
assert_param(IS_TIM_CC3_INSTANCE(htim->Instance));
- TIM_TI3_SetConfig(htim->Instance,
- sConfig->ICPolarity,
- sConfig->ICSelection,
- sConfig->ICFilter);
+ TIM_TI3_SetConfig(htim->Instance, sConfig->ICPolarity, sConfig->ICSelection,
+ sConfig->ICFilter);
/* Reset the IC3PSC Bits */
htim->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC;
/* Set the IC3PSC value */
htim->Instance->CCMR2 |= sConfig->ICPrescaler;
- }
- else
- {
+ } else {
/* TI4 Configuration */
assert_param(IS_TIM_CC4_INSTANCE(htim->Instance));
- TIM_TI4_SetConfig(htim->Instance,
- sConfig->ICPolarity,
- sConfig->ICSelection,
- sConfig->ICFilter);
+ TIM_TI4_SetConfig(htim->Instance, sConfig->ICPolarity, sConfig->ICSelection,
+ sConfig->ICFilter);
/* Reset the IC4PSC Bits */
htim->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC;
@@ -3085,20 +2872,21 @@ HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitT
}
/**
- * @brief Initializes the TIM PWM channels according to the specified
- * parameters in the TIM_OC_InitTypeDef.
- * @param htim : TIM handle
- * @param sConfig : TIM PWM configuration structure
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @arg TIM_CHANNEL_3: TIM Channel 3 selected
- * @arg TIM_CHANNEL_4: TIM Channel 4 selected
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef* sConfig, uint32_t Channel)
-{
+ * @brief Initializes the TIM PWM channels according to the specified
+ * parameters in the TIM_OC_InitTypeDef.
+ * @param htim : TIM handle
+ * @param sConfig : TIM PWM configuration structure
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3: TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4: TIM Channel 4 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim,
+ TIM_OC_InitTypeDef *sConfig,
+ uint32_t Channel) {
__HAL_LOCK(htim);
/* Check the parameters */
@@ -3109,10 +2897,8 @@ HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_Init
htim->State = HAL_TIM_STATE_BUSY;
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
/* Configure the Channel 1 in PWM mode */
TIM_OC1_SetConfig(htim->Instance, sConfig);
@@ -3123,11 +2909,9 @@ HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_Init
/* Configure the Output Fast mode */
htim->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE;
htim->Instance->CCMR1 |= sConfig->OCFastMode;
- }
- break;
+ } break;
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
/* Configure the Channel 2 in PWM mode */
TIM_OC2_SetConfig(htim->Instance, sConfig);
@@ -3138,11 +2922,9 @@ HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_Init
/* Configure the Output Fast mode */
htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE;
htim->Instance->CCMR1 |= sConfig->OCFastMode << 8;
- }
- break;
+ } break;
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
assert_param(IS_TIM_CC3_INSTANCE(htim->Instance));
/* Configure the Channel 3 in PWM mode */
TIM_OC3_SetConfig(htim->Instance, sConfig);
@@ -3150,14 +2932,12 @@ HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_Init
/* Set the Preload enable bit for channel3 */
htim->Instance->CCMR2 |= TIM_CCMR2_OC3PE;
- /* Configure the Output Fast mode */
+ /* Configure the Output Fast mode */
htim->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE;
htim->Instance->CCMR2 |= sConfig->OCFastMode;
- }
- break;
+ } break;
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
assert_param(IS_TIM_CC4_INSTANCE(htim->Instance));
/* Configure the Channel 4 in PWM mode */
TIM_OC4_SetConfig(htim->Instance, sConfig);
@@ -3165,14 +2945,13 @@ HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_Init
/* Set the Preload enable bit for channel4 */
htim->Instance->CCMR2 |= TIM_CCMR2_OC4PE;
- /* Configure the Output Fast mode */
+ /* Configure the Output Fast mode */
htim->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE;
htim->Instance->CCMR2 |= sConfig->OCFastMode << 8;
- }
- break;
+ } break;
default:
- break;
+ break;
}
htim->State = HAL_TIM_STATE_READY;
@@ -3183,332 +2962,304 @@ HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_Init
}
/**
- * @brief Initializes the TIM One Pulse Channels according to the specified
- * parameters in the TIM_OnePulse_InitTypeDef.
- * @param htim : TIM One Pulse handle
- * @param sConfig : TIM One Pulse configuration structure
- * @param OutputChannel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @param InputChannel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1 selected
- * @arg TIM_CHANNEL_2: TIM Channel 2 selected
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef* sConfig, uint32_t OutputChannel, uint32_t InputChannel)
-{
+ * @brief Initializes the TIM One Pulse Channels according to the specified
+ * parameters in the TIM_OnePulse_InitTypeDef.
+ * @param htim : TIM One Pulse handle
+ * @param sConfig : TIM One Pulse configuration structure
+ * @param OutputChannel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @param InputChannel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2: TIM Channel 2 selected
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(
+ TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig,
+ uint32_t OutputChannel, uint32_t InputChannel) {
TIM_OC_InitTypeDef temp1;
/* Check the parameters */
assert_param(IS_TIM_OPM_CHANNELS(OutputChannel));
assert_param(IS_TIM_OPM_CHANNELS(InputChannel));
- if(OutputChannel != InputChannel)
- {
- __HAL_LOCK(htim);
+ if (OutputChannel != InputChannel) {
+ __HAL_LOCK(htim);
- htim->State = HAL_TIM_STATE_BUSY;
+ htim->State = HAL_TIM_STATE_BUSY;
- /* Extract the Ouput compare configuration from sConfig structure */
- temp1.OCMode = sConfig->OCMode;
- temp1.Pulse = sConfig->Pulse;
- temp1.OCPolarity = sConfig->OCPolarity;
- temp1.OCNPolarity = sConfig->OCNPolarity;
- temp1.OCIdleState = sConfig->OCIdleState;
- temp1.OCNIdleState = sConfig->OCNIdleState;
+ /* Extract the Ouput compare configuration from sConfig structure */
+ temp1.OCMode = sConfig->OCMode;
+ temp1.Pulse = sConfig->Pulse;
+ temp1.OCPolarity = sConfig->OCPolarity;
+ temp1.OCNPolarity = sConfig->OCNPolarity;
+ temp1.OCIdleState = sConfig->OCIdleState;
+ temp1.OCNIdleState = sConfig->OCNIdleState;
- switch (OutputChannel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (OutputChannel) {
+ case TIM_CHANNEL_1: {
assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
- TIM_OC1_SetConfig(htim->Instance, &temp1);
- }
- break;
- case TIM_CHANNEL_2:
- {
+ TIM_OC1_SetConfig(htim->Instance, &temp1);
+ } break;
+ case TIM_CHANNEL_2: {
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- TIM_OC2_SetConfig(htim->Instance, &temp1);
+ TIM_OC2_SetConfig(htim->Instance, &temp1);
+ } break;
+ default:
+ break;
}
- break;
- default:
- break;
- }
- switch (InputChannel)
- {
- case TIM_CHANNEL_1:
- {
- assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
+ switch (InputChannel) {
+ case TIM_CHANNEL_1: {
+ assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
- TIM_TI1_SetConfig(htim->Instance, sConfig->ICPolarity,
- sConfig->ICSelection, sConfig->ICFilter);
+ TIM_TI1_SetConfig(htim->Instance, sConfig->ICPolarity,
+ sConfig->ICSelection, sConfig->ICFilter);
- /* Reset the IC1PSC Bits */
- htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
+ /* Reset the IC1PSC Bits */
+ htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
- /* Select the Trigger source */
+ /* Select the Trigger source */
htim->Instance->SMCR &= ~TIM_SMCR_TS;
- htim->Instance->SMCR |= TIM_TS_TI1FP1;
+ htim->Instance->SMCR |= TIM_TS_TI1FP1;
- /* Select the Slave Mode */
+ /* Select the Slave Mode */
htim->Instance->SMCR &= ~TIM_SMCR_SMS;
- htim->Instance->SMCR |= TIM_SLAVEMODE_TRIGGER;
- }
- break;
- case TIM_CHANNEL_2:
- {
- assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
+ htim->Instance->SMCR |= TIM_SLAVEMODE_TRIGGER;
+ } break;
+ case TIM_CHANNEL_2: {
+ assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- TIM_TI2_SetConfig(htim->Instance, sConfig->ICPolarity,
- sConfig->ICSelection, sConfig->ICFilter);
+ TIM_TI2_SetConfig(htim->Instance, sConfig->ICPolarity,
+ sConfig->ICSelection, sConfig->ICFilter);
- /* Reset the IC2PSC Bits */
+ /* Reset the IC2PSC Bits */
htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC;
- /* Select the Trigger source */
+ /* Select the Trigger source */
htim->Instance->SMCR &= ~TIM_SMCR_TS;
- htim->Instance->SMCR |= TIM_TS_TI2FP2;
+ htim->Instance->SMCR |= TIM_TS_TI2FP2;
- /* Select the Slave Mode */
+ /* Select the Slave Mode */
htim->Instance->SMCR &= ~TIM_SMCR_SMS;
- htim->Instance->SMCR |= TIM_SLAVEMODE_TRIGGER;
+ htim->Instance->SMCR |= TIM_SLAVEMODE_TRIGGER;
+ } break;
+
+ default:
+ break;
}
- break;
- default:
- break;
- }
+ htim->State = HAL_TIM_STATE_READY;
- htim->State = HAL_TIM_STATE_READY;
+ __HAL_UNLOCK(htim);
- __HAL_UNLOCK(htim);
-
- return HAL_OK;
-}
- else
- {
+ return HAL_OK;
+ } else {
return HAL_ERROR;
}
}
/**
- * @brief Configure the DMA Burst to transfer Data from the memory to the TIM peripheral
- * @param htim : TIM handle
- * @param BurstBaseAddress : TIM Base address from where the DMA will start the Data write
- * This parameter can be one of the following values:
- * @arg TIM_DMABASE_CR1
- * @arg TIM_DMABASE_CR2
- * @arg TIM_DMABASE_SMCR
- * @arg TIM_DMABASE_DIER
- * @arg TIM_DMABASE_SR
- * @arg TIM_DMABASE_EGR
- * @arg TIM_DMABASE_CCMR1
- * @arg TIM_DMABASE_CCMR2
- * @arg TIM_DMABASE_CCER
- * @arg TIM_DMABASE_CNT
- * @arg TIM_DMABASE_PSC
- * @arg TIM_DMABASE_ARR
- * @arg TIM_DMABASE_RCR
- * @arg TIM_DMABASE_CCR1
- * @arg TIM_DMABASE_CCR2
- * @arg TIM_DMABASE_CCR3
- * @arg TIM_DMABASE_CCR4
- * @arg TIM_DMABASE_BDTR
- * @arg TIM_DMABASE_DCR
- * @param BurstRequestSrc : TIM DMA Request sources
- * This parameter can be one of the following values:
- * @arg TIM_DMA_UPDATE: TIM update Interrupt source
- * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source
- * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source
- * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source
- * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source
- * @arg TIM_DMA_COM: TIM Commutation DMA source
- * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source
- * @param BurstBuffer : The Buffer address.
- * @param BurstLength : DMA Burst length. This parameter can be one value
- * between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc,
- uint32_t* BurstBuffer, uint32_t BurstLength)
-{
+ * @brief Configure the DMA Burst to transfer Data from the memory to the TIM
+ * peripheral
+ * @param htim : TIM handle
+ * @param BurstBaseAddress : TIM Base address from where the DMA will start the
+ * Data write This parameter can be one of the following values:
+ * @arg TIM_DMABASE_CR1
+ * @arg TIM_DMABASE_CR2
+ * @arg TIM_DMABASE_SMCR
+ * @arg TIM_DMABASE_DIER
+ * @arg TIM_DMABASE_SR
+ * @arg TIM_DMABASE_EGR
+ * @arg TIM_DMABASE_CCMR1
+ * @arg TIM_DMABASE_CCMR2
+ * @arg TIM_DMABASE_CCER
+ * @arg TIM_DMABASE_CNT
+ * @arg TIM_DMABASE_PSC
+ * @arg TIM_DMABASE_ARR
+ * @arg TIM_DMABASE_RCR
+ * @arg TIM_DMABASE_CCR1
+ * @arg TIM_DMABASE_CCR2
+ * @arg TIM_DMABASE_CCR3
+ * @arg TIM_DMABASE_CCR4
+ * @arg TIM_DMABASE_BDTR
+ * @arg TIM_DMABASE_DCR
+ * @param BurstRequestSrc : TIM DMA Request sources
+ * This parameter can be one of the following values:
+ * @arg TIM_DMA_UPDATE: TIM update Interrupt source
+ * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source
+ * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source
+ * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source
+ * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source
+ * @arg TIM_DMA_COM: TIM Commutation DMA source
+ * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source
+ * @param BurstBuffer : The Buffer address.
+ * @param BurstLength : DMA Burst length. This parameter can be one value
+ * between: TIM_DMABURSTLENGTH_1TRANSFER and
+ * TIM_DMABURSTLENGTH_18TRANSFERS.
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim,
+ uint32_t BurstBaseAddress,
+ uint32_t BurstRequestSrc,
+ uint32_t *BurstBuffer,
+ uint32_t BurstLength) {
/* Check the parameters */
assert_param(IS_TIM_DMABURST_INSTANCE(htim->Instance));
assert_param(IS_TIM_DMA_BASE(BurstBaseAddress));
assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
assert_param(IS_TIM_DMA_LENGTH(BurstLength));
- if((htim->State == HAL_TIM_STATE_BUSY))
- {
- return HAL_BUSY;
- }
- else if((htim->State == HAL_TIM_STATE_READY))
- {
- if((BurstBuffer == 0U) && (BurstLength > 0U))
- {
+ if ((htim->State == HAL_TIM_STATE_BUSY)) {
+ return HAL_BUSY;
+ } else if ((htim->State == HAL_TIM_STATE_READY)) {
+ if ((BurstBuffer == 0U) && (BurstLength > 0U)) {
return HAL_ERROR;
- }
- else
- {
+ } else {
htim->State = HAL_TIM_STATE_BUSY;
}
}
- switch(BurstRequestSrc)
- {
- case TIM_DMA_UPDATE:
- {
+ switch (BurstRequestSrc) {
+ case TIM_DMA_UPDATE: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
+ htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback =
+ TIM_DMAPeriodElapsedCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_CC1:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)BurstBuffer,
+ (uint32_t)&htim->Instance->DMAR,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_CC1: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt;
+ htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_CC2:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)BurstBuffer,
+ (uint32_t)&htim->Instance->DMAR,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_CC2: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt;
+ htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_CC3:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)BurstBuffer,
+ (uint32_t)&htim->Instance->DMAR,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_CC3: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt;
+ htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_CC4:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)BurstBuffer,
+ (uint32_t)&htim->Instance->DMAR,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_CC4: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt;
+ htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMADelayPulseCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_COM:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)BurstBuffer,
+ (uint32_t)&htim->Instance->DMAR,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_COM: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt;
+ htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback =
+ TIMEx_DMACommutationCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_TRIGGER:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION],
+ (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_TRIGGER: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_TRIGGER]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_TRIGGER]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U);
- }
- break;
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)BurstBuffer,
+ (uint32_t)&htim->Instance->DMAR,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
default:
- break;
+ break;
}
- /* configure the DMA Burst Mode */
- htim->Instance->DCR = BurstBaseAddress | BurstLength;
+ /* configure the DMA Burst Mode */
+ htim->Instance->DCR = BurstBaseAddress | BurstLength;
- /* Enable the TIM DMA Request */
- __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc);
+ /* Enable the TIM DMA Request */
+ __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc);
- htim->State = HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
/* Return function status */
return HAL_OK;
}
/**
- * @brief Stops the TIM DMA Burst mode
- * @param htim : TIM handle
- * @param BurstRequestSrc : TIM DMA Request sources to disable
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
-{
+ * @brief Stops the TIM DMA Burst mode
+ * @param htim : TIM handle
+ * @param BurstRequestSrc : TIM DMA Request sources to disable
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim,
+ uint32_t BurstRequestSrc) {
/* Check the parameters */
assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
/* Abort the DMA transfer (at least disable the DMA channel) */
- switch(BurstRequestSrc)
- {
- case TIM_DMA_UPDATE:
- {
+ switch (BurstRequestSrc) {
+ case TIM_DMA_UPDATE: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_UPDATE]);
- }
- break;
- case TIM_DMA_CC1:
- {
+ } break;
+ case TIM_DMA_CC1: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_CC1]);
- }
- break;
- case TIM_DMA_CC2:
- {
+ } break;
+ case TIM_DMA_CC2: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_CC2]);
- }
- break;
- case TIM_DMA_CC3:
- {
+ } break;
+ case TIM_DMA_CC3: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_CC3]);
- }
- break;
- case TIM_DMA_CC4:
- {
+ } break;
+ case TIM_DMA_CC4: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_CC4]);
- }
- break;
- case TIM_DMA_COM:
- {
+ } break;
+ case TIM_DMA_COM: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_COMMUTATION]);
- }
- break;
- case TIM_DMA_TRIGGER:
- {
+ } break;
+ case TIM_DMA_TRIGGER: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_TRIGGER]);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Disable the TIM Update DMA request */
@@ -3519,155 +3270,154 @@ HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t B
}
/**
- * @brief Configure the DMA Burst to transfer Data from the TIM peripheral to the memory
- * @param htim : TIM handle
- * @param BurstBaseAddress : TIM Base address from where the DMA will starts the Data read
- * This parameter can be one of the following values:
- * @arg TIM_DMABASE_CR1
- * @arg TIM_DMABASE_CR2
- * @arg TIM_DMABASE_SMCR
- * @arg TIM_DMABASE_DIER
- * @arg TIM_DMABASE_SR
- * @arg TIM_DMABASE_EGR
- * @arg TIM_DMABASE_CCMR1
- * @arg TIM_DMABASE_CCMR2
- * @arg TIM_DMABASE_CCER
- * @arg TIM_DMABASE_CNT
- * @arg TIM_DMABASE_PSC
- * @arg TIM_DMABASE_ARR
- * @arg TIM_DMABASE_RCR
- * @arg TIM_DMABASE_CCR1
- * @arg TIM_DMABASE_CCR2
- * @arg TIM_DMABASE_CCR3
- * @arg TIM_DMABASE_CCR4
- * @arg TIM_DMABASE_BDTR
- * @arg TIM_DMABASE_DCR
- * @param BurstRequestSrc : TIM DMA Request sources
- * This parameter can be one of the following values:
- * @arg TIM_DMA_UPDATE: TIM update Interrupt source
- * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source
- * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source
- * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source
- * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source
- * @arg TIM_DMA_COM: TIM Commutation DMA source
- * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source
- * @param BurstBuffer : The Buffer address.
- * @param BurstLength : DMA Burst length. This parameter can be one value
- * between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc,
- uint32_t *BurstBuffer, uint32_t BurstLength)
-{
+ * @brief Configure the DMA Burst to transfer Data from the TIM peripheral to
+ * the memory
+ * @param htim : TIM handle
+ * @param BurstBaseAddress : TIM Base address from where the DMA will starts
+ * the Data read This parameter can be one of the following values:
+ * @arg TIM_DMABASE_CR1
+ * @arg TIM_DMABASE_CR2
+ * @arg TIM_DMABASE_SMCR
+ * @arg TIM_DMABASE_DIER
+ * @arg TIM_DMABASE_SR
+ * @arg TIM_DMABASE_EGR
+ * @arg TIM_DMABASE_CCMR1
+ * @arg TIM_DMABASE_CCMR2
+ * @arg TIM_DMABASE_CCER
+ * @arg TIM_DMABASE_CNT
+ * @arg TIM_DMABASE_PSC
+ * @arg TIM_DMABASE_ARR
+ * @arg TIM_DMABASE_RCR
+ * @arg TIM_DMABASE_CCR1
+ * @arg TIM_DMABASE_CCR2
+ * @arg TIM_DMABASE_CCR3
+ * @arg TIM_DMABASE_CCR4
+ * @arg TIM_DMABASE_BDTR
+ * @arg TIM_DMABASE_DCR
+ * @param BurstRequestSrc : TIM DMA Request sources
+ * This parameter can be one of the following values:
+ * @arg TIM_DMA_UPDATE: TIM update Interrupt source
+ * @arg TIM_DMA_CC1: TIM Capture Compare 1 DMA source
+ * @arg TIM_DMA_CC2: TIM Capture Compare 2 DMA source
+ * @arg TIM_DMA_CC3: TIM Capture Compare 3 DMA source
+ * @arg TIM_DMA_CC4: TIM Capture Compare 4 DMA source
+ * @arg TIM_DMA_COM: TIM Commutation DMA source
+ * @arg TIM_DMA_TRIGGER: TIM Trigger DMA source
+ * @param BurstBuffer : The Buffer address.
+ * @param BurstLength : DMA Burst length. This parameter can be one value
+ * between: TIM_DMABURSTLENGTH_1TRANSFER and
+ * TIM_DMABURSTLENGTH_18TRANSFERS.
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim,
+ uint32_t BurstBaseAddress,
+ uint32_t BurstRequestSrc,
+ uint32_t *BurstBuffer,
+ uint32_t BurstLength) {
/* Check the parameters */
assert_param(IS_TIM_DMABURST_INSTANCE(htim->Instance));
assert_param(IS_TIM_DMA_BASE(BurstBaseAddress));
assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
assert_param(IS_TIM_DMA_LENGTH(BurstLength));
- if((htim->State == HAL_TIM_STATE_BUSY))
- {
- return HAL_BUSY;
- }
- else if((htim->State == HAL_TIM_STATE_READY))
- {
- if((BurstBuffer == 0U) && (BurstLength > 0U))
- {
+ if ((htim->State == HAL_TIM_STATE_BUSY)) {
+ return HAL_BUSY;
+ } else if ((htim->State == HAL_TIM_STATE_READY)) {
+ if ((BurstBuffer == 0U) && (BurstLength > 0U)) {
return HAL_ERROR;
- }
- else
- {
+ } else {
htim->State = HAL_TIM_STATE_BUSY;
}
}
- switch(BurstRequestSrc)
- {
- case TIM_DMA_UPDATE:
- {
+ switch (BurstRequestSrc) {
+ case TIM_DMA_UPDATE: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
+ htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback =
+ TIM_DMAPeriodElapsedCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_UPDATE]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_CC1:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE],
+ (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_CC1: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt;
+ htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_CC2:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1],
+ (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_CC2: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt;
+ htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_CC3:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2],
+ (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_CC3: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMACaptureCplt;
+ htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_CC4:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3],
+ (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_CC4: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMACaptureCplt;
+ htim->hdma[TIM_DMA_ID_CC4]->XferCpltCallback = TIM_DMACaptureCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_CC4]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_COM:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4],
+ (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_COM: {
/* Set the DMA Period elapsed callback */
- htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt;
+ htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback =
+ TIMEx_DMACommutationCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U);
- }
- break;
- case TIM_DMA_TRIGGER:
- {
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION],
+ (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
+ case TIM_DMA_TRIGGER: {
/* Set the DMA Period elapsed callback */
htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt;
/* Set the DMA error callback */
- htim->hdma[TIM_DMA_ID_TRIGGER]->XferErrorCallback = TIM_DMAError ;
+ htim->hdma[TIM_DMA_ID_TRIGGER]->XferErrorCallback = TIM_DMAError;
/* Enable the DMA channel */
- HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U);
- }
- break;
+ HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER],
+ (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
+ ((BurstLength) >> 8U) + 1U);
+ } break;
default:
- break;
+ break;
}
/* configure the DMA Burst Mode */
@@ -3683,56 +3433,41 @@ HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t B
}
/**
- * @brief Stop the DMA burst reading
- * @param htim : TIM handle
- * @param BurstRequestSrc : TIM DMA Request sources to disable.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
-{
+ * @brief Stop the DMA burst reading
+ * @param htim : TIM handle
+ * @param BurstRequestSrc : TIM DMA Request sources to disable.
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim,
+ uint32_t BurstRequestSrc) {
/* Check the parameters */
assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
/* Abort the DMA transfer (at least disable the DMA channel) */
- switch(BurstRequestSrc)
- {
- case TIM_DMA_UPDATE:
- {
+ switch (BurstRequestSrc) {
+ case TIM_DMA_UPDATE: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_UPDATE]);
- }
- break;
- case TIM_DMA_CC1:
- {
+ } break;
+ case TIM_DMA_CC1: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_CC1]);
- }
- break;
- case TIM_DMA_CC2:
- {
+ } break;
+ case TIM_DMA_CC2: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_CC2]);
- }
- break;
- case TIM_DMA_CC3:
- {
+ } break;
+ case TIM_DMA_CC3: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_CC3]);
- }
- break;
- case TIM_DMA_CC4:
- {
+ } break;
+ case TIM_DMA_CC4: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_CC4]);
- }
- break;
- case TIM_DMA_COM:
- {
+ } break;
+ case TIM_DMA_COM: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_COMMUTATION]);
- }
- break;
- case TIM_DMA_TRIGGER:
- {
+ } break;
+ case TIM_DMA_TRIGGER: {
HAL_DMA_Abort(htim->hdma[TIM_DMA_ID_TRIGGER]);
- }
- break;
+ } break;
default:
- break;
+ break;
}
/* Disable the TIM Update DMA request */
@@ -3743,25 +3478,26 @@ HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t Bu
}
/**
- * @brief Generate a software event
- * @param htim : TIM handle
- * @param EventSource : specifies the event source.
- * This parameter can be one of the following values:
- * @arg TIM_EVENTSOURCE_UPDATE: Timer update Event source
- * @arg TIM_EVENTSOURCE_CC1: Timer Capture Compare 1 Event source
- * @arg TIM_EVENTSOURCE_CC2: Timer Capture Compare 2 Event source
- * @arg TIM_EVENTSOURCE_CC3: Timer Capture Compare 3 Event source
- * @arg TIM_EVENTSOURCE_CC4: Timer Capture Compare 4 Event source
- * @arg TIM_EVENTSOURCE_COM: Timer COM event source
- * @arg TIM_EVENTSOURCE_TRIGGER: Timer Trigger Event source
- * @arg TIM_EVENTSOURCE_BREAK: Timer Break event source
- * @note TIM6 and TIM7 can only generate an update event.
- * @note TIM_EVENTSOURCE_COM and TIM_EVENTSOURCE_BREAK are used only with TIM1, TIM15, TIM16 and TIM17.
- * @retval HAL status
- */
+ * @brief Generate a software event
+ * @param htim : TIM handle
+ * @param EventSource : specifies the event source.
+ * This parameter can be one of the following values:
+ * @arg TIM_EVENTSOURCE_UPDATE: Timer update Event source
+ * @arg TIM_EVENTSOURCE_CC1: Timer Capture Compare 1 Event source
+ * @arg TIM_EVENTSOURCE_CC2: Timer Capture Compare 2 Event source
+ * @arg TIM_EVENTSOURCE_CC3: Timer Capture Compare 3 Event source
+ * @arg TIM_EVENTSOURCE_CC4: Timer Capture Compare 4 Event source
+ * @arg TIM_EVENTSOURCE_COM: Timer COM event source
+ * @arg TIM_EVENTSOURCE_TRIGGER: Timer Trigger Event source
+ * @arg TIM_EVENTSOURCE_BREAK: Timer Break event source
+ * @note TIM6 and TIM7 can only generate an update event.
+ * @note TIM_EVENTSOURCE_COM and TIM_EVENTSOURCE_BREAK are used only with TIM1,
+ * TIM15, TIM16 and TIM17.
+ * @retval HAL status
+ */
-HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource)
-{
+HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim,
+ uint32_t EventSource) {
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(htim->Instance));
assert_param(IS_TIM_EVENT_SOURCE(EventSource));
@@ -3785,27 +3521,31 @@ HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventS
}
/**
- * @brief Configures the OCRef clear feature
- * @param htim : TIM handle
- * @param sClearInputConfig : pointer to a TIM_ClearInputConfigTypeDef structure that
- * contains the OCREF clear feature and parameters for the TIM peripheral.
- * @param Channel : specifies the TIM Channel
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1
- * @arg TIM_CHANNEL_2: TIM Channel 2
- * @arg TIM_CHANNEL_3: TIM Channel 3
- * @arg TIM_CHANNEL_4: TIM Channel 4
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, TIM_ClearInputConfigTypeDef * sClearInputConfig, uint32_t Channel)
-{
+ * @brief Configures the OCRef clear feature
+ * @param htim : TIM handle
+ * @param sClearInputConfig : pointer to a TIM_ClearInputConfigTypeDef
+ * structure that contains the OCREF clear feature and parameters for the TIM
+ * peripheral.
+ * @param Channel : specifies the TIM Channel
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1
+ * @arg TIM_CHANNEL_2: TIM Channel 2
+ * @arg TIM_CHANNEL_3: TIM Channel 3
+ * @arg TIM_CHANNEL_4: TIM Channel 4
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(
+ TIM_HandleTypeDef *htim, TIM_ClearInputConfigTypeDef *sClearInputConfig,
+ uint32_t Channel) {
uint32_t tmpsmcr = 0U;
/* Check the parameters */
assert_param(IS_TIM_OCXREF_CLEAR_INSTANCE(htim->Instance));
assert_param(IS_TIM_CLEARINPUT_SOURCE(sClearInputConfig->ClearInputSource));
- assert_param(IS_TIM_CLEARINPUT_POLARITY(sClearInputConfig->ClearInputPolarity));
- assert_param(IS_TIM_CLEARINPUT_PRESCALER(sClearInputConfig->ClearInputPrescaler));
+ assert_param(
+ IS_TIM_CLEARINPUT_POLARITY(sClearInputConfig->ClearInputPolarity));
+ assert_param(
+ IS_TIM_CLEARINPUT_PRESCALER(sClearInputConfig->ClearInputPrescaler));
assert_param(IS_TIM_CLEARINPUT_FILTER(sClearInputConfig->ClearInputFilter));
/* Process Locked */
@@ -3813,95 +3553,67 @@ HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, TIM_ClearInp
htim->State = HAL_TIM_STATE_BUSY;
- switch (sClearInputConfig->ClearInputSource)
- {
- case TIM_CLEARINPUTSOURCE_NONE:
- {
-
+ switch (sClearInputConfig->ClearInputSource) {
+ case TIM_CLEARINPUTSOURCE_NONE: {
/* Clear the ETR Bits */
tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP);
/* Set TIMx_SMCR */
htim->Instance->SMCR = tmpsmcr;
- }
- break;
+ } break;
- case TIM_CLEARINPUTSOURCE_ETR:
- {
- TIM_ETR_SetConfig(htim->Instance,
- sClearInputConfig->ClearInputPrescaler,
+ case TIM_CLEARINPUTSOURCE_ETR: {
+ TIM_ETR_SetConfig(htim->Instance, sClearInputConfig->ClearInputPrescaler,
sClearInputConfig->ClearInputPolarity,
sClearInputConfig->ClearInputFilter);
- }
- break;
+ } break;
default:
- break;
+ break;
}
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
- if(sClearInputConfig->ClearInputState != RESET)
- {
- /* Enable the Ocref clear feature for Channel 1 */
- htim->Instance->CCMR1 |= TIM_CCMR1_OC1CE;
- }
- else
- {
- /* Disable the Ocref clear feature for Channel 1 */
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
+ if (sClearInputConfig->ClearInputState != RESET) {
+ /* Enable the Ocref clear feature for Channel 1 */
+ htim->Instance->CCMR1 |= TIM_CCMR1_OC1CE;
+ } else {
+ /* Disable the Ocref clear feature for Channel 1 */
htim->Instance->CCMR1 &= ~TIM_CCMR1_OC1CE;
- }
}
- break;
- case TIM_CHANNEL_2:
- {
- assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- if(sClearInputConfig->ClearInputState != RESET)
- {
- /* Enable the Ocref clear feature for Channel 2 */
- htim->Instance->CCMR1 |= TIM_CCMR1_OC2CE;
- }
- else
- {
- /* Disable the Ocref clear feature for Channel 2 */
- htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2CE;
- }
+ } break;
+ case TIM_CHANNEL_2: {
+ assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
+ if (sClearInputConfig->ClearInputState != RESET) {
+ /* Enable the Ocref clear feature for Channel 2 */
+ htim->Instance->CCMR1 |= TIM_CCMR1_OC2CE;
+ } else {
+ /* Disable the Ocref clear feature for Channel 2 */
+ htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2CE;
}
- break;
- case TIM_CHANNEL_3:
- {
- assert_param(IS_TIM_CC3_INSTANCE(htim->Instance));
- if(sClearInputConfig->ClearInputState != RESET)
- {
- /* Enable the Ocref clear feature for Channel 3 */
- htim->Instance->CCMR2 |= TIM_CCMR2_OC3CE;
- }
- else
- {
- /* Disable the Ocref clear feature for Channel 3 */
+ } break;
+ case TIM_CHANNEL_3: {
+ assert_param(IS_TIM_CC3_INSTANCE(htim->Instance));
+ if (sClearInputConfig->ClearInputState != RESET) {
+ /* Enable the Ocref clear feature for Channel 3 */
+ htim->Instance->CCMR2 |= TIM_CCMR2_OC3CE;
+ } else {
+ /* Disable the Ocref clear feature for Channel 3 */
htim->Instance->CCMR2 &= ~TIM_CCMR2_OC3CE;
- }
}
- break;
- case TIM_CHANNEL_4:
- {
- assert_param(IS_TIM_CC4_INSTANCE(htim->Instance));
- if(sClearInputConfig->ClearInputState != RESET)
- {
- /* Enable the Ocref clear feature for Channel 4 */
- htim->Instance->CCMR2 |= TIM_CCMR2_OC4CE;
- }
- else
- {
- /* Disable the Ocref clear feature for Channel 4 */
+ } break;
+ case TIM_CHANNEL_4: {
+ assert_param(IS_TIM_CC4_INSTANCE(htim->Instance));
+ if (sClearInputConfig->ClearInputState != RESET) {
+ /* Enable the Ocref clear feature for Channel 4 */
+ htim->Instance->CCMR2 |= TIM_CCMR2_OC4CE;
+ } else {
+ /* Disable the Ocref clear feature for Channel 4 */
htim->Instance->CCMR2 &= ~TIM_CCMR2_OC4CE;
- }
}
- break;
+ } break;
default:
- break;
+ break;
}
htim->State = HAL_TIM_STATE_READY;
@@ -3912,14 +3624,14 @@ HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, TIM_ClearInp
}
/**
- * @brief Configures the clock source to be used
- * @param htim : TIM handle
- * @param sClockSourceConfig : pointer to a TIM_ClockConfigTypeDef structure that
- * contains the clock source information for the TIM peripheral.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef * sClockSourceConfig)
-{
+ * @brief Configures the clock source to be used
+ * @param htim : TIM handle
+ * @param sClockSourceConfig : pointer to a TIM_ClockConfigTypeDef structure
+ * that contains the clock source information for the TIM peripheral.
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_ConfigClockSource(
+ TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef *sClockSourceConfig) {
uint32_t tmpsmcr = 0U;
/* Process Locked */
@@ -3936,29 +3648,26 @@ HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockCo
tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP);
htim->Instance->SMCR = tmpsmcr;
- switch (sClockSourceConfig->ClockSource)
- {
- case TIM_CLOCKSOURCE_INTERNAL:
- {
+ switch (sClockSourceConfig->ClockSource) {
+ case TIM_CLOCKSOURCE_INTERNAL: {
assert_param(IS_TIM_INSTANCE(htim->Instance));
- /* Disable slave mode to clock the prescaler directly with the internal clock */
+ /* Disable slave mode to clock the prescaler directly with the internal
+ * clock */
htim->Instance->SMCR &= ~TIM_SMCR_SMS;
- }
- break;
+ } break;
- case TIM_CLOCKSOURCE_ETRMODE1:
- {
- /* Check whether or not the timer instance supports external trigger input mode 1 (ETRF)*/
+ case TIM_CLOCKSOURCE_ETRMODE1: {
+ /* Check whether or not the timer instance supports external trigger input
+ * mode 1 (ETRF)*/
assert_param(IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(htim->Instance));
/* Check ETR input conditioning related parameters */
assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler));
assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
-
+
/* Configure the ETR Clock source */
- TIM_ETR_SetConfig(htim->Instance,
- sClockSourceConfig->ClockPrescaler,
+ TIM_ETR_SetConfig(htim->Instance, sClockSourceConfig->ClockPrescaler,
sClockSourceConfig->ClockPolarity,
sClockSourceConfig->ClockFilter);
/* Get the TIMx SMCR register value */
@@ -3969,50 +3678,46 @@ HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockCo
tmpsmcr |= (TIM_SLAVEMODE_EXTERNAL1 | TIM_CLOCKSOURCE_ETRMODE1);
/* Write to TIMx SMCR */
htim->Instance->SMCR = tmpsmcr;
- }
- break;
+ } break;
- case TIM_CLOCKSOURCE_ETRMODE2:
- {
- /* Check whether or not the timer instance supports external trigger input mode 2 (ETRF)*/
+ case TIM_CLOCKSOURCE_ETRMODE2: {
+ /* Check whether or not the timer instance supports external trigger input
+ * mode 2 (ETRF)*/
assert_param(IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(htim->Instance));
/* Check ETR input conditioning related parameters */
assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler));
assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
-
+
/* Configure the ETR Clock source */
- TIM_ETR_SetConfig(htim->Instance,
- sClockSourceConfig->ClockPrescaler,
+ TIM_ETR_SetConfig(htim->Instance, sClockSourceConfig->ClockPrescaler,
sClockSourceConfig->ClockPolarity,
sClockSourceConfig->ClockFilter);
/* Enable the External clock mode2 */
htim->Instance->SMCR |= TIM_SMCR_ECE;
- }
- break;
+ } break;
- case TIM_CLOCKSOURCE_TI1:
- {
- /* Check whether or not the timer instance supports external clock mode 1 */
+ case TIM_CLOCKSOURCE_TI1: {
+ /* Check whether or not the timer instance supports external clock mode 1
+ */
assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance));
/* Check TI1 input conditioning related parameters */
assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
-
+
TIM_TI1_ConfigInputStage(htim->Instance,
sClockSourceConfig->ClockPolarity,
sClockSourceConfig->ClockFilter);
TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1);
- }
- break;
- case TIM_CLOCKSOURCE_TI2:
- {
- /* Check whether or not the timer instance supports external clock mode 1 (ETRF)*/
+ } break;
+ case TIM_CLOCKSOURCE_TI2: {
+ /* Check whether or not the timer instance supports external clock mode 1
+ * (ETRF)*/
assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance));
- /* Check TI2 input conditioning related parameters */
+ /* Check TI2 input conditioning related parameters */
assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
@@ -4020,11 +3725,10 @@ HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockCo
sClockSourceConfig->ClockPolarity,
sClockSourceConfig->ClockFilter);
TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI2);
- }
- break;
- case TIM_CLOCKSOURCE_TI1ED:
- {
- /* Check whether or not the timer instance supports external clock mode 1 */
+ } break;
+ case TIM_CLOCKSOURCE_TI1ED: {
+ /* Check whether or not the timer instance supports external clock mode 1
+ */
assert_param(IS_TIM_CLOCKSOURCE_TIX_INSTANCE(htim->Instance));
/* Check TI1 input conditioning related parameters */
@@ -4035,43 +3739,38 @@ HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockCo
sClockSourceConfig->ClockPolarity,
sClockSourceConfig->ClockFilter);
TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1ED);
- }
- break;
- case TIM_CLOCKSOURCE_ITR0:
- {
- /* Check whether or not the timer instance supports external clock mode 1 */
+ } break;
+ case TIM_CLOCKSOURCE_ITR0: {
+ /* Check whether or not the timer instance supports external clock mode 1
+ */
assert_param(IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(htim->Instance));
TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_ITR0);
- }
- break;
- case TIM_CLOCKSOURCE_ITR1:
- {
- /* Check whether or not the timer instance supports external clock mode 1 */
+ } break;
+ case TIM_CLOCKSOURCE_ITR1: {
+ /* Check whether or not the timer instance supports external clock mode 1
+ */
assert_param(IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(htim->Instance));
TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_ITR1);
- }
- break;
- case TIM_CLOCKSOURCE_ITR2:
- {
- /* Check whether or not the timer instance supports external clock mode 1 */
+ } break;
+ case TIM_CLOCKSOURCE_ITR2: {
+ /* Check whether or not the timer instance supports external clock mode 1
+ */
assert_param(IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(htim->Instance));
TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_ITR2);
- }
- break;
- case TIM_CLOCKSOURCE_ITR3:
- {
- /* Check whether or not the timer instance supports external clock mode 1 */
+ } break;
+ case TIM_CLOCKSOURCE_ITR3: {
+ /* Check whether or not the timer instance supports external clock mode 1
+ */
assert_param(IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(htim->Instance));
TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_ITR3);
- }
- break;
+ } break;
- default:
- break;
+ default:
+ break;
}
htim->State = HAL_TIM_STATE_READY;
@@ -4081,19 +3780,20 @@ HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockCo
}
/**
- * @brief Selects the signal connected to the TI1 input: direct from CH1_input
- * or a XOR combination between CH1_input, CH2_input & CH3_input
- * @param htim : TIM handle.
- * @param TI1_Selection : Indicate whether or not channel 1 is connected to the
- * output of a XOR gate.
- * This parameter can be one of the following values:
- * @arg TIM_TI1SELECTION_CH1: The TIMx_CH1 pin is connected to TI1 input
- * @arg TIM_TI1SELECTION_XORCOMBINATION: The TIMx_CH1, CH2 and CH3
- * pins are connected to the TI1 input (XOR combination)
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection)
-{
+ * @brief Selects the signal connected to the TI1 input: direct from CH1_input
+ * or a XOR combination between CH1_input, CH2_input & CH3_input
+ * @param htim : TIM handle.
+ * @param TI1_Selection : Indicate whether or not channel 1 is connected to the
+ * output of a XOR gate.
+ * This parameter can be one of the following values:
+ * @arg TIM_TI1SELECTION_CH1: The TIMx_CH1 pin is connected to TI1
+ * input
+ * @arg TIM_TI1SELECTION_XORCOMBINATION: The TIMx_CH1, CH2 and CH3
+ * pins are connected to the TI1 input (XOR combination)
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim,
+ uint32_t TI1_Selection) {
uint32_t tmpcr2 = 0U;
/* Check the parameters */
@@ -4116,16 +3816,16 @@ HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_S
}
/**
- * @brief Configures the TIM in Slave mode
- * @param htim : TIM handle.
- * @param sSlaveConfig : pointer to a TIM_SlaveConfigTypeDef structure that
- * contains the selected trigger (internal trigger input, filtered
- * timer input or external trigger input) and the ) and the Slave
- * mode (Disable, Reset, Gated, Trigger, External clock mode 1).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchronization(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef * sSlaveConfig)
-{
+ * @brief Configures the TIM in Slave mode
+ * @param htim : TIM handle.
+ * @param sSlaveConfig : pointer to a TIM_SlaveConfigTypeDef structure that
+ * contains the selected trigger (internal trigger input, filtered
+ * timer input or external trigger input) and the ) and the Slave
+ * mode (Disable, Reset, Gated, Trigger, External clock mode 1).
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchronization(
+ TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig) {
/* Check the parameters */
assert_param(IS_TIM_SLAVE_INSTANCE(htim->Instance));
assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode));
@@ -4148,21 +3848,20 @@ HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchronization(TIM_HandleTypeDef *htim, TI
__HAL_UNLOCK(htim);
return HAL_OK;
- }
+}
/**
- * @brief Configures the TIM in Slave mode in interrupt mode
- * @param htim: TIM handle.
- * @param sSlaveConfig: pointer to a TIM_SlaveConfigTypeDef structure that
- * contains the selected trigger (internal trigger input, filtered
- * timer input or external trigger input) and the ) and the Slave
- * mode (Disable, Reset, Gated, Trigger, External clock mode 1).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchronization_IT(TIM_HandleTypeDef *htim,
- TIM_SlaveConfigTypeDef * sSlaveConfig)
- {
- /* Check the parameters */
+ * @brief Configures the TIM in Slave mode in interrupt mode
+ * @param htim: TIM handle.
+ * @param sSlaveConfig: pointer to a TIM_SlaveConfigTypeDef structure that
+ * contains the selected trigger (internal trigger input, filtered
+ * timer input or external trigger input) and the ) and the Slave
+ * mode (Disable, Reset, Gated, Trigger, External clock mode 1).
+ * @retval HAL status
+ */
+HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchronization_IT(
+ TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig) {
+ /* Check the parameters */
assert_param(IS_TIM_SLAVE_INSTANCE(htim->Instance));
assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode));
assert_param(IS_TIM_TRIGGER_SELECTION(sSlaveConfig->InputTrigger));
@@ -4187,69 +3886,63 @@ HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchronization_IT(TIM_HandleTypeDef *htim,
}
/**
- * @brief Read the captured value from Capture Compare unit
- * @param htim : TIM handle.
- * @param Channel : TIM Channels to be enabled
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1 : TIM Channel 1 selected
- * @arg TIM_CHANNEL_2 : TIM Channel 2 selected
- * @arg TIM_CHANNEL_3 : TIM Channel 3 selected
- * @arg TIM_CHANNEL_4 : TIM Channel 4 selected
- * @retval Captured value
- */
-uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel)
-{
+ * @brief Read the captured value from Capture Compare unit
+ * @param htim : TIM handle.
+ * @param Channel : TIM Channels to be enabled
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1 : TIM Channel 1 selected
+ * @arg TIM_CHANNEL_2 : TIM Channel 2 selected
+ * @arg TIM_CHANNEL_3 : TIM Channel 3 selected
+ * @arg TIM_CHANNEL_4 : TIM Channel 4 selected
+ * @retval Captured value
+ */
+uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel) {
uint32_t tmpreg = 0U;
__HAL_LOCK(htim);
- switch (Channel)
- {
- case TIM_CHANNEL_1:
- {
+ switch (Channel) {
+ case TIM_CHANNEL_1: {
/* Check the parameters */
assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
/* Return the capture 1 value */
- tmpreg = htim->Instance->CCR1;
+ tmpreg = htim->Instance->CCR1;
break;
}
- case TIM_CHANNEL_2:
- {
+ case TIM_CHANNEL_2: {
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
/* Return the capture 2 value */
- tmpreg = htim->Instance->CCR2;
+ tmpreg = htim->Instance->CCR2;
break;
}
- case TIM_CHANNEL_3:
- {
+ case TIM_CHANNEL_3: {
/* Check the parameters */
assert_param(IS_TIM_CC3_INSTANCE(htim->Instance));
/* Return the capture 3 value */
- tmpreg = htim->Instance->CCR3;
+ tmpreg = htim->Instance->CCR3;
break;
}
- case TIM_CHANNEL_4:
- {
+ case TIM_CHANNEL_4: {
/* Check the parameters */
assert_param(IS_TIM_CC4_INSTANCE(htim->Instance));
/* Return the capture 4 value */
- tmpreg = htim->Instance->CCR4;
+ tmpreg = htim->Instance->CCR4;
break;
}
- default:
- break;
+ default:
+ break;
}
__HAL_UNLOCK(htim);
@@ -4257,13 +3950,13 @@ uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel)
}
/**
- * @}
- */
+ * @}
+ */
/** @defgroup TIM_Exported_Functions_Group9 TIM Callbacks functions
- * @brief TIM Callbacks functions
+ * @brief TIM Callbacks functions
*
-@verbatim
+@verbatim
==============================================================================
##### TIM Callbacks functions #####
==============================================================================
@@ -4280,67 +3973,65 @@ uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel)
*/
/**
- * @brief Period elapsed callback in non blocking mode
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
-{
+ * @brief Period elapsed callback in non blocking mode
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
- the __HAL_TIM_PeriodElapsedCallback could be implemented in the user file
- */
-
-}
-/**
- * @brief Output Compare callback in non blocking mode
- * @param htim : TIM OC handle
- * @retval None
- */
-__weak void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(htim);
- /* NOTE : This function Should not be modified, when the callback is needed,
- the __HAL_TIM_OC_DelayElapsedCallback could be implemented in the user file
+ the __HAL_TIM_PeriodElapsedCallback could be implemented in the user
+ file
*/
}
/**
- * @brief Input Capture callback in non blocking mode
- * @param htim : TIM IC handle
- * @retval None
- */
-__weak void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
-{
+ * @brief Output Compare callback in non blocking mode
+ * @param htim : TIM OC handle
+ * @retval None
+ */
+__weak void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
- the __HAL_TIM_IC_CaptureCallback could be implemented in the user file
+ the __HAL_TIM_OC_DelayElapsedCallback could be implemented in the
+ user file
+ */
+}
+/**
+ * @brief Input Capture callback in non blocking mode
+ * @param htim : TIM IC handle
+ * @retval None
+ */
+__weak void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
+ /* Prevent unused argument(s) compilation warning */
+ UNUSED(htim);
+ /* NOTE : This function Should not be modified, when the callback is needed,
+ the __HAL_TIM_IC_CaptureCallback could be implemented in the user
+ file
*/
}
/**
- * @brief PWM Pulse finished callback in non blocking mode
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
-{
+ * @brief PWM Pulse finished callback in non blocking mode
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
- the __HAL_TIM_PWM_PulseFinishedCallback could be implemented in the user file
+ the __HAL_TIM_PWM_PulseFinishedCallback could be implemented in the
+ user file
*/
}
/**
- * @brief Hall Trigger detection callback in non blocking mode
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim)
-{
+ * @brief Hall Trigger detection callback in non blocking mode
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -4349,12 +4040,11 @@ __weak void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim)
}
/**
- * @brief Timer error callback in non blocking mode
- * @param htim : TIM handle
- * @retval None
- */
-__weak void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim)
-{
+ * @brief Timer error callback in non blocking mode
+ * @param htim : TIM handle
+ * @retval None
+ */
+__weak void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim) {
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
@@ -4363,18 +4053,18 @@ __weak void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim)
}
/**
- * @}
- */
+ * @}
+ */
-/** @defgroup TIM_Exported_Functions_Group10 Peripheral State functions
- * @brief Peripheral State functions
+/** @defgroup TIM_Exported_Functions_Group10 Peripheral State functions
+ * @brief Peripheral State functions
*
-@verbatim
+@verbatim
==============================================================================
##### Peripheral State functions #####
==============================================================================
[..]
- This subsection permit to get in run-time the status of the peripheral
+ This subsection permit to get in run-time the status of the peripheral
and the data flow.
@endverbatim
@@ -4382,116 +4072,103 @@ __weak void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim)
*/
/**
- * @brief Return the TIM Base state
- * @param htim : TIM Base handle
- * @retval HAL state
- */
-HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(TIM_HandleTypeDef *htim)
-{
+ * @brief Return the TIM Base state
+ * @param htim : TIM Base handle
+ * @retval HAL state
+ */
+HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(TIM_HandleTypeDef *htim) {
return htim->State;
}
/**
- * @brief Return the TIM OC state
- * @param htim : TIM Ouput Compare handle
- * @retval HAL state
- */
-HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(TIM_HandleTypeDef *htim)
-{
+ * @brief Return the TIM OC state
+ * @param htim : TIM Ouput Compare handle
+ * @retval HAL state
+ */
+HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(TIM_HandleTypeDef *htim) {
return htim->State;
}
/**
- * @brief Return the TIM PWM state
- * @param htim : TIM handle
- * @retval HAL state
- */
-HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(TIM_HandleTypeDef *htim)
-{
+ * @brief Return the TIM PWM state
+ * @param htim : TIM handle
+ * @retval HAL state
+ */
+HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(TIM_HandleTypeDef *htim) {
return htim->State;
}
/**
- * @brief Return the TIM Input Capture state
- * @param htim : TIM IC handle
- * @retval HAL state
- */
-HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(TIM_HandleTypeDef *htim)
-{
+ * @brief Return the TIM Input Capture state
+ * @param htim : TIM IC handle
+ * @retval HAL state
+ */
+HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(TIM_HandleTypeDef *htim) {
return htim->State;
}
/**
- * @brief Return the TIM One Pulse Mode state
- * @param htim : TIM OPM handle
- * @retval HAL state
- */
-HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(TIM_HandleTypeDef *htim)
-{
+ * @brief Return the TIM One Pulse Mode state
+ * @param htim : TIM OPM handle
+ * @retval HAL state
+ */
+HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(TIM_HandleTypeDef *htim) {
return htim->State;
}
/**
- * @brief Return the TIM Encoder Mode state
- * @param htim : TIM Encoder handle
- * @retval HAL state
- */
-HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(TIM_HandleTypeDef *htim)
-{
+ * @brief Return the TIM Encoder Mode state
+ * @param htim : TIM Encoder handle
+ * @retval HAL state
+ */
+HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(TIM_HandleTypeDef *htim) {
return htim->State;
}
/**
- * @}
- */
+ * @}
+ */
/**
- * @}
- */
+ * @}
+ */
/** @addtogroup TIM_Private_Functions
- * @{
- */
+ * @{
+ */
/**
- * @brief TIM DMA error callback
- * @param hdma : pointer to DMA handle.
- * @retval None
- */
-void TIM_DMAError(DMA_HandleTypeDef *hdma)
-{
- TIM_HandleTypeDef* htim = ( TIM_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
+ * @brief TIM DMA error callback
+ * @param hdma : pointer to DMA handle.
+ * @retval None
+ */
+void TIM_DMAError(DMA_HandleTypeDef *hdma) {
+ TIM_HandleTypeDef *htim =
+ (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
HAL_TIM_ErrorCallback(htim);
}
/**
- * @brief TIM DMA Delay Pulse complete callback.
- * @param hdma : pointer to DMA handle.
- * @retval None
- */
-void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma)
-{
- TIM_HandleTypeDef* htim = ( TIM_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
+ * @brief TIM DMA Delay Pulse complete callback.
+ * @param hdma : pointer to DMA handle.
+ * @retval None
+ */
+void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma) {
+ TIM_HandleTypeDef *htim =
+ (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
- if (hdma == htim->hdma[TIM_DMA_ID_CC1])
- {
+ if (hdma == htim->hdma[TIM_DMA_ID_CC1]) {
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1;
- }
- else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
- {
+ } else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) {
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2;
- }
- else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
- {
+ } else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) {
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3;
- }
- else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
- {
+ } else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) {
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4;
}
@@ -4500,30 +4177,23 @@ void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma)
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED;
}
/**
- * @brief TIM DMA Capture complete callback.
- * @param hdma : pointer to DMA handle.
- * @retval None
- */
-void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma)
-{
- TIM_HandleTypeDef* htim = ( TIM_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
+ * @brief TIM DMA Capture complete callback.
+ * @param hdma : pointer to DMA handle.
+ * @retval None
+ */
+void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma) {
+ TIM_HandleTypeDef *htim =
+ (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
- if (hdma == htim->hdma[TIM_DMA_ID_CC1])
- {
+ if (hdma == htim->hdma[TIM_DMA_ID_CC1]) {
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_1;
- }
- else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
- {
+ } else if (hdma == htim->hdma[TIM_DMA_ID_CC2]) {
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_2;
- }
- else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
- {
+ } else if (hdma == htim->hdma[TIM_DMA_ID_CC3]) {
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_3;
- }
- else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
- {
+ } else if (hdma == htim->hdma[TIM_DMA_ID_CC4]) {
htim->Channel = HAL_TIM_ACTIVE_CHANNEL_4;
}
@@ -4533,54 +4203,51 @@ void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma)
}
/**
- * @brief TIM DMA Period Elapse complete callback.
- * @param hdma : pointer to DMA handle.
- * @retval None
- */
-static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma)
-{
- TIM_HandleTypeDef* htim = ( TIM_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
+ * @brief TIM DMA Period Elapse complete callback.
+ * @param hdma : pointer to DMA handle.
+ * @retval None
+ */
+static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma) {
+ TIM_HandleTypeDef *htim =
+ (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
HAL_TIM_PeriodElapsedCallback(htim);
}
/**
- * @brief TIM DMA Trigger callback.
- * @param hdma : pointer to DMA handle.
- * @retval None
- */
-static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma)
-{
- TIM_HandleTypeDef* htim = ( TIM_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
+ * @brief TIM DMA Trigger callback.
+ * @param hdma : pointer to DMA handle.
+ * @retval None
+ */
+static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma) {
+ TIM_HandleTypeDef *htim =
+ (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
- htim->State= HAL_TIM_STATE_READY;
+ htim->State = HAL_TIM_STATE_READY;
HAL_TIM_TriggerCallback(htim);
}
/**
- * @brief Time Base configuration
- * @param TIMx : TIM periheral
- * @param Structure : TIM Base configuration structure
- * @retval None
- */
-void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
-{
+ * @brief Time Base configuration
+ * @param TIMx : TIM periheral
+ * @param Structure : TIM Base configuration structure
+ * @retval None
+ */
+void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure) {
uint32_t tmpcr1 = 0U;
tmpcr1 = TIMx->CR1;
/* Set TIM Time Base Unit parameters ---------------------------------------*/
- if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx))
- {
+ if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx)) {
/* Select the Counter Mode */
tmpcr1 &= ~(TIM_CR1_DIR | TIM_CR1_CMS);
tmpcr1 |= Structure->CounterMode;
}
- if(IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx))
- {
+ if (IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx)) {
/* Set the clock division */
tmpcr1 &= ~TIM_CR1_CKD;
tmpcr1 |= (uint32_t)Structure->ClockDivision;
@@ -4593,41 +4260,40 @@ void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
TIMx->CR1 = tmpcr1;
/* Set the Autoreload value */
- TIMx->ARR = (uint32_t)Structure->Period ;
+ TIMx->ARR = (uint32_t)Structure->Period;
/* Set the Prescaler value */
TIMx->PSC = (uint32_t)Structure->Prescaler;
- if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx))
- {
+ if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx)) {
/* Set the Repetition Counter value */
TIMx->RCR = Structure->RepetitionCounter;
}
- /* Generate an update event to reload the Prescaler
+ /* Generate an update event to reload the Prescaler
and the repetition counter(only for TIM1 and TIM8) value immediatly */
TIMx->EGR = TIM_EGR_UG;
}
/**
- * @brief Time Ouput Compare 1 configuration
- * @param TIMx to select the TIM peripheral
- * @param OC_Config : The ouput configuration structure
- * @retval None
- */
-static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
-{
+ * @brief Time Ouput Compare 1 configuration
+ * @param TIMx to select the TIM peripheral
+ * @param OC_Config : The ouput configuration structure
+ * @retval None
+ */
+static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx,
+ TIM_OC_InitTypeDef *OC_Config) {
uint32_t tmpccmrx = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpcr2 = 0U;
- /* Disable the Channel 1: Reset the CC1E Bit */
+ /* Disable the Channel 1: Reset the CC1E Bit */
TIMx->CCER &= ~TIM_CCER_CC1E;
/* Get the TIMx CCER register value */
tmpccer = TIMx->CCER;
/* Get the TIMx CR2 register value */
- tmpcr2 = TIMx->CR2;
+ tmpcr2 = TIMx->CR2;
/* Get the TIMx CCMR1 register value */
tmpccmrx = TIMx->CCMR1;
@@ -4643,8 +4309,7 @@ static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
/* Set the Output Compare Polarity */
tmpccer |= OC_Config->OCPolarity;
- if(IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_1))
- {
+ if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_1)) {
/* Check parameters */
assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity));
@@ -4656,8 +4321,7 @@ static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
tmpccer &= ~TIM_CCER_CC1NE;
}
- if(IS_TIM_BREAK_INSTANCE(TIMx))
- {
+ if (IS_TIM_BREAK_INSTANCE(TIMx)) {
/* Check parameters */
assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState));
assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState));
@@ -4684,13 +4348,12 @@ static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
}
/**
- * @brief Time Ouput Compare 2 configuration
- * @param TIMx to select the TIM peripheral
- * @param OC_Config : The ouput configuration structure
- * @retval None
- */
-void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
-{
+ * @brief Time Ouput Compare 2 configuration
+ * @param TIMx to select the TIM peripheral
+ * @param OC_Config : The ouput configuration structure
+ * @retval None
+ */
+void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config) {
uint32_t tmpccmrx = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpcr2 = 0U;
@@ -4701,7 +4364,7 @@ void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
/* Get the TIMx CCER register value */
tmpccer = TIMx->CCER;
/* Get the TIMx CR2 register value */
- tmpcr2 = TIMx->CR2;
+ tmpcr2 = TIMx->CR2;
/* Get the TIMx CCMR1 register value */
tmpccmrx = TIMx->CCMR1;
@@ -4718,8 +4381,7 @@ void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
/* Set the Output Compare Polarity */
tmpccer |= (OC_Config->OCPolarity << 4U);
- if(IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_2))
- {
+ if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_2)) {
assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity));
/* Reset the Output N Polarity level */
@@ -4728,11 +4390,9 @@ void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
tmpccer |= (OC_Config->OCNPolarity << 4U);
/* Reset the Output N State */
tmpccer &= ~TIM_CCER_CC2NE;
-
}
- if(IS_TIM_BREAK_INSTANCE(TIMx))
- {
+ if (IS_TIM_BREAK_INSTANCE(TIMx)) {
/* Check parameters */
assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState));
assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState));
@@ -4760,13 +4420,13 @@ void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
}
/**
- * @brief Time Ouput Compare 3 configuration
- * @param TIMx to select the TIM peripheral
- * @param OC_Config : The ouput configuration structure
- * @retval None
- */
-static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
-{
+ * @brief Time Ouput Compare 3 configuration
+ * @param TIMx to select the TIM peripheral
+ * @param OC_Config : The ouput configuration structure
+ * @retval None
+ */
+static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx,
+ TIM_OC_InitTypeDef *OC_Config) {
uint32_t tmpccmrx = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpcr2 = 0U;
@@ -4777,7 +4437,7 @@ static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
/* Get the TIMx CCER register value */
tmpccer = TIMx->CCER;
/* Get the TIMx CR2 register value */
- tmpcr2 = TIMx->CR2;
+ tmpcr2 = TIMx->CR2;
/* Get the TIMx CCMR2 register value */
tmpccmrx = TIMx->CCMR2;
@@ -4793,8 +4453,7 @@ static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
/* Set the Output Compare Polarity */
tmpccer |= (OC_Config->OCPolarity << 8U);
- if(IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_3))
- {
+ if (IS_TIM_CCXN_INSTANCE(TIMx, TIM_CHANNEL_3)) {
assert_param(IS_TIM_OCN_POLARITY(OC_Config->OCNPolarity));
/* Reset the Output N Polarity level */
@@ -4805,8 +4464,7 @@ static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
tmpccer &= ~TIM_CCER_CC3NE;
}
- if(IS_TIM_BREAK_INSTANCE(TIMx))
- {
+ if (IS_TIM_BREAK_INSTANCE(TIMx)) {
/* Check parameters */
assert_param(IS_TIM_OCNIDLE_STATE(OC_Config->OCNIdleState));
assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState));
@@ -4834,13 +4492,13 @@ static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
}
/**
- * @brief Time Ouput Compare 4 configuration
- * @param TIMx to select the TIM peripheral
- * @param OC_Config : The ouput configuration structure
- * @retval None
- */
-static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
-{
+ * @brief Time Ouput Compare 4 configuration
+ * @param TIMx to select the TIM peripheral
+ * @param OC_Config : The ouput configuration structure
+ * @retval None
+ */
+static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx,
+ TIM_OC_InitTypeDef *OC_Config) {
uint32_t tmpccmrx = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpcr2 = 0U;
@@ -4851,7 +4509,7 @@ static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
/* Get the TIMx CCER register value */
tmpccer = TIMx->CCER;
/* Get the TIMx CR2 register value */
- tmpcr2 = TIMx->CR2;
+ tmpcr2 = TIMx->CR2;
/* Get the TIMx CCMR2 register value */
tmpccmrx = TIMx->CCMR2;
@@ -4868,11 +4526,10 @@ static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
/* Set the Output Compare Polarity */
tmpccer |= (OC_Config->OCPolarity << 12U);
- if(IS_TIM_BREAK_INSTANCE(TIMx))
- {
+ if (IS_TIM_BREAK_INSTANCE(TIMx)) {
assert_param(IS_TIM_OCIDLE_STATE(OC_Config->OCIdleState));
- /* Reset the Output Compare IDLE State */
+ /* Reset the Output Compare IDLE State */
tmpcr2 &= ~TIM_CR2_OIS4;
/* Set the Output Idle state */
tmpcr2 |= (OC_Config->OCIdleState << 6);
@@ -4891,17 +4548,15 @@ static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
TIMx->CCER = tmpccer;
}
-
/**
- * @brief Time Slave configuration
- * @param htim: pointer to a TIM_HandleTypeDef structure that contains
- * the configuration information for TIM module.
- * @param sSlaveConfig: The slave configuration structure
- * @retval None
- */
+ * @brief Time Slave configuration
+ * @param htim: pointer to a TIM_HandleTypeDef structure that contains
+ * the configuration information for TIM module.
+ * @param sSlaveConfig: The slave configuration structure
+ * @retval None
+ */
static void TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
- TIM_SlaveConfigTypeDef * sSlaveConfig)
-{
+ TIM_SlaveConfigTypeDef *sSlaveConfig) {
uint32_t tmpsmcr = 0U;
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
@@ -4923,25 +4578,20 @@ static void TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
htim->Instance->SMCR = tmpsmcr;
/* Configure the trigger prescaler, filter, and polarity */
- switch (sSlaveConfig->InputTrigger)
- {
- case TIM_TS_ETRF:
- {
+ switch (sSlaveConfig->InputTrigger) {
+ case TIM_TS_ETRF: {
/* Check the parameters */
assert_param(IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(htim->Instance));
assert_param(IS_TIM_TRIGGERPRESCALER(sSlaveConfig->TriggerPrescaler));
assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity));
assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter));
/* Configure the ETR Trigger source */
- TIM_ETR_SetConfig(htim->Instance,
- sSlaveConfig->TriggerPrescaler,
+ TIM_ETR_SetConfig(htim->Instance, sSlaveConfig->TriggerPrescaler,
sSlaveConfig->TriggerPolarity,
sSlaveConfig->TriggerFilter);
- }
- break;
+ } break;
- case TIM_TS_TI1F_ED:
- {
+ case TIM_TS_TI1F_ED: {
/* Check the parameters */
assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter));
@@ -4959,92 +4609,79 @@ static void TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
htim->Instance->CCMR1 = tmpccmr1;
htim->Instance->CCER = tmpccer;
- }
- break;
+ } break;
- case TIM_TS_TI1FP1:
- {
+ case TIM_TS_TI1FP1: {
/* Check the parameters */
assert_param(IS_TIM_CC1_INSTANCE(htim->Instance));
assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity));
assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter));
/* Configure TI1 Filter and Polarity */
- TIM_TI1_ConfigInputStage(htim->Instance,
- sSlaveConfig->TriggerPolarity,
+ TIM_TI1_ConfigInputStage(htim->Instance, sSlaveConfig->TriggerPolarity,
sSlaveConfig->TriggerFilter);
- }
- break;
+ } break;
- case TIM_TS_TI2FP2:
- {
+ case TIM_TS_TI2FP2: {
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
assert_param(IS_TIM_TRIGGERPOLARITY(sSlaveConfig->TriggerPolarity));
assert_param(IS_TIM_TRIGGERFILTER(sSlaveConfig->TriggerFilter));
/* Configure TI2 Filter and Polarity */
- TIM_TI2_ConfigInputStage(htim->Instance,
- sSlaveConfig->TriggerPolarity,
- sSlaveConfig->TriggerFilter);
- }
- break;
+ TIM_TI2_ConfigInputStage(htim->Instance, sSlaveConfig->TriggerPolarity,
+ sSlaveConfig->TriggerFilter);
+ } break;
- case TIM_TS_ITR0:
- {
+ case TIM_TS_ITR0: {
/* Check the parameter */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- }
- break;
+ } break;
- case TIM_TS_ITR1:
- {
+ case TIM_TS_ITR1: {
/* Check the parameter */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- }
- break;
+ } break;
- case TIM_TS_ITR2:
- {
+ case TIM_TS_ITR2: {
/* Check the parameter */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- }
- break;
+ } break;
- case TIM_TS_ITR3:
- {
+ case TIM_TS_ITR3: {
/* Check the parameter */
assert_param(IS_TIM_CC2_INSTANCE(htim->Instance));
- }
- break;
+ } break;
- default:
- break;
+ default:
+ break;
}
}
/**
- * @brief Configure the TI1 as Input.
- * @param TIMx to select the TIM peripheral.
- * @param TIM_ICPolarity : The Input Polarity.
- * This parameter can be one of the following values:
- * @arg TIM_ICPOLARITY_RISING
- * @arg TIM_ICPOLARITY_FALLING
- * @param TIM_ICSelection : specifies the input to be used.
- * This parameter can be one of the following values:
- * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 1 is selected to be connected to IC1.
- * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 1 is selected to be connected to IC2.
- * @arg TIM_ICSELECTION_TRC: TIM Input 1 is selected to be connected to TRC.
- * @param TIM_ICFilter : Specifies the Input Capture Filter.
- * This parameter must be a value between 0x00 and 0x0F.
- * @retval None
- * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI2FP1
- * (on channel2 path) is used as the input signal. Therefore CCMR1 must be
- * protected against un-initialized filter and polarity values.
- */
-void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
- uint32_t TIM_ICFilter)
-{
+ * @brief Configure the TI1 as Input.
+ * @param TIMx to select the TIM peripheral.
+ * @param TIM_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICPOLARITY_RISING
+ * @arg TIM_ICPOLARITY_FALLING
+ * @param TIM_ICSelection : specifies the input to be used.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 1 is selected to be
+ * connected to IC1.
+ * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 1 is selected to be
+ * connected to IC2.
+ * @arg TIM_ICSELECTION_TRC: TIM Input 1 is selected to be
+ * connected to TRC.
+ * @param TIM_ICFilter : Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI2FP1
+ * (on channel2 path) is used as the input signal. Therefore CCMR1 must be
+ * protected against un-initialized filter and polarity values.
+ */
+void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICSelection, uint32_t TIM_ICFilter) {
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
@@ -5054,13 +4691,10 @@ void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_
tmpccer = TIMx->CCER;
/* Select the Input */
- if(IS_TIM_CC2_INSTANCE(TIMx) != RESET)
- {
+ if (IS_TIM_CC2_INSTANCE(TIMx) != RESET) {
tmpccmr1 &= ~TIM_CCMR1_CC1S;
tmpccmr1 |= TIM_ICSelection;
- }
- else
- {
+ } else {
tmpccmr1 |= TIM_CCMR1_CC1S_0;
}
@@ -5078,18 +4712,18 @@ void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_
}
/**
- * @brief Configure the Polarity and Filter for TI1.
- * @param TIMx to select the TIM peripheral.
- * @param TIM_ICPolarity : The Input Polarity.
- * This parameter can be one of the following values:
- * @arg TIM_ICPOLARITY_RISING
- * @arg TIM_ICPOLARITY_FALLING
- * @param TIM_ICFilter : Specifies the Input Capture Filter.
- * This parameter must be a value between 0x00 and 0x0F.
- * @retval None
- */
-static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter)
-{
+ * @brief Configure the Polarity and Filter for TI1.
+ * @param TIMx to select the TIM peripheral.
+ * @param TIM_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICPOLARITY_RISING
+ * @arg TIM_ICPOLARITY_FALLING
+ * @param TIM_ICFilter : Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ */
+static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICFilter) {
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
@@ -5112,27 +4746,29 @@ static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
}
/**
- * @brief Configure the TI2 as Input.
- * @param TIMx to select the TIM peripheral
- * @param TIM_ICPolarity : The Input Polarity.
- * This parameter can be one of the following values:
- * @arg TIM_ICPOLARITY_RISING
- * @arg TIM_ICPOLARITY_FALLING
- * @param TIM_ICSelection : specifies the input to be used.
- * This parameter can be one of the following values:
- * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 2 is selected to be connected to IC2.
- * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 2 is selected to be connected to IC1.
- * @arg TIM_ICSELECTION_TRC: TIM Input 2 is selected to be connected to TRC.
- * @param TIM_ICFilter : Specifies the Input Capture Filter.
- * This parameter must be a value between 0x00 and 0x0F.
- * @retval None
- * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI1FP2
- * (on channel1 path) is used as the input signal. Therefore CCMR1 must be
- * protected against un-initialized filter and polarity values.
- */
-static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
- uint32_t TIM_ICFilter)
-{
+ * @brief Configure the TI2 as Input.
+ * @param TIMx to select the TIM peripheral
+ * @param TIM_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICPOLARITY_RISING
+ * @arg TIM_ICPOLARITY_FALLING
+ * @param TIM_ICSelection : specifies the input to be used.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 2 is selected to be
+ * connected to IC2.
+ * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 2 is selected to be
+ * connected to IC1.
+ * @arg TIM_ICSELECTION_TRC: TIM Input 2 is selected to be
+ * connected to TRC.
+ * @param TIM_ICFilter : Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI1FP2
+ * (on channel1 path) is used as the input signal. Therefore CCMR1 must be
+ * protected against un-initialized filter and polarity values.
+ */
+static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICSelection, uint32_t TIM_ICFilter) {
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
@@ -5154,23 +4790,23 @@ static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32
tmpccer |= ((TIM_ICPolarity << 4U) & (TIM_CCER_CC2P | TIM_CCER_CC2NP));
/* Write to TIMx CCMR1 and CCER registers */
- TIMx->CCMR1 = tmpccmr1 ;
+ TIMx->CCMR1 = tmpccmr1;
TIMx->CCER = tmpccer;
}
/**
- * @brief Configure the Polarity and Filter for TI2.
- * @param TIMx to select the TIM peripheral.
- * @param TIM_ICPolarity : The Input Polarity.
- * This parameter can be one of the following values:
- * @arg TIM_ICPOLARITY_RISING
- * @arg TIM_ICPOLARITY_FALLING
- * @param TIM_ICFilter : Specifies the Input Capture Filter.
- * This parameter must be a value between 0x00 and 0x0F.
- * @retval None
- */
-static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter)
-{
+ * @brief Configure the Polarity and Filter for TI2.
+ * @param TIMx to select the TIM peripheral.
+ * @param TIM_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICPOLARITY_RISING
+ * @arg TIM_ICPOLARITY_FALLING
+ * @param TIM_ICFilter : Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ */
+static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICFilter) {
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
@@ -5188,32 +4824,34 @@ static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
tmpccer |= (TIM_ICPolarity << 4U);
/* Write to TIMx CCMR1 and CCER registers */
- TIMx->CCMR1 = tmpccmr1 ;
+ TIMx->CCMR1 = tmpccmr1;
TIMx->CCER = tmpccer;
}
/**
- * @brief Configure the TI3 as Input.
- * @param TIMx to select the TIM peripheral
- * @param TIM_ICPolarity : The Input Polarity.
- * This parameter can be one of the following values:
- * @arg TIM_ICPOLARITY_RISING
- * @arg TIM_ICPOLARITY_FALLING
- * @param TIM_ICSelection : specifies the input to be used.
- * This parameter can be one of the following values:
- * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 3 is selected to be connected to IC3.
- * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 3 is selected to be connected to IC4.
- * @arg TIM_ICSELECTION_TRC: TIM Input 3 is selected to be connected to TRC.
- * @param TIM_ICFilter : Specifies the Input Capture Filter.
- * This parameter must be a value between 0x00 and 0x0F.
- * @retval None
- * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI3FP4
- * (on channel1 path) is used as the input signal. Therefore CCMR2 must be
- * protected against un-initialized filter and polarity values.
- */
-static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
- uint32_t TIM_ICFilter)
-{
+ * @brief Configure the TI3 as Input.
+ * @param TIMx to select the TIM peripheral
+ * @param TIM_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICPOLARITY_RISING
+ * @arg TIM_ICPOLARITY_FALLING
+ * @param TIM_ICSelection : specifies the input to be used.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 3 is selected to be
+ * connected to IC3.
+ * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 3 is selected to be
+ * connected to IC4.
+ * @arg TIM_ICSELECTION_TRC: TIM Input 3 is selected to be
+ * connected to TRC.
+ * @param TIM_ICFilter : Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI3FP4
+ * (on channel1 path) is used as the input signal. Therefore CCMR2 must be
+ * protected against un-initialized filter and polarity values.
+ */
+static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICSelection, uint32_t TIM_ICFilter) {
uint32_t tmpccmr2 = 0U;
uint32_t tmpccer = 0U;
@@ -5240,27 +4878,29 @@ static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32
}
/**
- * @brief Configure the TI4 as Input.
- * @param TIMx to select the TIM peripheral
- * @param TIM_ICPolarity : The Input Polarity.
- * This parameter can be one of the following values:
- * @arg TIM_ICPOLARITY_RISING
- * @arg TIM_ICPOLARITY_FALLING
- * @param TIM_ICSelection : specifies the input to be used.
- * This parameter can be one of the following values:
- * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 4 is selected to be connected to IC4.
- * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 4 is selected to be connected to IC3.
- * @arg TIM_ICSELECTION_TRC: TIM Input 4 is selected to be connected to TRC.
- * @param TIM_ICFilter : Specifies the Input Capture Filter.
- * This parameter must be a value between 0x00 and 0x0F.
- * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI4FP3
- * (on channel1 path) is used as the input signal. Therefore CCMR2 must be
- * protected against un-initialized filter and polarity values.
- * @retval None
- */
-static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
- uint32_t TIM_ICFilter)
-{
+ * @brief Configure the TI4 as Input.
+ * @param TIMx to select the TIM peripheral
+ * @param TIM_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICPOLARITY_RISING
+ * @arg TIM_ICPOLARITY_FALLING
+ * @param TIM_ICSelection : specifies the input to be used.
+ * This parameter can be one of the following values:
+ * @arg TIM_ICSELECTION_DIRECTTI: TIM Input 4 is selected to be
+ * connected to IC4.
+ * @arg TIM_ICSELECTION_INDIRECTTI: TIM Input 4 is selected to be
+ * connected to IC3.
+ * @arg TIM_ICSELECTION_TRC: TIM Input 4 is selected to be
+ * connected to TRC.
+ * @param TIM_ICFilter : Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @note TIM_ICFilter and TIM_ICPolarity are not used in INDIRECT mode as TI4FP3
+ * (on channel1 path) is used as the input signal. Therefore CCMR2 must be
+ * protected against un-initialized filter and polarity values.
+ * @retval None
+ */
+static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity,
+ uint32_t TIM_ICSelection, uint32_t TIM_ICFilter) {
uint32_t tmpccmr2 = 0U;
uint32_t tmpccer = 0U;
@@ -5283,57 +4923,57 @@ static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32
/* Write to TIMx CCMR2 and CCER registers */
TIMx->CCMR2 = tmpccmr2;
- TIMx->CCER = tmpccer ;
+ TIMx->CCER = tmpccer;
}
/**
- * @brief Selects the Input Trigger source
- * @param TIMx to select the TIM peripheral
- * @param InputTriggerSource : The Input Trigger source.
- * This parameter can be one of the following values:
- * @arg TIM_TS_ITR0 : Internal Trigger 0
- * @arg TIM_TS_ITR1 : Internal Trigger 1
- * @arg TIM_TS_ITR2 : Internal Trigger 2
- * @arg TIM_TS_ITR3 : Internal Trigger 3
- * @arg TIM_TS_TI1F_ED : TI1 Edge Detector
- * @arg TIM_TS_TI1FP1 : Filtered Timer Input 1
- * @arg TIM_TS_TI2FP2 : Filtered Timer Input 2
- * @arg TIM_TS_ETRF : External Trigger input
- * @retval None
- */
-static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint16_t InputTriggerSource)
-{
+ * @brief Selects the Input Trigger source
+ * @param TIMx to select the TIM peripheral
+ * @param InputTriggerSource : The Input Trigger source.
+ * This parameter can be one of the following values:
+ * @arg TIM_TS_ITR0 : Internal Trigger 0
+ * @arg TIM_TS_ITR1 : Internal Trigger 1
+ * @arg TIM_TS_ITR2 : Internal Trigger 2
+ * @arg TIM_TS_ITR3 : Internal Trigger 3
+ * @arg TIM_TS_TI1F_ED : TI1 Edge Detector
+ * @arg TIM_TS_TI1FP1 : Filtered Timer Input 1
+ * @arg TIM_TS_TI2FP2 : Filtered Timer Input 2
+ * @arg TIM_TS_ETRF : External Trigger input
+ * @retval None
+ */
+static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint16_t InputTriggerSource) {
uint32_t tmpsmcr = 0U;
- /* Get the TIMx SMCR register value */
- tmpsmcr = TIMx->SMCR;
- /* Reset the TS Bits */
- tmpsmcr &= ~TIM_SMCR_TS;
- /* Set the Input Trigger source and the slave mode*/
- tmpsmcr |= InputTriggerSource | TIM_SLAVEMODE_EXTERNAL1;
- /* Write to TIMx SMCR */
- TIMx->SMCR = tmpsmcr;
+ /* Get the TIMx SMCR register value */
+ tmpsmcr = TIMx->SMCR;
+ /* Reset the TS Bits */
+ tmpsmcr &= ~TIM_SMCR_TS;
+ /* Set the Input Trigger source and the slave mode*/
+ tmpsmcr |= InputTriggerSource | TIM_SLAVEMODE_EXTERNAL1;
+ /* Write to TIMx SMCR */
+ TIMx->SMCR = tmpsmcr;
}
/**
- * @brief Configures the TIMx External Trigger (ETR).
- * @param TIMx to select the TIM peripheral
- * @param TIM_ExtTRGPrescaler : The external Trigger Prescaler.
- * This parameter can be one of the following values:
- * @arg TIM_ETRPRESCALER_DIV1: ETRP Prescaler OFF.
- * @arg TIM_ETRPRESCALER_DIV2: ETRP frequency divided by 2.
- * @arg TIM_ETRPRESCALER_DIV4: ETRP frequency divided by 4.
- * @arg TIM_ETRPRESCALER_DIV8: ETRP frequency divided by 8.
- * @param TIM_ExtTRGPolarity : The external Trigger Polarity.
- * This parameter can be one of the following values:
- * @arg TIM_ETRPOLARITY_INVERTED: active low or falling edge active.
- * @arg TIM_ETRPOLARITY_NONINVERTED: active high or rising edge active.
- * @param ExtTRGFilter : External Trigger Filter.
- * This parameter must be a value between 0x00 and 0x0F
- * @retval None
- */
-static void TIM_ETR_SetConfig(TIM_TypeDef* TIMx, uint32_t TIM_ExtTRGPrescaler,
- uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter)
-{
+ * @brief Configures the TIMx External Trigger (ETR).
+ * @param TIMx to select the TIM peripheral
+ * @param TIM_ExtTRGPrescaler : The external Trigger Prescaler.
+ * This parameter can be one of the following values:
+ * @arg TIM_ETRPRESCALER_DIV1: ETRP Prescaler OFF.
+ * @arg TIM_ETRPRESCALER_DIV2: ETRP frequency divided by 2.
+ * @arg TIM_ETRPRESCALER_DIV4: ETRP frequency divided by 4.
+ * @arg TIM_ETRPRESCALER_DIV8: ETRP frequency divided by 8.
+ * @param TIM_ExtTRGPolarity : The external Trigger Polarity.
+ * This parameter can be one of the following values:
+ * @arg TIM_ETRPOLARITY_INVERTED: active low or falling edge active.
+ * @arg TIM_ETRPOLARITY_NONINVERTED: active high or rising edge
+ * active.
+ * @param ExtTRGFilter : External Trigger Filter.
+ * This parameter must be a value between 0x00 and 0x0F
+ * @retval None
+ */
+static void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler,
+ uint32_t TIM_ExtTRGPolarity,
+ uint32_t ExtTRGFilter) {
uint32_t tmpsmcr = 0U;
tmpsmcr = TIMx->SMCR;
@@ -5342,27 +4982,28 @@ static void TIM_ETR_SetConfig(TIM_TypeDef* TIMx, uint32_t TIM_ExtTRGPrescaler,
tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP);
/* Set the Prescaler, the Filter value and the Polarity */
- tmpsmcr |= (uint32_t)(TIM_ExtTRGPrescaler | (TIM_ExtTRGPolarity | (ExtTRGFilter << 8U)));
+ tmpsmcr |= (uint32_t)(TIM_ExtTRGPrescaler |
+ (TIM_ExtTRGPolarity | (ExtTRGFilter << 8U)));
/* Write to TIMx SMCR */
TIMx->SMCR = tmpsmcr;
}
/**
- * @brief Enables or disables the TIM Capture Compare Channel x.
- * @param TIMx to select the TIM peripheral
- * @param Channel : specifies the TIM Channel
- * This parameter can be one of the following values:
- * @arg TIM_CHANNEL_1: TIM Channel 1
- * @arg TIM_CHANNEL_2: TIM Channel 2
- * @arg TIM_CHANNEL_3: TIM Channel 3
- * @arg TIM_CHANNEL_4: TIM Channel 4
- * @param ChannelState : specifies the TIM Channel CCxE bit new state.
- * This parameter can be: TIM_CCx_ENABLE or TIM_CCx_Disable.
- * @retval None
- */
-void TIM_CCxChannelCmd(TIM_TypeDef* TIMx, uint32_t Channel, uint32_t ChannelState)
-{
+ * @brief Enables or disables the TIM Capture Compare Channel x.
+ * @param TIMx to select the TIM peripheral
+ * @param Channel : specifies the TIM Channel
+ * This parameter can be one of the following values:
+ * @arg TIM_CHANNEL_1: TIM Channel 1
+ * @arg TIM_CHANNEL_2: TIM Channel 2
+ * @arg TIM_CHANNEL_3: TIM Channel 3
+ * @arg TIM_CHANNEL_4: TIM Channel 4
+ * @param ChannelState : specifies the TIM Channel CCxE bit new state.
+ * This parameter can be: TIM_CCx_ENABLE or TIM_CCx_Disable.
+ * @retval None
+ */
+void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel,
+ uint32_t ChannelState) {
uint32_t tmp = 0U;
/* Check the parameters */
@@ -5375,19 +5016,19 @@ void TIM_CCxChannelCmd(TIM_TypeDef* TIMx, uint32_t Channel, uint32_t ChannelStat
TIMx->CCER &= ~tmp;
/* Set or reset the CCxE Bit */
- TIMx->CCER |= (uint32_t)(ChannelState << Channel);
+ TIMx->CCER |= (uint32_t)(ChannelState << Channel);
}
/**
- * @}
- */
+ * @}
+ */
#endif /* HAL_TIM_MODULE_ENABLED */
/**
- * @}
- */
+ * @}
+ */
/**
- * @}
- */
+ * @}
+ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/workspace/TS100/Makefile b/workspace/TS100/Makefile
index f0be4f53..1a9030a5 100644
--- a/workspace/TS100/Makefile
+++ b/workspace/TS100/Makefile
@@ -1,5 +1,8 @@
-OUTPUT_EXE=TS100_$(lang)
+ifndef model
+model:=TS100
+endif
+OUTPUT_EXE=$(model)_$(lang)
ifndef lang
lang:= EN
endif
@@ -36,7 +39,7 @@ OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color
# global defines ---------------------------------------------------------------
-GLOBAL_DEFINES += -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D LANG_$(lang) -D LANG
+GLOBAL_DEFINES += -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D LANG_$(lang) -D LANG -D MODEL_$(model)
# Enable debug code generation
DEBUG=-g
diff --git a/workspace/TS100/inc/FRToSI2C.hpp b/workspace/TS100/inc/FRToSI2C.hpp
index a3544081..b62d1ac3 100644
--- a/workspace/TS100/inc/FRToSI2C.hpp
+++ b/workspace/TS100/inc/FRToSI2C.hpp
@@ -11,29 +11,30 @@
#include "cmsis_os.h"
class FRToSI2C {
- public:
+public:
- FRToSI2C(I2C_HandleTypeDef *i2chandle) : i2c(i2chandle),
- I2CSemaphore(nullptr) {
- }
+ static void init(I2C_HandleTypeDef *i2chandle) {i2c=i2chandle;
+ I2CSemaphore=nullptr;}
- void FRToSInit() {
+ static void FRToSInit() {
I2CSemaphore = xSemaphoreCreateBinary();
xSemaphoreGive(I2CSemaphore);
}
- void CpltCallback(); //Normal Tx Callback
+ static void CpltCallback(); //Normal Tx Callback
- void Mem_Read(uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize,
- uint8_t *pData, uint16_t Size);
- void Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
- uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
+ static void Mem_Read(uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize,
+ uint8_t *pData, uint16_t Size);
+ static void Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
+ uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
- void Transmit(uint16_t DevAddress, uint8_t *pData, uint16_t Size);
+ static void Transmit(uint16_t DevAddress, uint8_t *pData, uint16_t Size);
+ static void I2C_RegisterWrite(uint8_t address, uint8_t reg, uint8_t data);
+ static uint8_t I2C_RegisterRead(uint8_t address, uint8_t reg);
- private:
- I2C_HandleTypeDef *i2c;
- SemaphoreHandle_t I2CSemaphore;
+private:
+ static I2C_HandleTypeDef *i2c;
+ static SemaphoreHandle_t I2CSemaphore;
};
#endif /* FRTOSI2C_HPP_ */
diff --git a/workspace/TS100/inc/FreeRTOSConfig.h b/workspace/TS100/inc/FreeRTOSConfig.h
index 9d2b6c33..4c787b06 100644
--- a/workspace/TS100/inc/FreeRTOSConfig.h
+++ b/workspace/TS100/inc/FreeRTOSConfig.h
@@ -102,12 +102,12 @@
#define configMAX_PRIORITIES ( 4 )
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
#define configTOTAL_HEAP_SIZE ((size_t)10240) /*Currently use about 9000*/
-#define configMAX_TASK_NAME_LEN ( 48 )
+#define configMAX_TASK_NAME_LEN ( 24 )
#define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
-#define configCHECK_FOR_STACK_OVERFLOW 2
+#define configCHECK_FOR_STACK_OVERFLOW 0 /*Bump this to 2 during development and bug hunting*/
/* Co-routine definitions. */
@@ -117,10 +117,10 @@
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
-#define INCLUDE_uxTaskPriorityGet 1
+#define INCLUDE_uxTaskPriorityGet 0
#define INCLUDE_vTaskDelete 0
#define INCLUDE_vTaskCleanUpResources 0
-#define INCLUDE_vTaskSuspend 1
+#define INCLUDE_vTaskSuspend 0
#define INCLUDE_vTaskDelayUntil 0
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
diff --git a/workspace/TS100/inc/LIS2DH12.hpp b/workspace/TS100/inc/LIS2DH12.hpp
index 2721e7c4..b292db32 100644
--- a/workspace/TS100/inc/LIS2DH12.hpp
+++ b/workspace/TS100/inc/LIS2DH12.hpp
@@ -14,15 +14,29 @@
class LIS2DH12 {
public:
- LIS2DH12(FRToSI2C* i2cHandle) : i2c(i2cHandle) {}
- void initalize();
- Orientation getOrientation() { return static_cast((I2C_RegisterRead(LIS_INT2_SRC) >> 2) - 1); }
- void getAxisReadings(int16_t *x, int16_t *y, int16_t *z);
+ static void initalize();
+ //1 = rh, 2,=lh, 8=flat
+ static Orientation getOrientation() {
+#ifdef MODEL_TS80
+ uint8_t val = (FRToSI2C::I2C_RegisterRead(LIS2DH_I2C_ADDRESS,
+ LIS_INT2_SRC) >> 2);
+ if (val == 8)
+ val = 3;
+ else if (val==1)
+ val=0;
+ else if(val==2)
+ val=1;
+ else
+ val=3;
+ return static_cast(val);
+#endif
+#ifdef MODEL_TS100
+ return static_cast((FRToSI2C::I2C_RegisterRead(LIS2DH_I2C_ADDRESS,LIS_INT2_SRC) >> 2) - 1);
+#endif
+ }
+ static void getAxisReadings(int16_t *x, int16_t *y, int16_t *z);
private:
- void I2C_RegisterWrite(uint8_t reg, uint8_t data);
- uint8_t I2C_RegisterRead(uint8_t reg);
- FRToSI2C* i2c;
};
#endif /* LIS2DH12_HPP_ */
diff --git a/workspace/TS100/inc/MMA8652FC.hpp b/workspace/TS100/inc/MMA8652FC.hpp
index 84f9fb0e..7bf1cafa 100644
--- a/workspace/TS100/inc/MMA8652FC.hpp
+++ b/workspace/TS100/inc/MMA8652FC.hpp
@@ -16,17 +16,12 @@ class MMA8652FC {
public:
- MMA8652FC(FRToSI2C* i2cHandle) : i2c(i2cHandle) {}
- void initalize(); // Initalize the system
- Orientation getOrientation();// Reads the I2C register and returns the orientation (true == left)
- void getAxisReadings(int16_t *x, int16_t *y, int16_t *z);
+
+ static void initalize(); // Initalize the system
+ static Orientation getOrientation();// Reads the I2C register and returns the orientation (true == left)
+ static void getAxisReadings(int16_t *x, int16_t *y, int16_t *z);
private:
-
- void I2C_RegisterWrite(uint8_t reg, uint8_t data);
- uint8_t I2C_RegisterRead(uint8_t reg);
- FRToSI2C* i2c;
-
};
#endif /* MMA8652FC_HPP_ */
diff --git a/workspace/TS100/inc/OLED.hpp b/workspace/TS100/inc/OLED.hpp
index cbf3eecc..095e17d4 100644
--- a/workspace/TS100/inc/OLED.hpp
+++ b/workspace/TS100/inc/OLED.hpp
@@ -26,79 +26,83 @@ extern "C" {
#define OLED_WIDTH 96
#define FRAMEBUFFER_START 17
-
class OLED {
public:
- OLED(FRToSI2C* i2cHandle); // Initialize Driver and store I2C pointer
- void initialize(); // Startup the I2C coms (brings screen out of reset etc)
-
+ static void initialize(); // Startup the I2C coms (brings screen out of reset etc)
+
// Draw the buffer out to the LCD using the DMA Channel
- void refresh() {
- i2c->Transmit( DEVICEADDR_OLED, screenBuffer, FRAMEBUFFER_START + (OLED_WIDTH * 2));
+ static void refresh() {
+ FRToSI2C::Transmit( DEVICEADDR_OLED, screenBuffer,
+ FRAMEBUFFER_START + (OLED_WIDTH * 2));
//DMA tx time is ~ 20mS Ensure after calling this you delay for at least 25ms
//or we need to goto double buffering
}
- void drawChar(char c, char preCursorCommand = '\0'); // Draw a character to a specific location
+ static void drawChar(char c, char preCursorCommand = '\0'); // Draw a character to a specific location
// Turn the screen on or not
- void displayOnOff(bool on) {
+ static void displayOnOff(bool on) {
displayOnOffState = on;
screenBuffer[1] = on ? 0xAF : 0xAE;
- }
- void setRotation(bool leftHanded); // Set the rotation for the screen
+ }
+ static void setRotation(bool leftHanded); // Set the rotation for the screen
// Get the current rotation of the LCD
- bool getRotation() const {
+ static bool getRotation() {
return inLeftHandedMode;
- }
- void print(const char* string); // Draw a string to the current location, with current font
+ }
+ static int16_t getCursorX() {
+ return cursor_x;
+ }
+ static void print(const char* string);// Draw a string to the current location, with current font
// Set the cursor location by pixels
- void setCursor(int16_t x, int16_t y) {
+ static void setCursor(int16_t x, int16_t y) {
cursor_x = x;
- cursor_y = y;
- }
+ cursor_y = y;
+ }
//Set cursor location by chars in current font
- void setCharCursor(int16_t x, int16_t y) {
+ static void setCharCursor(int16_t x, int16_t y) {
cursor_x = x * fontWidth;
cursor_y = y * fontHeight;
}
- void setFont(uint8_t fontNumber); // (Future) Set the font that is being used
- void drawImage(const uint8_t* buffer, uint8_t x, uint8_t width) {
+ static void setFont(uint8_t fontNumber); // (Future) Set the font that is being used
+ static void drawImage(const uint8_t* buffer, uint8_t x, uint8_t width) {
drawArea(x, 0, width, 16, buffer);
}
// Draws an image to the buffer, at x offset from top to bottom (fixed height renders)
- void printNumber(uint16_t number, uint8_t places);
+ static void printNumber(uint16_t number, uint8_t places);
// Draws a number at the current cursor location
// Clears the buffer
- void clearScreen() {
+ static void clearScreen() {
memset(&screenBuffer[FRAMEBUFFER_START], 0, OLED_WIDTH * 2);
- }
+ }
// Draws the battery level symbol
- void drawBattery(uint8_t state) {
+ static void drawBattery(uint8_t state) {
drawSymbol(3 + (state > 10 ? 10 : state));
- }
+ }
// Draws a checkbox
- void drawCheckbox(bool state) {
+ static void drawCheckbox(bool state) {
drawSymbol((state) ? 16 : 17);
}
- void drawSymbol(uint8_t symbolID);//Used for drawing symbols of a predictable width
- void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t* ptr); //Draw an area, but y must be aligned on 0/8 offset
- void fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t value); //Fill an area, but y must be aligned on 0/8 offset
- void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,bool clear);
- void drawHeatSymbol(uint8_t state);
+ static void drawSymbol(uint8_t symbolID);//Used for drawing symbols of a predictable width
+ static void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
+ const uint8_t* ptr); //Draw an area, but y must be aligned on 0/8 offset
+ static void fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
+ const uint8_t value); //Fill an area, but y must be aligned on 0/8 offset
+ static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
+ bool clear);
+ static void drawHeatSymbol(uint8_t state);
private:
//Draw a buffer to the screen buffer
- FRToSI2C* i2c; //i2c Pointer
- const uint8_t* currentFont; // Pointer to the current font used for rendering to the buffer
- uint8_t* firstStripPtr; // Pointers to the strips to allow for buffer having extra content
- uint8_t* secondStripPtr; //Pointers to the strips
- bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
- bool displayOnOffState; // If the display is on or not
- uint8_t fontWidth, fontHeight;
- int16_t cursor_x, cursor_y;
- uint8_t displayOffset;
- uint8_t screenBuffer[16 + (OLED_WIDTH * 2) + 10]; // The data buffer
+ static const uint8_t* currentFont;// Pointer to the current font used for rendering to the buffer
+ static uint8_t* firstStripPtr; // Pointers to the strips to allow for buffer having extra content
+ static uint8_t* secondStripPtr; //Pointers to the strips
+ static bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
+ static bool displayOnOffState; // If the display is on or not
+ static uint8_t fontWidth, fontHeight;
+ static int16_t cursor_x, cursor_y;
+ static uint8_t displayOffset;
+ static uint8_t screenBuffer[16 + (OLED_WIDTH * 2) + 10]; // The data buffer
};
#endif /* OLED_HPP_ */
diff --git a/workspace/TS100/inc/Settings.h b/workspace/TS100/inc/Settings.h
index 8d653943..65dccd67 100644
--- a/workspace/TS100/inc/Settings.h
+++ b/workspace/TS100/inc/Settings.h
@@ -11,36 +11,45 @@
#define SETTINGS_H_
#include
#include "stm32f1xx_hal.h"
-#define SETTINGSVERSION 0x15 /*Change this if you change the struct below to prevent people getting out of sync*/
+#define SETTINGSVERSION \
+ 0x16 /*Change this if you change the struct below to prevent people getting \
+ out of sync*/
/*
- * This struct must be a multiple of 2 bytes as it is saved / restored from flash in uint16_t chunks
+ * This struct must be a multiple of 2 bytes as it is saved / restored from
+ * flash in uint16_t chunks
*/
typedef struct {
- uint16_t SolderingTemp; //current set point for the iron
- uint16_t SleepTemp; //temp to drop to in sleep
- uint8_t SleepTime; //minutes timeout to sleep
- uint8_t cutoutSetting; // The voltage we cut out at for under voltage
- uint8_t OrientationMode:2; //If true we want to invert the display for lefties
- uint8_t sensitivity :4; //Sensitivity of accelerometer (5 bits)
- uint8_t autoStartMode :2; //Should the unit automatically jump straight into soldering mode when power is applied
- uint8_t ShutdownTime; //Time until unit shuts down if left alone
- uint8_t boostModeEnabled :1; //Boost mode swaps BUT_A in soldering mode to temporary soldering temp over-ride
- uint8_t coolingTempBlink :1; //Should the temperature blink on the cool down screen until its <50C
- uint8_t detailedIDLE :1; //Detailed idle screen
- uint8_t detailedSoldering :1; //Detailed soldering screens
- uint8_t temperatureInF; //Should the temp be in F or C (true is F)
- uint8_t descriptionScrollSpeed:1; // Description scroll speed
- uint16_t voltageDiv; //Voltage divisor factor
- uint16_t BoostTemp; //Boost mode set point for the iron
- int16_t CalibrationOffset; //This stores the temperature offset for this tip in the iron.
- uint8_t PID_P; //PID P Term
- uint8_t PID_I; //PID I Term
- uint8_t PID_D; //PID D Term
- uint8_t version; //Used to track if a reset is needed on firmware upgrade
- uint8_t customTipGain; // Tip gain value if custom tuned, or 0 if using a tipType param
+ uint16_t SolderingTemp; // current set point for the iron
+ uint16_t SleepTemp; // temp to drop to in sleep
+ uint8_t SleepTime; // minutes timeout to sleep
+ uint8_t cutoutSetting; // The voltage we cut out at for under voltage OR Power level for TS80
+ uint8_t OrientationMode :2; // If true we want to invert the display for lefties
+ uint8_t sensitivity :4; // Sensitivity of accelerometer (5 bits)
+ uint8_t autoStartMode :2; // Should the unit automatically jump straight
+ // into soldering mode when power is applied
+ uint8_t ShutdownTime; // Time until unit shuts down if left alone
+ uint8_t boostModeEnabled :1; // Boost mode swaps BUT_A in soldering mode to
+ // temporary soldering temp over-ride
+ uint8_t coolingTempBlink :1; // Should the temperature blink on the cool
+ // down screen until its <50C
+ uint8_t detailedIDLE :1; // Detailed idle screen
+ uint8_t detailedSoldering :1; // Detailed soldering screens
+ uint8_t temperatureInF; // Should the temp be in F or C (true is F)
+ uint8_t descriptionScrollSpeed :1; // Description scroll speed
+ uint16_t voltageDiv; // Voltage divisor factor
+ uint16_t BoostTemp; // Boost mode set point for the iron
+ int16_t CalibrationOffset; // This stores the temperature offset for this tip
+ // in the iron.
+ uint8_t PID_P; // PID P Term
+ uint8_t PID_I; // PID I Term
+ uint8_t PID_D; // PID D Term
+ uint8_t version; // Used to track if a reset is needed on firmware upgrade
+ uint8_t customTipGain; // Tip gain value if custom tuned, or 0 if using a
+ // tipType param
uint8_t tipType;
- uint32_t padding; //This is here for in case we are not an even divisor so that nothing gets cut off
+ uint32_t padding; // This is here for in case we are not an even divisor so
+ // that nothing gets cut off
} systemSettingsType;
extern volatile systemSettingsType systemSettings;
diff --git a/workspace/TS100/inc/Translation.h b/workspace/TS100/inc/Translation.h
index b5030744..afb1dcc2 100644
--- a/workspace/TS100/inc/Translation.h
+++ b/workspace/TS100/inc/Translation.h
@@ -9,7 +9,8 @@
#define TRANSLATION_H_
enum ShortNameType {
- SHORT_NAME_SINGLE_LINE = 1, SHORT_NAME_DOUBLE_LINE = 2,
+ SHORT_NAME_SINGLE_LINE = 1,
+ SHORT_NAME_DOUBLE_LINE = 2,
};
/*
@@ -17,10 +18,9 @@ enum ShortNameType {
* use SettingsShortNames as SettingsShortNames[16][1].. second column undefined
*/
extern const enum ShortNameType SettingsShortNameType;
-extern const char* SettingsShortNames[][2];
-extern const char* SettingsDescriptions[];
+extern const char* SettingsShortNames[21][2];
+extern const char* SettingsDescriptions[21];
extern const char* SettingsMenuEntries[4];
-extern const char* SettingsMenuEntriesDescriptions[4];
extern const char* SettingsCalibrationDone;
extern const char* SettingsCalibrationWarning;
diff --git a/workspace/TS100/inc/hardware.h b/workspace/TS100/inc/hardware.h
index 6d945b3f..aa6de11d 100644
--- a/workspace/TS100/inc/hardware.h
+++ b/workspace/TS100/inc/hardware.h
@@ -7,36 +7,38 @@
#ifndef HARDWARE_H_
#define HARDWARE_H_
-#include "stm32f1xx_hal.h"
#include "Setup.h"
+#include "stm32f1xx_hal.h"
#ifdef __cplusplus
extern "C" {
#endif
enum Orientation {
- ORIENTATION_LEFT_HAND = 0, ORIENTATION_RIGHT_HAND = 1, ORIENTATION_FLAT = 3
-};
-/*
- * Keep in a uint8_t range for the ID's
- */
-enum TipType {
- TS_B2 = 0,
- TS_D24 = 1,
- TS_BC2 = 2,
- TS_C1 = 3,
- Tip_MiniWare=4,
- HAKKO_BC2=4,
- Tip_Hakko=5,
- Tip_Custom=5,
+ ORIENTATION_LEFT_HAND = 0,
+ ORIENTATION_RIGHT_HAND = 1,
+ ORIENTATION_FLAT = 3
};
+#ifndef MODEL_TS100
+ #ifndef MODEL_TS80
+#error "Please Define the model you are building for! MODEL=TS100 or MODEL=TS80"
+ #endif
+#endif
+
+#ifdef MODEL_TS100
+
#define KEY_B_Pin GPIO_PIN_6
#define KEY_B_GPIO_Port GPIOA
#define TMP36_INPUT_Pin GPIO_PIN_7
#define TMP36_INPUT_GPIO_Port GPIOA
+#define TMP36_ADC1_CHANNEL ADC_CHANNEL_7
#define TIP_TEMP_Pin GPIO_PIN_0
#define TIP_TEMP_GPIO_Port GPIOB
+#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_8
+#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_8
#define VIN_Pin GPIO_PIN_1
#define VIN_GPIO_Port GPIOB
+#define VIN_ADC1_CHANNEL ADC_CHANNEL_9
+#define VIN_ADC2_CHANNEL ADC_CHANNEL_9
#define OLED_RESET_Pin GPIO_PIN_8
#define OLED_RESET_GPIO_Port GPIOA
#define KEY_A_Pin GPIO_PIN_9
@@ -45,6 +47,8 @@ enum TipType {
#define INT_Orientation_GPIO_Port GPIOB
#define PWM_Out_Pin GPIO_PIN_4
#define PWM_Out_GPIO_Port GPIOB
+#define PWM_Out_CHANNEL TIM_CHANNEL_1
+#define PWM_Out_CCR
#define INT_Movement_Pin GPIO_PIN_5
#define INT_Movement_GPIO_Port GPIOB
#define SCL_Pin GPIO_PIN_6
@@ -52,6 +56,64 @@ enum TipType {
#define SDA_Pin GPIO_PIN_7
#define SDA_GPIO_Port GPIOB
+#else
+// TS80 pin map
+#define KEY_B_Pin GPIO_PIN_0
+#define KEY_B_GPIO_Port GPIOB
+#define TMP36_INPUT_Pin GPIO_PIN_4
+#define TMP36_INPUT_GPIO_Port GPIOA
+#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
+#define TIP_TEMP_Pin GPIO_PIN_3
+#define TIP_TEMP_GPIO_Port GPIOA
+#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
+#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3
+
+#define VIN_Pin GPIO_PIN_2
+#define VIN_GPIO_Port GPIOA
+#define VIN_ADC1_CHANNEL ADC_CHANNEL_2
+#define VIN_ADC2_CHANNEL ADC_CHANNEL_2
+#define OLED_RESET_Pin GPIO_PIN_15
+#define OLED_RESET_GPIO_Port GPIOA
+#define KEY_A_Pin GPIO_PIN_1
+#define KEY_A_GPIO_Port GPIOB
+#define INT_Orientation_Pin GPIO_PIN_4
+#define INT_Orientation_GPIO_Port GPIOB
+#define PWM_Out_Pin GPIO_PIN_6
+#define PWM_Out_GPIO_Port GPIOA
+#define PWM_Out_CHANNEL TIM_CHANNEL_1
+#define INT_Movement_Pin GPIO_PIN_5
+#define INT_Movement_GPIO_Port GPIOB
+#define SCL_Pin GPIO_PIN_6
+#define SCL_GPIO_Port GPIOB
+#define SDA_Pin GPIO_PIN_7
+#define SDA_GPIO_Port GPIOB
+
+#endif
+
+/*
+ * Keep in a uint8_t range for the ID's
+ */
+#ifdef MODEL_TS100
+enum TipType {
+ TS_B2 = 0,
+ TS_D24 = 1,
+ TS_BC2 = 2,
+ TS_C1 = 3,
+ Tip_MiniWare = 4,
+ HAKKO_BC2 = 4,
+ Tip_Hakko = 5,
+ Tip_Custom = 5,
+};
+#endif
+#ifdef MODEL_TS80
+enum TipType {
+ TS_B02 = 0,
+ TS_D25 = 1,
+ Tip_MiniWare = 2,
+ Tip_Custom = 2,
+};
+#endif
+
uint16_t getHandleTemperature();
uint16_t getTipRawTemp(uint8_t instant);
uint16_t getInputVoltageX10(uint16_t divisor);
@@ -62,9 +124,17 @@ uint16_t ctoTipMeasurement(uint16_t temp);
uint16_t tipMeasurementToC(uint16_t raw);
uint16_t ftoTipMeasurement(uint16_t temp);
uint16_t tipMeasurementToF(uint16_t raw);
-
+void seekQC(int16_t Vx10);
void setCalibrationOffset(int16_t offSet);
void setTipType(enum TipType tipType, uint8_t manualCalGain);
+uint32_t calculateTipR(uint8_t useFilter);
+int16_t calculateMaxVoltage(uint8_t useFilter, uint8_t useHP);
+void startQC(); // Tries to negotiate QC for highest voltage, must be run after
+ // RToS
+// This will try for 12V, failing that 9V, failing that 5V
+// If input is over 12V returns -1
+// If the input is [5-12] Will return the value.
+
#ifdef __cplusplus
}
#endif
diff --git a/workspace/TS100/inc/main.hpp b/workspace/TS100/inc/main.hpp
index f91bf0a4..f83933a5 100644
--- a/workspace/TS100/inc/main.hpp
+++ b/workspace/TS100/inc/main.hpp
@@ -2,25 +2,23 @@
#define __MAIN_H
#include
-#include "Setup.h"
#include "OLED.hpp"
-extern uint16_t currentlyActiveTemperatureTarget;
-extern OLED lcd;
-extern MMA8652FC accel;
+#include "Setup.h"
extern uint8_t PCBVersion;
+extern uint16_t currentlyActiveTemperatureTarget;
enum ButtonState {
- BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
- BUTTON_F_SHORT = 1, /* User has pressed the front button*/
- BUTTON_B_SHORT = 2, /* User has pressed the back button*/
- BUTTON_F_LONG = 4, /* User is holding the front button*/
- BUTTON_B_LONG = 8, /* User is holding the back button*/
- BUTTON_BOTH = 16, /* User has pressed both buttons*/
+ BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
+ BUTTON_F_SHORT = 1, /* User has pressed the front button*/
+ BUTTON_B_SHORT = 2, /* User has pressed the back button*/
+ BUTTON_F_LONG = 4, /* User is holding the front button*/
+ BUTTON_B_LONG = 8, /* User is holding the back button*/
+ BUTTON_BOTH = 16, /* User has pressed both buttons*/
-/*
- * Note:
- * Pressed means press + release, we trigger on a full \__/ pulse
- * holding means it has gone low, and been low for longer than filter time
- */
+ /*
+ * Note:
+ * Pressed means press + release, we trigger on a full \__/ pulse
+ * holding means it has gone low, and been low for longer than filter time
+ */
};
ButtonState getButtonState();
@@ -31,15 +29,15 @@ void GUIDelay();
extern "C" {
#endif
-void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc);
+void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc);
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c);
-void vApplicationStackOverflowHook( xTaskHandle *pxTask,
- signed portCHAR *pcTaskName);
+void vApplicationStackOverflowHook(xTaskHandle *pxTask,
+ signed portCHAR *pcTaskName);
#ifdef __cplusplus
}
diff --git a/workspace/TS100/src/FRToSI2C.cpp b/workspace/TS100/src/FRToSI2C.cpp
index b50f86d2..1acc532e 100644
--- a/workspace/TS100/src/FRToSI2C.cpp
+++ b/workspace/TS100/src/FRToSI2C.cpp
@@ -7,82 +7,85 @@
#include "FRToSI2C.hpp"
-void __attribute__ ((long_call, section (".data.ramfuncs"))) FRToSI2C::CpltCallback() {
- BaseType_t xHigherPriorityTaskWoken = pdFALSE;
- i2c->State = HAL_I2C_STATE_READY;//Force state reset
- if (I2CSemaphore) {
- xSemaphoreGiveFromISR(I2CSemaphore, &xHigherPriorityTaskWoken);
- portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
- }
+I2C_HandleTypeDef* FRToSI2C::i2c;
+SemaphoreHandle_t FRToSI2C::I2CSemaphore;
+void FRToSI2C::CpltCallback() {
+ BaseType_t xHigherPriorityTaskWoken = pdFALSE;
+ i2c->State = HAL_I2C_STATE_READY; // Force state reset (even if tx error)
+ if (I2CSemaphore) {
+ xSemaphoreGiveFromISR(I2CSemaphore, &xHigherPriorityTaskWoken);
+ portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
+ }
}
void FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t MemAddress,
- uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
- if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED
- || I2CSemaphore == NULL) {
- //no RToS, run blocking code
- HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
- 5000);
- } else {
- //RToS is active, run threading
- //Get the mutex so we can use the I2C port
- //Wait up to 1 second for the mutex
- if ( xSemaphoreTake( I2CSemaphore, ( TickType_t ) 5000 ) == pdTRUE) {
- if (HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData,
- Size, 5000) != HAL_OK) {
- NVIC_SystemReset();
- }
- xSemaphoreGive(I2CSemaphore);
- } else {
- NVIC_SystemReset();
- }
-
- }
-
+ uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
+ if (I2CSemaphore == NULL) {
+ // no RToS, run blocking code
+ HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
+ 5000);
+ } else {
+ // RToS is active, run threading
+ // Get the mutex so we can use the I2C port
+ // Wait up to 1 second for the mutex
+ if (xSemaphoreTake(I2CSemaphore, (TickType_t)5000) == pdTRUE) {
+ if (HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
+ 5000) != HAL_OK) {
+ NVIC_SystemReset();
+ }
+ xSemaphoreGive(I2CSemaphore);
+ } else {
+ NVIC_SystemReset();
+ }
+ }
+}
+void FRToSI2C::I2C_RegisterWrite(uint8_t address, uint8_t reg, uint8_t data) {
+ Mem_Write(address, reg, I2C_MEMADD_SIZE_8BIT, &data, 1);
}
+uint8_t FRToSI2C::I2C_RegisterRead(uint8_t add, uint8_t reg) {
+ uint8_t tx_data[1];
+ Mem_Read(add, reg, I2C_MEMADD_SIZE_8BIT, tx_data, 1);
+ return tx_data[0];
+}
void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
- uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
- if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED
- || I2CSemaphore == NULL) {
- //no RToS, run blocking code
- HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
- 5000);
- } else {
- //RToS is active, run threading
- //Get the mutex so we can use the I2C port
- //Wait up to 1 second for the mutex
- if ( xSemaphoreTake( I2CSemaphore, ( TickType_t ) 5000 ) == pdTRUE) {
- if (HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize,
- pData, Size, 5000) != HAL_OK) {
- NVIC_SystemReset();
- }
- xSemaphoreGive(I2CSemaphore);
+ uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
+ if (I2CSemaphore == NULL) {
+ // no RToS, run blocking code
+ HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
+ 5000);
+ } else {
+ // RToS is active, run threading
+ // Get the mutex so we can use the I2C port
+ // Wait up to 1 second for the mutex
+ if (xSemaphoreTake(I2CSemaphore, (TickType_t)5000) == pdTRUE) {
+ if (HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData,
+ Size, 5000) != HAL_OK) {
+ NVIC_SystemReset();
+ }
+ xSemaphoreGive(I2CSemaphore);
- } else {
- NVIC_SystemReset();
- }
- }
+ } else {
+ NVIC_SystemReset();
+ }
+ }
}
void FRToSI2C::Transmit(uint16_t DevAddress, uint8_t* pData, uint16_t Size) {
- if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED
- || I2CSemaphore == NULL) {
- //no RToS, run blocking code
- HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
- } else {
- //RToS is active, run threading
- //Get the mutex so we can use the I2C port
- //Wait up to 1 second for the mutex
- if ( xSemaphoreTake( I2CSemaphore, ( TickType_t ) 5000 ) == pdTRUE) {
- if (HAL_I2C_Master_Transmit_DMA(i2c, DevAddress, pData, Size)
- != HAL_OK) {
- NVIC_SystemReset();
- }
- //xSemaphoreGive(I2CSemaphore);
- } else {
- NVIC_SystemReset();
- }
- }
-
+ if (I2CSemaphore == NULL) {
+ // no RToS, run blocking code
+ HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
+ } else {
+ // RToS is active, run threading
+ // Get the mutex so we can use the I2C port
+ // Wait up to 1 second for the mutex
+ if (xSemaphoreTake(I2CSemaphore, (TickType_t)5000) == pdTRUE) {
+ if (HAL_I2C_Master_Transmit_DMA(i2c, DevAddress, pData, Size) != HAL_OK) {
+ NVIC_SystemReset();
+ }
+ // xSemaphoreGive(I2CSemaphore);
+ } else {
+ NVIC_SystemReset();
+ }
+ }
}
diff --git a/workspace/TS100/src/LIS2DH12.cpp b/workspace/TS100/src/LIS2DH12.cpp
index 40f9be53..544ead40 100644
--- a/workspace/TS100/src/LIS2DH12.cpp
+++ b/workspace/TS100/src/LIS2DH12.cpp
@@ -8,6 +8,7 @@
#include
#include "cmsis_os.h"
+
typedef struct {
const uint8_t reg;
const uint8_t value;
@@ -31,13 +32,13 @@ static const LIS_REG i2c_registers[] = {
void LIS2DH12::initalize() {
for (size_t index = 0; index < (sizeof(i2c_registers) / sizeof(i2c_registers[0])); index++) {
- I2C_RegisterWrite(i2c_registers[index].reg, i2c_registers[index].value);
+ FRToSI2C::I2C_RegisterWrite(LIS2DH_I2C_ADDRESS,i2c_registers[index].reg, i2c_registers[index].value);
}
}
void LIS2DH12::getAxisReadings(int16_t* x, int16_t* y, int16_t* z) {
uint8_t tempArr[6];
- i2c->Mem_Read(LIS2DH_I2C_ADDRESS, 0xA8, I2C_MEMADD_SIZE_8BIT,
+FRToSI2C::Mem_Read(LIS2DH_I2C_ADDRESS, 0xA8, I2C_MEMADD_SIZE_8BIT,
(uint8_t*) tempArr, 6);
(*x) = ((uint16_t) (tempArr[1] << 8 | tempArr[0]));
@@ -45,13 +46,4 @@ void LIS2DH12::getAxisReadings(int16_t* x, int16_t* y, int16_t* z) {
(*z) = ((uint16_t) (tempArr[5] << 8 | tempArr[4]));
}
-void LIS2DH12::I2C_RegisterWrite(uint8_t reg, uint8_t data) {
- i2c->Mem_Write(LIS2DH_I2C_ADDRESS, reg, I2C_MEMADD_SIZE_8BIT, &data, 1);
-}
-
-uint8_t LIS2DH12::I2C_RegisterRead(uint8_t reg) {
- uint8_t tx_data[1];
- i2c->Mem_Read( LIS2DH_I2C_ADDRESS, reg, I2C_MEMADD_SIZE_8BIT, tx_data, 1);
- return tx_data[0];
-}
diff --git a/workspace/TS100/src/MMA8652FC.cpp b/workspace/TS100/src/MMA8652FC.cpp
index 5825a880..a6757604 100644
--- a/workspace/TS100/src/MMA8652FC.cpp
+++ b/workspace/TS100/src/MMA8652FC.cpp
@@ -9,55 +9,47 @@
#include "cmsis_os.h"
typedef struct {
- const uint8_t reg;
- const uint8_t val;
+ const uint8_t reg;
+ const uint8_t val;
} MMA_REG;
-static const MMA_REG i2c_registers[] = {
- {CTRL_REG2, 0}, //Normal mode
- {CTRL_REG2, 0x40}, // Reset all registers to POR values
- {FF_MT_CFG_REG, 0x78}, // Enable motion detection for X, Y, Z axis, latch disabled
- {PL_CFG_REG, 0x40}, //Enable the orientation detection
- {PL_COUNT_REG, 200}, //200 count debounce
- {PL_BF_ZCOMP_REG, 0b01000111}, //Set the threshold to 42 degrees
- {P_L_THS_REG, 0b10011100}, //Up the trip angles
- {CTRL_REG4, 0x01 | (1 << 4)}, // Enable dataready interrupt & orientation interrupt
- {CTRL_REG5, 0x01}, // Route data ready interrupts to INT1 ->PB5 ->EXTI5, leaving orientation routed to INT2
- {CTRL_REG2, 0x12}, //Set maximum resolution oversampling
- {XYZ_DATA_CFG_REG, (1 << 4)}, //select high pass filtered data
- {HP_FILTER_CUTOFF_REG, 0x03}, //select high pass filtered data
- {CTRL_REG1, 0x19} // ODR=12 Hz, Active mode
+static const MMA_REG i2c_registers[] = { { CTRL_REG2, 0 }, //Normal mode
+ { CTRL_REG2, 0x40 }, // Reset all registers to POR values
+ { FF_MT_CFG_REG, 0x78 }, // Enable motion detection for X, Y, Z axis, latch disabled
+ { PL_CFG_REG, 0x40 }, //Enable the orientation detection
+ { PL_COUNT_REG, 200 }, //200 count debounce
+ { PL_BF_ZCOMP_REG, 0b01000111 }, //Set the threshold to 42 degrees
+ { P_L_THS_REG, 0b10011100 }, //Up the trip angles
+ { CTRL_REG4, 0x01 | (1 << 4) }, // Enable dataready interrupt & orientation interrupt
+ { CTRL_REG5, 0x01 }, // Route data ready interrupts to INT1 ->PB5 ->EXTI5, leaving orientation routed to INT2
+ { CTRL_REG2, 0x12 }, //Set maximum resolution oversampling
+ { XYZ_DATA_CFG_REG, (1 << 4) }, //select high pass filtered data
+ { HP_FILTER_CUTOFF_REG, 0x03 }, //select high pass filtered data
+ { CTRL_REG1, 0x19 } // ODR=12 Hz, Active mode
};
-void MMA8652FC::I2C_RegisterWrite(uint8_t reg, uint8_t data) {
- i2c->Mem_Write( MMA8652FC_I2C_ADDRESS, reg, I2C_MEMADD_SIZE_8BIT, &data, 1);
-}
-uint8_t MMA8652FC::I2C_RegisterRead(uint8_t reg) {
- uint8_t tx_data[1];
- i2c->Mem_Read( MMA8652FC_I2C_ADDRESS, reg, I2C_MEMADD_SIZE_8BIT, tx_data,
- 1);
-
- return tx_data[0];
-}
void MMA8652FC::initalize() {
size_t index = 0;
//send all the init commands to the unit
- I2C_RegisterWrite(i2c_registers[index].reg, i2c_registers[index].val); index++;
- I2C_RegisterWrite(i2c_registers[index].reg, i2c_registers[index].val); index++;
+ FRToSI2C::I2C_RegisterWrite(MMA8652FC_I2C_ADDRESS,i2c_registers[index].reg, i2c_registers[index].val);
+ index++;
+ FRToSI2C::I2C_RegisterWrite(MMA8652FC_I2C_ADDRESS,i2c_registers[index].reg, i2c_registers[index].val);
+ index++;
HAL_Delay(2); // ~1ms delay
while (index < (sizeof(i2c_registers) / sizeof(i2c_registers[0]))) {
- I2C_RegisterWrite(i2c_registers[index].reg, i2c_registers[index].val); index++;
+ FRToSI2C::I2C_RegisterWrite(MMA8652FC_I2C_ADDRESS,i2c_registers[index].reg, i2c_registers[index].val);
+ index++;
}
}
Orientation MMA8652FC::getOrientation() {
//First read the PL_STATUS register
- uint8_t plStatus = I2C_RegisterRead(PL_STATUS_REG);
+ uint8_t plStatus = FRToSI2C::I2C_RegisterRead(MMA8652FC_I2C_ADDRESS,PL_STATUS_REG);
if ((plStatus & 0b10000000) == 0b10000000) {
plStatus >>= 1; //We don't need the up/down bit
plStatus &= 0x03; //mask to the two lower bits
@@ -67,12 +59,13 @@ Orientation MMA8652FC::getOrientation() {
return static_cast(plStatus);
}
-
+
return ORIENTATION_FLAT;
}
void MMA8652FC::getAxisReadings(int16_t *x, int16_t *y, int16_t *z) {
uint8_t tempArr[6];
- i2c->Mem_Read( MMA8652FC_I2C_ADDRESS, OUT_X_MSB_REG,I2C_MEMADD_SIZE_8BIT, (uint8_t*) tempArr, 6);
+ FRToSI2C::Mem_Read( MMA8652FC_I2C_ADDRESS, OUT_X_MSB_REG, I2C_MEMADD_SIZE_8BIT,
+ (uint8_t*) tempArr, 6);
(*x) = tempArr[0] << 8 | tempArr[1];
(*y) = tempArr[2] << 8 | tempArr[3];
diff --git a/workspace/TS100/src/OLED.cpp b/workspace/TS100/src/OLED.cpp
index 6c638ae6..17067208 100644
--- a/workspace/TS100/src/OLED.cpp
+++ b/workspace/TS100/src/OLED.cpp
@@ -5,69 +5,81 @@
* Author: Ben V. Brown
*/
-#include
#include
+#include
#include "Translation.h"
#include "cmsis_os.h"
+
+const uint8_t* OLED::currentFont; // Pointer to the current font used for
+ // rendering to the buffer
+uint8_t* OLED::firstStripPtr; // Pointers to the strips to allow for buffer
+ // having extra content
+uint8_t* OLED::secondStripPtr; // Pointers to the strips
+bool OLED::inLeftHandedMode; // Whether the screen is in left or not (used for
+ // offsets in GRAM)
+bool OLED::displayOnOffState; // If the display is on or not
+uint8_t OLED::fontWidth, OLED::fontHeight;
+int16_t OLED::cursor_x, OLED::cursor_y;
+uint8_t OLED::displayOffset;
+uint8_t OLED::screenBuffer[16 + (OLED_WIDTH * 2) + 10]; // The data buffer
+
/*Setup params for the OLED screen*/
/*http://www.displayfuture.com/Display/datasheet/controller/SSD1307.pdf*/
/*All commands are prefixed with 0x80*/
/*Data packets are prefixed with 0x40*/
-uint8_t OLED_Setup_Array[] = { /**/
-0x80, 0xAE,/*Display off*/
-0x80, 0xD5,/*Set display clock divide ratio / osc freq*/
-0x80, 0x52,/*Divide ratios*/
-0x80, 0xA8,/*Set Multiplex Ratio*/
-0x80, 0x0F,/*16 == max brightness,39==dimmest*/
-0x80, 0xC0,/*Set COM Scan direction*/
-0x80, 0xD3,/*Set vertical Display offset*/
-0x80, 0x00,/*0 Offset*/
-0x80, 0x40,/*Set Display start line to 0*/
-0x80, 0xA0,/*Set Segment remap to normal*/
-0x80, 0x8D,/*Charge Pump*/
-0x80, 0x14,/*Charge Pump settings*/
-0x80, 0xDA,/*Set VCOM Pins hardware config*/
-0x80, 0x02,/*Combination 2*/
-0x80, 0x81,/*Contrast*/
-0x80, 0x33,/*^51*/
-0x80, 0xD9,/*Set pre-charge period*/
-0x80, 0xF1,/*Pre charge period*/
-0x80, 0xDB,/*Adjust VCOMH regulator ouput*/
-0x80, 0x30,/*VCOM level*/
-0x80, 0xA4,/*Enable the display GDDR*/
-0x80, 0XA6,/*Normal display*/
-0x80, 0x20,/*Memory Mode*/
-0x80, 0x00,/*Wrap memory*/
-0x80, 0xAF /*Display on*/
+uint8_t OLED_Setup_Array[] = {
+ /**/
+ 0x80, 0xAE, /*Display off*/
+ 0x80, 0xD5, /*Set display clock divide ratio / osc freq*/
+ 0x80, 0x52, /*Divide ratios*/
+ 0x80, 0xA8, /*Set Multiplex Ratio*/
+ 0x80, 0x0F, /*16 == max brightness,39==dimmest*/
+ 0x80, 0xC0, /*Set COM Scan direction*/
+ 0x80, 0xD3, /*Set vertical Display offset*/
+ 0x80, 0x00, /*0 Offset*/
+ 0x80, 0x40, /*Set Display start line to 0*/
+ 0x80, 0xA0, /*Set Segment remap to normal*/
+ 0x80, 0x8D, /*Charge Pump*/
+ 0x80, 0x14, /*Charge Pump settings*/
+ 0x80, 0xDA, /*Set VCOM Pins hardware config*/
+ 0x80, 0x02, /*Combination 2*/
+ 0x80, 0x81, /*Contrast*/
+ 0x80, 0x33, /*^51*/
+ 0x80, 0xD9, /*Set pre-charge period*/
+ 0x80, 0xF1, /*Pre charge period*/
+ 0x80, 0xDB, /*Adjust VCOMH regulator ouput*/
+ 0x80, 0x30, /*VCOM level*/
+ 0x80, 0xA4, /*Enable the display GDDR*/
+ 0x80, 0XA6, /*Normal display*/
+ 0x80, 0x20, /*Memory Mode*/
+ 0x80, 0x00, /*Wrap memory*/
+ 0x80, 0xAF /*Display on*/
};
-//Setup based on the SSD1307 and modified for the SSD1306
+// Setup based on the SSD1307 and modified for the SSD1306
-const uint8_t REFRESH_COMMANDS[17] = { 0x80, 0xAF, 0x80, 0x21, 0x80, 0x20, 0x80,
- 0x7F, 0x80, 0xC0, 0x80, 0x22, 0x80, 0x00, 0x80, 0x01, 0x40 };
-
-OLED::OLED(FRToSI2C* i2cHandle) {
- i2c = i2cHandle;
- cursor_x = cursor_y = 0;
- currentFont = FONT_12;
- fontWidth = 12;
- inLeftHandedMode = false;
- firstStripPtr = &screenBuffer[FRAMEBUFFER_START];
- secondStripPtr = &screenBuffer[FRAMEBUFFER_START + OLED_WIDTH];
- fontHeight = 16;
- displayOffset = 0;
- displayOnOffState = true;
-}
+const uint8_t REFRESH_COMMANDS[17] = {0x80, 0xAF, 0x80, 0x21, 0x80, 0x20,
+ 0x80, 0x7F, 0x80, 0xC0, 0x80, 0x22,
+ 0x80, 0x00, 0x80, 0x01, 0x40};
void OLED::initialize() {
- memcpy(&screenBuffer[0], &REFRESH_COMMANDS[0], sizeof(REFRESH_COMMANDS));
+ cursor_x = cursor_y = 0;
+ currentFont = FONT_12;
+ fontWidth = 12;
+ inLeftHandedMode = false;
+ firstStripPtr = &screenBuffer[FRAMEBUFFER_START];
+ secondStripPtr = &screenBuffer[FRAMEBUFFER_START + OLED_WIDTH];
+ fontHeight = 16;
+ displayOffset = 0;
+ displayOnOffState = true;
+ memcpy(&screenBuffer[0], &REFRESH_COMMANDS[0], sizeof(REFRESH_COMMANDS));
- HAL_Delay(50);
- HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
- HAL_Delay(50);
- //Send the setup settings
- i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
- sizeof(OLED_Setup_Array));
- displayOnOff(true);
+ HAL_Delay(50);
+ HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
+ HAL_Delay(50);
+ // Send the setup settings
+ FRToSI2C::Transmit(DEVICEADDR_OLED, (uint8_t*)OLED_Setup_Array,
+ sizeof(OLED_Setup_Array));
+ displayOnOff(true);
}
/*
@@ -76,259 +88,262 @@ void OLED::initialize() {
* Precursor is the command char that is used to select the table.
*/
void OLED::drawChar(char c, char PrecursorCommand) {
- if (c == '\n' && cursor_y == 0) {
- cursor_x = 0;
- cursor_y = 8;
- }
- if (c < ' ') {
- return;
- }
- uint16_t index = 0;
- if (PrecursorCommand == 0) {
- //Fonts are offset to start at the space char
- index = (c - ' ');
- } else {
- //This is for extended range
- //We decode the precursor command to find the offset
- //Latin starts at 96
- c -= 0x80;
+ if (c == '\n' && cursor_y == 0) {
+ cursor_x = 0;
+ cursor_y = 8;
+ }
+ if (c < ' ') {
+ return;
+ }
+ uint16_t index = 0;
+ if (PrecursorCommand == 0) {
+ // Fonts are offset to start at the space char
+ index = (c - ' ');
+ } else {
+ // This is for extended range
+ // We decode the precursor command to find the offset
+ // Latin starts at 96
+ c -= 0x80;
- switch (PrecursorCommand) {
-
- case 0xC2:
- index = (96 - 32) + (c);
- break; //-32 compensate for chars excluded from font C2 section
- case 0xC3:
- index = (128) + (c);
- break;
-#if defined(LANG_RU) || defined(LANG_UK) || defined(LANG_SR) || defined(LANG_BG) || defined(LANG_MK)
- case 0xD0:
- index = (192) + (c);
- break;
- case 0xD1:
- index = (256) + (c);
- break;
+ switch (PrecursorCommand) {
+ case 0xC2:
+ index = (96 - 32) + (c);
+ break; //-32 compensate for chars excluded from font C2 section
+ case 0xC3:
+ index = (128) + (c);
+ break;
+#if defined(LANG_RU) || defined(LANG_UK) || defined(LANG_SR) || \
+ defined(LANG_BG) || defined(LANG_MK)
+ case 0xD0:
+ index = (192) + (c);
+ break;
+ case 0xD1:
+ index = (256) + (c);
+ break;
#else
- case 0xC4:
- index = (192) + (c);
- break;
- case 0xC5:
- index = (256) + (c);
- break;
+ case 0xC4:
+ index = (192) + (c);
+ break;
+ case 0xC5:
+ index = (256) + (c);
+ break;
#endif
- default:
- return;
- }
- }
- uint8_t* charPointer;
- charPointer = ((uint8_t*) currentFont)
- + ((fontWidth * (fontHeight / 8)) * index);
+ default:
+ return;
+ }
+ }
+ uint8_t* charPointer;
+ charPointer =
+ ((uint8_t*)currentFont) + ((fontWidth * (fontHeight / 8)) * index);
- drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
+ drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
- cursor_x += fontWidth;
+ cursor_x += fontWidth;
}
void OLED::setRotation(bool leftHanded) {
- if (inLeftHandedMode == leftHanded) {
- return;
- }
+ if (inLeftHandedMode == leftHanded) {
+ return;
+ }
- //send command struct again with changes
- if (leftHanded) {
- OLED_Setup_Array[11] = 0xC8; //c1?
- OLED_Setup_Array[19] = 0xA1;
- } else {
- OLED_Setup_Array[11] = 0xC0;
- OLED_Setup_Array[19] = 0xA0;
- }
- i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
- sizeof(OLED_Setup_Array));
- inLeftHandedMode = leftHanded;
+ // send command struct again with changes
+ if (leftHanded) {
+ OLED_Setup_Array[11] = 0xC8; // c1?
+ OLED_Setup_Array[19] = 0xA1;
+ } else {
+ OLED_Setup_Array[11] = 0xC0;
+ OLED_Setup_Array[19] = 0xA0;
+ }
+ FRToSI2C::Transmit(DEVICEADDR_OLED, (uint8_t*)OLED_Setup_Array,
+ sizeof(OLED_Setup_Array));
+ inLeftHandedMode = leftHanded;
- screenBuffer[5] = inLeftHandedMode ? 0 : 32; //display is shifted by 32 in left handed mode as driver ram is 128 wide
- screenBuffer[7] = inLeftHandedMode ? 95 : 0x7F; //End address of the ram segment we are writing to (96 wide)
- screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
+ screenBuffer[5] =
+ inLeftHandedMode ? 0 : 32; // display is shifted by 32 in left handed
+ // mode as driver ram is 128 wide
+ screenBuffer[7] =
+ inLeftHandedMode
+ ? 95
+ : 0x7F; // End address of the ram segment we are writing to (96 wide)
+ screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
}
-//print a string to the current cursor location
+// print a string to the current cursor location
void OLED::print(const char* str) {
- while (str[0]) {
- if (str[0] >= 0x80) {
- drawChar(str[1], str[0]);
- str++; //skip this marker
- } else
- drawChar(str[0]);
- str++;
- }
+ while (str[0]) {
+ if (str[0] >= 0x80) {
+ drawChar(str[1], str[0]);
+ str++; // skip this marker
+ } else
+ drawChar(str[0]);
+ str++;
+ }
}
void OLED::setFont(uint8_t fontNumber) {
- if (fontNumber == 1) {
- //small font
- currentFont = FONT_6x8;
- fontHeight = 8;
- fontWidth = 6;
- } else if (fontNumber == 2) {
- currentFont = ExtraFontChars;
- fontHeight = 16;
- fontWidth = 12;
- } else {
- currentFont = FONT_12;
- fontHeight = 16;
- fontWidth = 12;
- }
+ if (fontNumber == 1) {
+ // small font
+ currentFont = FONT_6x8;
+ fontHeight = 8;
+ fontWidth = 6;
+ } else if (fontNumber == 2) {
+ currentFont = ExtraFontChars;
+ fontHeight = 16;
+ fontWidth = 12;
+ } else {
+ currentFont = FONT_12;
+ fontHeight = 16;
+ fontWidth = 12;
+ }
}
-//maximum places is 5
+// maximum places is 5
void OLED::printNumber(uint16_t number, uint8_t places) {
- char buffer[7] = { 0 };
+ char buffer[7] = {0};
- if (places >= 5) {
- buffer[5] = '0' + number % 10;
- number /= 10;
- }
- if (places > 4) {
- buffer[4] = '0' + number % 10;
- number /= 10;
- }
+ if (places >= 5) {
+ buffer[5] = '0' + number % 10;
+ number /= 10;
+ }
+ if (places > 4) {
+ buffer[4] = '0' + number % 10;
+ number /= 10;
+ }
- if (places > 3) {
- buffer[3] = '0' + number % 10;
- number /= 10;
- }
+ if (places > 3) {
+ buffer[3] = '0' + number % 10;
+ number /= 10;
+ }
- if (places > 2) {
- buffer[2] = '0' + number % 10;
- number /= 10;
- }
+ if (places > 2) {
+ buffer[2] = '0' + number % 10;
+ number /= 10;
+ }
- if (places > 1) {
- buffer[1] = '0' + number % 10;
- number /= 10;
- }
+ if (places > 1) {
+ buffer[1] = '0' + number % 10;
+ number /= 10;
+ }
- buffer[0] = '0' + number % 10;
- number /= 10;
- print(buffer);
+ buffer[0] = '0' + number % 10;
+ number /= 10;
+ print(buffer);
}
void OLED::drawSymbol(uint8_t symbolID) {
- //draw a symbol to the current cursor location
- setFont(2);
- drawChar(' ' + symbolID); // space offset is in all fonts, so we pad it here and remove it later
- setFont(0);
+ // draw a symbol to the current cursor location
+ setFont(2);
+ drawChar(' ' + symbolID); // space offset is in all fonts, so we pad it here
+ // and remove it later
+ setFont(0);
}
-//Draw an area, but y must be aligned on 0/8 offset
+// Draw an area, but y must be aligned on 0/8 offset
void OLED::drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
- const uint8_t* ptr) {
- // Splat this from x->x+wide in two strides
- if (x <= -wide)
- return; //cutoffleft
- if (x > 96)
- return; //cutoff right
+ const uint8_t* ptr) {
+ // Splat this from x->x+wide in two strides
+ if (x <= -wide) return; // cutoffleft
+ if (x > 96) return; // cutoff right
- uint8_t visibleStart = 0;
- uint8_t visibleEnd = wide;
+ uint8_t visibleStart = 0;
+ uint8_t visibleEnd = wide;
- // trimming to draw partials
- if (x < 0) {
- visibleStart -= x; //subtract negative value == add absolute value
- }
- if (x + wide > 96) {
- visibleEnd = 96 - x;
- }
+ // trimming to draw partials
+ if (x < 0) {
+ visibleStart -= x; // subtract negative value == add absolute value
+ }
+ if (x + wide > 96) {
+ visibleEnd = 96 - x;
+ }
- if (y == 0) {
- //Splat first line of data
- for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
- firstStripPtr[xx + x] = ptr[xx];
- }
- }
- if (y == 8 || height == 16) {
- // Splat the second line
- for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
- secondStripPtr[x + xx] = ptr[xx + (height == 16 ? wide : 0)];
- }
- }
+ if (y == 0) {
+ // Splat first line of data
+ for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
+ firstStripPtr[xx + x] = ptr[xx];
+ }
+ }
+ if (y == 8 || height == 16) {
+ // Splat the second line
+ for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
+ secondStripPtr[x + xx] = ptr[xx + (height == 16 ? wide : 0)];
+ }
+ }
}
void OLED::fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
- const uint8_t value) {
- // Splat this from x->x+wide in two strides
- if (x <= -wide)
- return; //cutoffleft
- if (x > 96)
- return; //cutoff right
+ const uint8_t value) {
+ // Splat this from x->x+wide in two strides
+ if (x <= -wide) return; // cutoffleft
+ if (x > 96) return; // cutoff right
- uint8_t visibleStart = 0;
- uint8_t visibleEnd = wide;
+ uint8_t visibleStart = 0;
+ uint8_t visibleEnd = wide;
- // trimming to draw partials
- if (x < 0) {
- visibleStart -= x; //subtract negative value == add absolute value
- }
- if (x + wide > 96) {
- visibleEnd = 96 - x;
- }
+ // trimming to draw partials
+ if (x < 0) {
+ visibleStart -= x; // subtract negative value == add absolute value
+ }
+ if (x + wide > 96) {
+ visibleEnd = 96 - x;
+ }
- if (y == 0) {
- //Splat first line of data
- for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
- firstStripPtr[xx + x] = value;
- }
- }
- if (y == 8 || height == 16) {
- // Splat the second line
- for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
- secondStripPtr[x + xx] = value;
- }
- }
+ if (y == 0) {
+ // Splat first line of data
+ for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
+ firstStripPtr[xx + x] = value;
+ }
+ }
+ if (y == 8 || height == 16) {
+ // Splat the second line
+ for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
+ secondStripPtr[x + xx] = value;
+ }
+ }
}
void OLED::drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
- bool clear) {
- //Draw this in 3 sections
- //This is basically a N wide version of vertical line
+ bool clear) {
+ // Draw this in 3 sections
+ // This is basically a N wide version of vertical line
- //Step 1 : Draw in the top few pixels that are not /8 aligned
- //LSB is at the top of the screen
- uint8_t mask = 0xFF;
- if (y0) {
- mask = mask << (y0 % 8);
- for (uint8_t col = x0; col < x1; col++)
- if (clear)
- firstStripPtr[(y0 / 8) * 96 + col] &= ~mask;
- else
- firstStripPtr[(y0 / 8) * 96 + col] |= mask;
- }
- //Next loop down the line the total number of solids
- if (y0 / 8 != y1 / 8)
- for (uint8_t col = x0; col < x1; col++)
- for (uint8_t r = (y0 / 8); r < (y1 / 8); r++) {
- //This gives us the row index r
- if (clear)
- firstStripPtr[(r * 96) + col] = 0;
- else
- firstStripPtr[(r * 96) + col] = 0xFF;
- }
+ // Step 1 : Draw in the top few pixels that are not /8 aligned
+ // LSB is at the top of the screen
+ uint8_t mask = 0xFF;
+ if (y0) {
+ mask = mask << (y0 % 8);
+ for (uint8_t col = x0; col < x1; col++)
+ if (clear)
+ firstStripPtr[(y0 / 8) * 96 + col] &= ~mask;
+ else
+ firstStripPtr[(y0 / 8) * 96 + col] |= mask;
+ }
+ // Next loop down the line the total number of solids
+ if (y0 / 8 != y1 / 8)
+ for (uint8_t col = x0; col < x1; col++)
+ for (uint8_t r = (y0 / 8); r < (y1 / 8); r++) {
+ // This gives us the row index r
+ if (clear)
+ firstStripPtr[(r * 96) + col] = 0;
+ else
+ firstStripPtr[(r * 96) + col] = 0xFF;
+ }
- //Finally draw the tail
- mask = ~(mask << (y1 % 8));
- for (uint8_t col = x0; col < x1; col++)
- if (clear)
- firstStripPtr[(y1 / 8) * 96 + col] &= ~mask;
- else
- firstStripPtr[(y1 / 8) * 96 + col] |= mask;
+ // Finally draw the tail
+ mask = ~(mask << (y1 % 8));
+ for (uint8_t col = x0; col < x1; col++)
+ if (clear)
+ firstStripPtr[(y1 / 8) * 96 + col] &= ~mask;
+ else
+ firstStripPtr[(y1 / 8) * 96 + col] |= mask;
}
void OLED::drawHeatSymbol(uint8_t state) {
- //Draw symbol 14
-//Then draw over it botom 5 pixels always stay. 8 pixels above that are the levels
- state /= 12; // 0-> 8 range
- //Then we want to draw down (16-(5+state)
- uint8_t cursor_x_temp = cursor_x;
- drawSymbol(14);
- drawFilledRect(cursor_x_temp, 0, cursor_x_temp + 12, 2 + (8 - state), true);
+ // Draw symbol 14
+ // Then draw over it, the bottom 5 pixels always stay. 8 pixels above that are
+ // the levels masks the symbol nicely
+ state /= 12; // 0-> 8 range
+ // Then we want to draw down (16-(5+state)
+ uint8_t cursor_x_temp = cursor_x;
+ drawSymbol(14);
+ drawFilledRect(cursor_x_temp, 0, cursor_x_temp + 12, 2 + (8 - state), true);
}
diff --git a/workspace/TS100/src/Settings.cpp b/workspace/TS100/src/Settings.cpp
index fbafa8f7..c541124c 100644
--- a/workspace/TS100/src/Settings.cpp
+++ b/workspace/TS100/src/Settings.cpp
@@ -4,61 +4,62 @@
* Created on: 29 Sep 2016
* Author: Ralim
*
- * This file holds the users settings and saves / restores them to the devices flash
+ * This file holds the users settings and saves / restores them to the
+ * devices flash
*/
#include "Settings.h"
#include "Setup.h"
-#define FLASH_ADDR (0x8000000|0xFC00)/*Flash start OR'ed with the maximum amount of flash - 1024 bytes*/
+#define FLASH_ADDR \
+ (0x8000000 | \
+ 0xFC00) /*Flash start OR'ed with the maximum amount of flash - 1024 bytes*/
#include "string.h"
volatile systemSettingsType systemSettings;
void saveSettings() {
- //First we erase the flash
- FLASH_EraseInitTypeDef pEraseInit;
- pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
- pEraseInit.Banks = FLASH_BANK_1;
- pEraseInit.NbPages = 1;
- pEraseInit.PageAddress = FLASH_ADDR;
- uint32_t failingAddress = 0;
- HAL_IWDG_Refresh(&hiwdg);
- __HAL_FLASH_CLEAR_FLAG(
- FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
- HAL_FLASH_Unlock();
- HAL_Delay(10);
- HAL_IWDG_Refresh(&hiwdg);
- HAL_FLASHEx_Erase(&pEraseInit, &failingAddress);
- //^ Erase the page of flash (1024 bytes on this stm32)
- //erased the chunk
- //now we program it
- uint16_t *data = (uint16_t*) &systemSettings;
- HAL_FLASH_Unlock();
-
- for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
- HAL_IWDG_Refresh(&hiwdg);
- HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, FLASH_ADDR + (i * 2),
- data[i]);
- }
- HAL_FLASH_Lock();
+ // First we erase the flash
+ FLASH_EraseInitTypeDef pEraseInit;
+ pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
+ pEraseInit.Banks = FLASH_BANK_1;
+ pEraseInit.NbPages = 1;
+ pEraseInit.PageAddress = FLASH_ADDR;
+ uint32_t failingAddress = 0;
+ HAL_IWDG_Refresh(&hiwdg);
+ __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR |
+ FLASH_FLAG_BSY);
+ HAL_FLASH_Unlock();
+ HAL_Delay(10);
+ HAL_IWDG_Refresh(&hiwdg);
+ HAL_FLASHEx_Erase(&pEraseInit, &failingAddress);
+ //^ Erase the page of flash (1024 bytes on this stm32)
+ // erased the chunk
+ // now we program it
+ uint16_t *data = (uint16_t *)&systemSettings;
+ HAL_FLASH_Unlock();
+ for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
+ HAL_IWDG_Refresh(&hiwdg);
+ HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, FLASH_ADDR + (i * 2),
+ data[i]);
+ }
+ HAL_FLASH_Lock();
}
void restoreSettings() {
- //We read the flash
- uint16_t *data = (uint16_t*) &systemSettings;
- for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
- data[i] = *((uint16_t*) (FLASH_ADDR + (i * 2)));
- }
-
- //if the version is correct were done
- //if not we reset and save
- if (systemSettings.version != SETTINGSVERSION) {
- //probably not setup
- resetSettings();
- }
+ // We read the flash
+ uint16_t *data = (uint16_t *)&systemSettings;
+ for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
+ data[i] = *((uint16_t *)(FLASH_ADDR + (i * 2)));
+ }
+ // if the version is correct were done
+ // if not we reset and save
+ if (systemSettings.version != SETTINGSVERSION) {
+ // probably not setup
+ resetSettings();
+ }
}
-//Lookup function for cutoff setting -> X10 voltage
+// Lookup function for cutoff setting -> X10 voltage
/*
* 0=DC
* 1=3S
@@ -67,36 +68,54 @@ void restoreSettings() {
* 4=6S
*/
uint8_t lookupVoltageLevel(uint8_t level) {
- if (level == 0)
- return 90; //9V since iron does not function effectively below this
- else
- return (level * 33) + (33 * 2);
+ if (level == 0)
+ return 90; // 9V since iron does not function effectively below this
+ else
+ return (level * 33) + (33 * 2);
}
void resetSettings() {
- memset((void*) &systemSettings, 0, sizeof(systemSettingsType));
- systemSettings.SleepTemp = 150; //Temperature the iron sleeps at - default 150.0 C
- systemSettings.SleepTime = 6; //How many seconds/minutes we wait until going to sleep - default 1 min
- systemSettings.SolderingTemp = 320; //Default soldering temp is 320.0 C
- systemSettings.cutoutSetting = 0; //default to no cut-off voltage
- systemSettings.version = SETTINGSVERSION;//Store the version number to allow for easier upgrades
- systemSettings.detailedSoldering = 0; // Detailed soldering screen
- systemSettings.detailedIDLE = 0;// Detailed idle screen (off for first time users)
- systemSettings.OrientationMode = 2; //Default to automatic
- systemSettings.sensitivity = 7; //Default high sensitivity
- systemSettings.voltageDiv = 467; //Default divider from schematic
- systemSettings.ShutdownTime = 10;//How many minutes until the unit turns itself off
- systemSettings.boostModeEnabled = 1;//Default to safe, with no boost mode
- systemSettings.BoostTemp = 420; //default to 400C
- systemSettings.autoStartMode = 0; //Auto start off for safety
- systemSettings.coolingTempBlink = 0;//Blink the temperature on the cooling screen when its > 50C
- systemSettings.temperatureInF = 0; //default to 0
- systemSettings.descriptionScrollSpeed = 0; //default to slow
- systemSettings.PID_P = 42;
- systemSettings.PID_I = 50;
- systemSettings.PID_D = 15;
- systemSettings.CalibrationOffset = 2780; // the adc offset
- systemSettings.customTipGain = 0; // The tip type is either default or a custom gain
- systemSettings.tipType = TS_B2;
- saveSettings();
-}
+ memset((void *)&systemSettings, 0, sizeof(systemSettingsType));
+ systemSettings.SleepTemp =
+ 150; // Temperature the iron sleeps at - default 150.0 C
+ systemSettings.SleepTime = 6; // How many seconds/minutes we wait until going
+ // to sleep - default 1 min
+ systemSettings.SolderingTemp = 320; // Default soldering temp is 320.0 C
+ systemSettings.cutoutSetting = 0; // default to no cut-off voltage (or 18W for TS80)
+ systemSettings.version =
+ SETTINGSVERSION; // Store the version number to allow for easier upgrades
+ systemSettings.detailedSoldering = 0; // Detailed soldering screen
+ systemSettings.detailedIDLE =
+ 0; // Detailed idle screen (off for first time users)
+ systemSettings.OrientationMode = 2; // Default to automatic
+ systemSettings.sensitivity = 7; // Default high sensitivity
+#ifdef MODEL_TS80
+ systemSettings.voltageDiv = 780; // Default divider from schematic
+#else
+ systemSettings.voltageDiv = 467; // Default divider from schematic
+#endif
+ systemSettings.ShutdownTime =
+ 10; // How many minutes until the unit turns itself off
+ systemSettings.boostModeEnabled =
+ 1; // Default to having boost mode on as most people prefer itF
+ systemSettings.BoostTemp = 420; // default to 400C
+ systemSettings.autoStartMode = 0; // Auto start off for safety
+ systemSettings.coolingTempBlink =
+ 0; // Blink the temperature on the cooling screen when its > 50C
+ systemSettings.temperatureInF = 0; // default to 0
+ systemSettings.descriptionScrollSpeed = 0; // default to slow
+ systemSettings.PID_P = 42; // PID tuning constants
+ systemSettings.PID_I = 50;
+ systemSettings.PID_D = 15;
+ systemSettings.CalibrationOffset = 2780; // the adc offset
+ systemSettings.customTipGain =
+ 0; // The tip type is either default or a custom gain
+#ifdef MODEL_TS100
+ systemSettings.tipType = TS_B2; // Default to the B2 Tip
+#endif
+#ifdef MODEL_TS80
+
+ systemSettings.tipType = TS_B02; // Default to the B2 Tip
+#endif
+ saveSettings(); // Save defaults
+}
diff --git a/workspace/TS100/src/Setup.c b/workspace/TS100/src/Setup.c
index 5df7a5bf..202f98df 100644
--- a/workspace/TS100/src/Setup.c
+++ b/workspace/TS100/src/Setup.c
@@ -17,9 +17,9 @@ IWDG_HandleTypeDef hiwdg;
TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim3;
-uint16_t ADCReadings[64]; //room for 32 lots of the pair of readings
+uint16_t ADCReadings[64]; // room for 32 lots of the pair of readings
-//Functions
+// Functions
void SystemClock_Config(void);
static void MX_ADC1_Init(void);
static void MX_I2C1_Init(void);
@@ -31,344 +31,340 @@ static void MX_GPIO_Init(void);
static void MX_ADC2_Init(void);
void Setup_HAL() {
- SystemClock_Config();
- MX_GPIO_Init();
- MX_DMA_Init();
- MX_I2C1_Init();
- MX_ADC1_Init();
- MX_ADC2_Init();
- MX_TIM3_Init();
- MX_TIM2_Init();
- MX_IWDG_Init();
- HAL_ADC_Start(&hadc2);
- HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*) ADCReadings, 64); //start DMA of normal readings
- HAL_ADCEx_InjectedStart(&hadc1); //enable injected readings
- HAL_ADCEx_InjectedStart(&hadc2); //enable injected readings
-
-
+ SystemClock_Config();
+ __HAL_AFIO_REMAP_SWJ_DISABLE();
+ MX_GPIO_Init();
+ MX_DMA_Init();
+ MX_I2C1_Init();
+ MX_ADC1_Init();
+ MX_ADC2_Init();
+ MX_TIM3_Init();
+ MX_TIM2_Init();
+ MX_IWDG_Init();
+ HAL_ADC_Start(&hadc2);
+ HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*)ADCReadings,
+ 64); // start DMA of normal readings
+ HAL_ADCEx_InjectedStart(&hadc1); // enable injected readings
+ HAL_ADCEx_InjectedStart(&hadc2); // enable injected readings
}
-//channel 0 -> temperature sensor, 1-> VIN
+// channel 0 -> temperature sensor, 1-> VIN
uint16_t getADC(uint8_t channel) {
- uint32_t sum = 0;
- for (uint8_t i = 0; i < 32; i++)
- sum += ADCReadings[channel + (i * 2)];
- return sum >> 2;
+ uint32_t sum = 0;
+ for (uint8_t i = 0; i < 32; i++) sum += ADCReadings[channel + (i * 2)];
+ return sum >> 2;
}
/** System Clock Configuration
*/
void SystemClock_Config(void) {
+ RCC_OscInitTypeDef RCC_OscInitStruct;
+ RCC_ClkInitTypeDef RCC_ClkInitStruct;
+ RCC_PeriphCLKInitTypeDef PeriphClkInit;
- RCC_OscInitTypeDef RCC_OscInitStruct;
- RCC_ClkInitTypeDef RCC_ClkInitStruct;
- RCC_PeriphCLKInitTypeDef PeriphClkInit;
+ /**Initializes the CPU, AHB and APB busses clocks
+ */
+ RCC_OscInitStruct.OscillatorType =
+ RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_LSI;
+ RCC_OscInitStruct.HSIState = RCC_HSI_ON;
+ RCC_OscInitStruct.HSICalibrationValue = 16;
+ RCC_OscInitStruct.LSIState = RCC_LSI_ON;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
+ RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16; // 64MHz
+ HAL_RCC_OscConfig(&RCC_OscInitStruct);
- /**Initializes the CPU, AHB and APB busses clocks
- */
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI
- | RCC_OSCILLATORTYPE_LSI;
- RCC_OscInitStruct.HSIState = RCC_HSI_ON;
- RCC_OscInitStruct.HSICalibrationValue = 16;
- RCC_OscInitStruct.LSIState = RCC_LSI_ON;
- RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
- RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
- RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16; //64MHz
- HAL_RCC_OscConfig(&RCC_OscInitStruct);
+ /**Initializes the CPU, AHB and APB busses clocks
+ */
+ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK |
+ RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+ RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV16; // TIM
+ // 2,3,4,5,6,7,12,13,14
+ RCC_ClkInitStruct.APB2CLKDivider =
+ RCC_HCLK_DIV1; // 64 mhz to some peripherals and adc
- /**Initializes the CPU, AHB and APB busses clocks
- */
- RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
- | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
- RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
- RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
- RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV16; //TIM 2,3,4,5,6,7,12,13,14
- RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; //64 mhz to some peripherals and adc
+ HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
- HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
+ PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
+ PeriphClkInit.AdcClockSelection =
+ RCC_ADCPCLK2_DIV6; // 6 or 8 are the only non overclocked options
+ HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
- PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
- PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; //6 or 8 are the only non overclocked options
- HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
+ /**Configure the Systick interrupt time
+ */
+ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
- /**Configure the Systick interrupt time
- */
- HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
+ /**Configure the Systick
+ */
+ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
- /**Configure the Systick
- */
- HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
-
- /* SysTick_IRQn interrupt configuration */
- HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);
+ /* SysTick_IRQn interrupt configuration */
+ HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);
}
/* ADC1 init function */
static void MX_ADC1_Init(void) {
- ADC_MultiModeTypeDef multimode;
+ ADC_MultiModeTypeDef multimode;
- ADC_ChannelConfTypeDef sConfig;
- ADC_InjectionConfTypeDef sConfigInjected;
- /**Common config
- */
- hadc1.Instance = ADC1;
- hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
- hadc1.Init.ContinuousConvMode = ENABLE;
- hadc1.Init.DiscontinuousConvMode = DISABLE;
- hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
- hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
- hadc1.Init.NbrOfConversion = 2;
- HAL_ADC_Init(&hadc1);
+ ADC_ChannelConfTypeDef sConfig;
+ ADC_InjectionConfTypeDef sConfigInjected;
+ /**Common config
+ */
+ hadc1.Instance = ADC1;
+ hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
+ hadc1.Init.ContinuousConvMode = ENABLE;
+ hadc1.Init.DiscontinuousConvMode = DISABLE;
+ hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
+ hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
+ hadc1.Init.NbrOfConversion = 2;
+ HAL_ADC_Init(&hadc1);
- /**Configure the ADC multi-mode
- */
- multimode.Mode = ADC_DUALMODE_REGSIMULT_INJECSIMULT;
- HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode);
+ /**Configure the ADC multi-mode
+ */
+ multimode.Mode = ADC_DUALMODE_REGSIMULT_INJECSIMULT;
+ HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode);
- /**Configure Regular Channel
- */
- sConfig.Channel = ADC_CHANNEL_7;
- sConfig.Rank = 1;
- sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
- HAL_ADC_ConfigChannel(&hadc1, &sConfig);
+ /**Configure Regular Channel
+ */
+ sConfig.Channel = TMP36_ADC1_CHANNEL;
+ sConfig.Rank = 1;
+ sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
+ HAL_ADC_ConfigChannel(&hadc1, &sConfig);
- /**Configure Regular Channel
- */
- sConfig.Channel = ADC_CHANNEL_9;
- sConfig.Rank = 2;
- HAL_ADC_ConfigChannel(&hadc1, &sConfig);
+ /**Configure Regular Channel
+ */
+ sConfig.Channel = VIN_ADC1_CHANNEL;
+ sConfig.Rank = 2;
+ HAL_ADC_ConfigChannel(&hadc1, &sConfig);
- /**Configure Injected Channel
- */
- //F in = 10.66 MHz
- /*
- * Injected time is 1 delay clock + (12 adc cycles*4)+4*sampletime =~217 clocks = 0.2ms
- * Charge time is 0.016 uS ideally
- * So Sampling time must be >= 0.016uS
- * 1/10.66MHz is 0.09uS, so 1 CLK is *should* be enough
- * */
- sConfigInjected.InjectedChannel = ADC_CHANNEL_8;
- sConfigInjected.InjectedRank = 1;
- sConfigInjected.InjectedNbrOfConversion = 4;
- sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_7CYCLES_5;
- sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
- sConfigInjected.AutoInjectedConv = DISABLE;
- sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
- sConfigInjected.InjectedOffset = 0;
+ /**Configure Injected Channel
+ */
+ // F in = 10.66 MHz
+ /*
+ * Injected time is 1 delay clock + (12 adc cycles*4)+4*sampletime =~217
+ * clocks = 0.2ms Charge time is 0.016 uS ideally So Sampling time must be >=
+ * 0.016uS 1/10.66MHz is 0.09uS, so 1 CLK is *should* be enough
+ * */
+ sConfigInjected.InjectedChannel = TIP_TEMP_ADC1_CHANNEL;
+ sConfigInjected.InjectedRank = 1;
+ sConfigInjected.InjectedNbrOfConversion = 4;
+ sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_7CYCLES_5;
+ sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
+ sConfigInjected.AutoInjectedConv = DISABLE;
+ sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
+ sConfigInjected.InjectedOffset = 0;
- HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
+ HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
- sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
- sConfigInjected.InjectedRank = 2;
- HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
- sConfigInjected.InjectedRank = 3;
- HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
- sConfigInjected.InjectedRank = 4;
- HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
- SET_BIT(hadc1.Instance->CR1, ( ADC_CR1_JEOCIE )); //Enable end of injected conv irq
- // Run ADC internal calibration
- while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK)
- ;
+ sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
+ sConfigInjected.InjectedRank = 2;
+ HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
+ sConfigInjected.InjectedRank = 3;
+ HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
+ sConfigInjected.InjectedRank = 4;
+ HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
+ SET_BIT(hadc1.Instance->CR1,
+ (ADC_CR1_JEOCIE)); // Enable end of injected conv irq
+ // Run ADC internal calibration
+ while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK)
+ ;
}
/* ADC2 init function */
static void MX_ADC2_Init(void) {
+ ADC_ChannelConfTypeDef sConfig;
+ ADC_InjectionConfTypeDef sConfigInjected;
- ADC_ChannelConfTypeDef sConfig;
- ADC_InjectionConfTypeDef sConfigInjected;
+ /**Common config
+ */
+ hadc2.Instance = ADC2;
+ hadc2.Init.ScanConvMode = ADC_SCAN_ENABLE;
+ hadc2.Init.ContinuousConvMode = ENABLE;
+ hadc2.Init.DiscontinuousConvMode = DISABLE;
+ hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
+ hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
+ hadc2.Init.NbrOfConversion = 2;
+ HAL_ADC_Init(&hadc2);
- /**Common config
- */
- hadc2.Instance = ADC2;
- hadc2.Init.ScanConvMode = ADC_SCAN_ENABLE;
- hadc2.Init.ContinuousConvMode = ENABLE;
- hadc2.Init.DiscontinuousConvMode = DISABLE;
- hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
- hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
- hadc2.Init.NbrOfConversion = 2;
- HAL_ADC_Init(&hadc2);
+ /**Configure Regular Channel
+ */
+ sConfig.Channel = TIP_TEMP_ADC2_CHANNEL;
+ sConfig.Rank = ADC_REGULAR_RANK_1;
+ sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
+ HAL_ADC_ConfigChannel(&hadc2, &sConfig);
+ sConfig.Channel = VIN_ADC2_CHANNEL;
+ sConfig.Rank = ADC_REGULAR_RANK_2;
+ sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
+ HAL_ADC_ConfigChannel(&hadc2, &sConfig);
- /**Configure Regular Channel
- */
- sConfig.Channel = ADC_CHANNEL_8;
- sConfig.Rank = ADC_REGULAR_RANK_1;
- sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
- HAL_ADC_ConfigChannel(&hadc2, &sConfig);
- sConfig.Channel = ADC_CHANNEL_8;
- sConfig.Rank = ADC_REGULAR_RANK_2;
- sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
- HAL_ADC_ConfigChannel(&hadc2, &sConfig);
+ /**Configure Injected Channel
+ */
+ sConfigInjected.InjectedChannel = TIP_TEMP_ADC2_CHANNEL;
+ sConfigInjected.InjectedRank = ADC_INJECTED_RANK_1;
+ sConfigInjected.InjectedNbrOfConversion = 4;
+ sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_7CYCLES_5;
+ sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
+ sConfigInjected.AutoInjectedConv = DISABLE;
+ sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
+ sConfigInjected.InjectedOffset = 0;
+ HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
+ sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
- /**Configure Injected Channel
- */
- sConfigInjected.InjectedChannel = ADC_CHANNEL_8;
- sConfigInjected.InjectedRank = ADC_INJECTED_RANK_1;
- sConfigInjected.InjectedNbrOfConversion = 4;
- sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_7CYCLES_5;
- sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
- sConfigInjected.AutoInjectedConv = DISABLE;
- sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
- sConfigInjected.InjectedOffset = 0;
- HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
- sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
-
- sConfigInjected.InjectedRank = ADC_INJECTED_RANK_2;
- HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
- sConfigInjected.InjectedRank = ADC_INJECTED_RANK_3;
- HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
- sConfigInjected.InjectedRank = ADC_INJECTED_RANK_4;
- HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
-
- // Run ADC internal calibration
- while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK)
- ;
+ sConfigInjected.InjectedRank = ADC_INJECTED_RANK_2;
+ HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
+ sConfigInjected.InjectedRank = ADC_INJECTED_RANK_3;
+ HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
+ sConfigInjected.InjectedRank = ADC_INJECTED_RANK_4;
+ HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
+ // Run ADC internal calibration
+ while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK)
+ ;
}
/* I2C1 init function */
static void MX_I2C1_Init(void) {
-
- hi2c1.Instance = I2C1;
- hi2c1.Init.ClockSpeed = 100000; // OLED doesnt handle >100k when its asleep (off).
- hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
- hi2c1.Init.OwnAddress1 = 0;
- hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
- hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
- hi2c1.Init.OwnAddress2 = 0;
- hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
- hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
- HAL_I2C_Init(&hi2c1);
-
+ hi2c1.Instance = I2C1;
+ hi2c1.Init.ClockSpeed =
+ 100000; // OLED doesnt handle >100k when its asleep (off).
+ hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
+ hi2c1.Init.OwnAddress1 = 0;
+ hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
+ hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
+ hi2c1.Init.OwnAddress2 = 0;
+ hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
+ hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
+ HAL_I2C_Init(&hi2c1);
}
/* IWDG init function */
static void MX_IWDG_Init(void) {
-
- hiwdg.Instance = IWDG;
- hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
- hiwdg.Init.Reload = 100;
- HAL_IWDG_Init(&hiwdg);
-
+ hiwdg.Instance = IWDG;
+ hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
+ hiwdg.Init.Reload = 100;
+ HAL_IWDG_Init(&hiwdg);
}
/* TIM3 init function */
static void MX_TIM3_Init(void) {
+ TIM_ClockConfigTypeDef sClockSourceConfig;
+ TIM_MasterConfigTypeDef sMasterConfig;
+ TIM_OC_InitTypeDef sConfigOC;
- TIM_ClockConfigTypeDef sClockSourceConfig;
- TIM_MasterConfigTypeDef sMasterConfig;
- TIM_OC_InitTypeDef sConfigOC;
+ htim3.Instance = TIM3;
+ htim3.Init.Prescaler = 2;
+ htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
+ htim3.Init.Period = 100; // 10 Khz PWM freq
+ htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; // 4mhz before div
+ htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
+ HAL_TIM_Base_Init(&htim3);
- htim3.Instance = TIM3;
- htim3.Init.Prescaler = 2;
- htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
- htim3.Init.Period = 100; //10 Khz PWM freq
- htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; //4mhz before div
- htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
- HAL_TIM_Base_Init(&htim3);
+ sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
+ HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig);
- sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
- HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig);
+ HAL_TIM_PWM_Init(&htim3);
- HAL_TIM_PWM_Init(&htim3);
+ HAL_TIM_OC_Init(&htim3);
- HAL_TIM_OC_Init(&htim3);
+ sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
+ sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
+ HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig);
- sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
- sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
- HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig);
+ sConfigOC.OCMode = TIM_OCMODE_PWM1;
+ sConfigOC.Pulse = 50;
+ sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
+ sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
+ HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, PWM_Out_CHANNEL);
- sConfigOC.OCMode = TIM_OCMODE_PWM1;
- sConfigOC.Pulse = 50;
- sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
- sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
- HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1);
-
- GPIO_InitTypeDef GPIO_InitStruct;
-
- /**TIM3 GPIO Configuration
- PB4 ------> TIM3_CH1
- */
- GPIO_InitStruct.Pin = PWM_Out_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
- HAL_GPIO_Init(PWM_Out_GPIO_Port, &GPIO_InitStruct);
-
- __HAL_AFIO_REMAP_TIM3_PARTIAL()
- ;
- HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
+ GPIO_InitTypeDef GPIO_InitStruct;
+ /**TIM3 GPIO Configuration
+ PWM_Out_Pin ------> TIM3_CH1
+ */
+ GPIO_InitStruct.Pin = PWM_Out_Pin;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(PWM_Out_GPIO_Port, &GPIO_InitStruct);
+#ifdef MODEL_TS100
+ // Remap TIM3_CH1 to be on pB4
+ __HAL_AFIO_REMAP_TIM3_PARTIAL();
+#else
+ // No re-map required
+#endif
+ HAL_TIM_PWM_Start(&htim3, PWM_Out_CHANNEL);
}
/* TIM3 init function */
static void MX_TIM2_Init(void) {
- /*
- * We use the channel 1 to trigger the ADC at end of PWM period
- * And we use the channel 4 as the PWM modulation source using Interrupts
- * */
- TIM_ClockConfigTypeDef sClockSourceConfig;
- TIM_MasterConfigTypeDef sMasterConfig;
- TIM_OC_InitTypeDef sConfigOC;
+ /*
+ * We use the channel 1 to trigger the ADC at end of PWM period
+ * And we use the channel 4 as the PWM modulation source using Interrupts
+ * */
+ TIM_ClockConfigTypeDef sClockSourceConfig;
+ TIM_MasterConfigTypeDef sMasterConfig;
+ TIM_OC_InitTypeDef sConfigOC;
- //Timer 2 is fairly slow as its being used to run the PWM and trigger the ADC in the PWM off time.
- htim2.Instance = TIM2;
- htim2.Init.Prescaler = 2000; // pwm out is 10k, we want to run our PWM at around 100hz
- htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
- htim2.Init.Period = 122;
- htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; //4mhz before divide
- htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
- HAL_TIM_Base_Init(&htim2);
+ // Timer 2 is fairly slow as its being used to run the PWM and trigger the ADC
+ // in the PWM off time.
+ htim2.Instance = TIM2;
+ htim2.Init.Prescaler =
+ 2000; // pwm out is 10k, we want to run our PWM at around 100hz
+ htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
+ htim2.Init.Period = 122;
+ htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; // 4mhz before divide
+ htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
+ HAL_TIM_Base_Init(&htim2);
- sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
- HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig);
+ sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
+ HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig);
- HAL_TIM_PWM_Init(&htim2);
- HAL_TIM_OC_Init(&htim2);
+ HAL_TIM_PWM_Init(&htim2);
+ HAL_TIM_OC_Init(&htim2);
- sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
- sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
- HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);
+ sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
+ sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
+ HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);
- sConfigOC.OCMode = TIM_OCMODE_PWM1;
- sConfigOC.Pulse = 118;
- /*
- * It takes 4 milliseconds for output to be stable after PWM turns off.
- * Assume ADC samples in 0.5ms
- * We need to set this to 100% + 5.5ms
- * */
- sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
- sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
- HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1);
+ sConfigOC.OCMode = TIM_OCMODE_PWM1;
+ sConfigOC.Pulse = 118;
+ /*
+ * It takes 4 milliseconds for output to be stable after PWM turns off.
+ * Assume ADC samples in 0.5ms
+ * We need to set this to 100% + 5.5ms
+ * */
+ sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
+ sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
+ HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1);
- sConfigOC.OCMode = TIM_OCMODE_PWM1;
- sConfigOC.Pulse = 0;
- sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
- sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
- HAL_TIM_OC_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_4);
-
- HAL_TIM_Base_Start_IT(&htim2);
- HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
- HAL_TIM_PWM_Start_IT(&htim2, TIM_CHANNEL_4);
- HAL_NVIC_EnableIRQ(TIM2_IRQn);
+ sConfigOC.OCMode = TIM_OCMODE_PWM1;
+ sConfigOC.Pulse = 0;
+ sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
+ sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
+ HAL_TIM_OC_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_4);
+ HAL_TIM_Base_Start_IT(&htim2);
+ HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
+ HAL_TIM_PWM_Start_IT(&htim2, TIM_CHANNEL_4);
+ HAL_NVIC_EnableIRQ(TIM2_IRQn);
}
/**
* Enable DMA controller clock
*/
static void MX_DMA_Init(void) {
- /* DMA controller clock enable */
- __HAL_RCC_DMA1_CLK_ENABLE()
- ;
-
- /* DMA interrupt init */
- /* DMA1_Channel1_IRQn interrupt configuration */
- HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 15, 0);
- HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
- /* DMA1_Channel6_IRQn interrupt configuration */
- HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 15, 0);
- HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
- /* DMA1_Channel7_IRQn interrupt configuration */
- HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 15, 0);
- HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
+ /* DMA controller clock enable */
+ __HAL_RCC_DMA1_CLK_ENABLE();
+ /* DMA interrupt init */
+ /* DMA1_Channel1_IRQn interrupt configuration */
+ HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 15, 0);
+ HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
+ /* DMA1_Channel6_IRQn interrupt configuration */
+ HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 15, 0);
+ HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
+ /* DMA1_Channel7_IRQn interrupt configuration */
+ HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 15, 0);
+ HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
}
/** Configure pins as
@@ -382,71 +378,73 @@ static void MX_DMA_Init(void) {
PB1 ------> ADCx_IN9
*/
static void MX_GPIO_Init(void) {
+ GPIO_InitTypeDef GPIO_InitStruct;
- GPIO_InitTypeDef GPIO_InitStruct;
+ /* GPIO Ports Clock Enable */
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ __HAL_RCC_GPIOB_CLK_ENABLE();
- /* GPIO Ports Clock Enable */
- __HAL_RCC_GPIOD_CLK_ENABLE()
- ;
- __HAL_RCC_GPIOA_CLK_ENABLE()
- ;
- __HAL_RCC_GPIOB_CLK_ENABLE()
- ;
+ /*Configure GPIO pin Output Level */
+ HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_RESET);
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+ /*Configure GPIO pins : PD0 PD1 */
+ GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1;
+ GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
+ HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+ /*Configure peripheral I/O remapping */
+ __HAL_AFIO_REMAP_PD01_ENABLE();
+ //^ remap XTAL so that pins can be analog (all input buffers off).
+ // reduces power consumption
- /*Configure GPIO pin Output Level */
- HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_RESET);
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- /*Configure GPIO pins : PD0 PD1 */
- GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+ /*
+ * Configure All pins as analog by default
+ */
+ GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 |
+ GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 |
+ GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_15;
+ GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 |
+#ifdef MODEL_TS100
+ GPIO_PIN_3 |
+#endif
+ GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 |
+ GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |
+ GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
- /*Configure GPIO pins : PA0 PA1 PA2 PA3
- PA4 PA5 PA10 PA15 */
- GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3
- | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12
- | GPIO_PIN_15;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+#ifdef MODEL_TS100
+ /* Pull USB lines low to disable, pull down debug too*/
+ GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_14 | GPIO_PIN_13;
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_13, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_14, GPIO_PIN_RESET);
+#else
+ /* TS80 */
+ /* Leave USB lines open circuit*/
- //Set PA 11 and PA 12 to GND to stop usb detection, 13/14 re-rused for debug
- GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_14 | GPIO_PIN_13;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_RESET);
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET);
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_13, GPIO_PIN_RESET);
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_14, GPIO_PIN_RESET);
+#endif
- /*Configure GPIO pins : KEY_B_Pin KEY_A_Pin */
- GPIO_InitStruct.Pin = KEY_B_Pin | KEY_A_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
- GPIO_InitStruct.Pull = GPIO_PULLUP;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ /*Configure GPIO pins : KEY_B_Pin KEY_A_Pin */
+ GPIO_InitStruct.Pin = KEY_B_Pin | KEY_A_Pin;
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+ GPIO_InitStruct.Pull = GPIO_PULLUP;
+ HAL_GPIO_Init(KEY_B_GPIO_Port, &GPIO_InitStruct);
- /*Configure GPIO pins : TIP_TEMP_Pin VIN_Pin PB2 */
- GPIO_InitStruct.Pin = TIP_TEMP_Pin | VIN_Pin | GPIO_PIN_2;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
- /*Configure GPIO pin : OLED_RESET_Pin */
- GPIO_InitStruct.Pin = OLED_RESET_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(OLED_RESET_GPIO_Port, &GPIO_InitStruct);
- HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_RESET);
-
- /* Configure GPIO pins : INT_Orientation_Pin INT_Movement_Pin */
- /* Not used anymore*/
- GPIO_InitStruct.Pin = INT_Orientation_Pin | INT_Movement_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_PULLUP;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
- /*Configure peripheral I/O remapping */
- __HAL_AFIO_REMAP_PD01_ENABLE();
- //^ remap XTAL so that pins can be analog (all input buffers off).
- // reduces power consumption
+ /*Configure GPIO pin : OLED_RESET_Pin */
+ GPIO_InitStruct.Pin = OLED_RESET_Pin;
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+ HAL_GPIO_Init(OLED_RESET_GPIO_Port, &GPIO_InitStruct);
+ HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_RESET);
+ // Pull down LCD reset
+ HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_RESET);
+ HAL_Delay(10);
+ HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
}
diff --git a/workspace/TS100/src/Translation.cpp b/workspace/TS100/src/Translation.cpp
index ac18ed59..f39785b8 100644
--- a/workspace/TS100/src/Translation.cpp
+++ b/workspace/TS100/src/Translation.cpp
@@ -1,4 +1,5 @@
-// WARNING: THIS FILE WAS AUTO GENERATED BY make_translation.py. PLEASE DO NOT EDIT.
+// WARNING: THIS FILE WAS AUTO GENERATED BY make_translation.py. PLEASE DO NOT
+// EDIT.
#include "Translation.h"
#ifndef LANG
@@ -29,6 +30,7 @@ const char* SettingsDescriptions[] = {
/* TipModel */ "Tip Model selection",
/* SimpleCalibrationMode */ "Simple Calibration using Hot water",
/* AdvancedCalibrationMode */ "Advanced calibration using thermocouple on the tip",
+ /* Power Input */ "The power rating of the power adapter",
};
const char* SettingsCalibrationDone = "Calibration done!";
@@ -81,17 +83,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Soldering\nSettings",
- /* PowerSavingMenu */ "Sleep\nModes",
- /* UIMenu */ "User\nInterface",
- /* AdvancedMenu */ "Advanced\nOptions",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Soldering settings",
- /* PowerSavingMenu */ "Power saving settings",
- /* UIMenu */ "User interface settings",
- /* AdvancedMenu */ "Advanced options",
+ /* SolderingMenu */ "Soldering\nSettings",
+ /* PowerSavingMenu */ "Sleep\nModes",
+ /* UIMenu */ "User\nInterface",
+ /* AdvancedMenu */ "Advanced\nOptions",
};
#endif
@@ -172,17 +167,17 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Поялник\nНастройки",
- /* PowerSavingMenu */ "Режими\nНастройки",
- /* UIMenu */ "Интерфейс\nНастройки",
- /* AdvancedMenu */ "Разширени\nНастройки",
+ /* SolderingMenu */ "Поялник\nНастройки",
+ /* PowerSavingMenu */ "Режими\nНастройки",
+ /* UIMenu */ "Интерфейс\nНастройки",
+ /* AdvancedMenu */ "Разширени\nНастройки",
};
const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Настройки на поялника",
- /* PowerSavingMenu */ "Настройки енергоспестяване",
- /* UIMenu */ "Настройки на интерфейса",
- /* AdvancedMenu */ "Допълнителни настройки",
+ /* SolderingMenu */ "Настройки на поялника",
+ /* PowerSavingMenu */ "Настройки енергоспестяване",
+ /* UIMenu */ "Настройки на интерфейса",
+ /* AdvancedMenu */ "Допълнителни настройки",
};
#endif
@@ -263,17 +258,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Pájecí\nnastavení",
- /* PowerSavingMenu */ "Režim\nspánku",
- /* UIMenu */ "Uživatelské\nrozhraní",
- /* AdvancedMenu */ "Pokročilé\nvolby",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Nastavení pájení (boost, auto start...)",
- /* PowerSavingMenu */ "Nastavení režimu spánku, automatického vypnutí...",
- /* UIMenu */ "Nastavení uživatelského rozhraní.",
- /* AdvancedMenu */ "Pokročilé volby (detailní obrazovky, kalibrace, tovární nastavení...)",
+ /* SolderingMenu */ "Pájecí\nnastavení",
+ /* PowerSavingMenu */ "Režim\nspánku",
+ /* UIMenu */ "Uživatelské\nrozhraní",
+ /* AdvancedMenu */ "Pokročilé\nvolby",
};
#endif
@@ -354,17 +342,17 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Löt-\neinstellungen",
- /* PowerSavingMenu */ "Schlaf-\nmodus",
- /* UIMenu */ "Menü-\neinstellungen",
- /* AdvancedMenu */ "Erweiterte\nEinstellungen",
+ /* SolderingMenu */ "Löt-\neinstellungen",
+ /* PowerSavingMenu */ "Schlaf-\nmodus",
+ /* UIMenu */ "Menü-\neinstellungen",
+ /* AdvancedMenu */ "Erweiterte\nEinstellungen",
};
const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Löteinstellungen",
- /* PowerSavingMenu */ "Energiespareinstellungen",
- /* UIMenu */ "Menüeinstellungen",
- /* AdvancedMenu */ "Erweiterte Einstellungen",
+ /* SolderingMenu */ "Löteinstellungen",
+ /* PowerSavingMenu */ "Energiespareinstellungen",
+ /* UIMenu */ "Menüeinstellungen",
+ /* AdvancedMenu */ "Erweiterte Einstellungen",
};
#endif
@@ -445,17 +433,17 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Soldering\nSettings",
- /* PowerSavingMenu */ "Sleep\nModes",
- /* UIMenu */ "User\nInterface",
- /* AdvancedMenu */ "Advanced\nOptions",
+ /* SolderingMenu */ "Soldering\nSettings",
+ /* PowerSavingMenu */ "Sleep\nModes",
+ /* UIMenu */ "User\nInterface",
+ /* AdvancedMenu */ "Advanced\nOptions",
};
const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Soldering settings",
- /* PowerSavingMenu */ "Power Saving Settings",
- /* UIMenu */ "User Interface settings",
- /* AdvancedMenu */ "Advanced options",
+ /* SolderingMenu */ "Soldering settings",
+ /* PowerSavingMenu */ "Power Saving Settings",
+ /* UIMenu */ "User Interface settings",
+ /* AdvancedMenu */ "Advanced options",
};
#endif
@@ -536,17 +524,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Opciones de\nSoldadura",
- /* PowerSavingMenu */ "Modos de\nReposo",
- /* UIMenu */ "Interfaz\nde Usuario",
- /* AdvancedMenu */ "Opciones\nAvanzadas",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Opciones de Soldadura",
- /* PowerSavingMenu */ "Opciones de ahorro energético",
- /* UIMenu */ "Opciones de interfaz de usuario",
- /* AdvancedMenu */ "Opciones avanzadas",
+ /* SolderingMenu */ "Opciones de\nSoldadura",
+ /* PowerSavingMenu */ "Modos de\nReposo",
+ /* UIMenu */ "Interfaz\nde Usuario",
+ /* AdvancedMenu */ "Opciones\nAvanzadas",
};
#endif
@@ -627,17 +608,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Juotos-\nasetukset",
- /* PowerSavingMenu */ "Lepotilan\nasetukset",
- /* UIMenu */ "Käyttö-\nliittymä",
- /* AdvancedMenu */ "Lisä-\nasetukset",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Juotosasetukset",
- /* PowerSavingMenu */ "Virransäästöasetukset",
- /* UIMenu */ "Käyttöliittymän asetukset",
- /* AdvancedMenu */ "Lisäasetukset",
+ /* SolderingMenu */ "Juotos-\nasetukset",
+ /* PowerSavingMenu */ "Lepotilan\nasetukset",
+ /* UIMenu */ "Käyttö-\nliittymä",
+ /* AdvancedMenu */ "Lisä-\nasetukset",
};
#endif
@@ -718,17 +692,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Soudure\nParamètres",
- /* PowerSavingMenu */ "Mode\nVeille",
- /* UIMenu */ "Interface\nUtilisateur",
- /* AdvancedMenu */ "Options\nAdvanced",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Paramètres de soudage",
- /* PowerSavingMenu */ "Paramètres d'économie d'énergie",
- /* UIMenu */ "Paramètres de l'interface utilisateur",
- /* AdvancedMenu */ "Options avancées",
+ /* SolderingMenu */ "Soudure\nParamètres",
+ /* PowerSavingMenu */ "Mode\nVeille",
+ /* UIMenu */ "Interface\nUtilisateur",
+ /* AdvancedMenu */ "Options\nAdvanced",
};
#endif
@@ -809,17 +776,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Postavke\nlemljenja",
- /* PowerSavingMenu */ "Ušteda\nenergije",
- /* UIMenu */ "Korisničko\nsučelje",
- /* AdvancedMenu */ "Napredne\nopcije",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Postavke pri lemljenju",
- /* PowerSavingMenu */ "Postavke spavanja i štednje energije",
- /* UIMenu */ "Postavke korisničkog sučelja",
- /* AdvancedMenu */ "Upravljanje naprednim opcijama",
+ /* SolderingMenu */ "Postavke\nlemljenja",
+ /* PowerSavingMenu */ "Ušteda\nenergije",
+ /* UIMenu */ "Korisničko\nsučelje",
+ /* AdvancedMenu */ "Napredne\nopcije",
};
#endif
@@ -900,17 +860,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Forrasztás\nBeállítások",
- /* PowerSavingMenu */ "Alvás\nMódok",
- /* UIMenu */ "Felhasználó\nfelület",
- /* AdvancedMenu */ "Speciális\nbeállítások",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Forrasztási beállítások",
- /* PowerSavingMenu */ "Energiatakarékossági beállítások",
- /* UIMenu */ "Felhasználói felület beállításai",
- /* AdvancedMenu */ "Speciális beállítások",
+ /* SolderingMenu */ "Forrasztás\nBeállítások",
+ /* PowerSavingMenu */ "Alvás\nMódok",
+ /* UIMenu */ "Felhasználó\nfelület",
+ /* AdvancedMenu */ "Speciális\nbeállítások",
};
#endif
@@ -1082,17 +1035,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Litavimo\nnustatymai",
- /* PowerSavingMenu */ "Miego\nrežimai",
- /* UIMenu */ "Naudotojo\nsąsaja",
- /* AdvancedMenu */ "Išplėstin.\nnustatymai",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Litavimo nustatymai",
- /* PowerSavingMenu */ "Energijos vartojimo nustatymai",
- /* UIMenu */ "Naudotojo sąsajos nustatymai",
- /* AdvancedMenu */ "Išplėstiniai nustatymai",
+ /* SolderingMenu */ "Litavimo\nnustatymai",
+ /* PowerSavingMenu */ "Miego\nrežimai",
+ /* UIMenu */ "Naudotojo\nsąsaja",
+ /* AdvancedMenu */ "Išplėstin.\nnustatymai",
};
#endif
@@ -1173,17 +1119,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Soldeer\nInstellingen",
- /* PowerSavingMenu */ "Slaap\nModes",
- /* UIMenu */ "Gebruikers-\nInterface",
- /* AdvancedMenu */ "geavanceerde\nInstellingen",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Soldeerinstellingen",
- /* PowerSavingMenu */ "Batterijbesparingsinstellingen",
- /* UIMenu */ "Gebruikersinterface Instellingen",
- /* AdvancedMenu */ "geavanceerde Instellingen",
+ /* SolderingMenu */ "Soldeer\nInstellingen",
+ /* PowerSavingMenu */ "Slaap\nModes",
+ /* UIMenu */ "Gebruikers-\nInterface",
+ /* AdvancedMenu */ "geavanceerde\nInstellingen",
};
#endif
@@ -1264,17 +1203,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Lodde-\ninnst.",
- /* PowerSavingMenu */ "Dvale-\ninnst.",
- /* UIMenu */ "Bruker-\ngrensesn.",
- /* AdvancedMenu */ "Avanserte\nvalg",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Loddeinnstillinger",
- /* PowerSavingMenu */ "Dvaleinnstillinger",
- /* UIMenu */ "Brukergrensesnitt-innstillinger",
- /* AdvancedMenu */ "Avanserte valg",
+ /* SolderingMenu */ "Lodde-\ninnst.",
+ /* PowerSavingMenu */ "Dvale-\ninnst.",
+ /* UIMenu */ "Bruker-\ngrensesn.",
+ /* AdvancedMenu */ "Avanserte\nvalg",
};
#endif
@@ -1355,17 +1287,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Soldering\nSettings",
- /* PowerSavingMenu */ "Sleep\nModes",
- /* UIMenu */ "User\nInterface",
- /* AdvancedMenu */ "Advanced\nOptions",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Soldering settings",
- /* PowerSavingMenu */ "Power Saving Settings",
- /* UIMenu */ "User Interface settings",
- /* AdvancedMenu */ "Advanced options",
+ /* SolderingMenu */ "Soldering\nSettings",
+ /* PowerSavingMenu */ "Sleep\nModes",
+ /* UIMenu */ "User\nInterface",
+ /* AdvancedMenu */ "Advanced\nOptions",
};
#endif
@@ -1446,17 +1371,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Configurações\nSolda",
- /* PowerSavingMenu */ "Modos\nRepouso",
- /* UIMenu */ "Interface\nUsuário",
- /* AdvancedMenu */ "Menu\nAvançado",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Configurações de soldagem",
- /* PowerSavingMenu */ "Configurações de economia de energia",
- /* UIMenu */ "Configurações da interface do usuário",
- /* AdvancedMenu */ "Opções avançadas",
+ /* SolderingMenu */ "Configurações\nSolda",
+ /* PowerSavingMenu */ "Modos\nRepouso",
+ /* UIMenu */ "Interface\nUsuário",
+ /* AdvancedMenu */ "Menu\nAvançado",
};
#endif
@@ -1537,17 +1455,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Параметры\nпайки",
- /* PowerSavingMenu */ "Режим\nсна",
- /* UIMenu */ "Пользовател\nинтерфейс",
- /* AdvancedMenu */ "Дополнител.\nпараметры",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Параметры пайки",
- /* PowerSavingMenu */ "Параметры экономии энергии",
- /* UIMenu */ "Параметры пользовательского интерфейса",
- /* AdvancedMenu */ "Дополнительные параметры",
+ /* SolderingMenu */ "Параметры\nпайки",
+ /* PowerSavingMenu */ "Режим\nсна",
+ /* UIMenu */ "Пользовател\nинтерфейс",
+ /* AdvancedMenu */ "Дополнител.\nпараметры",
};
#endif
@@ -1628,17 +1539,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Soldering\nSettings",
- /* PowerSavingMenu */ "Sleep\nModes",
- /* UIMenu */ "User\nInterface",
- /* AdvancedMenu */ "Advanced\nOptions",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Soldering settings",
- /* PowerSavingMenu */ "Power Saving Settings",
- /* UIMenu */ "User Interface settings",
- /* AdvancedMenu */ "Advanced options",
+ /* SolderingMenu */ "Soldering\nSettings",
+ /* PowerSavingMenu */ "Sleep\nModes",
+ /* UIMenu */ "User\nInterface",
+ /* AdvancedMenu */ "Advanced\nOptions",
};
#endif
@@ -1719,17 +1623,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Postavke\nlemljenja",
- /* PowerSavingMenu */ "Ušteda\nenergije",
- /* UIMenu */ "Korisničke\nopcije",
- /* AdvancedMenu */ "Napredne\nopcije",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Postavke pri lemljenju",
- /* PowerSavingMenu */ "Postavke spavanja i štednje energije",
- /* UIMenu */ "Postavke korisničkih opcija",
- /* AdvancedMenu */ "Upravljanje naprednim opcijama",
+ /* SolderingMenu */ "Postavke\nlemljenja",
+ /* PowerSavingMenu */ "Ušteda\nenergije",
+ /* UIMenu */ "Korisničke\nopcije",
+ /* AdvancedMenu */ "Napredne\nopcije",
};
#endif
@@ -1810,17 +1707,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Lödnings-\ninställningar",
- /* PowerSavingMenu */ "Vilo-\nlägen",
- /* UIMenu */ "Användar-\ngränssnitt",
- /* AdvancedMenu */ "Avancerade\nalternativ",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Lödningsinställningar",
- /* PowerSavingMenu */ "Viloläges-inställningar",
- /* UIMenu */ "Användargränssnitts-inställningar",
- /* AdvancedMenu */ "Avancerade alternativ",
+ /* SolderingMenu */ "Lödnings-\ninställningar",
+ /* PowerSavingMenu */ "Vilo-\nlägen",
+ /* UIMenu */ "Användar-\ngränssnitt",
+ /* AdvancedMenu */ "Avancerade\nalternativ",
};
#endif
@@ -1901,17 +1791,10 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Soldering\nSettings",
- /* PowerSavingMenu */ "Sleep\nModes",
- /* UIMenu */ "User\nInterface",
- /* AdvancedMenu */ "Advanced\nOptions",
-};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Soldering settings",
- /* PowerSavingMenu */ "Power Saving Settings",
- /* UIMenu */ "User Interface settings",
- /* AdvancedMenu */ "Advanced options",
+ /* SolderingMenu */ "Soldering\nSettings",
+ /* PowerSavingMenu */ "Sleep\nModes",
+ /* UIMenu */ "User\nInterface",
+ /* AdvancedMenu */ "Advanced\nOptions",
};
#endif
@@ -1992,17 +1875,9 @@ const char* SettingsShortNames[][2] = {
};
const char* SettingsMenuEntries[4] = {
- /* SolderingMenu */ "Пайка\n",
- /* PowerSavingMenu */ "Сон\n",
- /* UIMenu */ "Інтерфейс\n",
- /* AdvancedMenu */ "Інші\n",
+ /* SolderingMenu */ "Пайка\n",
+ /* PowerSavingMenu */ "Сон\n",
+ /* UIMenu */ "Інтерфейс\n",
+ /* AdvancedMenu */ "Інші\n",
};
-
-const char* SettingsMenuEntriesDescriptions[4] = {
- /* SolderingMenu */ "Налаштування для режиму пайки. Діють при включеному жалі.",
- /* PowerSavingMenu */ "Налаштування при бездіяльності. Корисно що б не обпектися і з часом не спалити житло.",
- /* UIMenu */ "Користувальницький інтерфейс.",
- /* AdvancedMenu */ "Розширені налаштування. Додаткові зручності.",
-};
-
#endif
diff --git a/workspace/TS100/src/gui.cpp b/workspace/TS100/src/gui.cpp
index b78964f6..256f1b57 100644
--- a/workspace/TS100/src/gui.cpp
+++ b/workspace/TS100/src/gui.cpp
@@ -6,15 +6,21 @@
*/
#include "gui.hpp"
-#include "main.hpp"
-#include "cmsis_os.h"
#include "Translation.h"
+#include "cmsis_os.h"
+#include "main.hpp"
#include "string.h"
extern uint32_t lastButtonTime;
void gui_Menu(const menuitem* menu);
+#ifdef MODEL_TS100
static void settings_setInputVRange(void);
static void settings_displayInputVRange(void);
+#else
+static void settings_setInputPRange(void);
+static void settings_displayInputPRange(void);
+
+#endif
static void settings_setSleepTemp(void);
static void settings_displaySleepTemp(void);
static void settings_setSleepTime(void);
@@ -51,13 +57,13 @@ static void settings_displayCalibrate(void);
static void settings_setCalibrateVIN(void);
static void settings_displayCalibrateVIN(void);
-//Calibration Menu
-static void calibration_displaySimpleCal(void); // Hot water cal
+// Calibration Menu
+static void calibration_displaySimpleCal(void); // Hot water cal
static void calibration_enterSimpleCal(void);
-static void calibration_displayAdvancedCal(void); // two point cal
+static void calibration_displayAdvancedCal(void); // two point cal
static void calibration_enterAdvancedCal(void);
-//Menu functions
+// Menu functions
static void settings_displaySolderingMenu(void);
static void settings_enterSolderingMenu(void);
static void settings_displayPowerMenu(void);
@@ -97,7 +103,7 @@ static void settings_enterAdvancedMenu(void);
* Reset Settings
*
*/
-const menuitem rootSettingsMenu[] {
+const menuitem rootSettingsMenu[]{
/*
* Power Source
* Soldering Menu
@@ -106,122 +112,143 @@ const menuitem rootSettingsMenu[] {
* Advanced Menu
* Exit
*/
-{ (const char*) SettingsDescriptions[0], { settings_setInputVRange }, {
- settings_displayInputVRange } }, /*Voltage input*/
-{ (const char*) SettingsMenuEntriesDescriptions[0], {
- settings_enterSolderingMenu }, { settings_displaySolderingMenu } }, /*Soldering*/
-{ (const char*) SettingsMenuEntriesDescriptions[1], { settings_enterPowerMenu },
- { settings_displayPowerMenu } }, /*Sleep Options Menu*/
-{ (const char*) SettingsMenuEntriesDescriptions[2], { settings_enterUIMenu }, {
- settings_displayUIMenu } }, /*UI Menu*/
-{ (const char*) SettingsMenuEntriesDescriptions[3],
- { settings_enterAdvancedMenu }, { settings_displayAdvancedMenu } }, /*Advanced Menu*/
-{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
+#ifdef MODEL_TS100
+ {(const char*)SettingsDescriptions[0],
+ {settings_setInputVRange},
+ {settings_displayInputVRange}}, /*Voltage input*/
+#else
+ {(const char*)SettingsDescriptions[20],
+ {settings_setInputPRange},
+ {settings_displayInputPRange}}, /*Voltage input*/
+#endif
+ {(const char*)NULL,
+ {settings_enterSolderingMenu},
+ {settings_displaySolderingMenu}}, /*Soldering*/
+ {(const char*)NULL,
+ {settings_enterPowerMenu},
+ {settings_displayPowerMenu}}, /*Sleep Options Menu*/
+ {(const char*)NULL,
+ {settings_enterUIMenu},
+ {settings_displayUIMenu}}, /*UI Menu*/
+ {(const char*)NULL,
+ {settings_enterAdvancedMenu},
+ {settings_displayAdvancedMenu}}, /*Advanced Menu*/
+ {NULL, {NULL}, {NULL}} // end of menu marker. DO NOT REMOVE
};
const menuitem solderingMenu[] = {
-/*
- * Boost Mode Enabled
- * Boost Mode Temp
- * Auto Start
- */
-{ (const char*) SettingsDescriptions[8], { settings_setBoostModeEnabled }, {
- settings_displayBoostModeEnabled } }, /*Enable Boost*/
-{ (const char*) SettingsDescriptions[9], { settings_setBoostTemp }, {
- settings_displayBoostTemp } }, /*Boost Temp*/
-{ (const char*) SettingsDescriptions[10], { settings_setAutomaticStartMode }, {
- settings_displayAutomaticStartMode } }, /*Auto start*/
-{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
+ /*
+ * Boost Mode Enabled
+ * Boost Mode Temp
+ * Auto Start
+ */
+ {(const char*)SettingsDescriptions[8],
+ {settings_setBoostModeEnabled},
+ {settings_displayBoostModeEnabled}}, /*Enable Boost*/
+ {(const char*)SettingsDescriptions[9],
+ {settings_setBoostTemp},
+ {settings_displayBoostTemp}}, /*Boost Temp*/
+ {(const char*)SettingsDescriptions[10],
+ {settings_setAutomaticStartMode},
+ {settings_displayAutomaticStartMode}}, /*Auto start*/
+ {NULL, {NULL}, {NULL}} // end of menu marker. DO NOT REMOVE
};
const menuitem UIMenu[] = {
-/*
- // Language
- * Scrolling Speed
- * Temperature Unit
- * Display orientation
- * Cooldown blink
- */
-{ (const char*) SettingsDescriptions[5], { settings_setTempF }, {
- settings_displayTempF } }, /* Temperature units*/
-{ (const char*) SettingsDescriptions[7], { settings_setDisplayRotation }, {
- settings_displayDisplayRotation } }, /*Display Rotation*/
-{ (const char*) SettingsDescriptions[11], { settings_setCoolingBlinkEnabled }, {
- settings_displayCoolingBlinkEnabled } }, /*Cooling blink warning*/
-{ (const char*) SettingsDescriptions[16], { settings_setScrollSpeed }, {
- settings_displayScrollSpeed } }, /*Scroll Speed for descriptions*/
-{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
+ /*
+ // Language
+ * Scrolling Speed
+ * Temperature Unit
+ * Display orientation
+ * Cooldown blink
+ */
+ {(const char*)SettingsDescriptions[5],
+ {settings_setTempF},
+ {settings_displayTempF}}, /* Temperature units*/
+ {(const char*)SettingsDescriptions[7],
+ {settings_setDisplayRotation},
+ {settings_displayDisplayRotation}}, /*Display Rotation*/
+ {(const char*)SettingsDescriptions[11],
+ {settings_setCoolingBlinkEnabled},
+ {settings_displayCoolingBlinkEnabled}}, /*Cooling blink warning*/
+ {(const char*)SettingsDescriptions[16],
+ {settings_setScrollSpeed},
+ {settings_displayScrollSpeed}}, /*Scroll Speed for descriptions*/
+ {NULL, {NULL}, {NULL}} // end of menu marker. DO NOT REMOVE
};
const menuitem PowerMenu[] = {
-/*
- * Sleep Temp
- * Sleep Time
- * Shutdown Time
- * Motion Sensitivity
- */
-{ (const char*) SettingsDescriptions[1], { settings_setSleepTemp }, {
- settings_displaySleepTemp } }, /*Sleep Temp*/
-{ (const char*) SettingsDescriptions[2], { settings_setSleepTime }, {
- settings_displaySleepTime } }, /*Sleep Time*/
-{ (const char*) SettingsDescriptions[3], { settings_setShutdownTime }, {
- settings_displayShutdownTime } }, /*Shutdown Time*/
-{ (const char*) SettingsDescriptions[4], { settings_setSensitivity }, {
- settings_displaySensitivity } }, /* Motion Sensitivity*/
-{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
+ /*
+ * Sleep Temp
+ * Sleep Time
+ * Shutdown Time
+ * Motion Sensitivity
+ */
+ {(const char*)SettingsDescriptions[1],
+ {settings_setSleepTemp},
+ {settings_displaySleepTemp}}, /*Sleep Temp*/
+ {(const char*)SettingsDescriptions[2],
+ {settings_setSleepTime},
+ {settings_displaySleepTime}}, /*Sleep Time*/
+ {(const char*)SettingsDescriptions[3],
+ {settings_setShutdownTime},
+ {settings_displayShutdownTime}}, /*Shutdown Time*/
+ {(const char*)SettingsDescriptions[4],
+ {settings_setSensitivity},
+ {settings_displaySensitivity}}, /* Motion Sensitivity*/
+ {NULL, {NULL}, {NULL}} // end of menu marker. DO NOT REMOVE
};
const menuitem advancedMenu[] = {
-/*
- * Detailed IDLE
- * Detailed Soldering
- * Logo Time
- * Calibrate Temperature
- * Calibrate Input V
- * Reset Settings
- */
-{ (const char*) SettingsDescriptions[6], { settings_setAdvancedIDLEScreens }, {
- settings_displayAdvancedIDLEScreens } }, /* Advanced idle screen*/
-{ (const char*) SettingsDescriptions[15],
- { settings_setAdvancedSolderingScreens }, {
- settings_displayAdvancedSolderingScreens } }, /* Advanced soldering screen*/
-{ (const char*) SettingsDescriptions[13], { settings_setResetSettings }, {
- settings_displayResetSettings } }, /*Resets settings*/
-{ (const char*) SettingsDescriptions[17], { settings_setTipModel }, {
- settings_displayTipModel } }, /*Select tip Model */
-{ (const char*) SettingsDescriptions[12], { settings_setCalibrate }, {
- settings_displayCalibrate } }, /*Calibrate tip*/
-{ (const char*) SettingsDescriptions[14], { settings_setCalibrateVIN }, {
- settings_displayCalibrateVIN } }, /*Voltage input cal*/
-#ifdef PIDSETTINGS
-
- { (const char*) SettingsDescriptions[17], {settings_setPIDP}, {
- settings_displayPIDP}}, /*Voltage input cal*/
- { (const char*) SettingsDescriptions[18], {settings_setPIDI}, {
- settings_displayPIDI}}, /*Voltage input cal*/
- { (const char*) SettingsDescriptions[19], {settings_setPIDD}, {
- settings_displayPIDD}}, /*Voltage input cal*/
-#endif
- { NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
+ /*
+ * Detailed IDLE
+ * Detailed Soldering
+ * Logo Time
+ * Calibrate Temperature
+ * Calibrate Input V
+ * Reset Settings
+ */
+ {(const char*)SettingsDescriptions[6],
+ {settings_setAdvancedIDLEScreens},
+ {settings_displayAdvancedIDLEScreens}}, /* Advanced idle screen*/
+ {(const char*)SettingsDescriptions[15],
+ {settings_setAdvancedSolderingScreens},
+ {settings_displayAdvancedSolderingScreens}}, /* Advanced soldering screen*/
+ {(const char*)SettingsDescriptions[13],
+ {settings_setResetSettings},
+ {settings_displayResetSettings}}, /*Resets settings*/
+ {(const char*)SettingsDescriptions[17],
+ {settings_setTipModel},
+ {settings_displayTipModel}}, /*Select tip Model */
+ {(const char*)SettingsDescriptions[12],
+ {settings_setCalibrate},
+ {settings_displayCalibrate}}, /*Calibrate tip*/
+ {(const char*)SettingsDescriptions[14],
+ {settings_setCalibrateVIN},
+ {settings_displayCalibrateVIN}}, /*Voltage input cal*/
+ {NULL, {NULL}, {NULL}} // end of menu marker. DO NOT REMOVE
};
-const menuitem calibrationMenu[] { { (const char*) SettingsDescriptions[6], {
- calibration_enterSimpleCal }, { calibration_displaySimpleCal } },
-/* Simple Cal*/
-{ (const char*) SettingsDescriptions[6], { calibration_enterAdvancedCal }, {
- calibration_displayAdvancedCal } }, /* Advanced Cal */
-{ NULL, { NULL }, { NULL } } };
+const menuitem calibrationMenu[]{
+ {(const char*)SettingsDescriptions[6],
+ {calibration_enterSimpleCal},
+ {calibration_displaySimpleCal}},
+ /* Simple Cal*/
+ {(const char*)SettingsDescriptions[6],
+ {calibration_enterAdvancedCal},
+ {calibration_displayAdvancedCal}}, /* Advanced Cal */
+ {NULL, {NULL}, {NULL}}};
static void printShortDescriptionSingleLine(uint32_t shortDescIndex) {
- lcd.setFont(0);
- lcd.setCharCursor(0, 0);
- lcd.print(SettingsShortNames[shortDescIndex][0]);
+ OLED::setFont(0);
+ OLED::setCharCursor(0, 0);
+ OLED::print(SettingsShortNames[shortDescIndex][0]);
}
static void printShortDescriptionDoubleLine(uint32_t shortDescIndex) {
- lcd.setFont(1);
- lcd.setCharCursor(0, 0);
- lcd.print(SettingsShortNames[shortDescIndex][0]);
- lcd.setCharCursor(0, 1);
- lcd.print(SettingsShortNames[shortDescIndex][1]);
+ OLED::setFont(1);
+ OLED::setCharCursor(0, 0);
+ OLED::print(SettingsShortNames[shortDescIndex][0]);
+ OLED::setCharCursor(0, 1);
+ OLED::print(SettingsShortNames[shortDescIndex][1]);
}
/**
@@ -232,454 +259,497 @@ static void printShortDescriptionDoubleLine(uint32_t shortDescIndex) {
* description.
*/
static void printShortDescription(uint32_t shortDescIndex,
- uint16_t cursorCharPosition) {
- // print short description (default single line, explicit double line)
- if (SettingsShortNameType == SHORT_NAME_DOUBLE_LINE) {
- printShortDescriptionDoubleLine(shortDescIndex);
- } else {
- printShortDescriptionSingleLine(shortDescIndex);
- }
+ uint16_t cursorCharPosition) {
+ // print short description (default single line, explicit double line)
+ if (SettingsShortNameType == SHORT_NAME_DOUBLE_LINE) {
+ printShortDescriptionDoubleLine(shortDescIndex);
+ } else {
+ printShortDescriptionSingleLine(shortDescIndex);
+ }
- // prepare cursor for value
- lcd.setFont(0);
- lcd.setCharCursor(cursorCharPosition, 0);
+ // prepare cursor for value
+ OLED::setFont(0);
+ OLED::setCharCursor(cursorCharPosition, 0);
}
static int userConfirmation(const char* message) {
- uint16_t messageWidth = FONT_12_WIDTH * (strlen(message) + 7);
- uint32_t messageStart = xTaskGetTickCount();
+ uint16_t messageWidth = FONT_12_WIDTH * (strlen(message) + 7);
+ uint32_t messageStart = xTaskGetTickCount();
- lcd.setFont(0);
- lcd.setCursor(0, 0);
- int16_t lastOffset = -1;
- bool lcdRefresh = true;
+ OLED::setFont(0);
+ OLED::setCursor(0, 0);
+ int16_t lastOffset = -1;
+ bool lcdRefresh = true;
- for (;;) {
+ for (;;) {
+ int16_t messageOffset =
+ ((xTaskGetTickCount() - messageStart) /
+ (systemSettings.descriptionScrollSpeed == 1 ? 1 : 2));
+ messageOffset %= messageWidth; // Roll around at the end
- int16_t messageOffset = ((xTaskGetTickCount() - messageStart)
- / (systemSettings.descriptionScrollSpeed == 1 ? 1 : 2));
- messageOffset %= messageWidth; //Roll around at the end
+ if (lastOffset != messageOffset) {
+ OLED::clearScreen();
- if (lastOffset != messageOffset) {
- lcd.clearScreen();
+ //^ Rolling offset based on time
+ OLED::setCursor((OLED_WIDTH - messageOffset), 0);
+ OLED::print(message);
+ lastOffset = messageOffset;
+ lcdRefresh = true;
+ }
- //^ Rolling offset based on time
- lcd.setCursor((OLED_WIDTH - messageOffset), 0);
- lcd.print(message);
- lastOffset = messageOffset;
- lcdRefresh = true;
- }
+ ButtonState buttons = getButtonState();
+ switch (buttons) {
+ case BUTTON_F_SHORT:
+ // User confirmed
+ return 1;
- ButtonState buttons = getButtonState();
- switch (buttons) {
- case BUTTON_F_SHORT:
- //User confirmed
- return 1;
+ case BUTTON_NONE:
+ break;
+ default:
+ case BUTTON_BOTH:
+ case BUTTON_B_SHORT:
+ case BUTTON_F_LONG:
+ case BUTTON_B_LONG:
+ return 0;
+ }
- case BUTTON_NONE:
- break;
- default:
- case BUTTON_BOTH:
- case BUTTON_B_SHORT:
- case BUTTON_F_LONG:
- case BUTTON_B_LONG:
- return 0;
- }
-
- if (lcdRefresh) {
- lcd.refresh();
- osDelay(40);
- lcdRefresh = false;
- }
- }
- return 0;
+ if (lcdRefresh) {
+ OLED::refresh();
+ osDelay(40);
+ lcdRefresh = false;
+ }
+ }
+ return 0;
}
-
+#ifdef MODEL_TS100
static void settings_setInputVRange(void) {
- systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5;
+ systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5;
}
static void settings_displayInputVRange(void) {
- printShortDescription(0, 6);
+ printShortDescription(0, 6);
- if (systemSettings.cutoutSetting) {
- lcd.drawChar('0' + 2 + systemSettings.cutoutSetting);
- lcd.drawChar('S');
- } else {
- lcd.print("DC");
- }
+ if (systemSettings.cutoutSetting) {
+ OLED::drawChar('0' + 2 + systemSettings.cutoutSetting);
+ OLED::drawChar('S');
+ } else {
+ OLED::print("DC");
+ }
+}
+#else
+static void settings_setInputPRange(void) {
+ systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 2;
}
+static void settings_displayInputPRange(void) {
+ printShortDescription(0, 5);
+//0 = 18W, 1=24W
+ switch(systemSettings.cutoutSetting)
+ {
+ case 0:
+ OLED::print("18W");
+ break;
+ case 1:
+ OLED::print("24W");
+ break;
+ default:
+ break;
+ }
+
+}
+
+#endif
static void settings_setSleepTemp(void) {
- //If in C, 10 deg, if in F 20 deg
- if (systemSettings.temperatureInF) {
- systemSettings.SleepTemp += 20;
- if (systemSettings.SleepTemp > 580)
- systemSettings.SleepTemp = 120;
- } else {
- systemSettings.SleepTemp += 10;
- if (systemSettings.SleepTemp > 300)
- systemSettings.SleepTemp = 50;
- }
+ // If in C, 10 deg, if in F 20 deg
+ if (systemSettings.temperatureInF) {
+ systemSettings.SleepTemp += 20;
+ if (systemSettings.SleepTemp > 580) systemSettings.SleepTemp = 120;
+ } else {
+ systemSettings.SleepTemp += 10;
+ if (systemSettings.SleepTemp > 300) systemSettings.SleepTemp = 50;
+ }
}
static void settings_displaySleepTemp(void) {
- printShortDescription(1, 5);
- lcd.printNumber(systemSettings.SleepTemp, 3);
+ printShortDescription(1, 5);
+ OLED::printNumber(systemSettings.SleepTemp, 3);
}
static void settings_setSleepTime(void) {
- systemSettings.SleepTime++; // Go up 1 minute at a time
- if (systemSettings.SleepTime >= 16) {
- systemSettings.SleepTime = 0; // can't set time over 10 mins
- }
- // Remember that ^ is the time of no movement
- if (PCBVersion == 3)
- systemSettings.SleepTime = 0; //Disable sleep on no accel
+ systemSettings.SleepTime++; // Go up 1 minute at a time
+ if (systemSettings.SleepTime >= 16) {
+ systemSettings.SleepTime = 0; // can't set time over 10 mins
+ }
+ // Remember that ^ is the time of no movement
+ if (PCBVersion == 3)
+ systemSettings.SleepTime = 0; // Disable sleep on no accel
}
static void settings_displaySleepTime(void) {
- printShortDescription(2, 5);
- if (systemSettings.SleepTime == 0) {
- lcd.print(OffString);
- } else if (systemSettings.SleepTime < 6) {
- lcd.printNumber(systemSettings.SleepTime * 10, 2);
- lcd.drawChar('S');
- } else {
- lcd.printNumber(systemSettings.SleepTime - 5, 2);
- lcd.drawChar('M');
- }
+ printShortDescription(2, 5);
+ if (systemSettings.SleepTime == 0) {
+ OLED::print(OffString);
+ } else if (systemSettings.SleepTime < 6) {
+ OLED::printNumber(systemSettings.SleepTime * 10, 2);
+ OLED::drawChar('S');
+ } else {
+ OLED::printNumber(systemSettings.SleepTime - 5, 2);
+ OLED::drawChar('M');
+ }
}
static void settings_setShutdownTime(void) {
- systemSettings.ShutdownTime++;
- if (systemSettings.ShutdownTime > 60) {
- systemSettings.ShutdownTime = 0; // wrap to off
- }
- if (PCBVersion == 3)
- systemSettings.ShutdownTime = 0; //Disable shutdown on no accel
+ systemSettings.ShutdownTime++;
+ if (systemSettings.ShutdownTime > 60) {
+ systemSettings.ShutdownTime = 0; // wrap to off
+ }
+ if (PCBVersion == 3)
+ systemSettings.ShutdownTime = 0; // Disable shutdown on no accel
}
static void settings_displayShutdownTime(void) {
- printShortDescription(3, 5);
- if (systemSettings.ShutdownTime == 0) {
- lcd.print(OffString);
- } else {
- lcd.printNumber(systemSettings.ShutdownTime, 2);
- lcd.drawChar('M');
- }
+ printShortDescription(3, 5);
+ if (systemSettings.ShutdownTime == 0) {
+ OLED::print(OffString);
+ } else {
+ OLED::printNumber(systemSettings.ShutdownTime, 2);
+ OLED::drawChar('M');
+ }
}
static void settings_setTempF(void) {
- systemSettings.temperatureInF = !systemSettings.temperatureInF;
- if (systemSettings.temperatureInF) {
- //Change sleep, boost and soldering temps to the F equiv
- //C to F == F= ( (C*9) +160)/5
- systemSettings.BoostTemp = ((systemSettings.BoostTemp * 9) + 160) / 5;
- systemSettings.SolderingTemp =
- ((systemSettings.SolderingTemp * 9) + 160) / 5;
- systemSettings.SleepTemp = ((systemSettings.SleepTemp * 9) + 160) / 5;
- } else {
- //Change sleep, boost and soldering temps to the C equiv
- // F->C == C = ((F-32)*5)/9
- systemSettings.BoostTemp = ((systemSettings.BoostTemp - 32) * 5) / 9;
- systemSettings.SolderingTemp = ((systemSettings.SolderingTemp - 32) * 5)
- / 9;
- systemSettings.SleepTemp = ((systemSettings.SleepTemp - 32) * 5) / 9;
-
- }
- // Rescale both to be multiples of 10
- systemSettings.BoostTemp = systemSettings.BoostTemp / 10;
- systemSettings.BoostTemp *= 10;
- systemSettings.SolderingTemp = systemSettings.SolderingTemp / 10;
- systemSettings.SolderingTemp *= 10;
- systemSettings.SleepTemp = systemSettings.SleepTemp / 10;
- systemSettings.SleepTemp *= 10;
-
+ systemSettings.temperatureInF = !systemSettings.temperatureInF;
+ if (systemSettings.temperatureInF) {
+ // Change sleep, boost and soldering temps to the F equiv
+ // C to F == F= ( (C*9) +160)/5
+ systemSettings.BoostTemp = ((systemSettings.BoostTemp * 9) + 160) / 5;
+ systemSettings.SolderingTemp =
+ ((systemSettings.SolderingTemp * 9) + 160) / 5;
+ systemSettings.SleepTemp = ((systemSettings.SleepTemp * 9) + 160) / 5;
+ } else {
+ // Change sleep, boost and soldering temps to the C equiv
+ // F->C == C = ((F-32)*5)/9
+ systemSettings.BoostTemp = ((systemSettings.BoostTemp - 32) * 5) / 9;
+ systemSettings.SolderingTemp =
+ ((systemSettings.SolderingTemp - 32) * 5) / 9;
+ systemSettings.SleepTemp = ((systemSettings.SleepTemp - 32) * 5) / 9;
+ }
+ // Rescale both to be multiples of 10
+ systemSettings.BoostTemp = systemSettings.BoostTemp / 10;
+ systemSettings.BoostTemp *= 10;
+ systemSettings.SolderingTemp = systemSettings.SolderingTemp / 10;
+ systemSettings.SolderingTemp *= 10;
+ systemSettings.SleepTemp = systemSettings.SleepTemp / 10;
+ systemSettings.SleepTemp *= 10;
}
static void settings_displayTempF(void) {
- printShortDescription(5, 7);
+ printShortDescription(5, 7);
- lcd.drawChar((systemSettings.temperatureInF) ? 'F' : 'C');
+ OLED::drawChar((systemSettings.temperatureInF) ? 'F' : 'C');
}
static void settings_setSensitivity(void) {
- systemSettings.sensitivity++;
- systemSettings.sensitivity = systemSettings.sensitivity % 10;
+ systemSettings.sensitivity++;
+ systemSettings.sensitivity = systemSettings.sensitivity % 10;
}
static void settings_displaySensitivity(void) {
- printShortDescription(4, 7);
- lcd.printNumber(systemSettings.sensitivity, 1);
+ printShortDescription(4, 7);
+ OLED::printNumber(systemSettings.sensitivity, 1);
}
static void settings_setAdvancedSolderingScreens(void) {
- systemSettings.detailedSoldering = !systemSettings.detailedSoldering;
+ systemSettings.detailedSoldering = !systemSettings.detailedSoldering;
}
static void settings_displayAdvancedSolderingScreens(void) {
- printShortDescription(15, 7);
+ printShortDescription(15, 7);
- lcd.drawCheckbox(systemSettings.detailedSoldering);
+ OLED::drawCheckbox(systemSettings.detailedSoldering);
}
static void settings_setAdvancedIDLEScreens(void) {
- systemSettings.detailedIDLE = !systemSettings.detailedIDLE;
+ systemSettings.detailedIDLE = !systemSettings.detailedIDLE;
}
static void settings_displayAdvancedIDLEScreens(void) {
- printShortDescription(6, 7);
+ printShortDescription(6, 7);
- lcd.drawCheckbox(systemSettings.detailedIDLE);
+ OLED::drawCheckbox(systemSettings.detailedIDLE);
}
static void settings_setScrollSpeed(void) {
-
- if (systemSettings.descriptionScrollSpeed == 0)
- systemSettings.descriptionScrollSpeed = 1;
- else
- systemSettings.descriptionScrollSpeed = 0;
+ if (systemSettings.descriptionScrollSpeed == 0)
+ systemSettings.descriptionScrollSpeed = 1;
+ else
+ systemSettings.descriptionScrollSpeed = 0;
}
static void settings_displayScrollSpeed(void) {
- printShortDescription(16, 7);
- lcd.drawChar(
- (systemSettings.descriptionScrollSpeed) ?
- SettingFastChar : SettingSlowChar);
+ printShortDescription(16, 7);
+ OLED::drawChar((systemSettings.descriptionScrollSpeed) ? SettingFastChar
+ : SettingSlowChar);
}
static void settings_setDisplayRotation(void) {
- systemSettings.OrientationMode++;
- systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
- switch (systemSettings.OrientationMode) {
- case 0:
- lcd.setRotation(false);
- break;
- case 1:
- lcd.setRotation(true);
- break;
- case 2:
- //do nothing on auto
- break;
- default:
- break;
- }
+ systemSettings.OrientationMode++;
+ systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
+ switch (systemSettings.OrientationMode) {
+ case 0:
+ OLED::setRotation(false);
+ break;
+ case 1:
+ OLED::setRotation(true);
+ break;
+ case 2:
+ // do nothing on auto
+ break;
+ default:
+ break;
+ }
}
static void settings_displayDisplayRotation(void) {
- printShortDescription(7, 7);
+ printShortDescription(7, 7);
- switch (systemSettings.OrientationMode) {
- case 0:
- lcd.drawChar(SettingRightChar);
- break;
- case 1:
- lcd.drawChar(SettingLeftChar);
- break;
- case 2:
- lcd.drawChar(SettingAutoChar);
- break;
- default:
- lcd.drawChar(SettingRightChar);
- break;
- }
+ switch (systemSettings.OrientationMode) {
+ case 0:
+ OLED::drawChar(SettingRightChar);
+ break;
+ case 1:
+ OLED::drawChar(SettingLeftChar);
+ break;
+ case 2:
+ OLED::drawChar(SettingAutoChar);
+ break;
+ default:
+ OLED::drawChar(SettingRightChar);
+ break;
+ }
}
static void settings_setBoostModeEnabled(void) {
- systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled;
+ systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled;
}
static void settings_displayBoostModeEnabled(void) {
- printShortDescription(8, 7);
+ printShortDescription(8, 7);
- lcd.drawCheckbox(systemSettings.boostModeEnabled);
+ OLED::drawCheckbox(systemSettings.boostModeEnabled);
}
static void settings_setBoostTemp(void) {
-
- if (systemSettings.temperatureInF) {
- systemSettings.BoostTemp += 20; // Go up 20F at a time
- if (systemSettings.BoostTemp > 850) {
- systemSettings.BoostTemp = 480; // loop back at 250
- }
- } else {
- systemSettings.BoostTemp += 10; // Go up 10C at a time
- if (systemSettings.BoostTemp > 450) {
- systemSettings.BoostTemp = 250; // loop back at 250
- }
- }
+ if (systemSettings.temperatureInF) {
+ systemSettings.BoostTemp += 20; // Go up 20F at a time
+ if (systemSettings.BoostTemp > 850) {
+ systemSettings.BoostTemp = 480; // loop back at 250
+ }
+ } else {
+ systemSettings.BoostTemp += 10; // Go up 10C at a time
+ if (systemSettings.BoostTemp > 450) {
+ systemSettings.BoostTemp = 250; // loop back at 250
+ }
+ }
}
static void settings_displayBoostTemp(void) {
- printShortDescription(9, 5);
- lcd.printNumber(systemSettings.BoostTemp, 3);
+ printShortDescription(9, 5);
+ OLED::printNumber(systemSettings.BoostTemp, 3);
}
static void settings_setAutomaticStartMode(void) {
- systemSettings.autoStartMode++;
- systemSettings.autoStartMode %= 2;
+ systemSettings.autoStartMode++;
+ systemSettings.autoStartMode %= 2;
}
static void settings_displayAutomaticStartMode(void) {
- printShortDescription(10, 7);
- lcd.drawCheckbox(systemSettings.autoStartMode);
+ printShortDescription(10, 7);
+ OLED::drawCheckbox(systemSettings.autoStartMode);
}
static void settings_setCoolingBlinkEnabled(void) {
- systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink;
+ systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink;
}
static void settings_displayCoolingBlinkEnabled(void) {
- printShortDescription(11, 7);
+ printShortDescription(11, 7);
- lcd.drawCheckbox(systemSettings.coolingTempBlink);
+ OLED::drawCheckbox(systemSettings.coolingTempBlink);
}
static void settings_setResetSettings(void) {
- if (userConfirmation(SettingsResetWarning)) {
- resetSettings();
+ if (userConfirmation(SettingsResetWarning)) {
+ resetSettings();
- lcd.setFont(0);
- lcd.setCursor(0, 0);
- lcd.print("RESET OK");
- lcd.refresh();
+ OLED::setFont(0);
+ OLED::setCursor(0, 0);
+ OLED::print("RESET OK");
+ OLED::refresh();
- waitForButtonPressOrTimeout(200);
- }
+ waitForButtonPressOrTimeout(200); // 2 second timeout
+ }
}
static void settings_displayResetSettings(void) {
- printShortDescription(13, 7);
+ printShortDescription(13, 7);
}
static void settings_setTipModel(void) {
- systemSettings.tipType++;
- systemSettings.tipType %= (Tip_Custom + 1); //Wrap after custom
-
+ systemSettings.tipType++;
+ systemSettings.tipType %= (Tip_Custom + 1); // Wrap after custom
}
static void settings_displayTipModel(void) {
- printShortDescription(17, 4);
- //Print in small text the tip model
- lcd.setFont(1);
- //set the cursor
- //Print the mfg
- lcd.setCursor(40, 0);
- if (systemSettings.tipType < Tip_MiniWare) {
- lcd.print("TS100");
- } else if (systemSettings.tipType < Tip_Hakko) {
- lcd.print("HAKKO");
- } else if (systemSettings.tipType == Tip_Custom) {
- lcd.print("User");
- }
- lcd.setCursor(40, 8);
- switch ((enum TipType) systemSettings.tipType) {
- case TS_B2:
- lcd.print(" B2 ");
- break;
- case TS_D24:
- lcd.print(" D24 ");
- break;
- case TS_BC2:
- lcd.print(" BC2 ");
- break;
- case TS_C1:
- lcd.print(" C1 ");
- break;
- case HAKKO_BC2:
- lcd.print(" BC2 ");
- break;
- case Tip_Custom:
- lcd.print("Tuned");
- break;
- default:
- lcd.print("????");
- break;
- }
-}
-static void calibration_displaySimpleCal(void) {
- printShortDescription(18, 5);
+ printShortDescription(17, 4);
+ // Print in small text the tip model
+ OLED::setFont(1);
+ // set the cursor
+ // Print the mfg
+ OLED::setCursor(40, 0);
+ if (systemSettings.tipType < Tip_MiniWare) {
+#ifdef MODEL_TS100
+ OLED::print("TS100");
+#else
+ OLED::print("TS80");
+#endif
+ }
+#ifdef MODEL_TS100
+ else if (systemSettings.tipType < Tip_Hakko) {
+ OLED::print("HAKKO");
+ }
+#endif
+ else if (systemSettings.tipType == Tip_Custom) {
+ OLED::print("User");
+ }
+ OLED::setCursor(40, 8);
+#ifdef MODEL_TS100
+ switch ((enum TipType)systemSettings.tipType) {
+ case TS_B2:
+ OLED::print(" B2 ");
+ break;
+ case TS_D24:
+ OLED::print(" D24 ");
+ break;
+ case TS_BC2:
+ OLED::print(" BC2 ");
+ break;
+ case TS_C1:
+ OLED::print(" C1 ");
+ break;
+ case HAKKO_BC2:
+ OLED::print(" BC2 ");
+ break;
+ case Tip_Custom:
+ OLED::print("Tuned");
+ break;
+ default:
+ OLED::print("????");
+ break;
+ }
+#endif
+#ifdef MODEL_TS80
+ // only 2 tips atm
+ switch ((enum TipType)systemSettings.tipType) {
+ case TS_B02:
+ OLED::print(" B02 ");
+ break;
+ case TS_D25:
+ OLED::print(" D25 ");
+ break;
+ case Tip_Custom:
+ OLED::print("Tuned");
+ break;
+ default:
+ OLED::print("????");
+ break;
+ }
+#endif
}
+static void calibration_displaySimpleCal(void) { printShortDescription(18, 5); }
static void dotDelay() {
- for (uint8_t i = 0; i < 20; i++) {
- getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
- lcd.clearScreen();
- lcd.setCursor(0, 0);
- for (uint8_t x = 0; x < i / 4; x++)
- lcd.print(".");
- lcd.refresh();
- osDelay(50);
- }
+ for (uint8_t i = 0; i < 20; i++) {
+ getTipRawTemp(
+ 1); // cycle through the filter a fair bit to ensure we're stable.
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
+ for (uint8_t x = 0; x < i / 4; x++) OLED::print(".");
+ OLED::refresh();
+ osDelay(50);
+ }
}
static void setTipOffset() {
- setCalibrationOffset(0); //turn off the current offset
- dotDelay();
+ setCalibrationOffset(0); // turn off the current offset
+ dotDelay();
- //If the thermocouple at the end of the tip, and the handle are at equalibrium, then the output should be zero, as there is no temperature differential.
+ // If the thermocouple at the end of the tip, and the handle are at
+ // equalibrium, then the output should be zero, as there is no temperature
+ // differential.
- int32_t offset = 0;
- for (uint8_t i = 0; i < 15; i++) {
- offset += getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
+ int32_t offset = 0;
+ for (uint8_t i = 0; i < 15; i++) {
+ offset += getTipRawTemp(
+ 1); // cycle through the filter a fair bit to ensure we're stable.
- lcd.clearScreen();
- lcd.setCursor(0, 0);
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
- for (uint8_t x = 0; x < i / 4; x++)
- lcd.print(".");
- lcd.refresh();
- osDelay(200);
- }
- systemSettings.CalibrationOffset = offset / 15;
- setCalibrationOffset(systemSettings.CalibrationOffset); //store the error
- osDelay(100);
+ for (uint8_t x = 0; x < i / 4; x++) OLED::print(".");
+ OLED::refresh();
+ osDelay(200);
+ }
+ systemSettings.CalibrationOffset = offset / 15;
+ setCalibrationOffset(systemSettings.CalibrationOffset); // store the error
+ osDelay(100);
}
static void calibration_enterSimpleCal(void) {
-//User has entered into the simple cal routine
- if (userConfirmation(SettingsCalibrationWarning)) {
- //User has confirmed their handle is at ambient
- //So take the offset measurement
- setTipOffset();
- //Next we want the user to put the tip into 100C water so we can calculate their tip's gain
- //Gain is the m term from rise/run plot of raw readings vs (tip-handle)
- //Thus we want to calculate ([TipRawHot-TipRawCold])/(ActualHot-HandleHot)-(ActualCold-HandleCold)
- //Thus we first need to store -> TiprawCold,HandleCold,ActualCold==HandleCold -> RawTipCold
- uint32_t RawTipCold = getTipRawTemp(0) * 10;
- lcd.clearScreen();
- lcd.setCursor(0, 0);
- lcd.setFont(1);
- lcd.print("Please Insert Tip\nInto Boiling Water");
- lcd.refresh();
- osDelay(200);
- waitForButtonPress();
- dotDelay(); //cycle the filter a bit
- //Now take the three hot measurements
- //Assume water is boiling at 100C
- uint32_t RawTipHot = getTipRawTemp(0) * 10;
- uint32_t HandleTempHot = getHandleTemperature() / 10;
+ // User has entered into the simple cal routine
+ if (userConfirmation(SettingsCalibrationWarning)) {
+ // User has confirmed their handle is at ambient
+ // So take the offset measurement
+ setTipOffset();
+ // Next we want the user to put the tip into 100C water so we can calculate
+ // their tip's gain Gain is the m term from rise/run plot of raw readings vs
+ // (tip-handle) Thus we want to calculate
+ // ([TipRawHot-TipRawCold])/(ActualHot-HandleHot)-(ActualCold-HandleCold)
+ // Thus we first need to store ->
+ // TiprawCold,HandleCold,ActualCold==HandleCold -> RawTipCold
+ uint32_t RawTipCold = getTipRawTemp(0) * 10;
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
+ OLED::setFont(1);
+ OLED::print("Please Insert Tip\nInto Boiling Water");
+ OLED::refresh();
+ osDelay(200);
+ waitForButtonPress();
+ dotDelay(); // cycle the filter a bit
+ // Now take the three hot measurements
+ // Assume water is boiling at 100C
+ uint32_t RawTipHot = getTipRawTemp(0) * 10;
+ uint32_t HandleTempHot = getHandleTemperature() / 10;
- uint32_t gain = (RawTipHot - RawTipCold) / (100 - HandleTempHot);
+ uint32_t gain = (RawTipHot - RawTipCold) / (100 - HandleTempHot);
- //Show this to the user
- lcd.clearScreen();
- lcd.setCursor(0, 0);
- lcd.print("Your G: ");
- lcd.printNumber(gain, 6);
- lcd.print("\n~= 120-140");
- lcd.refresh();
- osDelay(2000);
- waitForButtonPress();
- lcd.clearScreen();
- lcd.setCursor(0, 0);
- lcd.print("H: ");
- lcd.printNumber(RawTipHot, 8);
- lcd.setCursor(0, 8);
- lcd.print("C: ");
- lcd.printNumber(RawTipCold, 8);
- lcd.refresh();
- osDelay(2000);
- waitForButtonPress();
- }
+ // Show this to the user
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
+ OLED::print("Your G: ");
+ OLED::printNumber(gain, 6);
+ OLED::print("\n~= 120-140");
+ OLED::refresh();
+ osDelay(2000);
+ waitForButtonPress();
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
+ OLED::print("H: ");
+ OLED::printNumber(RawTipHot, 8);
+ OLED::setCursor(0, 8);
+ OLED::print("C: ");
+ OLED::printNumber(RawTipCold, 8);
+ OLED::refresh();
+ osDelay(2000);
+ waitForButtonPress();
+ }
}
static void calibration_displayAdvancedCal(void) {
- printShortDescription(19, 5);
+ printShortDescription(19, 5);
}
static void calibration_enterAdvancedCal(void) {
//Advanced cal
@@ -721,22 +791,22 @@ static void calibration_enterAdvancedCal(void) {
systemSettings.customTipGain = 200;
else if (systemSettings.customTipGain <= 100)
systemSettings.customTipGain = 100;
- lcd.setCursor(0, 0);
- lcd.clearScreen();
- lcd.setFont(0);
- if (lcd.getRotation())
- lcd.drawChar('-');
+ OLED::setCursor(0, 0);
+ OLED::clearScreen();
+ OLED::setFont(0);
+ if (OLED::getRotation())
+ OLED::drawChar('-');
else
- lcd.drawChar('+');
+ OLED::drawChar('+');
- lcd.drawChar(' ');
- lcd.printNumber(systemSettings.customTipGain, 4);
- lcd.drawChar(' ');
- if (lcd.getRotation())
- lcd.drawChar('+');
+ OLED::drawChar(' ');
+ OLED::printNumber(systemSettings.customTipGain, 4);
+ OLED::drawChar(' ');
+ if (OLED::getRotation())
+ OLED::drawChar('+');
else
- lcd.drawChar('-');
- lcd.refresh();
+ OLED::drawChar('-');
+ OLED::refresh();
GUIDelay();
}
// Wait for the user to confirm the exit message that the calibration is done
@@ -746,228 +816,205 @@ static void calibration_enterAdvancedCal(void) {
//Provide the user the option to tune their own tip if custom is selected
//If not only do single point tuning as per usual
static void settings_setCalibrate(void) {
- if (systemSettings.tipType == Tip_Custom) {
- //Two types of calibration
- //1. Basic, idle temp + hot water (100C)
- //2. Advanced, 100C + 350C, we keep PID tracking to a temperature target
- return gui_Menu(calibrationMenu);
- }
- //Else
- // Ask user if handle is at the tip temperature
- // Any error between handle and the tip will be a direct offset in the control loop
+ if (systemSettings.tipType == Tip_Custom) {
+ // Two types of calibration
+ // 1. Basic, idle temp + hot water (100C)
+ // 2. Advanced, 100C + 350C, we keep PID tracking to a temperature target
+ return gui_Menu(calibrationMenu);
+ }
+ // Else
+ // Ask user if handle is at the tip temperature
+ // Any error between handle and the tip will be a direct offset in the control
+ // loop
- else if (userConfirmation(SettingsCalibrationWarning)) {
- //User confirmed
- //So we now perform the actual calculation
- setTipOffset();
-
- }
+ else if (userConfirmation(SettingsCalibrationWarning)) {
+ // User confirmed
+ // So we now perform the actual calculation
+ setTipOffset();
+ }
}
-static void settings_displayCalibrate(void) {
- printShortDescription(12, 5);
-}
+static void settings_displayCalibrate(void) { printShortDescription(12, 5); }
static void settings_setCalibrateVIN(void) {
- // Jump to the voltage calibration subscreen
- lcd.setFont(0);
- lcd.clearScreen();
- lcd.setCursor(0, 0);
+ // Jump to the voltage calibration subscreen
+ OLED::setFont(0);
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
- for (;;) {
- lcd.setCursor(0, 0);
- lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
- lcd.print(".");
- lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
- lcd.print("V");
+ for (;;) {
+ OLED::setCursor(0, 0);
+ OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
+ OLED::print(".");
+ OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
+ OLED::print("V");
- ButtonState buttons = getButtonState();
- switch (buttons) {
- case BUTTON_F_SHORT:
- systemSettings.voltageDiv++;
- break;
+ ButtonState buttons = getButtonState();
+ switch (buttons) {
+ case BUTTON_F_SHORT:
+ systemSettings.voltageDiv++;
+ break;
- case BUTTON_B_SHORT:
- systemSettings.voltageDiv--;
- break;
+ case BUTTON_B_SHORT:
+ systemSettings.voltageDiv--;
+ break;
- case BUTTON_BOTH:
- case BUTTON_F_LONG:
- case BUTTON_B_LONG:
- saveSettings();
- return;
- break;
- case BUTTON_NONE:
- default:
- break;
- }
+ case BUTTON_BOTH:
+ case BUTTON_F_LONG:
+ case BUTTON_B_LONG:
+ saveSettings();
+ return;
+ break;
+ case BUTTON_NONE:
+ default:
+ break;
+ }
- lcd.refresh();
- osDelay(40);
+ OLED::refresh();
+ osDelay(40);
- // Cap to sensible values
- if (systemSettings.voltageDiv < 360) {
- systemSettings.voltageDiv = 360;
- } else if (systemSettings.voltageDiv > 520) {
- systemSettings.voltageDiv = 520;
- }
- }
+ // Cap to sensible values
+ if (systemSettings.voltageDiv < 360) {
+ systemSettings.voltageDiv = 360;
+ } else if (systemSettings.voltageDiv > 520) {
+ systemSettings.voltageDiv = 520;
+ }
+ }
}
static void displayMenu(size_t index) {
- //Call into the menu
- lcd.setFont(1);
- lcd.setCursor(0, 0);
- //Draw title
- lcd.print(SettingsMenuEntries[index]);
- //Draw symbol
- //16 pixel wide image
- lcd.drawArea(96 - 16, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index]));
+ // Call into the menu
+ OLED::setFont(1);
+ OLED::setCursor(0, 0);
+ // Draw title
+ OLED::print(SettingsMenuEntries[index]);
+ // Draw symbol
+ // 16 pixel wide image
+ OLED::drawArea(96 - 16, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index]));
}
-static void settings_displayCalibrateVIN(void) {
- printShortDescription(14, 5);
-}
-static void settings_displaySolderingMenu(void) {
- displayMenu(0);
-}
-static void settings_enterSolderingMenu(void) {
- gui_Menu(solderingMenu);
-}
-static void settings_displayPowerMenu(void) {
- displayMenu(1);
-}
-static void settings_enterPowerMenu(void) {
- gui_Menu(PowerMenu);
-}
-static void settings_displayUIMenu(void) {
- displayMenu(2);
-}
-static void settings_enterUIMenu(void) {
- gui_Menu(UIMenu);
-}
-static void settings_displayAdvancedMenu(void) {
- displayMenu(3);
-}
-static void settings_enterAdvancedMenu(void) {
- gui_Menu(advancedMenu);
-}
+static void settings_displayCalibrateVIN(void) { printShortDescription(14, 5); }
+static void settings_displaySolderingMenu(void) { displayMenu(0); }
+static void settings_enterSolderingMenu(void) { gui_Menu(solderingMenu); }
+static void settings_displayPowerMenu(void) { displayMenu(1); }
+static void settings_enterPowerMenu(void) { gui_Menu(PowerMenu); }
+static void settings_displayUIMenu(void) { displayMenu(2); }
+static void settings_enterUIMenu(void) { gui_Menu(UIMenu); }
+static void settings_displayAdvancedMenu(void) { displayMenu(3); }
+static void settings_enterAdvancedMenu(void) { gui_Menu(advancedMenu); }
void gui_Menu(const menuitem* menu) {
- // Draw the settings menu and provide iteration support etc
- uint8_t currentScreen = 0;
- uint32_t autoRepeatTimer = 0;
- uint8_t autoRepeatAcceleration = 0;
- bool earlyExit = false;
- uint32_t descriptionStart = 0;
- int16_t lastOffset = -1;
- bool lcdRefresh = true;
- ButtonState lastButtonState = BUTTON_NONE;
+ // Draw the settings menu and provide iteration support etc
+ uint8_t currentScreen = 0;
+ uint32_t autoRepeatTimer = 0;
+ uint8_t autoRepeatAcceleration = 0;
+ bool earlyExit = false;
+ uint32_t descriptionStart = 0;
+ int16_t lastOffset = -1;
+ bool lcdRefresh = true;
+ ButtonState lastButtonState = BUTTON_NONE;
- while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) {
- lcd.setFont(0);
- lcd.setCursor(0, 0);
- //If the user has hesitated for >=3 seconds, show the long text
- //Otherwise "draw" the option
- if (xTaskGetTickCount() - lastButtonTime < 300) {
- lcd.clearScreen();
- menu[currentScreen].draw.func();
- lastOffset = -1;
- lcdRefresh = true;
- } else {
- // Draw description
- if (descriptionStart == 0)
- descriptionStart = xTaskGetTickCount();
- // lower the value - higher the speed
- int16_t descriptionWidth = FONT_12_WIDTH
- * (strlen(menu[currentScreen].description) + 7);
- int16_t descriptionOffset =
- ((xTaskGetTickCount() - descriptionStart)
- / (systemSettings.descriptionScrollSpeed == 1 ?
- 1 : 2));
- descriptionOffset %= descriptionWidth; //Roll around at the end
+ while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) {
+ OLED::setFont(0);
+ OLED::setCursor(0, 0);
+ // If the user has hesitated for >=3 seconds, show the long text
+ // Otherwise "draw" the option
+ if ((xTaskGetTickCount() - lastButtonTime < 300) ||
+ menu[currentScreen].description == NULL) {
+ OLED::clearScreen();
+ menu[currentScreen].draw.func();
+ lastOffset = -1;
+ lcdRefresh = true;
+ } else {
+ // Draw description
+ if (descriptionStart == 0) descriptionStart = xTaskGetTickCount();
+ // lower the value - higher the speed
+ int16_t descriptionWidth =
+ FONT_12_WIDTH * (strlen(menu[currentScreen].description) + 7);
+ int16_t descriptionOffset =
+ ((xTaskGetTickCount() - descriptionStart) /
+ (systemSettings.descriptionScrollSpeed == 1 ? 1 : 2));
+ descriptionOffset %= descriptionWidth; // Roll around at the end
- if (lastOffset != descriptionOffset) {
- lcd.clearScreen();
+ if (lastOffset != descriptionOffset) {
+ OLED::clearScreen();
- //^ Rolling offset based on time
- lcd.setCursor((OLED_WIDTH - descriptionOffset), 0);
- lcd.print(menu[currentScreen].description);
- lastOffset = descriptionOffset;
- lcdRefresh = true;
- }
+ //^ Rolling offset based on time
+ OLED::setCursor((OLED_WIDTH - descriptionOffset), 0);
+ OLED::print(menu[currentScreen].description);
+ lastOffset = descriptionOffset;
+ lcdRefresh = true;
+ }
+ }
- }
+ ButtonState buttons = getButtonState();
- ButtonState buttons = getButtonState();
+ if (buttons != lastButtonState) {
+ autoRepeatAcceleration = 0;
+ lastButtonState = buttons;
+ }
- if (buttons != lastButtonState) {
- autoRepeatAcceleration = 0;
- lastButtonState = buttons;
- }
+ switch (buttons) {
+ case BUTTON_BOTH:
+ earlyExit = true; // will make us exit next loop
+ descriptionStart = 0;
+ break;
+ case BUTTON_F_SHORT:
+ // increment
+ if (descriptionStart == 0) {
+ if (menu[currentScreen].incrementHandler.func != NULL)
+ menu[currentScreen].incrementHandler.func();
+ else
+ earlyExit = true;
+ } else
+ descriptionStart = 0;
+ break;
+ case BUTTON_B_SHORT:
+ if (descriptionStart == 0)
+ currentScreen++;
+ else
+ descriptionStart = 0;
+ break;
+ case BUTTON_F_LONG:
+ if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration >
+ PRESS_ACCEL_INTERVAL_MAX) {
+ menu[currentScreen].incrementHandler.func();
+ autoRepeatTimer = xTaskGetTickCount();
+ descriptionStart = 0;
- switch (buttons) {
- case BUTTON_BOTH:
- earlyExit = true; // will make us exit next loop
- descriptionStart = 0;
- break;
- case BUTTON_F_SHORT:
- // increment
- if (descriptionStart == 0) {
- if (menu[currentScreen].incrementHandler.func != NULL)
- menu[currentScreen].incrementHandler.func();
- else
- earlyExit = true;
- } else
- descriptionStart = 0;
- break;
- case BUTTON_B_SHORT:
- if (descriptionStart == 0)
- currentScreen++;
- else
- descriptionStart = 0;
- break;
- case BUTTON_F_LONG:
- if (xTaskGetTickCount() - autoRepeatTimer
- + autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
- menu[currentScreen].incrementHandler.func();
- autoRepeatTimer = xTaskGetTickCount();
- descriptionStart = 0;
+ autoRepeatAcceleration += PRESS_ACCEL_STEP;
+ }
+ break;
+ case BUTTON_B_LONG:
+ if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration >
+ PRESS_ACCEL_INTERVAL_MAX) {
+ currentScreen++;
+ autoRepeatTimer = xTaskGetTickCount();
+ descriptionStart = 0;
- autoRepeatAcceleration += PRESS_ACCEL_STEP;
- }
- break;
- case BUTTON_B_LONG:
- if (xTaskGetTickCount() - autoRepeatTimer
- + autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
- currentScreen++;
- autoRepeatTimer = xTaskGetTickCount();
- descriptionStart = 0;
+ autoRepeatAcceleration += PRESS_ACCEL_STEP;
+ }
+ break;
+ case BUTTON_NONE:
+ default:
+ break;
+ }
- autoRepeatAcceleration += PRESS_ACCEL_STEP;
- }
- break;
- case BUTTON_NONE:
- default:
- break;
- }
-
- if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration)
- < PRESS_ACCEL_INTERVAL_MIN) {
- autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX
- - PRESS_ACCEL_INTERVAL_MIN;
- }
-
- if (lcdRefresh) {
- lcd.refresh(); // update the LCD
- osDelay(40);
- lcdRefresh = false;
- }
- }
+ if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration) <
+ PRESS_ACCEL_INTERVAL_MIN) {
+ autoRepeatAcceleration =
+ PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
+ }
+ if (lcdRefresh) {
+ OLED::refresh(); // update the LCD
+ osDelay(40);
+ lcdRefresh = false;
+ }
+ }
}
void enterSettingsMenu() {
- gui_Menu(rootSettingsMenu); //Call the root menu
- saveSettings();
+ gui_Menu(rootSettingsMenu); // Call the root menu
+ saveSettings();
}
diff --git a/workspace/TS100/src/hardware.c b/workspace/TS100/src/hardware.c
index ce383790..d88566ea 100644
--- a/workspace/TS100/src/hardware.c
+++ b/workspace/TS100/src/hardware.c
@@ -5,8 +5,10 @@
* Author: Ben V. Brown
*/
-//These are all the functions for interacting with the hardware
+// These are all the functions for interacting with the hardware
#include "hardware.h"
+#include "FreeRTos.h"
+#include "stm32f1xx_hal.h"
volatile uint16_t PWMSafetyTimer = 0;
volatile int16_t CalibrationTempOffset = 0;
uint16_t tipGainCalValue = 0;
@@ -22,32 +24,30 @@ void setCalibrationOffset(int16_t offSet) {
}
uint16_t getHandleTemperature() {
// We return the current handle temperature in X10 C
- // TMP36 in handle, 0.5V offset and then 10mV per deg C (0.75V @ 25C for example)
- // STM32 = 4096 count @ 3.3V input -> But
- // We oversample by 32/(2^2) = 8 times oversampling
- // Therefore 32768 is the 3.3V input, so 0.201416015625 mV per count
- // So we need to subtract an offset of 0.5V to center on 0C (2482*2 counts)
+ // TMP36 in handle, 0.5V offset and then 10mV per deg C (0.75V @ 25C for
+ // example) STM32 = 4096 count @ 3.3V input -> But We oversample by 32/(2^2) =
+ // 8 times oversampling Therefore 32768 is the 3.3V input, so 0.1007080078125
+ // mV per count So we need to subtract an offset of 0.5V to center on 0C
+ // (4964.8 counts)
//
- uint16_t result = getADC(0);
- if (result < 4964)
- return 0;
- result -= 4964; //remove 0.5V offset
- result /= 10; //convert to X10 C
+ int32_t result = getADC(0);
+ result -= 4965; // remove 0.5V offset
+ // 10mV per C
+ // 99.29 counts per Deg C above 0C
+ result *= 10;
+ result /= 993;
return result;
-
}
uint16_t tipMeasurementToC(uint16_t raw) {
-
//((Raw Tip-RawOffset) * calibrationgain) / 1000 = tip delta in CX10
// tip delta in CX10 + handleTemp in CX10 = tip absolute temp in CX10
- //Div answer by 10 to get final result
+ // Div answer by 10 to get final result
uint32_t tipDelta = ((raw - CalibrationTempOffset) * tipGainCalValue)
/ 1000;
tipDelta += getHandleTemperature();
return tipDelta / 10;
-
}
uint16_t ctoTipMeasurement(uint16_t temp) {
//[ (temp-handle/10) * 10000 ]/calibrationgain = tip raw delta
@@ -59,37 +59,34 @@ uint16_t ctoTipMeasurement(uint16_t temp) {
}
uint16_t tipMeasurementToF(uint16_t raw) {
- //Convert result from C to F
+ // Convert result from C to F
return (tipMeasurementToC(raw) * 9) / 5 + 32;
-
}
uint16_t ftoTipMeasurement(uint16_t temp) {
-//Convert the temp back to C from F
+ // Convert the temp back to C from F
return ctoTipMeasurement(((temp - 32) * 5) / 9);
}
-uint16_t __attribute__ ((long_call, section (".data.ramfuncs"))) getTipInstantTemperature() {
+uint16_t getTipInstantTemperature() {
uint16_t sum;
- sum = HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_1);
- sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_2);
- sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_3);
- sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_4);
- sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_1);
- sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_2);
- sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_3);
- sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_4);
-
- return sum; // 8x over sample
-
+ sum = hadc1.Instance->JDR1;
+ sum += hadc1.Instance->JDR2;
+ sum += hadc1.Instance->JDR3;
+ sum += hadc1.Instance->JDR4;
+ sum += hadc2.Instance->JDR1;
+ sum += hadc2.Instance->JDR2;
+ sum += hadc2.Instance->JDR3;
+ sum += hadc2.Instance->JDR4;
+ return sum; // 8x over sample
}
/*
* Loopup table for the tip calibration values for
* the gain of the tip's
- * This can be found by line of best fit of TipRaw on X, and TipTemp-handle on Y.
- * Then take the m term * 10000
+ * This can be found by line of best fit of TipRaw on X, and TipTemp-handle on
+ * Y. Then take the m term * 10000
* */
uint16_t lookupTipDefaultCalValue(enum TipType tipID) {
-
+#ifdef MODEL_TS100
switch (tipID) {
case TS_D24:
return 141;
@@ -103,16 +100,28 @@ uint16_t lookupTipDefaultCalValue(enum TipType tipID) {
case TS_B2:
return 133;
default:
- return 132; // make this the average of all
+ return 132; // make this the average of all
break;
}
+#else
+ switch (tipID) {
+ case TS_D25:
+ return 154;
+ break;
+ case TS_B02:
+ return 154;
+ break;
+ default:
+ return 154; // make this the average of all
+ break;
+ }
+#endif
}
-uint16_t __attribute__ ((long_call, section (".data.ramfuncs"))) getTipRawTemp(
- uint8_t instant) {
+uint16_t getTipRawTemp(uint8_t instant) {
static int64_t filterFP = 0;
static uint16_t lastSample = 0;
- const uint8_t filterBeta = 7; //higher values smooth out more, but reduce responsiveness
+ const uint8_t filterBeta = 7; // higher values smooth out more, but reduce responsiveness
if (instant == 1) {
uint16_t itemp = getTipInstantTemperature();
@@ -132,10 +141,10 @@ uint16_t __attribute__ ((long_call, section (".data.ramfuncs"))) getTipRawTemp(
}
}
uint16_t getInputVoltageX10(uint16_t divisor) {
- //ADC maximum is 32767 == 3.3V at input == 28.05V at VIN
- //Therefore we can divide down from there
- //Multiplying ADC max by 4 for additional calibration options,
- //ideal term is 467
+ // ADC maximum is 32767 == 3.3V at input == 28.05V at VIN
+ // Therefore we can divide down from there
+ // Multiplying ADC max by 4 for additional calibration options,
+ // ideal term is 467
#define BATTFILTERDEPTH 64
static uint8_t preFillneeded = 1;
static uint32_t samples[BATTFILTERDEPTH];
@@ -157,27 +166,277 @@ uint16_t getInputVoltageX10(uint16_t divisor) {
preFillneeded = 1;
return sum * 4 / divisor;
}
+#ifdef MODEL_TS80
+uint8_t QCMode = 0;
+void seekQC(int16_t Vx10) {
+ if (QCMode <= 1)
+ return; // NOT connected to a QC Charger
+ if (Vx10 < 50)
+ return;
+ // Seek the QC to the Voltage given if this adapter supports continuous mode
+ // try and step towards the wanted value
+
+ // 1. Measure current voltage
+ int16_t vStart = getInputVoltageX10(195);
+ int difference = Vx10 - vStart;
+
+ // 2. calculate ideal steps (0.2V changes)
+
+ int steps = difference / 2;
+ if (QCMode == 3) {
+ while (steps < 0) {
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
+ vTaskDelay(3);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
+ vTaskDelay(3);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
+ HAL_IWDG_Refresh(&hiwdg);
+ vTaskDelay(3);
+ steps++;
+ }
+ while (steps > 0) {
+ // step once up
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
+ vTaskDelay(3);
+
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
+ vTaskDelay(3);
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
+ HAL_IWDG_Refresh(&hiwdg);
+ vTaskDelay(3);
+ steps--;
+ }
+ }
+ // Re-measure
+ /* Disabled due to nothing to test and code space of around 1k*/
+#ifdef QC2_ROUND_DOWN
+ steps = vStart - getInputVoltageX10(195);
+ if (steps < 0) steps = -steps;
+ if (steps > (difference / 2)) {
+ // No continuous mode, so QC2
+ QCMode = 2;
+ // Goto nearest
+ if (Vx10 > 10.5) {
+ // request 12V
+ // D- = 0.6V, D+ = 0.6V
+ // Clamp PB3
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);// pull down D+
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
+
+ } else {
+ // request 9V
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
+ }
+ }
+#endif
+}
+
+// Must be called after FreeRToS Starts
+void startQC() {
+ // Pre check that the input could be >5V already, and if so, dont both
+ // negotiating as someone is feeding in hv
+ uint16_t vin = getInputVoltageX10(205);
+ if (vin > 150)
+ return;// Over voltage
+ if (vin > 100) {
+ QCMode = 1; // ALready at ~12V
+ return;
+ }
+ GPIO_InitTypeDef GPIO_InitStruct;
+
+ // Tries to negotiate QC for 9V
+ // This is a multiple step process.
+ // 1. Set around 0.6V on D+ for 1.25 Seconds or so
+ // 2. After this It should un-short D+->D- and instead add a 20k pulldown on
+ // D-
+ // 3. Now set D+ to 3.3V and D- to 0.6V to request 9V
+ // OR both at 0.6V for 12V request (if the adapter can do it).
+ // If 12V is implimented then should fallback to 9V after validation
+ // Step 1. We want to pull D+ to 0.6V
+ // Pull PB3 donwn to ground
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);// pull low to put 0.6V on D+
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
+ GPIO_InitStruct.Pin = GPIO_PIN_3;
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);// pull low to put 0.6V on D+
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
+
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_14 | GPIO_PIN_13;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ // Delay 1.25 seconds
+ uint8_t enteredQC = 0;
+ for (uint16_t i = 0; i < 130 && enteredQC == 0; i++) {
+ // HAL_Delay(10);
+ vTaskDelay(1);
+ HAL_IWDG_Refresh(&hiwdg);
+ }
+ // Check if D- is low to spot a QC charger
+ if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO_PIN_RESET)
+ enteredQC = 1;
+ if (enteredQC) {
+ // We have a QC capable charger
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
+
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Pin = GPIO_PIN_10 | GPIO_PIN_8;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
+ HAL_IWDG_Refresh(&hiwdg);
+
+ // Wait for frontend ADC to stabilise
+ QCMode = 4;
+ for (uint8_t i = 0; i < 10; i++) {
+ if (getInputVoltageX10(195) > 80) {
+ // yay we have at least QC2.0 or QC3.0
+ QCMode = 3;// We have at least QC2, pray for 3
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
+ return;
+ }
+ vTaskDelay(10); // 100mS
+ }
+ QCMode = 0;
+ // No QC / not working to us
+
+ } else {
+ // no QC
+ }
+}
+// Get tip resistance in milliohms
+uint32_t calculateTipR(uint8_t useFilter) {
+ // We inject a small current into the front end of the iron,
+ // By measuring the Vdrop over the tip we can calculate the resistance
+ // Turn PA0 into an output and drive high to inject (3.3V-0.6)/(6K8+Rtip)
+ // current PA0->Diode -> 6K8 -> Tip -> GND So the op-amp will amplify the
+ // small signal across the tip and convert this into an easily read voltage
+ GPIO_InitTypeDef GPIO_InitStruct;
+ GPIO_InitStruct.Pin = GPIO_PIN_0;
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_RESET);// Set low first
+ setTipPWM(0);
+ vTaskDelay(1);
+ uint32_t offReading = getTipInstantTemperature();
+ for (uint8_t i = 0; i < 24; i++) {
+ if (useFilter == 0) {
+ vTaskDelay(1); // delay to allow it too stabilize
+ offReading += getTipInstantTemperature();
+ } else {
+ offReading += getTipRawTemp(0);
+ }
+ }
+
+ // Turn on
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_SET);// Set low first
+ vTaskDelay(1);// delay to allow it too stabilize
+ uint32_t onReading = getTipInstantTemperature();
+ for (uint8_t i = 0; i < 24; i++) {
+ if (useFilter == 0) {
+ vTaskDelay(1); // delay to allow it too stabilize
+ onReading += getTipInstantTemperature();
+ } else {
+ onReading += getTipRawTemp(0);
+ }
+ }
+
+ uint32_t difference = onReading - offReading;
+ // V = IR, therefore I = V/R
+ // We can divide this reading by a known "gain" to get the resulting
+ // resistance This was determined emperically This tip is 4.688444162 ohms,
+ // 4688 milliohms (Measured using 4 terminal measurement) 25x oversampling
+ // reads this as around 47490 Almost perfectly 10x the milliohms value This
+ // will drift massively with tip temp However we really only need 10x ohms
+ return (difference / 10) + 1;// ceil
+}
+static unsigned int sqrt32(unsigned long n) {
+ unsigned int c = 0x8000;
+ unsigned int g = 0x8000;
+
+ for (;;) {
+ if (g * g > n)
+ g ^= c;
+ c >>= 1;
+ if (c == 0)
+ return g;
+ g |= c;
+ }
+}
+int16_t calculateMaxVoltage(uint8_t useFilter, uint8_t useHP) {
+ // This measures the tip resistance, then it calculates the appropriate
+ // voltage To stay under ~18W. Mosfet is "9A", so no issues there
+ // QC3.0 supports up to 18W, which is 2A @9V and 1.5A @12V
+ uint32_t milliOhms = calculateTipR(useFilter);
+ // Check no tip
+ if (milliOhms > 10000)
+ return -1;
+ //
+ // V = sqrt(18W*R)
+ // Convert this to sqrt(18W)*sqrt(milli ohms)*sqrt(1/1000)
+
+ uint32_t Vx = sqrt32(milliOhms);
+ if (useHP)
+ Vx *= 1549;//sqrt(24)*sqrt(1/1000)
+ else
+ Vx *= 1342;// sqrt(18) * sqrt(1/1000)
+
+ // Round to nearest 200mV,
+ // So divide by 100 to start, to get in Vxx
+ Vx /= 100;
+ if (Vx % 10 >= 5)
+ Vx += 10;
+ Vx /= 10;
+ // Round to nearest increment of 2
+ if (Vx % 2 == 1)
+ Vx++;
+ return Vx;
+}
+
+#endif
volatile uint32_t pendingPWM = 0;
uint8_t getTipPWM() {
return pendingPWM;
}
-void __attribute__ ((long_call, section (".data.ramfuncs"))) setTipPWM(uint8_t pulse) {
- PWMSafetyTimer = 2; //This is decremented in the handler for PWM so that the tip pwm is disabled if the PID task is not scheduled often enough.
+void setTipPWM(uint8_t pulse) {
+ PWMSafetyTimer = 2; // This is decremented in the handler for PWM so that the tip pwm is
+ // disabled if the PID task is not scheduled often enough.
if (pulse > 100)
pulse = 100;
pendingPWM = pulse;
}
-//These are called by the HAL after the corresponding events from the system timers.
+// These are called by the HAL after the corresponding events from the system
+// timers.
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PeriodElapsedCallback(
- TIM_HandleTypeDef *htim) {
- //Period has elapsed
+void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
+ // Period has elapsed
if (htim->Instance == TIM2) {
- //we want to turn on the output again
- PWMSafetyTimer--; //We decrement this safety value so that lockups in the scheduler will not cause the PWM to become locked in an active driving state.
- //While we could assume this could never happen, its a small price for increased safety
+ // we want to turn on the output again
+ PWMSafetyTimer--; // We decrement this safety value so that lockups in the
+ // scheduler will not cause the PWM to become locked in an
+ // active driving state.
+ // While we could assume this could never happen, its a small price for
+ // increased safety
htim2.Instance->CCR4 = pendingPWM;
if (htim2.Instance->CCR4 && PWMSafetyTimer) {
htim3.Instance->CCR1 = 50;
@@ -192,15 +451,12 @@ void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PeriodElaps
}
}
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PWM_PulseFinishedCallback(
- TIM_HandleTypeDef *htim) {
+void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) {
if (htim->Instance == TIM2) {
- //This was a when the PWM for the output has timed out
+ // This was a when the PWM for the output has timed out
if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) {
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
htim3.Instance->CCR1 = 0;
-
}
}
}
-
diff --git a/workspace/TS100/src/main.cpp b/workspace/TS100/src/main.cpp
index 221ff5b4..ac8a2033 100644
--- a/workspace/TS100/src/main.cpp
+++ b/workspace/TS100/src/main.cpp
@@ -1,29 +1,22 @@
// By Ben V. Brown - V2.0 of the TS100 firmware
#include
+#include
#include
-#include "OLED.hpp"
+#include "LIS2DH12.hpp"
#include "Settings.h"
#include "Translation.h"
#include "cmsis_os.h"
#include "stdlib.h"
#include "stm32f1xx_hal.h"
#include "string.h"
-#include "LIS2DH12.hpp"
-#include
-#include "FRToSI2C.hpp"
#define ACCELDEBUG 0
-// C++ objects
-FRToSI2C i2cDev(&hi2c1);
-OLED lcd(&i2cDev);
-MMA8652FC accel(&i2cDev);
-LIS2DH12 accel2(&i2cDev);
uint8_t PCBVersion = 0;
// File local variables
uint16_t currentlyActiveTemperatureTarget = 0;
uint32_t lastMovementTime = 0;
uint32_t lastButtonTime = 0;
-
+int16_t idealQCVoltage = 0;
// FreeRTOS variables
osThreadId GUITaskHandle;
osThreadId PIDTaskHandle;
@@ -43,45 +36,47 @@ int main(void) {
HAL_Init();
Setup_HAL(); // Setup all the HAL objects
HAL_IWDG_Refresh(&hiwdg);
- setTipPWM(0);
- lcd.initialize(); // start up the LCD
- lcd.setFont(0); // default to bigger font
- //Testing for new weird board version
+ setTipPWM(0); // force tip off
+ FRToSI2C::init(&hi2c1);
+ OLED::initialize(); // start up the LCD
+ OLED::setFont(0); // default to bigger font
+ // Testing for which accelerometer is mounted
uint8_t buffer[1];
HAL_IWDG_Refresh(&hiwdg);
if (HAL_I2C_Mem_Read(&hi2c1, 29 << 1, 0x0F, I2C_MEMADD_SIZE_8BIT, buffer, 1,
1000) == HAL_OK) {
PCBVersion = 1;
- accel.initalize(); // this sets up the I2C registers and loads up the default
- // settings
+ MMA8652FC::initalize(); // this sets up the I2C registers
} else if (HAL_I2C_Mem_Read(&hi2c1, 25 << 1, 0x0F, I2C_MEMADD_SIZE_8BIT,
buffer, 1, 1000) == HAL_OK) {
PCBVersion = 2;
- //Setup the ST Accelerometer
- accel2.initalize(); //startup the accelerometer
+ // Setup the ST Accelerometer
+ LIS2DH12::initalize(); // startup the accelerometer
} else {
PCBVersion = 3;
systemSettings.SleepTime = 0;
- systemSettings.ShutdownTime = 0; //No accel -> disable sleep
+ systemSettings.ShutdownTime = 0; // No accel -> disable sleep
systemSettings.sensitivity = 0;
+ saveSettings();
}
HAL_IWDG_Refresh(&hiwdg);
restoreSettings(); // load the settings from flash
setCalibrationOffset(systemSettings.CalibrationOffset);
- setTipType((enum TipType)systemSettings.tipType, systemSettings.customTipGain); //apply tip type selection
+ setTipType((enum TipType) systemSettings.tipType,
+ systemSettings.customTipGain); // apply tip type selection
HAL_IWDG_Refresh(&hiwdg);
/* Create the thread(s) */
/* definition and creation of GUITask */
- osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 768); //3k
+ osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 768); // 3k
GUITaskHandle = osThreadCreate(osThread(GUITask), NULL);
/* definition and creation of PIDTask */
- osThreadDef(PIDTask, startPIDTask, osPriorityRealtime, 0, 512); //2k
+ osThreadDef(PIDTask, startPIDTask, osPriorityRealtime, 0, 512); // 2k
PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL);
- if (PCBVersion != 3) {
+ if (PCBVersion < 3) {
/* definition and creation of MOVTask */
- osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 512); //2k
+ osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 512); // 2k
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
}
@@ -93,14 +88,15 @@ int main(void) {
}
}
void printVoltage() {
- lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
- lcd.drawChar('.');
- lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
+ OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
+ OLED::drawChar('.');
+ OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
}
void GUIDelay() {
- //Called in all UI looping tasks,
- //This limits the re-draw rate to the LCD and also lets the DMA run
- //As the gui task can very easily fill this bus with transactions, which will prevent the movement detection from running
+ // Called in all UI looping tasks,
+ // This limits the re-draw rate to the LCD and also lets the DMA run
+ // As the gui task can very easily fill this bus with transactions, which will
+ // prevent the movement detection from running
osDelay(50);
}
void gui_drawTipTemp(bool symbol) {
@@ -111,16 +107,13 @@ void gui_drawTipTemp(bool symbol) {
Temp = tipMeasurementToF(Temp);
else
Temp = tipMeasurementToC(Temp);
- //[Disabled 24/11/2017] Round if nearby
- // if (abs(Temp - systemSettings.SolderingTemp) < 3)
- // Temp = systemSettings.SolderingTemp;
- lcd.printNumber(Temp, 3); // Draw the tip temp out finally
+ OLED::printNumber(Temp, 3); // Draw the tip temp out finally
if (symbol) {
if (systemSettings.temperatureInF)
- lcd.print("F");
+ OLED::print("F");
else
- lcd.print("C");
+ OLED::print("C");
}
}
ButtonState getButtonState() {
@@ -167,7 +160,14 @@ ButtonState getButtonState() {
ButtonState retVal = BUTTON_NONE;
if (currentState) {
// User has pressed a button down (nothing done on down)
-
+ if (currentState != previousState) {
+ // There has been a change in the button states
+ // If there is a rising edge on one of the buttons from double press we
+ // want to mask that out As users are having issues with not release
+ // both at once
+ if (previousState == 0x03)
+ currentState = 0x03;
+ }
} else {
// User has released buttons
// If they previously had the buttons down we want to check if they were <
@@ -191,78 +191,103 @@ ButtonState getButtonState() {
return BUTTON_NONE;
}
- void waitForButtonPress() {
+void waitForButtonPress() {
// we are just lazy and sleep until user confirms button press
// This also eats the button press event!
ButtonState buttons = getButtonState();
while (buttons) {
buttons = getButtonState();
- lcd.refresh();
+ GUIDelay();
GUIDelay();
}
while (!buttons) {
buttons = getButtonState();
- lcd.refresh();
+ GUIDelay();
GUIDelay();
}
}
void waitForButtonPressOrTimeout(uint32_t timeout) {
timeout += xTaskGetTickCount();
- // Make timeout our exit value
- for (;;) {
- ButtonState buttons = getButtonState();
- if (buttons)
- return;
+ // calculate the exit point
+
+ ButtonState buttons = getButtonState();
+ while (buttons) {
+ buttons = getButtonState();
+ GUIDelay();
if (xTaskGetTickCount() > timeout)
return;
+ }
+ while (!buttons) {
+ buttons = getButtonState();
GUIDelay();
+ if (xTaskGetTickCount() > timeout)
+ return;
}
}
-
+#ifdef MODEL_TS100
// returns true if undervoltage has occured
static bool checkVoltageForExit() {
uint16_t v = getInputVoltageX10(systemSettings.voltageDiv);
if ((v < lookupVoltageLevel(systemSettings.cutoutSetting))) {
- lcd.clearScreen();
- lcd.setCursor(0, 0);
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
if (systemSettings.detailedSoldering) {
- lcd.setFont(1);
- lcd.print(UndervoltageString);
- lcd.setCursor(0, 8);
- lcd.print(InputVoltageString);
+ OLED::setFont(1);
+ OLED::print(UndervoltageString);
+ OLED::setCursor(0, 8);
+ OLED::print(InputVoltageString);
printVoltage();
- lcd.print("V");
+ OLED::print("V");
} else {
- lcd.setFont(0);
- lcd.print(UVLOWarningString);
+ OLED::setFont(0);
+ OLED::print(UVLOWarningString);
}
- lcd.refresh();
+ OLED::refresh();
currentlyActiveTemperatureTarget = 0;
waitForButtonPress();
return true;
}
return false;
}
+#endif
static void gui_drawBatteryIcon() {
+#ifdef MODEL_TS100
if (systemSettings.cutoutSetting) {
// User is on a lithium battery
// we need to calculate which of the 10 levels they are on
uint8_t cellCount = systemSettings.cutoutSetting + 2;
- uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv)
- / cellCount;
+ uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv) / cellCount;
// Should give us approx cell voltage X10
// Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
- if (cellV < 33)
- cellV = 33;
- cellV -= 33; // Should leave us a number of 0-9
- if (cellV > 9)
- cellV = 9;
- lcd.drawBattery(cellV + 1);
+ if (cellV < 33) cellV = 33;
+ cellV -= 33;// Should leave us a number of 0-9
+ if (cellV > 9) cellV = 9;
+ OLED::drawBattery(cellV + 1);
} else
- lcd.drawSymbol(15); // Draw the DC Logo
+ OLED::drawSymbol(15); // Draw the DC Logo
+#else
+ // On TS80 we replace this symbol with the voltage we are operating on
+ // If <9V then show single digit, if not show duals
+ uint8_t V = getInputVoltageX10(systemSettings.voltageDiv);
+ if (V % 10 >= 5)
+ V = V / 10 + 1; // round up
+ else
+ V = V / 10;
+ if (V >= 10) {
+ int16_t xPos = OLED::getCursorX();
+ OLED::setFont(1);
+ OLED::printNumber(1, 1);
+ OLED::setCursor(xPos, 8);
+ OLED::printNumber(V % 10, 1);
+
+ OLED::setFont(0);
+ } else {
+ OLED::printNumber(V, 1);
+ }
+#endif
}
static void gui_solderingTempAdjust() {
uint32_t lastChange = xTaskGetTickCount();
@@ -270,9 +295,9 @@ static void gui_solderingTempAdjust() {
uint32_t autoRepeatTimer = 0;
uint8_t autoRepeatAcceleration = 0;
for (;;) {
- lcd.setCursor(0, 0);
- lcd.clearScreen();
- lcd.setFont(0);
+ OLED::setCursor(0, 0);
+ OLED::clearScreen();
+ OLED::setFont(0);
ButtonState buttons = getButtonState();
if (buttons)
lastChange = xTaskGetTickCount();
@@ -284,35 +309,35 @@ static void gui_solderingTempAdjust() {
// exit
return;
break;
- case BUTTON_B_LONG:
- if (xTaskGetTickCount() - autoRepeatTimer
- + autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
+ case BUTTON_F_LONG:
+ if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration >
+ PRESS_ACCEL_INTERVAL_MAX) {
systemSettings.SolderingTemp -= 10; // sub 10
autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
- case BUTTON_F_LONG:
- if (xTaskGetTickCount() - autoRepeatTimer
- + autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
+ case BUTTON_B_LONG:
+ if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration >
+ PRESS_ACCEL_INTERVAL_MAX) {
systemSettings.SolderingTemp += 10;
autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
- case BUTTON_F_SHORT:
+ case BUTTON_B_SHORT:
systemSettings.SolderingTemp += 10; // add 10
break;
- case BUTTON_B_SHORT:
+ case BUTTON_F_SHORT:
systemSettings.SolderingTemp -= 10; // sub 10
break;
default:
break;
}
- if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration)
- < PRESS_ACCEL_INTERVAL_MIN) {
- autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX
- - PRESS_ACCEL_INTERVAL_MIN;
+ if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration) <
+ PRESS_ACCEL_INTERVAL_MIN) {
+ autoRepeatAcceleration =
+ PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
}
// constrain between 50-450 C
if (systemSettings.temperatureInF) {
@@ -330,23 +355,23 @@ static void gui_solderingTempAdjust() {
if (xTaskGetTickCount() - lastChange > 200)
return; // exit if user just doesn't press anything for a bit
- if (lcd.getRotation())
- lcd.drawChar('-');
+ if (OLED::getRotation())
+ OLED::drawChar('-');
else
- lcd.drawChar('+');
+ OLED::drawChar('+');
- lcd.drawChar(' ');
- lcd.printNumber(systemSettings.SolderingTemp, 3);
+ OLED::drawChar(' ');
+ OLED::printNumber(systemSettings.SolderingTemp, 3);
if (systemSettings.temperatureInF)
- lcd.drawSymbol(0);
+ OLED::drawSymbol(0);
else
- lcd.drawSymbol(1);
- lcd.drawChar(' ');
- if (lcd.getRotation())
- lcd.drawChar('+');
+ OLED::drawSymbol(1);
+ OLED::drawChar(' ');
+ if (OLED::getRotation())
+ OLED::drawChar('+');
else
- lcd.drawChar('-');
- lcd.refresh();
+ OLED::drawChar('-');
+ OLED::refresh();
GUIDelay();
}
}
@@ -367,9 +392,9 @@ static int gui_SolderingSleepingMode() {
if ((xTaskGetTickCount() - lastMovementTime < 100)
|| (xTaskGetTickCount() - lastButtonTime < 100))
return 0; // user moved or pressed a button, go back to soldering
- if (checkVoltageForExit())
- return 1; // return non-zero on error
-
+#ifdef MODEL_TS100
+ if (checkVoltageForExit()) return 1; // return non-zero on error
+#endif
if (systemSettings.temperatureInF) {
currentlyActiveTemperatureTarget = ftoTipMeasurement(
min(systemSettings.SleepTemp,
@@ -386,30 +411,30 @@ static int gui_SolderingSleepingMode() {
else
tipTemp = tipMeasurementToC(getTipRawTemp(0));
- lcd.clearScreen();
- lcd.setCursor(0, 0);
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
if (systemSettings.detailedSoldering) {
- lcd.setFont(1);
- lcd.print(SleepingAdvancedString);
- lcd.setCursor(0, 8);
- lcd.print(SleepingTipAdvancedString);
- lcd.printNumber(tipTemp, 3);
+ OLED::setFont(1);
+ OLED::print(SleepingAdvancedString);
+ OLED::setCursor(0, 8);
+ OLED::print(SleepingTipAdvancedString);
+ OLED::printNumber(tipTemp, 3);
if (systemSettings.temperatureInF)
- lcd.print("F");
+ OLED::print("F");
else
- lcd.print("C");
+ OLED::print("C");
- lcd.print(" ");
+ OLED::print(" ");
printVoltage();
- lcd.drawChar('V');
+ OLED::drawChar('V');
} else {
- lcd.setFont(0);
- lcd.print(SleepingSimpleString);
- lcd.printNumber(tipTemp, 3);
+ OLED::setFont(0);
+ OLED::print(SleepingSimpleString);
+ OLED::printNumber(tipTemp, 3);
if (systemSettings.temperatureInF)
- lcd.drawSymbol(0);
+ OLED::drawSymbol(0);
else
- lcd.drawSymbol(1);
+ OLED::drawSymbol(1);
}
if (systemSettings.ShutdownTime) // only allow shutdown exit if time > 0
if (lastMovementTime)
@@ -419,7 +444,7 @@ static int gui_SolderingSleepingMode() {
currentlyActiveTemperatureTarget = 0;
return 1; // we want to exit soldering mode
}
- lcd.refresh();
+ OLED::refresh();
GUIDelay();
}
return 0;
@@ -435,15 +460,15 @@ static void display_countdown(int sleepThres) {
lastMovementTime : lastButtonTime;
int downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
if (downCount > 9900) {
- lcd.printNumber(downCount / 6000 + 1, 2);
- lcd.print("M");
+ OLED::printNumber(downCount / 6000 + 1, 2);
+ OLED::print("M");
} else {
- lcd.printNumber(downCount / 100 + 1, 2);
- lcd.print("S");
+ OLED::printNumber(downCount / 100 + 1, 2);
+ OLED::print("S");
}
}
-static void gui_solderingMode() {
+static void gui_solderingMode(uint8_t jumpToSleep) {
/*
* * Soldering (gui_solderingMode)
* -> Main loop where we draw temp, and animations
@@ -497,67 +522,72 @@ static void gui_solderingMode() {
break;
}
// else we update the screen information
- lcd.setCursor(0, 0);
- lcd.clearScreen();
- lcd.setFont(0);
+ OLED::setCursor(0, 0);
+ OLED::clearScreen();
+ OLED::setFont(0);
if (tipTemp > 32752) {
- lcd.print(BadTipString);
- lcd.refresh();
+ OLED::print(BadTipString);
+ OLED::refresh();
currentlyActiveTemperatureTarget = 0;
waitForButtonPress();
return;
} else {
if (systemSettings.detailedSoldering) {
- lcd.setFont(1);/*
- lcd.print(SolderingAdvancedPowerPrompt); //Power:
- lcd.printNumber(getTipPWM(), 3);
- lcd.print("%");*/
- lcd.printNumber(getTipRawTemp(0), 6);
+ OLED::setFont(1);
+ OLED::print(SolderingAdvancedPowerPrompt); // Power:
+ OLED::printNumber(getTipPWM(), 3);
+ OLED::print("%");
+ // OLED::printNumber(getTipRawTemp(0), 6);
if (systemSettings.sensitivity && systemSettings.SleepTime) {
- lcd.print(" ");
+ OLED::print(" ");
display_countdown(sleepThres);
}
- lcd.setCursor(0, 8);
- lcd.print(SleepingTipAdvancedString);
+ OLED::setCursor(0, 8);
+ OLED::print(SleepingTipAdvancedString);
gui_drawTipTemp(true);
- lcd.print(" ");
+ OLED::print(" ");
printVoltage();
- lcd.drawChar('V');
+ OLED::drawChar('V');
} else {
- // We switch the layout direction depending on the orientation of the lcd.
- if (lcd.getRotation()) {
+ // We switch the layout direction depending on the orientation of the
+ // OLED::
+ if (OLED::getRotation()) {
// battery
gui_drawBatteryIcon();
- lcd.drawChar(' '); // Space out gap between battery <-> temp
+ OLED::drawChar(' '); // Space out gap between battery <-> temp
gui_drawTipTemp(true); // Draw current tip temp
- // We draw boost arrow if boosting, or else gap temp <-> heat indicator
+ // We draw boost arrow if boosting, or else gap temp <-> heat
+ // indicator
if (boostModeOn)
- lcd.drawSymbol(2);
+ OLED::drawSymbol(2);
else
- lcd.drawChar(' ');
+ OLED::drawChar(' ');
// Draw heating/cooling symbols
- lcd.drawHeatSymbol(getTipPWM());
+ OLED::drawHeatSymbol(getTipPWM());
} else {
// Draw heating/cooling symbols
- lcd.drawHeatSymbol(getTipPWM());
- // We draw boost arrow if boosting, or else gap temp <-> heat indicator
+ OLED::drawHeatSymbol(getTipPWM());
+ // We draw boost arrow if boosting, or else gap temp <-> heat
+ // indicator
if (boostModeOn)
- lcd.drawSymbol(2);
+ OLED::drawSymbol(2);
else
- lcd.drawChar(' ');
+ OLED::drawChar(' ');
gui_drawTipTemp(true); // Draw current tip temp
- lcd.drawChar(' '); // Space out gap between battery <-> temp
+ OLED::drawChar(' '); // Space out gap between battery <-> temp
gui_drawBatteryIcon();
}
}
}
+ OLED::refresh();
+
// Update the setpoints for the temperature
if (boostModeOn) {
if (systemSettings.temperatureInF)
@@ -576,13 +606,25 @@ static void gui_solderingMode() {
systemSettings.SolderingTemp);
}
+#ifdef MODEL_TS100
// Undervoltage test
if (checkVoltageForExit()) {
lastButtonTime = xTaskGetTickCount();
return;
}
-
- lcd.refresh();
+#else
+ // on the TS80 we only want to check for over voltage to prevent tip damage
+ if (getInputVoltageX10(systemSettings.voltageDiv) > 150) {
+ lastButtonTime = xTaskGetTickCount();
+ return; // Over voltage
+ }
+#endif
+ if (jumpToSleep) {
+ if (gui_SolderingSleepingMode()) {
+ lastButtonTime = xTaskGetTickCount();
+ return; // If the function returns non-0 then exit
+ }
+ }
if (systemSettings.sensitivity && systemSettings.SleepTime)
if (xTaskGetTickCount() - lastMovementTime > sleepThres
&& xTaskGetTickCount() - lastButtonTime > sleepThres) {
@@ -596,61 +638,67 @@ static void gui_solderingMode() {
}
static const char *HEADERS[] = {
-__DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "Rtip: ",
- "Ctip: ", "Vin :", "THan: " };
+__DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "RTip: ",
+ "CTip: ", "Vin :", "THan: ", "Model: " };
void showVersion(void) {
uint8_t screen = 0;
ButtonState b;
for (;;) {
- lcd.clearScreen(); // Ensure the buffer starts clean
- lcd.setCursor(0, 0); // Position the cursor at the 0,0 (top left)
- lcd.setFont(1); // small font
- lcd.print((char *) "V2.05 PCB"); // Print version number
- lcd.printNumber(PCBVersion, 1); //Print PCB ID number
- lcd.setCursor(0, 8); // second line
- lcd.print(HEADERS[screen]);
+ OLED::clearScreen(); // Ensure the buffer starts clean
+ OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
+ OLED::setFont(1); // small font
+#ifdef MODEL_TS100
+ OLED::print((char *)"V2.06 TS100"); // Print version number
+#else
+ OLED::print((char *) "V2.06 TS80"); // Print version number
+#endif
+ OLED::setCursor(0, 8); // second line
+ OLED::print(HEADERS[screen]);
switch (screen) {
case 1:
- lcd.printNumber(xPortGetFreeHeapSize(), 5);
+ OLED::printNumber(xPortGetFreeHeapSize(), 5);
break;
case 2:
- lcd.printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5);
+ OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5);
break;
case 3:
- lcd.printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5);
+ OLED::printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5);
break;
case 4:
- lcd.printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5);
+ OLED::printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5);
break;
case 5:
- lcd.printNumber(xTaskGetTickCount() / 100, 5);
+ OLED::printNumber(xTaskGetTickCount() / 100, 5);
break;
case 6:
- lcd.printNumber(lastMovementTime / 100, 5);
+ OLED::printNumber(lastMovementTime / 100, 5);
break;
case 7:
- lcd.printNumber(getTipRawTemp(0), 6);
+ OLED::printNumber(getTipRawTemp(0), 6);
break;
case 8:
- lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 5);
+ OLED::printNumber(tipMeasurementToC(getTipRawTemp(0)), 5);
break;
case 9:
printVoltage();
break;
case 10:
- lcd.printNumber(getHandleTemperature(), 3);
+ OLED::printNumber(getHandleTemperature(), 3);
+ case 11:
+ OLED::printNumber(PCBVersion, 1); // Print PCB ID number
+ break;
default:
break;
}
- lcd.refresh();
+ OLED::refresh();
b = getButtonState();
if (b == BUTTON_B_SHORT)
return;
else if (b == BUTTON_F_SHORT) {
screen++;
- screen = screen % 11;
+ screen = screen % 12;
}
GUIDelay();
}
@@ -658,26 +706,28 @@ void showVersion(void) {
/* StartGUITask function */
void startGUITask(void const *argument __unused) {
- i2cDev.FRToSInit();
+ FRToSI2C::FRToSInit();
uint8_t tempWarningState = 0;
bool buttonLockout = false;
bool tempOnDisplay = false;
- getTipRawTemp(2); //reset filter
- lcd.setRotation(systemSettings.OrientationMode & 1);
+ getTipRawTemp(2); // reset filter
+ OLED::setRotation(systemSettings.OrientationMode & 1);
uint32_t ticks = xTaskGetTickCount();
- ticks += 400; //4 seconds from now
+ ticks += 400; // 4 seconds from now
while (xTaskGetTickCount() < ticks) {
if (showBootLogoIfavailable() == false)
ticks = xTaskGetTickCount();
ButtonState buttons = getButtonState();
if (buttons)
- ticks = xTaskGetTickCount(); //make timeout now so we will exit
+ ticks = xTaskGetTickCount(); // make timeout now so we will exit
GUIDelay();
}
if (systemSettings.autoStartMode) {
// jump directly to the autostart mode
if (systemSettings.autoStartMode == 1)
- gui_solderingMode();
+ gui_solderingMode(0);
+ if (systemSettings.autoStartMode == 2)
+ gui_solderingMode(1);
}
#if ACCELDEBUG
@@ -705,7 +755,8 @@ void startGUITask(void const *argument __unused) {
break;
case BUTTON_BOTH:
// Not used yet
- //In multi-language this might be used to reset language on a long hold or some such
+ // In multi-language this might be used to reset language on a long hold
+ // or some such
break;
case BUTTON_B_LONG:
@@ -717,15 +768,21 @@ void startGUITask(void const *argument __unused) {
saveSettings();
break;
case BUTTON_F_SHORT:
- lcd.setFont(0);
- lcd.displayOnOff(true); // turn lcd on
- gui_solderingMode(); // enter soldering mode
+ OLED::setFont(0);
+ OLED::displayOnOff(true); // turn lcd on
+#ifdef MODEL_TS80
+ if (idealQCVoltage < 90)
+ idealQCVoltage = calculateMaxVoltage(1,
+ systemSettings.cutoutSetting); // 1 means use filtered values rather than do its own
+ seekQC(idealQCVoltage);
+#endif
+ gui_solderingMode(0); // enter soldering mode
buttonLockout = true;
break;
case BUTTON_B_SHORT:
- lcd.setFont(0);
- lcd.displayOnOff(true); // turn lcd on
- enterSettingsMenu(); // enter the settings menu
+ OLED::setFont(0);
+ OLED::displayOnOff(true); // turn lcd on
+ enterSettingsMenu(); // enter the settings menu
saveSettings();
buttonLockout = true;
setCalibrationOffset(systemSettings.CalibrationOffset); // ensure cal offset is applied
@@ -736,55 +793,58 @@ void startGUITask(void const *argument __unused) {
currentlyActiveTemperatureTarget = 0; // ensure tip is off
- uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(1)); //This forces a faster update rate on the filtering
+ uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(1)); // This forces a faster update rate on the filtering
if (tipTemp < 50) {
-
if (systemSettings.sensitivity) {
-
if ((xTaskGetTickCount() - lastMovementTime) > 6000
&& (xTaskGetTickCount() - lastButtonTime) > 6000) {
- lcd.displayOnOff(false); // turn lcd off when no movement
+ OLED::displayOnOff(false); // turn lcd off when no movement
} else
- lcd.displayOnOff(true); // turn lcd on
+ OLED::displayOnOff(true); // turn lcd on
} else
- lcd.displayOnOff(true); // turn lcd on - disabled motion sleep
+ OLED::displayOnOff(true); // turn lcd on - disabled motion sleep
} else
- lcd.displayOnOff(true); // turn lcd on when temp > 50C
+ OLED::displayOnOff(true); // turn lcd on when temp > 50C
if (tipTemp > 600)
tipTemp = 0;
// Clear the lcd buffer
- lcd.clearScreen();
- lcd.setCursor(0, 0);
+ OLED::clearScreen();
+ OLED::setCursor(0, 0);
if (systemSettings.detailedIDLE) {
- lcd.setFont(1);
+ OLED::setFont(1);
if (tipTemp > 470) {
- lcd.print(TipDisconnectedString);
+ OLED::print(TipDisconnectedString);
} else {
- lcd.print(IdleTipString);
+ OLED::print(IdleTipString);
if (systemSettings.temperatureInF)
- lcd.printNumber(tipMeasurementToF(getTipRawTemp(0)), 3);
+ OLED::printNumber(tipMeasurementToF(getTipRawTemp(0)), 3);
else
- lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 3);
- lcd.print(IdleSetString);
- lcd.printNumber(systemSettings.SolderingTemp, 3);
+ OLED::printNumber(tipMeasurementToC(getTipRawTemp(0)), 3);
+ OLED::print(IdleSetString);
+ OLED::printNumber(systemSettings.SolderingTemp, 3);
}
- lcd.setCursor(0, 8);
- lcd.print(InputVoltageString);
+ OLED::setCursor(0, 8);
+
+ OLED::print(InputVoltageString);
printVoltage();
- lcd.print("V");
} else {
- lcd.setFont(0);
- if (lcd.getRotation()) {
- lcd.drawArea(12, 0, 84, 16, idleScreenBG);
- lcd.setCursor(0, 0);
+ OLED::setFont(0);
+#ifdef MODEL_TS80
+ if (!OLED::getRotation()) {
+#else
+ if (OLED::getRotation()) {
+#endif
+ OLED::drawArea(12, 0, 84, 16, idleScreenBG);
+ OLED::setCursor(0, 0);
gui_drawBatteryIcon();
} else {
- lcd.drawArea(0, 0, 84, 16, idleScreenBGF); // Needs to be flipped so button ends up on right side of screen
- lcd.setCursor(84, 0);
+ OLED::drawArea(0, 0, 84, 16, idleScreenBGF); // Needs to be flipped so button ends up
+ // on right side of screen
+ OLED::setCursor(84, 0);
gui_drawBatteryIcon();
}
if (tipTemp > 55)
@@ -792,32 +852,36 @@ void startGUITask(void const *argument __unused) {
else if (tipTemp < 45)
tempOnDisplay = false;
if (tempOnDisplay) {
- //draw temp over the start soldering button
- //Location changes on screen rotation
- if (lcd.getRotation()) {
+ // draw temp over the start soldering button
+ // Location changes on screen rotation
+#ifdef MODEL_TS80
+ if (!OLED::getRotation()) {
+#else
+ if (OLED::getRotation()) {
+#endif
// in right handed mode we want to draw over the first part
- lcd.fillArea(55, 0, 41, 16, 0); //clear the area for the temp
- lcd.setCursor(56, 0);
+ OLED::fillArea(55, 0, 41, 16, 0); // clear the area for the temp
+ OLED::setCursor(56, 0);
} else {
- lcd.fillArea(0, 0, 41, 16, 0); //clear the area
- lcd.setCursor(0, 0);
+ OLED::fillArea(0, 0, 41, 16, 0); // clear the area
+ OLED::setCursor(0, 0);
}
- //draw in the temp
- lcd.setFont(0); //big font
+ // draw in the temp
+ OLED::setFont(0); // big font
if (!(systemSettings.coolingTempBlink
&& (xTaskGetTickCount() % 50 < 25)))
- gui_drawTipTemp(false); // draw in the temp
+ gui_drawTipTemp(false); // draw in the temp
}
}
- lcd.refresh();
+ OLED::refresh();
GUIDelay();
}
}
/* StartPIDTask function */
-void __attribute__ ((long_call, section (".data.ramfuncs"))) startPIDTask(void const *argument __unused) {
+void startPIDTask(void const *argument __unused) {
/*
* We take the current tip temperature & evaluate the next step for the tip
* control PWM
@@ -828,27 +892,48 @@ void __attribute__ ((long_call, section (".data.ramfuncs"))) startPIDTask(void c
* struct
*
*/
- setTipPWM(0); // disable the output driver if the output is set to be off
- osDelay(500);
+ setTipPWM(0); // disable the output driver if the output is set to be off
+#ifdef MODEL_TS100
+ for (uint8_t i = 0; i < 50; i++) {
+ osDelay(10);
+ getTipRawTemp(1); // cycle up the tip temp filter
+ HAL_IWDG_Refresh(&hiwdg);
+ }
+#else
+ // On the TS80 we can measure the tip resistance before cycling the filter a
+ // bit
+ idealQCVoltage = 0;
+ idealQCVoltage = calculateMaxVoltage(0, systemSettings.cutoutSetting);
+ // Rapidly cycle the filter to help converge
+ HAL_IWDG_Refresh(&hiwdg);
+ for (uint8_t i = 0; i < 50; i++) {
+ osDelay(11);
+ getTipRawTemp(1); // cycle up the tip temp filter
+ }
+ HAL_IWDG_Refresh(&hiwdg);
+
+#endif
+ currentlyActiveTemperatureTarget = 0; // Force start with no output (off). If in sleep / soldering this will
+ // be over-ridded rapidly
int32_t integralCount = 0;
int32_t derivativeLastValue = 0;
-// REMEBER ^^^^ These constants are backwards
-// They act as dividers, so to 'increase' a P term, you make the number
-// smaller.
+ // REMEBER ^^^^ These constants are backwards
+ // They act as dividers, so to 'increase' a P term, you make the number
+ // smaller.
const int32_t itermMax = 100;
pidTaskNotification = xTaskGetCurrentTaskHandle();
for (;;) {
- if (ulTaskNotifyTake( pdTRUE, 50)) {
- //Wait a max of 50ms
- //This is a call to block this thread until the ADC does its samples
+ if (ulTaskNotifyTake(pdTRUE, 50)) {
+ // Wait a max of 50ms
+ // This is a call to block this thread until the ADC does its samples
uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading
if (currentlyActiveTemperatureTarget) {
// Compute the PID loop in here
- // Because our values here are quite large for all measurements (0-32k ~=
- // 66 counts per C)
- // P I & D are divisors, so inverse logic applies (beware)
+ // Because our values here are quite large for all measurements (0-32k
+ // ~= 66 counts per C) P I & D are divisors, so inverse logic applies
+ // (beware)
// Cap the max set point to 450C
if (currentlyActiveTemperatureTarget > ctoTipMeasurement(450)) {
@@ -910,8 +995,18 @@ void __attribute__ ((long_call, section (".data.ramfuncs"))) startPIDTask(void c
}
#define MOVFilter 8
void startMOVTask(void const *argument __unused) {
+#ifdef MODEL_TS80
+ startQC();
+ while (idealQCVoltage == 0)
+ osDelay(20); // To ensure we return after idealQCVoltage is setup
+
+ seekQC(idealQCVoltage); // this will move the QC output to the preferred voltage to start with
+
+#else
osDelay(250); // wait for accelerometer to stabilize
- lcd.setRotation(systemSettings.OrientationMode & 1);
+#endif
+
+ OLED::setRotation(systemSettings.OrientationMode & 1);
lastMovementTime = 0;
int16_t datax[MOVFilter] = { 0 };
int16_t datay[MOVFilter] = { 0 };
@@ -927,18 +1022,18 @@ void startMOVTask(void const *argument __unused) {
Orientation rotation = ORIENTATION_FLAT;
for (;;) {
int32_t threshold = 1500 + (9 * 200);
- threshold -= systemSettings.sensitivity * 200; // 200 is the step size
+ threshold -= systemSettings.sensitivity * 200; // 200 is the step size
if (PCBVersion == 2) {
- accel2.getAxisReadings(&tx, &ty, &tz);
- rotation = accel2.getOrientation();
+ LIS2DH12::getAxisReadings(&tx, &ty, &tz);
+ rotation = LIS2DH12::getOrientation();
} else if (PCBVersion == 1) {
- accel.getAxisReadings(&tx, &ty, &tz);
- rotation = accel.getOrientation();
+ MMA8652FC::getAxisReadings(&tx, &ty, &tz);
+ rotation = MMA8652FC::getOrientation();
}
if (systemSettings.OrientationMode == 2) {
if (rotation != ORIENTATION_FLAT) {
- lcd.setRotation(rotation == ORIENTATION_LEFT_HAND); // link the data through
+ OLED::setRotation(rotation == ORIENTATION_LEFT_HAND); // link the data through
}
}
datax[currentPointer] = (int32_t) tx;
@@ -956,26 +1051,26 @@ void startMOVTask(void const *argument __unused) {
avgy /= MOVFilter;
avgz /= MOVFilter;
- //Sum the deltas
+ // Sum the deltas
int32_t error = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz));
#if ACCELDEBUG
// Debug for Accel
- lcd.setFont(1);
- lcd.setCursor(0, 0);
- lcd.printNumber(abs(avgx - (int32_t) tx), 5);
- lcd.print(" ");
- lcd.printNumber(abs(avgy - (int32_t) ty), 5);
+ OLED::setFont(1);
+ OLED::setCursor(0, 0);
+ OLED::printNumber(abs(avgx - (int32_t)tx), 5);
+ OLED::print(" ");
+ OLED::printNumber(abs(avgy - (int32_t)ty), 5);
if (error > max) {
max = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz));
}
- lcd.setCursor(0, 8);
- lcd.printNumber(max, 5);
- lcd.print(" ");
+ OLED::setCursor(0, 8);
+ OLED::printNumber(max, 5);
+ OLED::print(" ");
- lcd.printNumber((abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)), 5);
- lcd.refresh();
+ OLED::printNumber((abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)), 5);
+ OLED::refresh();
if (HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET) {
max = 0;
}
@@ -990,6 +1085,11 @@ void startMOVTask(void const *argument __unused) {
}
osDelay(100); // Slow down update rate
+#ifdef MODEL_TS80
+ if (currentlyActiveTemperatureTarget) {
+ seekQC(idealQCVoltage); // Run the QC seek again to try and compensate for cable V drop
+ }
+#endif
}
}
@@ -997,9 +1097,9 @@ void startMOVTask(void const *argument __unused) {
(0x8000000 | 0xF800) /*second last page of flash set aside for logo image*/
bool showBootLogoIfavailable() {
-// check if the header is there (0xAA,0x55,0xF0,0x0D)
-// If so display logo
- //TODO REDUCE STACK ON THIS ONE, USE DRAWING IN THE READ LOOP
+ // check if the header is there (0xAA,0x55,0xF0,0x0D)
+ // If so display logo
+ // TODO REDUCE STACK ON THIS ONE, USE DRAWING IN THE READ LOOP
uint16_t temp[98];
for (uint8_t i = 0; i < (98); i++) {
@@ -1020,17 +1120,17 @@ bool showBootLogoIfavailable() {
if (temp8[3] != 0x0D)
return false;
- lcd.drawArea(0, 0, 96, 16, (uint8_t *) (temp8 + 4));
- lcd.refresh();
+ OLED::drawArea(0, 0, 96, 16, (uint8_t *) (temp8 + 4));
+ OLED::refresh();
return true;
}
/*
- * Catch the IRQ that says that the conversion is done on the temperature readings coming in
- * Once these have come in we can unblock the PID so that it runs again
+ * Catch the IRQ that says that the conversion is done on the temperature
+ * readings coming in Once these have come in we can unblock the PID so that it
+ * runs again
*/
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_ADCEx_InjectedConvCpltCallback(
- ADC_HandleTypeDef* hadc) {
+void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if (hadc == &hadc1) {
if (pidTaskNotification) {
@@ -1040,34 +1140,26 @@ void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_ADCEx_InjectedC
}
}
}
-
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MasterRxCpltCallback(
- I2C_HandleTypeDef *hi2c __unused) {
- i2cDev.CpltCallback();
+void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
+ FRToSI2C::CpltCallback();
}
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MasterTxCpltCallback(
- I2C_HandleTypeDef *hi2c __unused) {
- i2cDev.CpltCallback();
+void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
+ FRToSI2C::CpltCallback();
}
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MemTxCpltCallback(
- I2C_HandleTypeDef *hi2c __unused) {
- i2cDev.CpltCallback();
+void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
+ FRToSI2C::CpltCallback();
}
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_ErrorCallback(
- I2C_HandleTypeDef *hi2c __unused) {
- i2cDev.CpltCallback();
+void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) {
+ FRToSI2C::CpltCallback();
}
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_AbortCpltCallback(
- I2C_HandleTypeDef *hi2c __unused) {
- i2cDev.CpltCallback();
+void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
+ FRToSI2C::CpltCallback();
}
-void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MemRxCpltCallback(
- I2C_HandleTypeDef *hi2c __unused) {
- i2cDev.CpltCallback();
+void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
+ FRToSI2C::CpltCallback();
}
-void vApplicationStackOverflowHook( xTaskHandle *pxTask __unused,
+void vApplicationStackOverflowHook(xTaskHandle *pxTask __unused,
signed portCHAR *pcTaskName __unused) {
-//We dont have a good way to handle a stack overflow at this point in time
+ // We dont have a good way to handle a stack overflow at this point in time
NVIC_SystemReset();
-
}
diff --git a/workspace/TS100/src/stm32f1xx_hal_msp.c b/workspace/TS100/src/stm32f1xx_hal_msp.c
index 0057ed84..f5243656 100644
--- a/workspace/TS100/src/stm32f1xx_hal_msp.c
+++ b/workspace/TS100/src/stm32f1xx_hal_msp.c
@@ -41,18 +41,6 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc) {
if (hadc->Instance == ADC1) {
__HAL_RCC_ADC1_CLK_ENABLE()
;
- /**ADC1 GPIO Configuration
- PA7 ------> ADC1_IN7
- PB0 ------> ADC1_IN8
- PB1 ------> ADC1_IN9
- */
- GPIO_InitStruct.Pin = TMP36_INPUT_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- HAL_GPIO_Init(TMP36_INPUT_GPIO_Port, &GPIO_InitStruct);
-
- GPIO_InitStruct.Pin = TIP_TEMP_Pin | VIN_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* ADC1 DMA Init */
/* ADC1 Init */
@@ -100,7 +88,7 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c) {
GPIO_InitStruct.Pin = SCL_Pin | SDA_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* Peripheral clock enable */
diff --git a/workspace/TS100/src/syscalls.c b/workspace/TS100/src/syscalls.c
index 855079c9..2af03c8a 100644
--- a/workspace/TS100/src/syscalls.c
+++ b/workspace/TS100/src/syscalls.c
@@ -45,25 +45,12 @@ void _exit (int status)
int _read (int file, char *ptr, int len)
{
- int DataIdx;
-
- for (DataIdx = 0; DataIdx < len; DataIdx++)
- {
- *ptr++ = __io_getchar();
- }
-
-return len;
+ return 0;
}
int _write(int file, char *ptr, int len)
{
- int DataIdx;
-
- for (DataIdx = 0; DataIdx < len; DataIdx++)
- {
- __io_putchar(*ptr++);
- }
- return len;
+ return 0;
}
caddr_t _sbrk(int incr)
diff --git a/workspace/TS100A/.project b/workspace/TS100A/.project
index bec4d1c2..6d126fab 100644
--- a/workspace/TS100A/.project
+++ b/workspace/TS100A/.project
@@ -165,11 +165,6 @@
1
PARENT-1-PROJECT_LOC/TS100/inc/stm32f1xx_it.h
-
- inc/uRender.hpp
- 1
- PARENT-1-PROJECT_LOC/TS100/inc/uRender.hpp
-
src/FRToSI2C.cpp
1
@@ -250,11 +245,6 @@
1
PARENT-1-PROJECT_LOC/TS100/src/system_stm32f1xx.c
-
- src/uRender.cpp
- 1
- PARENT-1-PROJECT_LOC/TS100/src/uRender.cpp
-
startup/startup_stm32.s
1
diff --git a/workspace/TS100A/.settings/language.settings.xml b/workspace/TS100A/.settings/language.settings.xml
index b3648380..abe26fb1 100644
--- a/workspace/TS100A/.settings/language.settings.xml
+++ b/workspace/TS100A/.settings/language.settings.xml
@@ -4,7 +4,7 @@
-
+