add oled pins and SPI in Cube

This commit is contained in:
2018-04-01 15:00:59 +02:00
parent 7bc0c8fe92
commit d265d8f777
59 changed files with 8119 additions and 634 deletions

View File

@ -19,6 +19,7 @@ my_src/led.o: ../my_src/led.c ../system/include/stm32f1xx/stm32f1xx_hal.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h \
/home/wn/workspace-stm32/newcar/hottislib/PontCoopScheduler.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,4 +66,6 @@ my_src/led.o: ../my_src/led.c ../system/include/stm32f1xx/stm32f1xx_hal.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:
/home/wn/workspace-stm32/newcar/hottislib/PontCoopScheduler.h:

Binary file not shown.

View File

@ -20,7 +20,8 @@ my_src/main2.o: ../my_src/main2.c \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h ../my_src/led.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h ../my_src/led.h
/home/wn/workspace-stm32/newcar/hottislib/PontCoopScheduler.h:
@ -68,4 +69,6 @@ my_src/main2.o: ../my_src/main2.c \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:
../my_src/led.h:

Binary file not shown.

Binary file not shown.

View File

@ -1,23 +1,23 @@
:020000040800F2
:1000000000C00020F9020008D5150008D915000825
:10001000DD150008E1150008E515000800000000E6
:10002000000000000000000000000000E9150008CA
:10003000ED15000800000000F1150008F515000896
:1000400065130008651300086513000865130008B0
:1000500065130008651300086513000865130008A0
:100060006513000865130008651300086513000890
:100070006513000865130008651300086513000880
:100080006513000865130008651300086513000870
:100090006513000865130008651300086513000860
:1000A0006513000865130008651300086513000850
:1000B0006513000865130008651300086513000840
:1000C0006513000865130008651300086513000830
:1000D0006513000865130008651300086513000820
:1000E0006513000865130008651300086513000810
:1000F0006513000865130008651300086513000800
:1001000065130008651300086513000865130008EF
:1001100065130008651300086513000865130008DF
:1001200065130008651300086513000865130008CF
:1000000000C00020F9020008211800082518000887
:10001000291800082D1800083118000800000000F9
:10002000000000000000000000000000351800087B
:1000300039180008000000003D18000841180008A9
:10004000F5140008F5140008F5140008F51400086C
:10005000F5140008F5140008F5140008F51400085C
:10006000F5140008F5140008F5140008F51400084C
:10007000F5140008F5140008F5140008F51400083C
:10008000F5140008F5140008F5140008F51400082C
:10009000F5140008F5140008F5140008F51400081C
:1000A000F5140008F5140008F5140008F51400080C
:1000B000F5140008F5140008F5140008F5140008FC
:1000C000F5140008F5140008F5140008F5140008EC
:1000D000F5140008F5140008F5140008F5140008DC
:1000E000F5140008F5140008F5140008F5140008CC
:1000F000F5140008F5140008F5140008F5140008BC
:10010000F5140008F5140008F5140008F5140008AB
:10011000F5140008F5140008F5140008F51400089B
:10012000F5140008F5140008F5140008F51400088B
:1001300000000000000000000000000000000000BF
:1001400000000000000000000000000000000000AF
:10015000000000000000000000000000000000009F
@ -29,22 +29,22 @@
:1001B000000000000000000000000000000000003F
:1001C000000000000000000000000000000000002F
:1001D000000000000000000000000000000000001F
:1001E0005FF8E0F100B583B001F0ACF8304B314A74
:1001E0005FF8E0F100B583B001F074F9304B314AAB
:1001F0001360314A1360314B314A03E011681960D2
:10020000043304322F498B42F8D32A4B1A682E4B01
:100210009A4204D1284B1A682C4B9A4200D0FEE730
:10022000234B2B4A13602B4A13602B4B02E0002216
:100230001A600433294A9342F9D3254B1B6813B93A
:10024000244B1B6803B1FEE701F088F8694601A85A
:1002500001F070F8224C234B1C1BA410002504E075
:10024000244B1B6803B1FEE701F050F9694601A891
:1002500001F038F9224C234B1C1BA410002504E0AC
:100260001F4B53F8253098470135AC42F8DC1E4C43
:100270001E4B1C1BA410002504E01B4B53F825301B
:1002800098470135AC42F8DC0099019801F04AF931
:1002800098470135AC42F8DC0099019801F042FA38
:100290000546174C174B1C1BA41004E0013C144BE3
:1002A00053F824309847002CF8DC284601F040F839
:1002A00053F824309847002CF8DC284601F008F970
:1002B000BABADECA000000201000002000000020B2
:1002C0001C18000814000020785634123254769816
:1002D00014000020600100201400002064010020B0
:1002C000981A000814000020785634123254769898
:1002D00014000020BC01002014000020C0010020F8
:1002E0009403000894030008940300089403000892
:1002F000940300089403000808B5FFF773FF00BFDC
:1003000000BEFEE71EF0040F0CBFEFF30880EFF312
@ -54,64 +54,64 @@
:100340000880EFF309807146074A104700BEFEE7B8
:1003500000BEFEE700BEFEE700BEFEE770470000FD
:0C03600019030008350300084D030008D5
:10036C001C18000800000020140000201C180008B5
:10037C0000000000000000001400002064010020B8
:10036C00981A00080000002014000020981A0008B9
:10037C00000000000000000014000020C00100205C
:08038C00000000000000000069
:1003940010B5044600F0C4FF064BA3FB00308009EF
:1003A40000F098F8002221464FF0FF3000F050F89A
:1003B400002010BDD34D621008B5074A136843F0FE
:1003C40010031360032000F025F80020FFF7E0FF7E
:1003D40001F0B6F8002008BD00200240024A13686C
:1003D40001F0B0F9002008BD00200240024A136871
:1003E40001331360704700BF18000020014B1868E8
:1003F400704700BF1800002010B582B00190FFF7CD
:10040400F5FF0446FFF7F2FF001B019B9842F9D366
:1004140002B010BD10B50446C31E042B03D9BA2183
:10042400094801F08BF8094AD36823F4E0631B04FC
:10042400094801F085F9094AD36823F4E0631B0401
:100434001B0C240204F4E064234343F0BF6343F43D
:100444000033D36010BD00BF6C17000800ED00E05E
:100444000033D36010BD00BFB819000800ED00E010
:1004540070B504460E4615460F2A03D9D2211A4810
:1004640001F06CF80F2E03D9D321174801F066F878
:1004640001F066F90F2E03D9D321174801F060F982
:10047400164BDA68C2F30222C2F10701042928BF2D
:100484000421131D062B01D9033A00E000220123A5
:1004940003FA01F101393140914003FA02F2013AC1
:1004A4002A400A43002C06DA04F00F041201D2B2E7
:1004B400074B1A5570BD1201D2B204F1604404F521
:1004C400614484F8002370BD6C17000800ED00E05F
:1004C400614484F8002370BDB819000800ED00E011
:1004D40014ED00E00138B0F1807F0AD2064B586079
:1004E400F021064A82F823100020986007221A603F
:1004F40070470120704700BF10E000E000ED00E00D
:1005040010B50446042805D020B14FF4DF71084823
:1005140001F014F8042C05D1064A136843F00403CF
:1005140001F00EF9042C05D1064A136843F00403D4
:10052400136010BD034A136823F00403136010BD65
:100534006C17000810E000E008B501F07DF808BD74
:10053400B819000810E000E008B501F0A3F908BDFF
:100544002DE9F04383B080460F46B54B98421BD04B
:1005540003F58063984217D003F58063984213D063
:1005640003F5806398420FD003F5806398420BD063
:1005740003F58063984207D003F58063984203D063
:10058400CF21A84800F0DAFF3B881BB9D021A54849
:1005940000F0D4FF7B68012B22D9112B20D0022B31
:10058400CF21A84801F0D4F83B881BB9D021A54855
:1005940001F0CEF87B68012B22D9112B20D0022B3D
:1005A4001ED0122B1CD0A04A934219D002F58012FF
:1005B400934215D002F58012934211D0A2F5F8129D
:1005C40093420DD002F58012934209D002F58012B5
:1005D400934205D0032B03D0D121924800F0AEFF03
:1005D400934205D0032B03D0D121924801F0A8F80F
:1005E4004FF000094E463FE10125B5403C682C40E0
:1005F400A54240F038818A4B98451BD003F58063AF
:10060400984517D003F58063984513D003F58063AC
:1006140098450FD003F5806398450BD003F58063AC
:10062400984507D003F58063984503D0DF217D48C2
:1006340000F084FF7B68122B49D00CD8022B3AD0EF
:1006340001F07EF87B68122B49D00CD8022B3AD0FB
:1006440004D8002B4FD0012B1ED067E0032B60D0C1
:10065400112B24D062E0754A934244D008D8A2F505
:10066400801293423FD002F58032934256D13AE051
:100674006F4A934237D002F58032934233D0A2F5C9
:10068400801293424AD12EE0FB68013B022B03D92E
:10069400E721644800F052FFD7F80C903EE0FB6875
:1006A400013B022B03D9EE215E4800F047FFFB68B3
:10069400E721644801F04CF8D7F80C903EE0FB6881
:1006A400013B022B03D9EE215E4801F041F8FB68BF
:1006B40003F1040932E0FB68013B022B03D9F52165
:1006C400584800F03BFFFB6803F1080926E0FB688B
:1006D400013B022B03D9FC21524800F02FFFFB6899
:1006C400584801F035F8FB6803F1080926E0FB6897
:1006D400013B022B03D9FC21524801F029F8FB68A5
:1006E40003F10C091AE0BB68022B04D940F209118A
:1006F4004C4800F023FFBB6873B1012B04D1C8F848
:1006F4004C4801F01DF8BB6873B1012B04D1C8F854
:1007040010504FF0080909E0C8F814504FF00809D8
:1007140004E04FF0000901E04FF00409FF2C01D878
:10072400404601E008F10400FF2C01D8B30002E0C8
@ -130,22 +130,22 @@
:1007F40013607B6813F4003F04D0104A536823430A
:10080400536004E00D4A536823EA040353607B6891
:1008140013F4801F14D0094A93682343936014E0AF
:10082400000801409C17000800001110000021106E
:1008240000080140E8190008000011100000211020
:10083400000031100010024000000140000401409B
:100844000C4A936823EA040393607B6813F4001F43
:1008540004D0084AD3681C43D46004E0054AD36832
:1008640023EA0404D46001360F2E7FF6BDAE03B034
:10087400BDE8F0830004014070B5064615460C46F9
:1008840021B94FF4F271084800F058FE012D04D943
:1008940040F2E511044800F051FE0DB1346170BD21
:1008A4002404346170BD00BF9C17000838B50446A9
:1008B4000D4621B94FF4FD71034800F03FFEE16895
:1008C4006940E16038BD00BF9C17000830B583B0B3
:1008D400044620B94FF48771B94800F02FFE23680D
:1008840021B94FF4F271084800F052FF012D04D948
:1008940040F2E511044800F04BFF0DB1346170BD26
:1008A4002404346170BD00BFE819000838B504465B
:1008B4000D4621B94FF4FD71034800F039FFE1689A
:1008C4006940E16038BD00BFE819000830B583B065
:1008D400044620B94FF48771B94800F029FF236812
:1008E4003BB113F00F0F04D140F20F11B44800F0E4
:1008F40025FE236813F0010F00F0A380636853B151
:1008F4001FFF236813F0010F00F0A380636853B156
:10090400B3F5803F07D0B3F5A02F04D040F2151102
:10091400AB4800F013FEAB4B5B6803F00C03042BF5
:10091400AB4800F00DFFAB4B5B6803F00C03042BFA
:100924000AD0A84B5B6803F00C03082B1BD1A54B22
:100934005B6813F4803F16D04FF4003393FAA3F3AB
:10094400A04B1A684FF4003393FAA3F3B3FA83F37A
@ -165,8 +165,8 @@
:100A240093FAA3F3674B1A684FF4003393FAA3F3D2
:100A3400B3FA83F303F01F0322FA03F313F0010F55
:100A4400E6D1236813F0020F00F0A0802369012B84
:100A540004D940F249115A4800F070FD63691F2B14
:100A640004D94FF4A571564800F068FD554B5B68F6
:100A540004D940F249115A4800F06AFE63691F2B19
:100A640004D94FF4A571564800F062FE554B5B68FB
:100A740013F00C0F0AD0534B5B6803F00C03082BE4
:100A840027D1504B5B6813F4803F22D1022393FAA1
:100A9400A3F34C4B1A68022393FAA3F3B3FA83F338
@ -186,9 +186,9 @@
:100B7400144B1A68022393FAA3F3B3FA83F303F032
:100B84001F0322FA03F313F0010FE8D1236813F0D3
:100B9400080F5CD0A369012B04D94FF4C571084830
:100BA40000F0CCFCA3696BB3012292FAA2F3B3FA6E
:100BA40000F0C6FDA3696BB3012292FAA2F3B3FA73
:100BB40083F3054941F82320FFF718FC05460BE0B1
:100BC400E01700080010024080044242FFF70EFCC8
:100BC4002C1A00080010024080044242FFF70EFC79
:100BD400401B022800F2EF81022393FAA3F293FA56
:100BE400A3F2A44A526A93FAA3F3B3FA83F303F089
:100BF4001F0322FA03F313F0010FE7D00120FFF7DC
@ -198,7 +198,7 @@
:100C340093FAA3F28F4A526A93FAA3F3B3FA83F3B3
:100C440003F01F0322FA03F313F0010FE7D1236823
:100C540013F0040F00F0AB80E368012B06D9052BD9
:100C640004D040F2B711854800F068FC814BDA6982
:100C640004D040F2B711854800F062FD814BDA6987
:100C740042F08052DA61DB6903F080530193019BF7
:100C84007F4A136843F480731360FFF7AFFB054694
:100C940005E0FFF7ABFB401B642800F29081784B22
@ -219,25 +219,25 @@
:100D84005B0943F00203DBB2022B02D1394B1A6A2E
:100D940001E0384B5A6A022393FAA3F3B3FA83F3BC
:100DA40003F01F0322FA03F313F0010FD9D1E3690F
:100DB400022B04D940F24721304800F0BFFBE3691D
:100DB400022B04D940F24721304800F0B9FCE36922
:100DC400002B00F002812B4A526802F00C02082A20
:100DD40000F0FD80022B40F0B780236A3BB1B3F5ED
:100DE400803F04D04FF41471244800F0A7FB636AD9
:100DE400803F04D04FF41471244800F0A1FC636ADE
:100DF40073B3B3F5802F2BD0B3F5002F28D0B3F500
:100E0400402F25D0B3F5801F22D0B3F5A01F1FD0EB
:100E1400B3F5C01F1CD0B3F5E01F19D0B3F5001F04
:100E240016D0B3F5101F13D0B3F5201F10D0B3F5AF
:100E3400301F0DD0B3F5401F0AD0B3F5501F07D0B3
:100E4400B3F5601F04D040F251210C4800F076FB4A
:100E4400B3F5601F04D040F251210C4800F070FC4F
:100E54004FF0807393FAA3F3B3FA83F39B0003F187
:100E6400844303F5840300221A60FFF7BFFA0546A2
:100E74000EE000BF0010024080044242E017000868
:100E74000EE000BF00100240800442422C1A000819
:100E840000700040FFF7B2FA401B022800F2A18074
:100E94004FF0007393FAA3F3514B1A684FF00073A9
:100EA40093FAA3F3B3FA83F303F01F0322FA03F3D1
:100EB40013F0010FE6D1236AB3F5803F10D1A36884
:100EC4003BB1B3F5003F04D040F26721454800F040
:100ED40035FB43494B6823F40032A36813434B604A
:100ED4002FFC43494B6823F40032A36813434B604F
:100EE4003F48436823F47411236A626A13430B4333
:100EF40043604FF0807393FAA3F3B3FA83F39B0038
:100F040003F1844303F5840301221A60FFF76EFAA8
@ -254,7 +254,7 @@
:100FB40014E0032012E0032010E003200EE00320DD
:100FC4000CE003200AE0032008E0002006E00120F2
:100FD40004E0032002E0032000E0032003B030BD5E
:100FE40000100240E017000830B486B01F4D02AC78
:100FE400001002402C1A000830B486B01F4D02AC29
:100FF40028686968AA68EB680FC42B8AADF80430C6
:101004001B4B5B6803F00C02082A2AD103F470110D
:101014004FF4701292FAA2F2B2FA82F221FA02F2B8
@ -262,19 +262,19 @@
:101034005B6803F400314FF4003393FAA3F3B3FA7B
:1010440083F321FA03F306A90B4413F8140C094B98
:10105400B3FBF0F000FB02F004E0074800FB02F0F1
:1010640000E0044806B030BC704700BFCC1700084D
:1010640000E0044806B030BC704700BF181A0008FE
:101074000010024000127A0000093D0070B50D46D0
:10108400044620B94FF42F71A04800F057FA2368A2
:1010940013F00F0F04D140F2BD219C4800F04EFA2A
:1010A400022D04D940F2BE21984800F047FA984B2B
:10108400044620B94FF42F71A04800F051FB2368A7
:1010940013F00F0F04D140F2BD219C4800F048FB2F
:1010A400022D04D940F2BE21984800F041FB984B30
:1010B4001B6803F007039D420BD9954A136823F07C
:1010C40007032B431360136803F007039D4240F0AA
:1010D4000D81236813F0020F1DD0A368A3B1802BE8
:1010E40012D0902B10D0A02B0ED0B02B0CD0C02B34
:1010F4000AD0D02B08D0E02B06D0F02B04D040F23D
:10110400D721824800F01AFA82494B6823F0F00292
:10110400D721824800F014FB82494B6823F0F00297
:10111400A36813434B60236813F0010F00F0818030
:101124006368022B04D940F2DE21784800F006FA05
:101124006368022B04D940F2DE21784800F000FB0A
:101134006268012A13D14FF4003393FAA3F3754B79
:1011440019684FF4003393FAA3F3B3FA83F303F06B
:101154001F0321FA03F313F0010F28D1C8E0022A78
@ -295,98 +295,138 @@
:101244009D4261D1236813F0040F19D0E36883B180
:10125400B3F5806F0DD0B3F5A06F0AD0B3F5C06FAE
:1012640007D0B3F5E06F04D040F23231274800F0E4
:1012740065F928494B6823F4E062E36813434B6043
:101274005FFA28494B6823F4E062E36813434B6048
:10128400236813F0080F1AD0236983B1B3F5806F74
:101294000DD0B3F5A06F0AD0B3F5C06F07D0B3F586
:1012A400E06F04D040F23931184800F047F9194A88
:1012A400E06F04D040F23931184800F041FA194A8D
:1012B400536823F46053216943EAC1035360FFF781
:1012C40093FE144B5B6803F0F002F02393FAA3F34C
:1012D400B3FA83F322FA03F30F4AD35CD8400F4BDB
:1012E40018600020FFF754F8002070BD012070BD85
:1012F400012070BD012070BD012070BD032070BDB0
:10130400032070BD032070BD012070BDE0170008EC
:1013140000200240001002400C1800080C000020BD
:10132400014B1868704700BF0C000020FEE700BFA7
:1013340001230360014B0B60704700BF04000020D1
:1013440008B500F00FF8024B024A9A6008BD00BFCE
:1013540000ED00E00000000808B500F029F808BD21
:10136400FEE700000F4B1A6842F001021A60596848
:101374000D4A0A405A601A6822F0847222F48032BC
:101384001A601A6822F480221A605A6822F4FE0253
:101394005A604FF41F029A604FF00062034B9A6048
:1013A400704700BF001002400000FFF800ED00E0AD
:1013B4001F4B5B6803F00C03042B06D0082B08D0EA
:1013C4003BBB1C4A1C4B1A6026E01A4A1A4B1A6093
:1013D40022E0174A53685268C3F38343023312F47A
:1013E400803F05D1154A02FB03F3134A136013E04F
:1013F4000F4A526812F4003F05D0104A02FB03F36F
:101404000D4A136008E00B4A02FB03F30A4A136017
:1014140002E0084A084B1A60054B5B68C3F30313E8
:10142400074AD15C044A1368CB401360704700BF7D
:101434000010024000127A000C00002000093D0058
:101444000C18000810B586B0134B9A6942F01002CC
:101454009A619A6902F010020092009A9A6942F025
:1014640004029A619B6903F004030193019B0B4CF2
:1014740000224FF400512046FFF7FEF94FF40053C9
:101484000293012303930223059302A92046FFF745
:1014940057F806B010BD00BF001002400010014014
:1014A40008B500F0CDF8FEE700B591B0012306932E
:1014B4004FF4803307930022089202220D920E9378
:1014C4004FF4E0130F9306A8FFF700FA08B1FFF7F3
:1014D400E7FF0F23019302210291002303934FF4AA
:1014E40080620492059301A8FFF7C8FD08B1FFF7D5
:1014F400D7FFFFF715FF094BA3FB00308009FEF768
:10150400E9FF0420FEF7FCFF002211464FF0FF30F4
:10151400FEF79EFF11B05DF804FB00BFD34D6210CF
:1015240008B500F081F8FEF747FFFFF7BDFFFFF7AE
:1015340089FF00F087F800F07BF8FCE7704700BFF4
:1015440000B583B0204B9A6942F001029A619B690D
:1015540003F001030193019B0320FEF75BFF0022CC
:1015640011466FF00B00FEF773FF002211466FF077
:101574000A00FEF76DFF002211466FF00900FEF726
:1015840067FF002211466FF00400FEF761FF00229E
:1015940011466FF00300FEF75BFF002211466FF067
:1015A4000100FEF755FF002211464FF0FF30FEF711
:1015B4004FFF064A536823F0E06343F0007353601F
:1015C40003B05DF804FB00BF0010024000000140BE
:1015D400704700BFFEE700BFFEE700BFFEE700BFA5
:1015E400FEE700BF704700BF704700BF704700BFF1
:1015F40008B5FEF7F3FEFEF79FFF08BD08B54FF4EC
:1016040000510248FFF752F908BD00BF0010014025
:1016140008B54FF47A7300221146024800F02EF800
:1016240008BD00BF0116000808B500F00FF808BD9A
:1016340008B500F043F808BD08B500F06BF808BD24
:10164400704700BF08B5FFF7E3FF08BD30B40023BF
:101654000EE0094C9900CA189500601900226251E5
:1016640042600272C2602846204402610133DBB248
:101674000F2BEED930BC704720000020F0B50024B9
:1016840017E0274604EB8406B5000B4E3544ED689D
:101694006DB934464FEA870E0EEB0705AE00A51967
:1016A400A2516B6000232B72E8602961F0BD013404
:1016B400E4B20F2CE5D9F0BD2000002070B5002461
:1016C40022E004EB84029300114A1344DB68CBB19B
:1016D40004EB840293000E4A13441B7A93B1A100D5
:1016E40021448A000A4E1644013B3372F368306980
:1016F4009847736833B904EB8405AB00044A134478
:101704000022DA600134E4B20F2CDAD970BD00BFD4
:101714002000002070B400231FE003EB830082004C
:1017240010480244D268B2B103EB830082000D4832
:10173400825852B904469A00D518A80025186E6834
:101744002650287A411C297205E003EB83018800A6
:10175400013A04490A500133DBB20F2BDDD970BCC6
:10176400704700BF200000202E2E2F7379737465FC
:101774006D2F7372632F73746D3332663178782FE3
:1017840073746D3332663178785F68616C5F636F50
:10179400727465782E6300002E2E2F73797374652E
:1017A4006D2F7372632F73746D3332663178782FB3
:1017B40073746D3332663178785F68616C5F67701B
:1017C400696F2E6300000000020304050607080980
:1017D4000A0B0C0D0E0F1010010200002E2E2F7399
:1017E400797374656D2F7372632F73746D333266FE
:1017F4003178782F73746D3332663178785F68612D
:101804006C5F7263632E6300000000000000000040
:081814000102030406070809A4
:10181C00785634121C0000200000000000A24A047C
:04182C003254769824
:10130400032070BD032070BD012070BD2C1A00089D
:101314000020024000100240881A00080C0000203F
:10132400014B1868704700BF0C000020002800F033
:10133400BC8010B5044603685D4A93420BD0A2F505
:101344007842934207D002F58062934203D06B2126
:10135400584800F0EDF9636833B1B3F5827F03D0E8
:101364006C21544800F0E4F9A3684BB1B3F5806FE5
:1013740006D0B3F5004F03D06D214E4800F0D8F9E4
:10138400E368B3F5006F04D01BB16E21494800F047
:10139400CFF923692BB1022B03D06F21454800F00C
:1013A400C7F96369012B03D97021424800F0C0F9E1
:1013B400A369B3F5007F07D033B1B3F5802F03D011
:1013C40071213C4800F0B4F9E3698BB1082B0FD0CC
:1013D400102B0DD0182B0BD0202B09D0282B07D085
:1013E400302B05D0382B03D07221324800F0A0F9FD
:1013F400236A2BB1802B03D073212E4800F098F977
:10140400636A1BB174212B4800F092F9A36A33B1CB
:10141400B3F5005F03D07521264800F089F9E36A2B
:10142400013B4FF6FE72934203D97621214800F026
:101434007FF994F8513013F0FF0F02D1204600F0E9
:10144400C1F9022384F851302268136823F0400361
:10145400136021686268A3681A43E3681A43236926
:101464001A4363691A43A36903F400731343E269DB
:101474001343226A1343A26A1A430A602168638BE6
:1014840003F00402636A13434B602368E26A1A613F
:101494002268D36923F40063D3610020064B1870DB
:1014A4006065012384F8513010BD0120704700BFEE
:1014B40000300140581A00081C000020FEE700BF5D
:1014C40001230360014B0B60704700BF0400002040
:1014D40008B500F00FF8024B024A9A6008BD00BF3D
:1014E40000ED00E00000000808B500F029F808BD90
:1014F400FEE700000F4B1A6842F001021A605968B7
:101504000D4A0A405A601A6822F0847222F480322A
:101514001A601A6822F480221A605A6822F4FE02C1
:101524005A604FF41F029A604FF00062034B9A60B6
:10153400704700BF001002400000FFF800ED00E01B
:101544001F4B5B6803F00C03042B06D0082B08D058
:101554003BBB1C4A1C4B1A6026E01A4A1A4B1A6001
:1015640022E0174A53685268C3F38343023312F4E8
:10157400803F05D1154A02FB03F3134A136013E0BD
:101584000F4A526812F4003F05D0104A02FB03F3DD
:101594000D4A136008E00B4A02FB03F30A4A136086
:1015A40002E0084A084B1A60054B5B68C3F3031357
:1015B400074AD15C044A1368CB401360704700BFEC
:1015C4000010024000127A000C00002000093D00C7
:1015D400881A0008F0B587B01A4B9A6942F01002D5
:1015E4009A619A6902F010020092009A9A6942F094
:1015F40004029A619B6903F004030193019B124F57
:1016040000224FF400513846FFF736F90F4C002200
:101614000E212046FFF730F94FF4005302930126C0
:1016240003960225059502A93846FEF789FF0E2385
:1016340002930396059502A92046FEF781FF07B0A1
:10164400F0BD00BF0010024000100140000801403E
:1016540008B500F01BF9FEE708B50D480D4B036013
:101664004FF48273436000238360C360036143616A
:101674004FF4007282611822C26103624362836282
:101684000A23C362FFF752FE08B1FFF7E1FF08BD6A
:10169400240000200030014000B591B001230693DE
:1016A4004FF4803307930022089202220D920E9386
:1016B4004FF4E0130F9306A8FFF708F908B1FFF7FA
:1016C400C7FF0F23019302210291002303934FF4D8
:1016D40080620492059301A8FFF7D0FC08B1FFF7DC
:1016E400B7FFFFF71DFE094BA3FB00308009FEF78F
:1016F400F1FE0420FEF704FF002211464FF0FF30F4
:10170400FEF7A6FE11B05DF804FB00BFD34D6210D6
:1017140008B500F0AFF8FEF74FFEFFF7BDFFFFF787
:1017240059FFFFF799FF00F0B3F800F0A7F8FCE7C2
:10173400704700BF00B583B0204B9A6942F00102A4
:101744009A619B6903F001030193019B0320FEF757
:1017540061FE002211466FF00B00FEF779FE0022B5
:1017640011466FF00A00FEF773FE002211466FF077
:101774000900FEF76DFE002211466FF00400FEF72B
:1017840067FE002211466FF00300FEF761FE00229F
:1017940011466FF00100FEF75BFE002211464FF088
:1017A400FF30FEF755FE064A536823F0E06343F02A
:1017B4000073536003B05DF804FB00BF00100240E7
:1017C400000001400268134B9A4222D110B586B042
:1017D40003F560439A6942F480529A619B6903F469
:1017E40080530193019BA0230293022303930323B9
:1017F4000593094C02A92046FEF7A2FE402302935A
:1018040000230393049302A92046FEF799FE06B031
:1018140010BD70470030014000080140704700BF10
:10182400FEE700BFFEE700BFFEE700BFFEE700BF24
:10183400704700BF704700BF704700BF08B5FEF790
:10184400CDFDFEF779FE08BD08B54FF400510248FE
:10185400FFF72CF808BD00BF0010014008B54FF495
:101864007A7300221146024800F02EF808BD00BF2A
:101874004D18000808B500F00FF808BD08B500F0D1
:1018840043F808BD08B500F06BF808BD704700BF09
:1018940008B5FFF7E3FF08BD30B400230EE0094CA0
:1018A4009900CA18950060190022625142600272C0
:1018B400C2602846204402610133DBB20F2BEED90B
:1018C40030BC70477C000020F0B5002417E02746A8
:1018D40004EB8406B5000B4E3544ED686DB934460F
:1018E4004FEA870E0EEB0705AE00A519A2516B60F7
:1018F40000232B72E8602961F0BD0134E4B20F2C9F
:10190400E5D9F0BD7C00002070B5002422E004EB92
:1019140084029300114A1344DB68CBB104EB8402C4
:1019240093000E4A13441B7A93B1A10021448A0008
:101934000A4E1644013B3372F36830699847736862
:1019440033B904EB8405AB00044A13440022DA6083
:101954000134E4B20F2CDAD970BD00BF7C00002042
:1019640070B400231FE003EB83008200104802449C
:10197400D268B2B103EB830082000D48825852B999
:1019840004469A00D518A80025186E682650287AAF
:10199400411C297205E003EB83018800013A0449E4
:1019A4000A500133DBB20F2BDDD970BC704700BF86
:1019B4007C0000202E2E2F73797374656D2F737243
:1019C400632F73746D3332663178782F73746D338B
:1019D40032663178785F68616C5F636F72746578C2
:1019E4002E6300002E2E2F73797374656D2F73721E
:1019F400632F73746D3332663178782F73746D335B
:101A040032663178785F68616C5F6770696F2E63E6
:101A14000000000002030405060708090A0B0C0D68
:101A24000E0F1010010200002E2E2F7379737465AF
:101A34006D2F7372632F73746D3332663178782F20
:101A440073746D3332663178785F68616C5F72638A
:101A5400632E63002E2E2F73797374656D2F73724A
:101A6400632F73746D3332663178782F73746D33EA
:101A740032663178785F68616C5F7370695F65782E
:101A84002E630000000000000000000001020304B7
:041A94000607080930
:101A980078563412200000200000000000A24A04FA
:041AA80032547698A6
:04000005080001E509
:00000001FF

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@ src/main.o: ../src/main.c ../system/include/stm32f1xx/stm32f1xx_hal.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h \
/home/wn/workspace-stm32/newcar/my_src/main2.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,4 +66,6 @@ src/main.o: ../src/main.c ../system/include/stm32f1xx/stm32f1xx_hal.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:
/home/wn/workspace-stm32/newcar/my_src/main2.h:

Binary file not shown.

View File

@ -19,7 +19,8 @@ src/stm32f1xx_hal_msp.o: ../src/stm32f1xx_hal_msp.c \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -64,3 +65,5 @@ src/stm32f1xx_hal_msp.o: ../src/stm32f1xx_hal_msp.c \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

Binary file not shown.

View File

@ -20,6 +20,7 @@ src/stm32f1xx_it.o: ../src/stm32f1xx_it.c \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h \
../include/stm32f1xx_it.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -66,4 +67,6 @@ src/stm32f1xx_it.o: ../src/stm32f1xx_it.c \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:
../include/stm32f1xx_it.h:

Binary file not shown.

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_cortex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_cortex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_dma.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_dma.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_flash.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_flash.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_flash_ex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_flash_ex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_gpio.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_gpio.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_gpio_ex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_gpio_ex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_pwr.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_pwr.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_rcc.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_rcc.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_rcc_ex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_rcc_ex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -0,0 +1,70 @@
system/src/stm32f1xx/stm32f1xx_hal_spi.o: \
../system/src/stm32f1xx/stm32f1xx_hal_spi.c \
../system/include/stm32f1xx/stm32f1xx_hal.h \
../include/stm32f1xx_hal_conf.h ../include/mxconstants.h \
../system/include/stm32f1xx/stm32f1xx_hal_rcc.h \
../system/include/stm32f1xx/stm32f1xx_hal_def.h \
../system/include/cmsis/device/stm32f1xx.h \
../system/include/cmsis/device/stm32f103xe.h \
../system/include/cmsis/core_cm3.h \
../system/include/cmsis/core_cmInstr.h \
../system/include/cmsis/cmsis_gcc.h \
../system/include/cmsis/core_cmFunc.h \
../system/include/cmsis/device/system_stm32f1xx.h \
../system/include/stm32f1xx/Legacy/stm32_hal_legacy.h \
../system/include/stm32f1xx/stm32f1xx_hal_rcc_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_gpio.h \
../system/include/stm32f1xx/stm32f1xx_hal_gpio_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_dma.h \
../system/include/stm32f1xx/stm32f1xx_hal_dma_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
../include/stm32f1xx_hal_conf.h:
../include/mxconstants.h:
../system/include/stm32f1xx/stm32f1xx_hal_rcc.h:
../system/include/stm32f1xx/stm32f1xx_hal_def.h:
../system/include/cmsis/device/stm32f1xx.h:
../system/include/cmsis/device/stm32f103xe.h:
../system/include/cmsis/core_cm3.h:
../system/include/cmsis/core_cmInstr.h:
../system/include/cmsis/cmsis_gcc.h:
../system/include/cmsis/core_cmFunc.h:
../system/include/cmsis/device/system_stm32f1xx.h:
../system/include/stm32f1xx/Legacy/stm32_hal_legacy.h:
../system/include/stm32f1xx/stm32f1xx_hal_rcc_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_gpio.h:
../system/include/stm32f1xx/stm32f1xx_hal_gpio_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_dma.h:
../system/include/stm32f1xx/stm32f1xx_hal_dma_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h:
../system/include/stm32f1xx/stm32f1xx_hal_flash.h:
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

Binary file not shown.

View File

@ -0,0 +1,70 @@
system/src/stm32f1xx/stm32f1xx_hal_spi_ex.o: \
../system/src/stm32f1xx/stm32f1xx_hal_spi_ex.c \
../system/include/stm32f1xx/stm32f1xx_hal.h \
../include/stm32f1xx_hal_conf.h ../include/mxconstants.h \
../system/include/stm32f1xx/stm32f1xx_hal_rcc.h \
../system/include/stm32f1xx/stm32f1xx_hal_def.h \
../system/include/cmsis/device/stm32f1xx.h \
../system/include/cmsis/device/stm32f103xe.h \
../system/include/cmsis/core_cm3.h \
../system/include/cmsis/core_cmInstr.h \
../system/include/cmsis/cmsis_gcc.h \
../system/include/cmsis/core_cmFunc.h \
../system/include/cmsis/device/system_stm32f1xx.h \
../system/include/stm32f1xx/Legacy/stm32_hal_legacy.h \
../system/include/stm32f1xx/stm32f1xx_hal_rcc_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_gpio.h \
../system/include/stm32f1xx/stm32f1xx_hal_gpio_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_dma.h \
../system/include/stm32f1xx/stm32f1xx_hal_dma_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
../include/stm32f1xx_hal_conf.h:
../include/mxconstants.h:
../system/include/stm32f1xx/stm32f1xx_hal_rcc.h:
../system/include/stm32f1xx/stm32f1xx_hal_def.h:
../system/include/cmsis/device/stm32f1xx.h:
../system/include/cmsis/device/stm32f103xe.h:
../system/include/cmsis/core_cm3.h:
../system/include/cmsis/core_cmInstr.h:
../system/include/cmsis/cmsis_gcc.h:
../system/include/cmsis/core_cmFunc.h:
../system/include/cmsis/device/system_stm32f1xx.h:
../system/include/stm32f1xx/Legacy/stm32_hal_legacy.h:
../system/include/stm32f1xx/stm32f1xx_hal_rcc_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_gpio.h:
../system/include/stm32f1xx/stm32f1xx_hal_gpio_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_dma.h:
../system/include/stm32f1xx/stm32f1xx_hal_dma_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h:
../system/include/stm32f1xx/stm32f1xx_hal_flash.h:
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

Binary file not shown.

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_tim.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_tim.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -20,7 +20,8 @@ system/src/stm32f1xx/stm32f1xx_hal_tim_ex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_cortex.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash.h \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h \
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h \
../system/include/stm32f1xx/stm32f1xx_hal_spi.h
../system/include/stm32f1xx/stm32f1xx_hal.h:
@ -65,3 +66,5 @@ system/src/stm32f1xx/stm32f1xx_hal_tim_ex.o: \
../system/include/stm32f1xx/stm32f1xx_hal_flash_ex.h:
../system/include/stm32f1xx/stm32f1xx_hal_pwr.h:
../system/include/stm32f1xx/stm32f1xx_hal_spi.h:

View File

@ -14,6 +14,8 @@ C_SRCS += \
../system/src/stm32f1xx/stm32f1xx_hal_pwr.c \
../system/src/stm32f1xx/stm32f1xx_hal_rcc.c \
../system/src/stm32f1xx/stm32f1xx_hal_rcc_ex.c \
../system/src/stm32f1xx/stm32f1xx_hal_spi.c \
../system/src/stm32f1xx/stm32f1xx_hal_spi_ex.c \
../system/src/stm32f1xx/stm32f1xx_hal_tim.c \
../system/src/stm32f1xx/stm32f1xx_hal_tim_ex.c
@ -28,6 +30,8 @@ OBJS += \
./system/src/stm32f1xx/stm32f1xx_hal_pwr.o \
./system/src/stm32f1xx/stm32f1xx_hal_rcc.o \
./system/src/stm32f1xx/stm32f1xx_hal_rcc_ex.o \
./system/src/stm32f1xx/stm32f1xx_hal_spi.o \
./system/src/stm32f1xx/stm32f1xx_hal_spi_ex.o \
./system/src/stm32f1xx/stm32f1xx_hal_tim.o \
./system/src/stm32f1xx/stm32f1xx_hal_tim_ex.o
@ -42,6 +46,8 @@ C_DEPS += \
./system/src/stm32f1xx/stm32f1xx_hal_pwr.d \
./system/src/stm32f1xx/stm32f1xx_hal_rcc.d \
./system/src/stm32f1xx/stm32f1xx_hal_rcc_ex.d \
./system/src/stm32f1xx/stm32f1xx_hal_spi.d \
./system/src/stm32f1xx/stm32f1xx_hal_spi_ex.d \
./system/src/stm32f1xx/stm32f1xx_hal_tim.d \
./system/src/stm32f1xx/stm32f1xx_hal_tim_ex.d

View File

@ -5,9 +5,9 @@ SourcePath=/home/wn/workspace-stm32/newcar/cube/newcar/Src
SourceFiles=stm32f1xx_it.h;stm32f1xx_hal_conf.h;mxconstants.h;stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c;
[PreviousLibFiles]
LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xg.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xg.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f105xc.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f107xc.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xb.h;
LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xg.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xg.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f105xc.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f107xc.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xb.h;
[PreviousUsedRideFiles]
SourceFiles=../Src/main.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.s;
SourceFiles=../Src/main.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.s;
HeaderPath=../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Include;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;

View File

@ -0,0 +1,674 @@
/**
******************************************************************************
* @file stm32f1xx_hal_spi.h
* @author MCD Application Team
* @version V1.0.4
* @date 29-April-2016
* @brief Header file of SPI HAL module.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* 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
* and/or other materials provided with the distribution.
* 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
* 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
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_SPI_H
#define __STM32F1xx_HAL_SPI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal_def.h"
/** @addtogroup STM32F1xx_HAL_Driver
* @{
*/
/** @addtogroup SPI
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup SPI_Exported_Types SPI Exported Types
* @{
*/
/**
* @brief SPI Configuration Structure definition
*/
typedef struct
{
uint32_t Mode; /*!< Specifies the SPI operating mode.
This parameter can be a value of @ref SPI_mode */
uint32_t Direction; /*!< Specifies the SPI Directional mode state.
This parameter can be a value of @ref SPI_Direction_mode */
uint32_t DataSize; /*!< Specifies the SPI data size.
This parameter can be a value of @ref SPI_data_size */
uint32_t CLKPolarity; /*!< Specifies the serial clock steady state.
This parameter can be a value of @ref SPI_Clock_Polarity */
uint32_t CLKPhase; /*!< Specifies the clock active edge for the bit capture.
This parameter can be a value of @ref SPI_Clock_Phase */
uint32_t NSS; /*!< Specifies whether the NSS signal is managed by
hardware (NSS pin) or by software using the SSI bit.
This parameter can be a value of @ref SPI_Slave_Select_management */
uint32_t BaudRatePrescaler; /*!< Specifies the Baud Rate prescaler value which will be
used to configure the transmit and receive SCK clock.
This parameter can be a value of @ref SPI_BaudRate_Prescaler
@note The communication clock is derived from the master
clock. The slave clock does not need to be set */
uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
This parameter can be a value of @ref SPI_MSB_LSB_transmission */
uint32_t TIMode; /*!< Specifies if the TI mode is enabled or not.
This parameter can be a value of @ref SPI_TI_mode */
uint32_t CRCCalculation; /*!< Specifies if the CRC calculation is enabled or not.
This parameter can be a value of @ref SPI_CRC_Calculation */
uint32_t CRCPolynomial; /*!< Specifies the polynomial used for the CRC calculation.
This parameter must be a number between Min_Data = 0 and Max_Data = 65535 */
}SPI_InitTypeDef;
/**
* @brief HAL SPI State structure definition
*/
typedef enum
{
HAL_SPI_STATE_RESET = 0x00, /*!< SPI not yet initialized or disabled */
HAL_SPI_STATE_READY = 0x01, /*!< SPI initialized and ready for use */
HAL_SPI_STATE_BUSY = 0x02, /*!< SPI process is ongoing */
HAL_SPI_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
HAL_SPI_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
HAL_SPI_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
HAL_SPI_STATE_ERROR = 0x03 /*!< SPI error state */
}HAL_SPI_StateTypeDef;
/**
* @brief SPI handle Structure definition
*/
typedef struct __SPI_HandleTypeDef
{
SPI_TypeDef *Instance; /*!< SPI registers base address */
SPI_InitTypeDef Init; /*!< SPI communication parameters */
uint8_t *pTxBuffPtr; /*!< Pointer to SPI Tx transfer Buffer */
uint16_t TxXferSize; /*!< SPI Tx transfer size */
uint16_t TxXferCount; /*!< SPI Tx Transfer Counter */
uint8_t *pRxBuffPtr; /*!< Pointer to SPI Rx transfer Buffer */
uint16_t RxXferSize; /*!< SPI Rx transfer size */
uint16_t RxXferCount; /*!< SPI Rx Transfer Counter */
DMA_HandleTypeDef *hdmatx; /*!< SPI Tx DMA handle parameters */
DMA_HandleTypeDef *hdmarx; /*!< SPI Rx DMA handle parameters */
void (*RxISR)(struct __SPI_HandleTypeDef * hspi); /*!< function pointer on Rx ISR */
void (*TxISR)(struct __SPI_HandleTypeDef * hspi); /*!< function pointer on Tx ISR */
HAL_LockTypeDef Lock; /*!< SPI locking object */
__IO HAL_SPI_StateTypeDef State; /*!< SPI communication state */
__IO uint32_t ErrorCode; /*!< SPI Error code */
}SPI_HandleTypeDef;
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup SPI_Exported_Constants SPI Exported Constants
* @{
*/
/** @defgroup SPI_Error_Codes SPI Error Codes
* @{
*/
#define HAL_SPI_ERROR_NONE ((uint32_t)0x00) /*!< No error */
#define HAL_SPI_ERROR_MODF ((uint32_t)0x01) /*!< MODF error */
#define HAL_SPI_ERROR_CRC ((uint32_t)0x02) /*!< CRC error */
#define HAL_SPI_ERROR_OVR ((uint32_t)0x04) /*!< OVR error */
#define HAL_SPI_ERROR_DMA ((uint32_t)0x08) /*!< DMA transfer error */
#define HAL_SPI_ERROR_FLAG ((uint32_t)0x10) /*!< Flag: RXNE,TXE, BSY */
/**
* @}
*/
/** @defgroup SPI_mode SPI mode
* @{
*/
#define SPI_MODE_SLAVE ((uint32_t)0x00000000)
#define SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI)
/**
* @}
*/
/** @defgroup SPI_Direction_mode SPI Direction mode
* @{
*/
#define SPI_DIRECTION_2LINES ((uint32_t)0x00000000)
#define SPI_DIRECTION_2LINES_RXONLY SPI_CR1_RXONLY
#define SPI_DIRECTION_1LINE SPI_CR1_BIDIMODE
/**
* @}
*/
/** @defgroup SPI_data_size SPI data size
* @{
*/
#define SPI_DATASIZE_8BIT ((uint32_t)0x00000000)
#define SPI_DATASIZE_16BIT SPI_CR1_DFF
/**
* @}
*/
/** @defgroup SPI_Clock_Polarity SPI Clock Polarity
* @{
*/
#define SPI_POLARITY_LOW ((uint32_t)0x00000000)
#define SPI_POLARITY_HIGH SPI_CR1_CPOL
/**
* @}
*/
/** @defgroup SPI_Clock_Phase SPI Clock Phase
* @{
*/
#define SPI_PHASE_1EDGE ((uint32_t)0x00000000)
#define SPI_PHASE_2EDGE SPI_CR1_CPHA
/**
* @}
*/
/** @defgroup SPI_Slave_Select_management SPI Slave Select management
* @{
*/
#define SPI_NSS_SOFT SPI_CR1_SSM
#define SPI_NSS_HARD_INPUT ((uint32_t)0x00000000)
#define SPI_NSS_HARD_OUTPUT ((uint32_t)(SPI_CR2_SSOE << 16))
/**
* @}
*/
/** @defgroup SPI_BaudRate_Prescaler SPI BaudRate Prescaler
* @{
*/
#define SPI_BAUDRATEPRESCALER_2 ((uint32_t)0x00000000)
#define SPI_BAUDRATEPRESCALER_4 ((uint32_t)SPI_CR1_BR_0)
#define SPI_BAUDRATEPRESCALER_8 ((uint32_t)SPI_CR1_BR_1)
#define SPI_BAUDRATEPRESCALER_16 ((uint32_t)SPI_CR1_BR_1 | SPI_CR1_BR_0)
#define SPI_BAUDRATEPRESCALER_32 ((uint32_t)SPI_CR1_BR_2)
#define SPI_BAUDRATEPRESCALER_64 ((uint32_t)SPI_CR1_BR_2 | SPI_CR1_BR_0)
#define SPI_BAUDRATEPRESCALER_128 ((uint32_t)SPI_CR1_BR_2 | SPI_CR1_BR_1)
#define SPI_BAUDRATEPRESCALER_256 ((uint32_t)SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0)
/**
* @}
*/
/** @defgroup SPI_MSB_LSB_transmission SPI MSB LSB transmission
* @{
*/
#define SPI_FIRSTBIT_MSB ((uint32_t)0x00000000)
#define SPI_FIRSTBIT_LSB SPI_CR1_LSBFIRST
/**
* @}
*/
/** @defgroup SPI_TI_mode SPI TI mode disable
* @brief SPI TI Mode not supported for STM32F1xx family
* @{
*/
#define SPI_TIMODE_DISABLE ((uint32_t)0x00000000)
/**
* @}
*/
/** @defgroup SPI_CRC_Calculation SPI CRC Calculation
* @{
*/
#define SPI_CRCCALCULATION_DISABLE ((uint32_t)0x00000000)
#define SPI_CRCCALCULATION_ENABLE SPI_CR1_CRCEN
/**
* @}
*/
/** @defgroup SPI_Interrupt_configuration_definition SPI Interrupt configuration definition
* @{
*/
#define SPI_IT_TXE SPI_CR2_TXEIE
#define SPI_IT_RXNE SPI_CR2_RXNEIE
#define SPI_IT_ERR SPI_CR2_ERRIE
/**
* @}
*/
/** @defgroup SPI_Flag_definition SPI Flag definition
* @{
*/
#define SPI_FLAG_RXNE SPI_SR_RXNE
#define SPI_FLAG_TXE SPI_SR_TXE
#define SPI_FLAG_CRCERR SPI_SR_CRCERR
#define SPI_FLAG_MODF SPI_SR_MODF
#define SPI_FLAG_OVR SPI_SR_OVR
#define SPI_FLAG_BSY SPI_SR_BSY
/**
* @}
*/
/**
* @}
*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup SPI_Private_Constants SPI Private Constants
* @{
*/
#define SPI_INVALID_CRC_ERROR 0 /* CRC error wrongly detected */
#define SPI_VALID_CRC_ERROR 1 /* CRC error is true */
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup SPI_Exported_Macros SPI Exported Macros
* @{
*/
/** @brief Reset SPI handle state
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
/** @brief Enable the specified SPI interrupts.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @param __INTERRUPT__: specifies the interrupt source to enable.
* This parameter can be one of the following values:
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
* @arg SPI_IT_ERR: Error interrupt enable
* @retval None
*/
#define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CR2, (__INTERRUPT__))
/** @brief Disable the specified SPI interrupts.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @param __INTERRUPT__: specifies the interrupt source to disable.
* This parameter can be one of the following values:
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
* @arg SPI_IT_ERR: Error interrupt enable
* @retval None
*/
#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CR2, (__INTERRUPT__))
/** @brief Check if the specified SPI interrupt source is enabled or disabled.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @param __INTERRUPT__: specifies the SPI interrupt source to check.
* This parameter can be one of the following values:
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
* @arg SPI_IT_ERR: Error interrupt enable
* @retval The new state of __IT__ (TRUE or FALSE).
*/
#define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
/** @brief Check whether the specified SPI flag is set or not.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @param __FLAG__: specifies the flag to check.
* This parameter can be one of the following values:
* @arg SPI_FLAG_RXNE: Receive buffer not empty flag
* @arg SPI_FLAG_TXE: Transmit buffer empty flag
* @arg SPI_FLAG_CRCERR: CRC error flag
* @arg SPI_FLAG_MODF: Mode fault flag
* @arg SPI_FLAG_OVR: Overrun flag
* @arg SPI_FLAG_BSY: Busy flag
* @retval The new state of __FLAG__ (TRUE or FALSE).
*/
#define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
/** @brief Clear the SPI CRCERR pending flag.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_CLEAR_CRCERRFLAG(__HANDLE__) ((__HANDLE__)->Instance->SR = ~(SPI_FLAG_CRCERR))
/** @brief Clear the SPI MODF pending flag.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) \
do{ \
__IO uint32_t tmpreg; \
tmpreg = (__HANDLE__)->Instance->SR; \
tmpreg = CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE); \
UNUSED(tmpreg); \
}while(0)
/** @brief Clear the SPI OVR pending flag.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) \
do{ \
__IO uint32_t tmpreg; \
tmpreg = (__HANDLE__)->Instance->DR; \
tmpreg = (__HANDLE__)->Instance->SR; \
UNUSED(tmpreg); \
}while(0)
/** @brief Enables the SPI.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE)
/** @brief Disables the SPI.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE)
/**
* @}
*/
/* Private macros -----------------------------------------------------------*/
/** @defgroup SPI_Private_Macros SPI Private Macros
* @{
*/
/** @brief Checks if SPI Mode parameter is in allowed range.
* @param __MODE__: specifies the SPI Mode.
* This parameter can be a value of @ref SPI_mode
* @retval None
*/
#define IS_SPI_MODE(__MODE__) (((__MODE__) == SPI_MODE_SLAVE) || ((__MODE__) == SPI_MODE_MASTER))
/** @brief Checks if SPI Direction Mode parameter is in allowed range.
* @param __MODE__: specifies the SPI Direction Mode.
* This parameter can be a value of @ref SPI_Direction_mode
* @retval None
*/
#define IS_SPI_DIRECTION_MODE(__MODE__) (((__MODE__) == SPI_DIRECTION_2LINES) || \
((__MODE__) == SPI_DIRECTION_2LINES_RXONLY) || \
((__MODE__) == SPI_DIRECTION_1LINE))
/** @brief Checks if SPI Direction Mode parameter is 1 or 2 lines.
* @param __MODE__: specifies the SPI Direction Mode.
* @retval None
*/
#define IS_SPI_DIRECTION_2LINES_OR_1LINE(__MODE__) (((__MODE__) == SPI_DIRECTION_2LINES) || \
((__MODE__) == SPI_DIRECTION_1LINE))
/** @brief Checks if SPI Direction Mode parameter is 2 lines.
* @param __MODE__: specifies the SPI Direction Mode.
* @retval None
*/
#define IS_SPI_DIRECTION_2LINES(__MODE__) ((__MODE__) == SPI_DIRECTION_2LINES)
/** @brief Checks if SPI Data Size parameter is in allowed range.
* @param __DATASIZE__: specifies the SPI Data Size.
* This parameter can be a value of @ref SPI_data_size
* @retval None
*/
#define IS_SPI_DATASIZE(__DATASIZE__) (((__DATASIZE__) == SPI_DATASIZE_16BIT) || \
((__DATASIZE__) == SPI_DATASIZE_8BIT))
/** @brief Checks if SPI Serial clock steady state parameter is in allowed range.
* @param __CPOL__: specifies the SPI serial clock steady state.
* This parameter can be a value of @ref SPI_Clock_Polarity
* @retval None
*/
#define IS_SPI_CPOL(__CPOL__) (((__CPOL__) == SPI_POLARITY_LOW) || \
((__CPOL__) == SPI_POLARITY_HIGH))
/** @brief Checks if SPI Clock Phase parameter is in allowed range.
* @param __CPHA__: specifies the SPI Clock Phase.
* This parameter can be a value of @ref SPI_Clock_Phase
* @retval None
*/
#define IS_SPI_CPHA(__CPHA__) (((__CPHA__) == SPI_PHASE_1EDGE) || \
((__CPHA__) == SPI_PHASE_2EDGE))
/** @brief Checks if SPI Slave select parameter is in allowed range.
* @param __NSS__: specifies the SPI Slave Slelect management parameter.
* This parameter can be a value of @ref SPI_Slave_Select_management
* @retval None
*/
#define IS_SPI_NSS(__NSS__) (((__NSS__) == SPI_NSS_SOFT) || \
((__NSS__) == SPI_NSS_HARD_INPUT) || \
((__NSS__) == SPI_NSS_HARD_OUTPUT))
/** @brief Checks if SPI Baudrate prescaler parameter is in allowed range.
* @param __PRESCALER__: specifies the SPI Baudrate prescaler.
* This parameter can be a value of @ref SPI_BaudRate_Prescaler
* @retval None
*/
#define IS_SPI_BAUDRATE_PRESCALER(__PRESCALER__) (((__PRESCALER__) == SPI_BAUDRATEPRESCALER_2) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_4) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_8) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_16) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_32) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_64) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_128) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_256))
/** @brief Checks if SPI MSB LSB transmission parameter is in allowed range.
* @param __BIT__: specifies the SPI MSB LSB transmission (whether data transfer starts from MSB or LSB bit).
* This parameter can be a value of @ref SPI_MSB_LSB_transmission
* @retval None
*/
#define IS_SPI_FIRST_BIT(__BIT__) (((__BIT__) == SPI_FIRSTBIT_MSB) || \
((__BIT__) == SPI_FIRSTBIT_LSB))
/** @brief Checks if SPI TI mode parameter is in allowed range.
* @param __MODE__: specifies the SPI TI mode.
* This parameter can be a value of @ref SPI_TI_mode
* @retval None
*/
#define IS_SPI_TIMODE(__MODE__) ((__MODE__) == SPI_TIMODE_DISABLE)
/** @brief Checks if SPI CRC calculation enabled state is in allowed range.
* @param __CALCULATION__: specifies the SPI CRC calculation enable state.
* This parameter can be a value of @ref SPI_CRC_Calculation
* @retval None
*/
#define IS_SPI_CRC_CALCULATION(__CALCULATION__) (((__CALCULATION__) == SPI_CRCCALCULATION_DISABLE) || \
((__CALCULATION__) == SPI_CRCCALCULATION_ENABLE))
/** @brief Checks if SPI polynomial value to be used for the CRC calculation, is in allowed range.
* @param __POLYNOMIAL__: specifies the SPI polynomial value to be used for the CRC calculation.
* This parameter must be a number between Min_Data = 0 and Max_Data = 65535
* @retval None
*/
#define IS_SPI_CRC_POLYNOMIAL(__POLYNOMIAL__) (((__POLYNOMIAL__) >= 0x1) && ((__POLYNOMIAL__) <= 0xFFFF))
/** @brief Sets the SPI transmit-only mode.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define SPI_1LINE_TX(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_BIDIOE)
/** @brief Sets the SPI receive-only mode.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define SPI_1LINE_RX(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_BIDIOE)
/** @brief Resets the CRC calculation of the SPI.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define SPI_RESET_CRC(__HANDLE__) do{CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_CRCEN);\
SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_CRCEN);}while(0)
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup SPI_Exported_Functions
* @{
*/
/* Initialization/de-initialization functions **********************************/
/** @addtogroup SPI_Exported_Functions_Group1
* @{
*/
HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi);
HAL_StatusTypeDef HAL_SPI_DeInit (SPI_HandleTypeDef *hspi);
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi);
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi);
/**
* @}
*/
/* I/O operation functions *****************************************************/
/** @addtogroup SPI_Exported_Functions_Group2
* @{
*/
HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_Receive_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_DMAPause(SPI_HandleTypeDef *hspi);
HAL_StatusTypeDef HAL_SPI_DMAResume(SPI_HandleTypeDef *hspi);
HAL_StatusTypeDef HAL_SPI_DMAStop(SPI_HandleTypeDef *hspi);
void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi);
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi);
/**
* @}
*/
/* Peripheral State and Control functions **************************************/
/** @addtogroup SPI_Exported_Functions_Group3
* @{
*/
HAL_SPI_StateTypeDef HAL_SPI_GetState(SPI_HandleTypeDef *hspi);
uint32_t HAL_SPI_GetError(SPI_HandleTypeDef *hspi);
/**
* @}
*/
/**
* @}
*/
/* Private functions --------------------------------------------------------*/
/** @addtogroup SPI_Private_Functions
* @{
*/
uint8_t SPI_ISCRCErrorValid(SPI_HandleTypeDef *hspi);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F1xx_HAL_SPI_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,217 @@
/**
******************************************************************************
* @file stm32f1xx_hal_spi_ex.c
* @author MCD Application Team
* @version V1.0.4
* @date 29-April-2016
* @brief Extended SPI HAL module driver.
*
* This file provides firmware functions to manage the following
* functionalities SPI extension peripheral:
* + Extended Peripheral Control functions
*
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* 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
* and/or other materials provided with the distribution.
* 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
* 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
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/** @addtogroup STM32F1xx_HAL_Driver
* @{
*/
/** @addtogroup SPI
* @{
*/
#ifdef HAL_SPI_MODULE_ENABLED
/** @defgroup SPI_Private_Variables SPI Private Variables
* @{
*/
/* Variable used to determine if device is impacted by implementation of workaround
related to wrong CRC errors detection on SPI2. Conditions in which this workaround has to be applied, are:
- STM32F101CDE/STM32F103CDE
- Revision ID : Z
- SPI2
- In receive only mode, with CRC calculation enabled, at the end of the CRC reception,
the software needs to check the CRCERR flag. If it is found set, read back the SPI_RXCRC:
+ If the value is 0, the complete data transfer is successful.
+ Otherwise, one or more errors have been detected during the data transfer by CPU or DMA.
If CRCERR is found reset, the complete data transfer is considered successful.
*/
uint8_t uCRCErrorWorkaroundCheck = 0;
/**
* @}
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/** @addtogroup SPI_Exported_Functions
* @{
*/
/** @addtogroup SPI_Exported_Functions_Group1
*
* @{
*/
/**
* @brief Initializes the SPI according to the specified parameters
* in the SPI_InitTypeDef and create the associated handle.
* @param hspi: pointer to a SPI_HandleTypeDef structure that contains
* the configuration information for SPI module.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi)
{
/* Check the SPI handle allocation */
if(hspi == NULL)
{
return HAL_ERROR;
}
/* Check the parameters */
assert_param(IS_SPI_ALL_INSTANCE(hspi->Instance));
assert_param(IS_SPI_MODE(hspi->Init.Mode));
assert_param(IS_SPI_DIRECTION_MODE(hspi->Init.Direction));
assert_param(IS_SPI_DATASIZE(hspi->Init.DataSize));
assert_param(IS_SPI_CPOL(hspi->Init.CLKPolarity));
assert_param(IS_SPI_CPHA(hspi->Init.CLKPhase));
assert_param(IS_SPI_NSS(hspi->Init.NSS));
assert_param(IS_SPI_BAUDRATE_PRESCALER(hspi->Init.BaudRatePrescaler));
assert_param(IS_SPI_FIRST_BIT(hspi->Init.FirstBit));
assert_param(IS_SPI_TIMODE(hspi->Init.TIMode));
assert_param(IS_SPI_CRC_CALCULATION(hspi->Init.CRCCalculation));
assert_param(IS_SPI_CRC_POLYNOMIAL(hspi->Init.CRCPolynomial));
if(hspi->State == HAL_SPI_STATE_RESET)
{
/* Init the low level hardware : GPIO, CLOCK, NVIC... */
HAL_SPI_MspInit(hspi);
}
hspi->State = HAL_SPI_STATE_BUSY;
/* Disble the selected SPI peripheral */
__HAL_SPI_DISABLE(hspi);
/*----------------------- SPIx CR1 & CR2 Configuration ---------------------*/
/* Configure : SPI Mode, Communication Mode, Data size, Clock polarity and phase, NSS management,
Communication speed, First bit and CRC calculation state */
WRITE_REG(hspi->Instance->CR1, (hspi->Init.Mode | hspi->Init.Direction | hspi->Init.DataSize |
hspi->Init.CLKPolarity | hspi->Init.CLKPhase | (hspi->Init.NSS & SPI_CR1_SSM) |
hspi->Init.BaudRatePrescaler | hspi->Init.FirstBit | hspi->Init.CRCCalculation) );
/* Configure : NSS management */
WRITE_REG(hspi->Instance->CR2, (((hspi->Init.NSS >> 16) & SPI_CR2_SSOE) | hspi->Init.TIMode));
/*---------------------------- SPIx CRCPOLY Configuration ------------------*/
/* Configure : CRC Polynomial */
WRITE_REG(hspi->Instance->CRCPR, hspi->Init.CRCPolynomial);
#if defined (STM32F101x6) || defined (STM32F101xB) || defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F102x6) || defined (STM32F102xB) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC)
/* Activate the SPI mode (Make sure that I2SMOD bit in I2SCFGR register is reset) */
CLEAR_BIT(hspi->Instance->I2SCFGR, SPI_I2SCFGR_I2SMOD);
#endif
#if defined (STM32F101xE) || defined (STM32F103xE)
/* Check RevisionID value for identifying if Device is Rev Z (0x0001) in order to enable workaround for
CRC errors wrongly detected */
/* Pb is that ES_STM32F10xxCDE also identify an issue in Debug registers access while not in Debug mode.
Revision ID information is only available in Debug mode, so Workaround could not be implemented
to distinguish Rev Z devices (issue present) from more recent version (issue fixed).
So, in case of Revison Z F101 or F103 devices, below variable should be assigned to 1 */
uCRCErrorWorkaroundCheck = 0;
#else
uCRCErrorWorkaroundCheck = 0;
#endif
hspi->ErrorCode = HAL_SPI_ERROR_NONE;
hspi->State = HAL_SPI_STATE_READY;
return HAL_OK;
}
/**
* @}
*/
/**
* @}
*/
/** @addtogroup SPI_Private_Functions
* @{
*/
/**
* @brief Checks if encountered CRC error could be corresponding to wrongly detected errors
* according to SPI instance, Device type, and revision ID.
* @param hspi: pointer to a SPI_HandleTypeDef structure that contains
* the configuration information for SPI module.
* @retval CRC error validity (SPI_INVALID_CRC_ERROR or SPI_VALID_CRC_ERROR).
*/
uint8_t SPI_ISCRCErrorValid(SPI_HandleTypeDef *hspi)
{
#if defined (STM32F101xE) || defined (STM32F103xE)
/* Check how to handle this CRC error (workaround to be applied or not) */
/* If CRC errors could be wrongly detected (issue 2.15.2 in STM32F10xxC/D/E silicon limitations ES (DocID14732 Rev 13) */
if ( (uCRCErrorWorkaroundCheck != 0) && (hspi->Instance == SPI2) )
{
if (hspi->Instance->RXCRCR == 0)
{
return (SPI_INVALID_CRC_ERROR);
}
}
return (SPI_VALID_CRC_ERROR);
#else
return (SPI_VALID_CRC_ERROR);
#endif
}
/**
* @}
*/
#endif /* HAL_SPI_MODULE_ENABLED */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -43,6 +43,12 @@
#define LED_Pin GPIO_PIN_13
#define LED_GPIO_Port GPIOC
#define OLED_DC_Pin GPIO_PIN_1
#define OLED_DC_GPIO_Port GPIOA
#define OLED_RST_Pin GPIO_PIN_2
#define OLED_RST_GPIO_Port GPIOA
#define OLED_CS_Pin GPIO_PIN_3
#define OLED_CS_GPIO_Port GPIOA
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */

View File

@ -75,7 +75,7 @@
/*#define HAL_SD_MODULE_ENABLED */
/*#define HAL_SDRAM_MODULE_ENABLED */
/*#define HAL_SMARTCARD_MODULE_ENABLED */
/*#define HAL_SPI_MODULE_ENABLED */
#define HAL_SPI_MODULE_ENABLED
/*#define HAL_SRAM_MODULE_ENABLED */
/*#define HAL_TIM_MODULE_ENABLED */
/*#define HAL_UART_MODULE_ENABLED */

View File

@ -38,6 +38,7 @@
/* USER CODE END Includes */
/* Private variables ---------------------------------------------------------*/
SPI_HandleTypeDef hspi1;
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
@ -48,6 +49,7 @@
void SystemClock_Config(void);
void Error_Handler(void);
static void MX_GPIO_Init(void);
static void MX_SPI1_Init(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
@ -75,6 +77,7 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();
/* USER CODE BEGIN 2 */
@ -131,6 +134,29 @@ void SystemClock_Config(void)
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
/* SPI1 init function */
static void MX_SPI1_Init(void)
{
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 10;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
}
/** Configure pins as
* Analog
* Input
@ -150,12 +176,21 @@ static void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, OLED_DC_Pin|OLED_RST_Pin|OLED_CS_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : LED_Pin */
GPIO_InitStruct.Pin = LED_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : OLED_DC_Pin OLED_RST_Pin OLED_CS_Pin */
GPIO_InitStruct.Pin = OLED_DC_Pin|OLED_RST_Pin|OLED_CS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
/* USER CODE BEGIN 4 */

View File

@ -77,6 +77,65 @@ void HAL_MspInit(void)
/* USER CODE END MspInit 1 */
}
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
{
GPIO_InitTypeDef GPIO_InitStruct;
if(hspi->Instance==SPI1)
{
/* USER CODE BEGIN SPI1_MspInit 0 */
/* USER CODE END SPI1_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_SPI1_CLK_ENABLE();
/**SPI1 GPIO Configuration
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_6;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN SPI1_MspInit 1 */
/* USER CODE END SPI1_MspInit 1 */
}
}
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
{
if(hspi->Instance==SPI1)
{
/* USER CODE BEGIN SPI1_MspDeInit 0 */
/* USER CODE END SPI1_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_SPI1_CLK_DISABLE();
/**SPI1 GPIO Configuration
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
}
/* USER CODE BEGIN SPI1_MspDeInit 1 */
/* USER CODE END SPI1_MspDeInit 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */

View File

@ -4,17 +4,24 @@ KeepUserPlacement=false
Mcu.Family=STM32F1
Mcu.IP0=NVIC
Mcu.IP1=RCC
Mcu.IP2=SYS
Mcu.IPNb=3
Mcu.IP2=SPI1
Mcu.IP3=SYS
Mcu.IPNb=4
Mcu.Name=STM32F103V(C-D-E)Tx
Mcu.Package=LQFP100
Mcu.Pin0=PC13-TAMPER-RTC
Mcu.Pin1=OSC_IN
Mcu.Pin10=PA14
Mcu.Pin11=VP_SYS_VS_Systick
Mcu.Pin2=OSC_OUT
Mcu.Pin3=PA13
Mcu.Pin4=PA14
Mcu.Pin5=VP_SYS_VS_Systick
Mcu.PinsNb=6
Mcu.Pin3=PA1
Mcu.Pin4=PA2
Mcu.Pin5=PA3
Mcu.Pin6=PA5
Mcu.Pin7=PA6
Mcu.Pin8=PA7
Mcu.Pin9=PA13
Mcu.PinsNb=12
Mcu.UserConstants=
Mcu.UserName=STM32F103VCTx
MxCube.Version=4.16.1
@ -33,10 +40,28 @@ OSC_IN.Mode=HSE-External-Oscillator
OSC_IN.Signal=RCC_OSC_IN
OSC_OUT.Mode=HSE-External-Oscillator
OSC_OUT.Signal=RCC_OSC_OUT
PA1.GPIOParameters=GPIO_Label
PA1.GPIO_Label=OLED_DC
PA1.Locked=true
PA1.Signal=GPIO_Output
PA13.Mode=Serial_Wire
PA13.Signal=SYS_JTMS-SWDIO
PA14.Mode=Serial_Wire
PA14.Signal=SYS_JTCK-SWCLK
PA2.GPIOParameters=GPIO_Label
PA2.GPIO_Label=OLED_RST
PA2.Locked=true
PA2.Signal=GPIO_Output
PA3.GPIOParameters=GPIO_Label
PA3.GPIO_Label=OLED_CS
PA3.Locked=true
PA3.Signal=GPIO_Output
PA5.Mode=Full_Duplex_Master
PA5.Signal=SPI1_SCK
PA6.Mode=Full_Duplex_Master
PA6.Signal=SPI1_MISO
PA7.Mode=Full_Duplex_Master
PA7.Signal=SPI1_MOSI
PC13-TAMPER-RTC.GPIOParameters=GPIO_Label
PC13-TAMPER-RTC.GPIO_Label=LED
PC13-TAMPER-RTC.Locked=true
@ -72,7 +97,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=SW4STM32
ProjectManager.ToolChainLocation=/home/wn/workspace-stm32/newcar/cube/newcar
ProjectManager.UnderRoot=true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false,2-MX_SPI1_Init-SPI1-false
RCC.ADCFreqValue=36000000
RCC.AHBFreq_Value=72000000
RCC.APB1CLKDivider=RCC_HCLK_DIV2
@ -100,6 +125,10 @@ RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
RCC.TimSysFreq_Value=72000000
RCC.USBFreq_Value=72000000
RCC.VCOOutput2Freq_Value=8000000
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16
SPI1.CalculateBaudRate=4.5 MBits/s
SPI1.IPParameters=Mode,BaudRatePrescaler,CalculateBaudRate
SPI1.Mode=SPI_MODE_MASTER
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
board=newcar

View File

@ -43,6 +43,12 @@
#define LED_Pin GPIO_PIN_13
#define LED_GPIO_Port GPIOC
#define OLED_DC_Pin GPIO_PIN_1
#define OLED_DC_GPIO_Port GPIOA
#define OLED_RST_Pin GPIO_PIN_2
#define OLED_RST_GPIO_Port GPIOA
#define OLED_CS_Pin GPIO_PIN_3
#define OLED_CS_GPIO_Port GPIOA
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */

View File

@ -75,7 +75,7 @@
/*#define HAL_SD_MODULE_ENABLED */
/*#define HAL_SDRAM_MODULE_ENABLED */
/*#define HAL_SMARTCARD_MODULE_ENABLED */
/*#define HAL_SPI_MODULE_ENABLED */
#define HAL_SPI_MODULE_ENABLED
/*#define HAL_SRAM_MODULE_ENABLED */
/*#define HAL_TIM_MODULE_ENABLED */
/*#define HAL_UART_MODULE_ENABLED */

View File

@ -39,6 +39,7 @@
/* USER CODE END Includes */
/* Private variables ---------------------------------------------------------*/
SPI_HandleTypeDef hspi1;
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
@ -49,6 +50,7 @@
void SystemClock_Config(void);
void Error_Handler(void);
static void MX_GPIO_Init(void);
static void MX_SPI1_Init(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
@ -77,6 +79,7 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();
/* USER CODE BEGIN 2 */
my_setup_2();
@ -135,6 +138,29 @@ void SystemClock_Config(void)
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
/* SPI1 init function */
static void MX_SPI1_Init(void)
{
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 10;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
}
/** Configure pins as
* Analog
* Input
@ -154,12 +180,21 @@ static void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, OLED_DC_Pin|OLED_RST_Pin|OLED_CS_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : LED_Pin */
GPIO_InitStruct.Pin = LED_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : OLED_DC_Pin OLED_RST_Pin OLED_CS_Pin */
GPIO_InitStruct.Pin = OLED_DC_Pin|OLED_RST_Pin|OLED_CS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
/* USER CODE BEGIN 4 */

View File

@ -38,6 +38,7 @@
/* USER CODE END Includes */
/* Private variables ---------------------------------------------------------*/
SPI_HandleTypeDef hspi1;
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
@ -48,6 +49,7 @@
void SystemClock_Config(void);
void Error_Handler(void);
static void MX_GPIO_Init(void);
static void MX_SPI1_Init(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
@ -75,6 +77,7 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();
/* USER CODE BEGIN 2 */
@ -131,6 +134,29 @@ void SystemClock_Config(void)
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
/* SPI1 init function */
static void MX_SPI1_Init(void)
{
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 10;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
}
/** Configure pins as
* Analog
* Input
@ -150,12 +176,21 @@ static void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, OLED_DC_Pin|OLED_RST_Pin|OLED_CS_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : LED_Pin */
GPIO_InitStruct.Pin = LED_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : OLED_DC_Pin OLED_RST_Pin OLED_CS_Pin */
GPIO_InitStruct.Pin = OLED_DC_Pin|OLED_RST_Pin|OLED_CS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
/* USER CODE BEGIN 4 */

View File

@ -77,6 +77,65 @@ void HAL_MspInit(void)
/* USER CODE END MspInit 1 */
}
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
{
GPIO_InitTypeDef GPIO_InitStruct;
if(hspi->Instance==SPI1)
{
/* USER CODE BEGIN SPI1_MspInit 0 */
/* USER CODE END SPI1_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_SPI1_CLK_ENABLE();
/**SPI1 GPIO Configuration
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_6;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN SPI1_MspInit 1 */
/* USER CODE END SPI1_MspInit 1 */
}
}
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
{
if(hspi->Instance==SPI1)
{
/* USER CODE BEGIN SPI1_MspDeInit 0 */
/* USER CODE END SPI1_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_SPI1_CLK_DISABLE();
/**SPI1 GPIO Configuration
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
}
/* USER CODE BEGIN SPI1_MspDeInit 1 */
/* USER CODE END SPI1_MspDeInit 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */

View File

@ -0,0 +1,674 @@
/**
******************************************************************************
* @file stm32f1xx_hal_spi.h
* @author MCD Application Team
* @version V1.0.4
* @date 29-April-2016
* @brief Header file of SPI HAL module.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* 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
* and/or other materials provided with the distribution.
* 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
* 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
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_SPI_H
#define __STM32F1xx_HAL_SPI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal_def.h"
/** @addtogroup STM32F1xx_HAL_Driver
* @{
*/
/** @addtogroup SPI
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup SPI_Exported_Types SPI Exported Types
* @{
*/
/**
* @brief SPI Configuration Structure definition
*/
typedef struct
{
uint32_t Mode; /*!< Specifies the SPI operating mode.
This parameter can be a value of @ref SPI_mode */
uint32_t Direction; /*!< Specifies the SPI Directional mode state.
This parameter can be a value of @ref SPI_Direction_mode */
uint32_t DataSize; /*!< Specifies the SPI data size.
This parameter can be a value of @ref SPI_data_size */
uint32_t CLKPolarity; /*!< Specifies the serial clock steady state.
This parameter can be a value of @ref SPI_Clock_Polarity */
uint32_t CLKPhase; /*!< Specifies the clock active edge for the bit capture.
This parameter can be a value of @ref SPI_Clock_Phase */
uint32_t NSS; /*!< Specifies whether the NSS signal is managed by
hardware (NSS pin) or by software using the SSI bit.
This parameter can be a value of @ref SPI_Slave_Select_management */
uint32_t BaudRatePrescaler; /*!< Specifies the Baud Rate prescaler value which will be
used to configure the transmit and receive SCK clock.
This parameter can be a value of @ref SPI_BaudRate_Prescaler
@note The communication clock is derived from the master
clock. The slave clock does not need to be set */
uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
This parameter can be a value of @ref SPI_MSB_LSB_transmission */
uint32_t TIMode; /*!< Specifies if the TI mode is enabled or not.
This parameter can be a value of @ref SPI_TI_mode */
uint32_t CRCCalculation; /*!< Specifies if the CRC calculation is enabled or not.
This parameter can be a value of @ref SPI_CRC_Calculation */
uint32_t CRCPolynomial; /*!< Specifies the polynomial used for the CRC calculation.
This parameter must be a number between Min_Data = 0 and Max_Data = 65535 */
}SPI_InitTypeDef;
/**
* @brief HAL SPI State structure definition
*/
typedef enum
{
HAL_SPI_STATE_RESET = 0x00, /*!< SPI not yet initialized or disabled */
HAL_SPI_STATE_READY = 0x01, /*!< SPI initialized and ready for use */
HAL_SPI_STATE_BUSY = 0x02, /*!< SPI process is ongoing */
HAL_SPI_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
HAL_SPI_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
HAL_SPI_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
HAL_SPI_STATE_ERROR = 0x03 /*!< SPI error state */
}HAL_SPI_StateTypeDef;
/**
* @brief SPI handle Structure definition
*/
typedef struct __SPI_HandleTypeDef
{
SPI_TypeDef *Instance; /*!< SPI registers base address */
SPI_InitTypeDef Init; /*!< SPI communication parameters */
uint8_t *pTxBuffPtr; /*!< Pointer to SPI Tx transfer Buffer */
uint16_t TxXferSize; /*!< SPI Tx transfer size */
uint16_t TxXferCount; /*!< SPI Tx Transfer Counter */
uint8_t *pRxBuffPtr; /*!< Pointer to SPI Rx transfer Buffer */
uint16_t RxXferSize; /*!< SPI Rx transfer size */
uint16_t RxXferCount; /*!< SPI Rx Transfer Counter */
DMA_HandleTypeDef *hdmatx; /*!< SPI Tx DMA handle parameters */
DMA_HandleTypeDef *hdmarx; /*!< SPI Rx DMA handle parameters */
void (*RxISR)(struct __SPI_HandleTypeDef * hspi); /*!< function pointer on Rx ISR */
void (*TxISR)(struct __SPI_HandleTypeDef * hspi); /*!< function pointer on Tx ISR */
HAL_LockTypeDef Lock; /*!< SPI locking object */
__IO HAL_SPI_StateTypeDef State; /*!< SPI communication state */
__IO uint32_t ErrorCode; /*!< SPI Error code */
}SPI_HandleTypeDef;
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup SPI_Exported_Constants SPI Exported Constants
* @{
*/
/** @defgroup SPI_Error_Codes SPI Error Codes
* @{
*/
#define HAL_SPI_ERROR_NONE ((uint32_t)0x00) /*!< No error */
#define HAL_SPI_ERROR_MODF ((uint32_t)0x01) /*!< MODF error */
#define HAL_SPI_ERROR_CRC ((uint32_t)0x02) /*!< CRC error */
#define HAL_SPI_ERROR_OVR ((uint32_t)0x04) /*!< OVR error */
#define HAL_SPI_ERROR_DMA ((uint32_t)0x08) /*!< DMA transfer error */
#define HAL_SPI_ERROR_FLAG ((uint32_t)0x10) /*!< Flag: RXNE,TXE, BSY */
/**
* @}
*/
/** @defgroup SPI_mode SPI mode
* @{
*/
#define SPI_MODE_SLAVE ((uint32_t)0x00000000)
#define SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI)
/**
* @}
*/
/** @defgroup SPI_Direction_mode SPI Direction mode
* @{
*/
#define SPI_DIRECTION_2LINES ((uint32_t)0x00000000)
#define SPI_DIRECTION_2LINES_RXONLY SPI_CR1_RXONLY
#define SPI_DIRECTION_1LINE SPI_CR1_BIDIMODE
/**
* @}
*/
/** @defgroup SPI_data_size SPI data size
* @{
*/
#define SPI_DATASIZE_8BIT ((uint32_t)0x00000000)
#define SPI_DATASIZE_16BIT SPI_CR1_DFF
/**
* @}
*/
/** @defgroup SPI_Clock_Polarity SPI Clock Polarity
* @{
*/
#define SPI_POLARITY_LOW ((uint32_t)0x00000000)
#define SPI_POLARITY_HIGH SPI_CR1_CPOL
/**
* @}
*/
/** @defgroup SPI_Clock_Phase SPI Clock Phase
* @{
*/
#define SPI_PHASE_1EDGE ((uint32_t)0x00000000)
#define SPI_PHASE_2EDGE SPI_CR1_CPHA
/**
* @}
*/
/** @defgroup SPI_Slave_Select_management SPI Slave Select management
* @{
*/
#define SPI_NSS_SOFT SPI_CR1_SSM
#define SPI_NSS_HARD_INPUT ((uint32_t)0x00000000)
#define SPI_NSS_HARD_OUTPUT ((uint32_t)(SPI_CR2_SSOE << 16))
/**
* @}
*/
/** @defgroup SPI_BaudRate_Prescaler SPI BaudRate Prescaler
* @{
*/
#define SPI_BAUDRATEPRESCALER_2 ((uint32_t)0x00000000)
#define SPI_BAUDRATEPRESCALER_4 ((uint32_t)SPI_CR1_BR_0)
#define SPI_BAUDRATEPRESCALER_8 ((uint32_t)SPI_CR1_BR_1)
#define SPI_BAUDRATEPRESCALER_16 ((uint32_t)SPI_CR1_BR_1 | SPI_CR1_BR_0)
#define SPI_BAUDRATEPRESCALER_32 ((uint32_t)SPI_CR1_BR_2)
#define SPI_BAUDRATEPRESCALER_64 ((uint32_t)SPI_CR1_BR_2 | SPI_CR1_BR_0)
#define SPI_BAUDRATEPRESCALER_128 ((uint32_t)SPI_CR1_BR_2 | SPI_CR1_BR_1)
#define SPI_BAUDRATEPRESCALER_256 ((uint32_t)SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0)
/**
* @}
*/
/** @defgroup SPI_MSB_LSB_transmission SPI MSB LSB transmission
* @{
*/
#define SPI_FIRSTBIT_MSB ((uint32_t)0x00000000)
#define SPI_FIRSTBIT_LSB SPI_CR1_LSBFIRST
/**
* @}
*/
/** @defgroup SPI_TI_mode SPI TI mode disable
* @brief SPI TI Mode not supported for STM32F1xx family
* @{
*/
#define SPI_TIMODE_DISABLE ((uint32_t)0x00000000)
/**
* @}
*/
/** @defgroup SPI_CRC_Calculation SPI CRC Calculation
* @{
*/
#define SPI_CRCCALCULATION_DISABLE ((uint32_t)0x00000000)
#define SPI_CRCCALCULATION_ENABLE SPI_CR1_CRCEN
/**
* @}
*/
/** @defgroup SPI_Interrupt_configuration_definition SPI Interrupt configuration definition
* @{
*/
#define SPI_IT_TXE SPI_CR2_TXEIE
#define SPI_IT_RXNE SPI_CR2_RXNEIE
#define SPI_IT_ERR SPI_CR2_ERRIE
/**
* @}
*/
/** @defgroup SPI_Flag_definition SPI Flag definition
* @{
*/
#define SPI_FLAG_RXNE SPI_SR_RXNE
#define SPI_FLAG_TXE SPI_SR_TXE
#define SPI_FLAG_CRCERR SPI_SR_CRCERR
#define SPI_FLAG_MODF SPI_SR_MODF
#define SPI_FLAG_OVR SPI_SR_OVR
#define SPI_FLAG_BSY SPI_SR_BSY
/**
* @}
*/
/**
* @}
*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup SPI_Private_Constants SPI Private Constants
* @{
*/
#define SPI_INVALID_CRC_ERROR 0 /* CRC error wrongly detected */
#define SPI_VALID_CRC_ERROR 1 /* CRC error is true */
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup SPI_Exported_Macros SPI Exported Macros
* @{
*/
/** @brief Reset SPI handle state
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
/** @brief Enable the specified SPI interrupts.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @param __INTERRUPT__: specifies the interrupt source to enable.
* This parameter can be one of the following values:
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
* @arg SPI_IT_ERR: Error interrupt enable
* @retval None
*/
#define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CR2, (__INTERRUPT__))
/** @brief Disable the specified SPI interrupts.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @param __INTERRUPT__: specifies the interrupt source to disable.
* This parameter can be one of the following values:
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
* @arg SPI_IT_ERR: Error interrupt enable
* @retval None
*/
#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CR2, (__INTERRUPT__))
/** @brief Check if the specified SPI interrupt source is enabled or disabled.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @param __INTERRUPT__: specifies the SPI interrupt source to check.
* This parameter can be one of the following values:
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
* @arg SPI_IT_ERR: Error interrupt enable
* @retval The new state of __IT__ (TRUE or FALSE).
*/
#define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
/** @brief Check whether the specified SPI flag is set or not.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @param __FLAG__: specifies the flag to check.
* This parameter can be one of the following values:
* @arg SPI_FLAG_RXNE: Receive buffer not empty flag
* @arg SPI_FLAG_TXE: Transmit buffer empty flag
* @arg SPI_FLAG_CRCERR: CRC error flag
* @arg SPI_FLAG_MODF: Mode fault flag
* @arg SPI_FLAG_OVR: Overrun flag
* @arg SPI_FLAG_BSY: Busy flag
* @retval The new state of __FLAG__ (TRUE or FALSE).
*/
#define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
/** @brief Clear the SPI CRCERR pending flag.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_CLEAR_CRCERRFLAG(__HANDLE__) ((__HANDLE__)->Instance->SR = ~(SPI_FLAG_CRCERR))
/** @brief Clear the SPI MODF pending flag.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) \
do{ \
__IO uint32_t tmpreg; \
tmpreg = (__HANDLE__)->Instance->SR; \
tmpreg = CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE); \
UNUSED(tmpreg); \
}while(0)
/** @brief Clear the SPI OVR pending flag.
* @param __HANDLE__: specifies the SPI handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) \
do{ \
__IO uint32_t tmpreg; \
tmpreg = (__HANDLE__)->Instance->DR; \
tmpreg = (__HANDLE__)->Instance->SR; \
UNUSED(tmpreg); \
}while(0)
/** @brief Enables the SPI.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE)
/** @brief Disables the SPI.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define __HAL_SPI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE)
/**
* @}
*/
/* Private macros -----------------------------------------------------------*/
/** @defgroup SPI_Private_Macros SPI Private Macros
* @{
*/
/** @brief Checks if SPI Mode parameter is in allowed range.
* @param __MODE__: specifies the SPI Mode.
* This parameter can be a value of @ref SPI_mode
* @retval None
*/
#define IS_SPI_MODE(__MODE__) (((__MODE__) == SPI_MODE_SLAVE) || ((__MODE__) == SPI_MODE_MASTER))
/** @brief Checks if SPI Direction Mode parameter is in allowed range.
* @param __MODE__: specifies the SPI Direction Mode.
* This parameter can be a value of @ref SPI_Direction_mode
* @retval None
*/
#define IS_SPI_DIRECTION_MODE(__MODE__) (((__MODE__) == SPI_DIRECTION_2LINES) || \
((__MODE__) == SPI_DIRECTION_2LINES_RXONLY) || \
((__MODE__) == SPI_DIRECTION_1LINE))
/** @brief Checks if SPI Direction Mode parameter is 1 or 2 lines.
* @param __MODE__: specifies the SPI Direction Mode.
* @retval None
*/
#define IS_SPI_DIRECTION_2LINES_OR_1LINE(__MODE__) (((__MODE__) == SPI_DIRECTION_2LINES) || \
((__MODE__) == SPI_DIRECTION_1LINE))
/** @brief Checks if SPI Direction Mode parameter is 2 lines.
* @param __MODE__: specifies the SPI Direction Mode.
* @retval None
*/
#define IS_SPI_DIRECTION_2LINES(__MODE__) ((__MODE__) == SPI_DIRECTION_2LINES)
/** @brief Checks if SPI Data Size parameter is in allowed range.
* @param __DATASIZE__: specifies the SPI Data Size.
* This parameter can be a value of @ref SPI_data_size
* @retval None
*/
#define IS_SPI_DATASIZE(__DATASIZE__) (((__DATASIZE__) == SPI_DATASIZE_16BIT) || \
((__DATASIZE__) == SPI_DATASIZE_8BIT))
/** @brief Checks if SPI Serial clock steady state parameter is in allowed range.
* @param __CPOL__: specifies the SPI serial clock steady state.
* This parameter can be a value of @ref SPI_Clock_Polarity
* @retval None
*/
#define IS_SPI_CPOL(__CPOL__) (((__CPOL__) == SPI_POLARITY_LOW) || \
((__CPOL__) == SPI_POLARITY_HIGH))
/** @brief Checks if SPI Clock Phase parameter is in allowed range.
* @param __CPHA__: specifies the SPI Clock Phase.
* This parameter can be a value of @ref SPI_Clock_Phase
* @retval None
*/
#define IS_SPI_CPHA(__CPHA__) (((__CPHA__) == SPI_PHASE_1EDGE) || \
((__CPHA__) == SPI_PHASE_2EDGE))
/** @brief Checks if SPI Slave select parameter is in allowed range.
* @param __NSS__: specifies the SPI Slave Slelect management parameter.
* This parameter can be a value of @ref SPI_Slave_Select_management
* @retval None
*/
#define IS_SPI_NSS(__NSS__) (((__NSS__) == SPI_NSS_SOFT) || \
((__NSS__) == SPI_NSS_HARD_INPUT) || \
((__NSS__) == SPI_NSS_HARD_OUTPUT))
/** @brief Checks if SPI Baudrate prescaler parameter is in allowed range.
* @param __PRESCALER__: specifies the SPI Baudrate prescaler.
* This parameter can be a value of @ref SPI_BaudRate_Prescaler
* @retval None
*/
#define IS_SPI_BAUDRATE_PRESCALER(__PRESCALER__) (((__PRESCALER__) == SPI_BAUDRATEPRESCALER_2) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_4) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_8) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_16) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_32) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_64) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_128) || \
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_256))
/** @brief Checks if SPI MSB LSB transmission parameter is in allowed range.
* @param __BIT__: specifies the SPI MSB LSB transmission (whether data transfer starts from MSB or LSB bit).
* This parameter can be a value of @ref SPI_MSB_LSB_transmission
* @retval None
*/
#define IS_SPI_FIRST_BIT(__BIT__) (((__BIT__) == SPI_FIRSTBIT_MSB) || \
((__BIT__) == SPI_FIRSTBIT_LSB))
/** @brief Checks if SPI TI mode parameter is in allowed range.
* @param __MODE__: specifies the SPI TI mode.
* This parameter can be a value of @ref SPI_TI_mode
* @retval None
*/
#define IS_SPI_TIMODE(__MODE__) ((__MODE__) == SPI_TIMODE_DISABLE)
/** @brief Checks if SPI CRC calculation enabled state is in allowed range.
* @param __CALCULATION__: specifies the SPI CRC calculation enable state.
* This parameter can be a value of @ref SPI_CRC_Calculation
* @retval None
*/
#define IS_SPI_CRC_CALCULATION(__CALCULATION__) (((__CALCULATION__) == SPI_CRCCALCULATION_DISABLE) || \
((__CALCULATION__) == SPI_CRCCALCULATION_ENABLE))
/** @brief Checks if SPI polynomial value to be used for the CRC calculation, is in allowed range.
* @param __POLYNOMIAL__: specifies the SPI polynomial value to be used for the CRC calculation.
* This parameter must be a number between Min_Data = 0 and Max_Data = 65535
* @retval None
*/
#define IS_SPI_CRC_POLYNOMIAL(__POLYNOMIAL__) (((__POLYNOMIAL__) >= 0x1) && ((__POLYNOMIAL__) <= 0xFFFF))
/** @brief Sets the SPI transmit-only mode.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define SPI_1LINE_TX(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_BIDIOE)
/** @brief Sets the SPI receive-only mode.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define SPI_1LINE_RX(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_BIDIOE)
/** @brief Resets the CRC calculation of the SPI.
* @param __HANDLE__: specifies the SPI Handle.
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
* @retval None
*/
#define SPI_RESET_CRC(__HANDLE__) do{CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_CRCEN);\
SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_CRCEN);}while(0)
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup SPI_Exported_Functions
* @{
*/
/* Initialization/de-initialization functions **********************************/
/** @addtogroup SPI_Exported_Functions_Group1
* @{
*/
HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi);
HAL_StatusTypeDef HAL_SPI_DeInit (SPI_HandleTypeDef *hspi);
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi);
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi);
/**
* @}
*/
/* I/O operation functions *****************************************************/
/** @addtogroup SPI_Exported_Functions_Group2
* @{
*/
HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_Receive_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
HAL_StatusTypeDef HAL_SPI_DMAPause(SPI_HandleTypeDef *hspi);
HAL_StatusTypeDef HAL_SPI_DMAResume(SPI_HandleTypeDef *hspi);
HAL_StatusTypeDef HAL_SPI_DMAStop(SPI_HandleTypeDef *hspi);
void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi);
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi);
/**
* @}
*/
/* Peripheral State and Control functions **************************************/
/** @addtogroup SPI_Exported_Functions_Group3
* @{
*/
HAL_SPI_StateTypeDef HAL_SPI_GetState(SPI_HandleTypeDef *hspi);
uint32_t HAL_SPI_GetError(SPI_HandleTypeDef *hspi);
/**
* @}
*/
/**
* @}
*/
/* Private functions --------------------------------------------------------*/
/** @addtogroup SPI_Private_Functions
* @{
*/
uint8_t SPI_ISCRCErrorValid(SPI_HandleTypeDef *hspi);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F1xx_HAL_SPI_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,217 @@
/**
******************************************************************************
* @file stm32f1xx_hal_spi_ex.c
* @author MCD Application Team
* @version V1.0.4
* @date 29-April-2016
* @brief Extended SPI HAL module driver.
*
* This file provides firmware functions to manage the following
* functionalities SPI extension peripheral:
* + Extended Peripheral Control functions
*
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* 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
* and/or other materials provided with the distribution.
* 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
* 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
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/** @addtogroup STM32F1xx_HAL_Driver
* @{
*/
/** @addtogroup SPI
* @{
*/
#ifdef HAL_SPI_MODULE_ENABLED
/** @defgroup SPI_Private_Variables SPI Private Variables
* @{
*/
/* Variable used to determine if device is impacted by implementation of workaround
related to wrong CRC errors detection on SPI2. Conditions in which this workaround has to be applied, are:
- STM32F101CDE/STM32F103CDE
- Revision ID : Z
- SPI2
- In receive only mode, with CRC calculation enabled, at the end of the CRC reception,
the software needs to check the CRCERR flag. If it is found set, read back the SPI_RXCRC:
+ If the value is 0, the complete data transfer is successful.
+ Otherwise, one or more errors have been detected during the data transfer by CPU or DMA.
If CRCERR is found reset, the complete data transfer is considered successful.
*/
uint8_t uCRCErrorWorkaroundCheck = 0;
/**
* @}
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/** @addtogroup SPI_Exported_Functions
* @{
*/
/** @addtogroup SPI_Exported_Functions_Group1
*
* @{
*/
/**
* @brief Initializes the SPI according to the specified parameters
* in the SPI_InitTypeDef and create the associated handle.
* @param hspi: pointer to a SPI_HandleTypeDef structure that contains
* the configuration information for SPI module.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi)
{
/* Check the SPI handle allocation */
if(hspi == NULL)
{
return HAL_ERROR;
}
/* Check the parameters */
assert_param(IS_SPI_ALL_INSTANCE(hspi->Instance));
assert_param(IS_SPI_MODE(hspi->Init.Mode));
assert_param(IS_SPI_DIRECTION_MODE(hspi->Init.Direction));
assert_param(IS_SPI_DATASIZE(hspi->Init.DataSize));
assert_param(IS_SPI_CPOL(hspi->Init.CLKPolarity));
assert_param(IS_SPI_CPHA(hspi->Init.CLKPhase));
assert_param(IS_SPI_NSS(hspi->Init.NSS));
assert_param(IS_SPI_BAUDRATE_PRESCALER(hspi->Init.BaudRatePrescaler));
assert_param(IS_SPI_FIRST_BIT(hspi->Init.FirstBit));
assert_param(IS_SPI_TIMODE(hspi->Init.TIMode));
assert_param(IS_SPI_CRC_CALCULATION(hspi->Init.CRCCalculation));
assert_param(IS_SPI_CRC_POLYNOMIAL(hspi->Init.CRCPolynomial));
if(hspi->State == HAL_SPI_STATE_RESET)
{
/* Init the low level hardware : GPIO, CLOCK, NVIC... */
HAL_SPI_MspInit(hspi);
}
hspi->State = HAL_SPI_STATE_BUSY;
/* Disble the selected SPI peripheral */
__HAL_SPI_DISABLE(hspi);
/*----------------------- SPIx CR1 & CR2 Configuration ---------------------*/
/* Configure : SPI Mode, Communication Mode, Data size, Clock polarity and phase, NSS management,
Communication speed, First bit and CRC calculation state */
WRITE_REG(hspi->Instance->CR1, (hspi->Init.Mode | hspi->Init.Direction | hspi->Init.DataSize |
hspi->Init.CLKPolarity | hspi->Init.CLKPhase | (hspi->Init.NSS & SPI_CR1_SSM) |
hspi->Init.BaudRatePrescaler | hspi->Init.FirstBit | hspi->Init.CRCCalculation) );
/* Configure : NSS management */
WRITE_REG(hspi->Instance->CR2, (((hspi->Init.NSS >> 16) & SPI_CR2_SSOE) | hspi->Init.TIMode));
/*---------------------------- SPIx CRCPOLY Configuration ------------------*/
/* Configure : CRC Polynomial */
WRITE_REG(hspi->Instance->CRCPR, hspi->Init.CRCPolynomial);
#if defined (STM32F101x6) || defined (STM32F101xB) || defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F102x6) || defined (STM32F102xB) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F103xE) || defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC)
/* Activate the SPI mode (Make sure that I2SMOD bit in I2SCFGR register is reset) */
CLEAR_BIT(hspi->Instance->I2SCFGR, SPI_I2SCFGR_I2SMOD);
#endif
#if defined (STM32F101xE) || defined (STM32F103xE)
/* Check RevisionID value for identifying if Device is Rev Z (0x0001) in order to enable workaround for
CRC errors wrongly detected */
/* Pb is that ES_STM32F10xxCDE also identify an issue in Debug registers access while not in Debug mode.
Revision ID information is only available in Debug mode, so Workaround could not be implemented
to distinguish Rev Z devices (issue present) from more recent version (issue fixed).
So, in case of Revison Z F101 or F103 devices, below variable should be assigned to 1 */
uCRCErrorWorkaroundCheck = 0;
#else
uCRCErrorWorkaroundCheck = 0;
#endif
hspi->ErrorCode = HAL_SPI_ERROR_NONE;
hspi->State = HAL_SPI_STATE_READY;
return HAL_OK;
}
/**
* @}
*/
/**
* @}
*/
/** @addtogroup SPI_Private_Functions
* @{
*/
/**
* @brief Checks if encountered CRC error could be corresponding to wrongly detected errors
* according to SPI instance, Device type, and revision ID.
* @param hspi: pointer to a SPI_HandleTypeDef structure that contains
* the configuration information for SPI module.
* @retval CRC error validity (SPI_INVALID_CRC_ERROR or SPI_VALID_CRC_ERROR).
*/
uint8_t SPI_ISCRCErrorValid(SPI_HandleTypeDef *hspi)
{
#if defined (STM32F101xE) || defined (STM32F103xE)
/* Check how to handle this CRC error (workaround to be applied or not) */
/* If CRC errors could be wrongly detected (issue 2.15.2 in STM32F10xxC/D/E silicon limitations ES (DocID14732 Rev 13) */
if ( (uCRCErrorWorkaroundCheck != 0) && (hspi->Instance == SPI2) )
{
if (hspi->Instance->RXCRCR == 0)
{
return (SPI_INVALID_CRC_ERROR);
}
}
return (SPI_VALID_CRC_ERROR);
#else
return (SPI_VALID_CRC_ERROR);
#endif
}
/**
* @}
*/
#endif /* HAL_SPI_MODULE_ENABLED */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/