Browse Source

实现LED灯闪烁

div1
QQyyblithe 2 years ago
parent
commit
4266349073
10 changed files with 283 additions and 184 deletions
  1. +11
    -11
      IAR/settings/test01.dnx
  2. +18
    -18
      IAR/settings/test01.wsdt
  3. +158
    -109
      IAR/test01.dep
  4. +6
    -0
      IAR/test01.ewp
  5. +6
    -0
      IAR/test01.ewt
  6. +33
    -0
      user/delay.c
  7. +7
    -0
      user/delay.h
  8. +8
    -46
      user/main.c
  9. +28
    -0
      user/pin_Init.c
  10. +8
    -0
      user/pin_Init.h

+ 11
- 11
IAR/settings/test01.dnx View File

@@ -35,7 +35,7 @@
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
</JLinkDriver>
<DebugChecksum>
<Checksum>2228608824</Checksum>
<Checksum>2701884870</Checksum>
</DebugChecksum>
<Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught>
@@ -125,6 +125,12 @@
<ShowTimeSum>1</ShowTimeSum>
<SumSortOrder>0</SumSortOrder>
</EventLog>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
@@ -134,6 +140,10 @@
<LogFile>_ ""</LogFile>
<Category>_ 0</Category>
</LogFile>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
<DriverProfiling>
<Enabled>0</Enabled>
<Mode>3</Mode>
@@ -152,14 +162,4 @@
<Probe0>I0</Probe0>
<ProbeSetup0>2 1 1 2 0 0</ProbeSetup0>
</PowerProbe>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
</settings>

+ 18
- 18
IAR/settings/test01.wsdt
File diff suppressed because it is too large
View File


+ 158
- 109
IAR/test01.dep View File

@@ -1,95 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<fileVersion>4</fileVersion>
<fileChecksum>2510143316</fileChecksum>
<fileChecksum>516634060</fileChecksum>
<configuration>
<name>Debug</name>
<outputs>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.__cstat.et</file>
<file>$PROJ_DIR$\..\startup\system_MKV56F24.c</file>
<file>$PROJ_DIR$\..\drivers\fsl_clock.c</file>
<file>$PROJ_DIR$\..\user\main.c</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.xcl</file>
<file>$PROJ_DIR$\..\Include\core_cm7.h</file>
<file>$TOOLKIT_DIR$\inc\c\ycheck.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.o</file>
<file>$PROJ_DIR$\..\startup\MKV56F24.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_common.c</file>
<file>$PROJ_DIR$\..\drivers\fsl_gpio.c</file>
<file>$PROJ_DIR$\..\drivers\fsl_clock.c</file>
<file>$PROJ_DIR$\..\Include\mpu_armv7.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.__cstat.et</file>
<file>$PROJ_DIR$\..\drivers\fsl_common.h</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console_conf.h</file>
<file>$PROJ_DIR$\..\startup\startup_MKV56F24.s</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_string.h</file>
<file>$TOOLKIT_DIR$\lib\rt7M_tl.a</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_debug_console.xcl</file>
<file>$PROJ_DIR$\..\utilities\fsl_assert.c</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_float_setup.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_port.h</file>
<file>$PROJ_DIR$\Debug\List\test01.map</file>
<file>$PROJ_DIR$\..\drivers\fsl_gpio.c</file>
<file>$PROJ_DIR$\..\Include\cmsis_version.h</file>
<file>$TOOLKIT_DIR$\inc\c\yvals.h</file>
<file>$TOOLKIT_DIR$\config\linker\NXP\MKV5xF512xxx24.icf</file>
<file>$TOOLKIT_DIR$\lib\m7M_tls.a</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.o</file>
<file>$TOOLKIT_DIR$\inc\c\iccarm_builtin.h</file>
<file>$PROJ_DIR$\Debug\Obj\main.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\startup_MKV56F24.o</file>
<file>$PROJ_DIR$\..\startup\system_MKV56F24.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.xcl</file>
<file>$PROJ_DIR$\..\Include\cmsis_iccarm.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.o</file>
<file>$TOOLKIT_DIR$\inc\c\stdarg.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.xcl</file>
<file>$PROJ_DIR$\..\startup\MKV56F24.h</file>
<file>$TOOLKIT_DIR$\inc\c\math.h</file>
<file>$PROJ_DIR$\..\user\main.c</file>
<file>$PROJ_DIR$\..\startup\system_MKV56F24.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.o</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Defaults.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_clock.h</file>
<file>$PROJ_DIR$\..\utilities\str\fsl_str.c</file>
<file>$TOOLKIT_DIR$\lib\shb_l.a</file>
<file>$TOOLKIT_DIR$\lib\dl7M_tln.a</file>
<file>$PROJ_DIR$\..\drivers\fsl_common.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_stdlib.h</file>
<file>$TOOLKIT_DIR$\inc\c\string.h</file>
<file>$TOOLKIT_DIR$\inc\c\ysizet.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.xcl</file>
<file>$TOOLKIT_DIR$\inc\c\stdint.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_gpio.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\main.o</file>
<file>$TOOLKIT_DIR$\inc\c\stdbool.h</file>
<file>$PROJ_DIR$\..\utilities\str\fsl_str.h</file>
<file>$PROJ_DIR$\..\Include\cmsis_compiler.h</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console.c</file>
<file>$TOOLKIT_DIR$\inc\c\stdlib.h</file>
<file>$PROJ_DIR$\..\startup\system_MKV56F24.h</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.xcl</file>
<file>$TOOLKIT_DIR$\inc\c\assert.h</file>
<file>$TOOLKIT_DIR$\lib\shb_l.a</file>
<file>$PROJ_DIR$\Debug\Obj\test01.pbd</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.o</file>
<file>$TOOLKIT_DIR$\inc\c\stdbool.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Exe\test01.out</file>
<file>$PROJ_DIR$\..\startup\MKV56F24_features.h</file>
<file>$PROJ_DIR$\Debug\Obj\main.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.xcl</file>
<file>$PROJ_DIR$\..\Include\cmsis_compiler.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.o</file>
<file>$PROJ_DIR$\..\Include\mpu_armv7.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_stdlib.h</file>
<file>$PROJ_DIR$\..\startup\fsl_device_registers.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Defaults.h</file>
<file>$TOOLKIT_DIR$\inc\c\stdint.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_clock.h</file>
<file>$PROJ_DIR$\..\Include\cmsis_iccarm.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\startup_MKV56F24.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.o</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.o</file>
<file>$PROJ_DIR$\Debug\Obj\main.xcl</file>
<file>$PROJ_DIR$\Debug\List\test01.map</file>
<file>$PROJ_DIR$\Debug\Exe\test01.out</file>
<file>$PROJ_DIR$\..\Include\cmsis_version.h</file>
<file>$TOOLKIT_DIR$\inc\c\ycheck.h</file>
<file>$TOOLKIT_DIR$\inc\c\ysizet.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.o</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product.h</file>
<file>$TOOLKIT_DIR$\lib\m7M_tls.a</file>
<file>$TOOLKIT_DIR$\inc\c\string.h</file>
<file>$PROJ_DIR$\..\Include\core_cm7.h</file>
<file>$PROJ_DIR$\Debug\Obj\main.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\test01.pbd</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\stddef.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_gpio.h</file>
<file>$PROJ_DIR$\..\utilities\str\fsl_str.h</file>
<file>$TOOLKIT_DIR$\inc\c\stdarg.h</file>
<file>$TOOLKIT_DIR$\inc\c\math.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_float_setup.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_debug_console.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.o</file>
<file>$PROJ_DIR$\..\utilities\str\fsl_str.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.xcl</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console_conf.h</file>
<file>$PROJ_DIR$\..\utilities\fsl_assert.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.o</file>
<file>$PROJ_DIR$\..\..\NXP_TestSDK\startup\system_MKV56F24.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\iccarm_builtin.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_string.h</file>
<file>$TOOLKIT_DIR$\inc\c\yvals.h</file>
<file>$TOOLKIT_DIR$\lib\rt7M_tl.a</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h</file>
<file>$TOOLKIT_DIR$\config\linker\NXP\MKV5xF512xxx24.icf</file>
<file>$PROJ_DIR$\..\user\delay.c</file>
<file>$PROJ_DIR$\..\user\delay.h</file>
<file>$PROJ_DIR$\Debug\Obj\delay.o</file>
<file>$PROJ_DIR$\Debug\Obj\delay.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\pin_Init.o</file>
<file>$PROJ_DIR$\Debug\Obj\pin_Init.xcl</file>
<file>$PROJ_DIR$\..\user\pin_Init.h</file>
<file>$PROJ_DIR$\..\user\pin_Init.c</file>
</outputs>
<file>
<name>[ROOT_NODE]</name>
<outputs>
<tool>
<name>ILINK</name>
<file> 44 15</file>
<file> 51 50</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\startup\system_MKV56F24.c</name>
<name>$PROJ_DIR$\..\drivers\fsl_common.c</name>
<outputs>
<tool>
<name>ICCARM</name>
@@ -97,114 +104,160 @@
</tool>
<tool>
<name>__cstat</name>
<file> 0</file>
<file> 65</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 5</file>
<file> 55</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 53 7 18 52 4 56 51 9 6 17 48 27 22 50 25 45</file>
<file> 5 40 53 68 22 70 57 32 28 59 54 67 36 42 64 43 17 60 52 34 44 66 3 37 41 23</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\drivers\fsl_clock.c</name>
<name>$PROJ_DIR$\..\drivers\fsl_gpio.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 41</file>
<file> 47</file>
</tool>
<tool>
<name>__cstat</name>
<file> 63</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 40</file>
<file> 27</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 54 29 34 7 18 52 4 56 42 53 31 32 12 33 30 57 51 9 6 17 48 27 22 50 25 45</file>
<file> 29 5 40 53 68 22 70 57 32 28 59 54 67 36 42 64 43 17 60 52 34 44 66 3 37 41 23</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\user\main.c</name>
<name>$PROJ_DIR$\..\drivers\fsl_clock.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 56</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 45</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 23 5 40 53 68 22 70 57 32 28 59 54 67 36 42 64 43 17 60 52 34 44 66 3 37 41</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\startup\startup_MKV56F24.s</name>
<outputs>
<tool>
<name>AARM</name>
<file> 46</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\utilities\fsl_assert.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 13</file>
</tool>
<tool>
<name>__cstat</name>
<file> 23</file>
<file> 4</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 55</file>
<file> 16</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 9 6 53 7 18 52 4 56 17 48 27 22 50 25 29 34 42 31 32 12 33 30 57 51 45 54 58 14</file>
<file> 5 40 53 68 22 70 57 32 28 59 54 67 36 42 64 43 17 60 52 34 44 66 3 37 41 23</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\drivers\fsl_common.c</name>
<name>$PROJ_DIR$\..\user\main.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 49</file>
<file> 31</file>
</tool>
<tool>
<name>__cstat</name>
<file> 39</file>
<file> 61</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 26</file>
<file> 49</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 29 34 7 18 52 4 56 42 53 31 32 12 33 30 57 51 9 6 17 48 27 22 50 25 45 54</file>
<file> 5 40 53 68 22 70 57 32 28 59 54 67 36 42 64 43 17 60 52 34 44 66 3 37 41 23 29 78 73</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\startup\startup_MKV56F24.s</name>
<name>$PROJ_DIR$\..\startup\system_MKV56F24.c</name>
<outputs>
<tool>
<name>AARM</name>
<file> 24</file>
<name>ICCARM</name>
<file> 48</file>
</tool>
<tool>
<name>__cstat</name>
<file> 38</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 39</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 28 53 68 22 70 57 43 17 60 52 34 44 66 3 37 41</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\drivers\fsl_gpio.c</name>
<name>$PROJ_DIR$\..\utilities\str\fsl_str.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 8</file>
<file> 15</file>
</tool>
<tool>
<name>__cstat</name>
<file> 38</file>
<file> 30</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 47</file>
<file> 12</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 58 29 34 7 18 52 4 56 42 53 31 32 12 33 30 57 51 9 6 17 48 27 22 50 25 45 54</file>
<file> 18 53 68 22 70 57 10 14 36 54 42 33 5 40 32 28 59 67 64 43 17 60 52 34 44 66 3 37 41 23 6</file>
</tool>
</inputs>
</file>
@@ -213,13 +266,13 @@
<outputs>
<tool>
<name>BICOMP</name>
<file> 63</file>
<file> 8</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 60 33 7 18 52 4 56 32 30 69 29 34 42 53 31 12 57 51 9 6 17 48 27 22 50 25 45 54 59</file>
<file> 14 36 53 68 22 70 57 54 42 6 5 40 32 28 59 67 64 43 17 60 52 34 44 66 3 37 41 23 33</file>
</tool>
</inputs>
</file>
@@ -228,62 +281,58 @@
<outputs>
<tool>
<name>ILINK</name>
<file> 15</file>
<file> 50</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ILINK</name>
<file> 19 41 49 8 46 24 21 35 13 20 28</file>
<file> 71 74 56 21 47 31 76 46 48 25 69 58 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\utilities\str\fsl_str.c</name>
<name>$PROJ_DIR$\..\user\delay.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 66</file>
</tool>
<tool>
<name>__cstat</name>
<file> 65</file>
<file> 74</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 68</file>
<file> 75</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 61 7 18 52 4 56 62 60 33 32 30 59 29 34 42 53 31 12 57 51 9 6 17 48 27 22 50 25 45 54 69</file>
<file> 5 40 53 68 22 70 57 32 28 59 54 67 36 42 64 43 17 60 52 34 44 66 3 37 41 23 73</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\utilities\fsl_assert.c</name>
<name>$PROJ_DIR$\..\user\pin_Init.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 71</file>
</tool>
<tool>
<name>__cstat</name>
<file> 43</file>
<file> 76</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 64</file>
<file> 77</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 29 34 7 18 52 4 56 42 53 31 32 12 33 30 57 51 9 6 17 48 27 22 50 25 45 54</file>
<file> 5 40 53 68 22 70 57 32 28 59 54 67 36 42 64 43 17 60 52 34 44 66 3 37 41 23 11 29 78</file>
</tool>
</inputs>
</file>
<forcedrebuild>
<name>[MULTI_TOOL]</name>
<tool>ILINK</tool>
</forcedrebuild>
</configuration>
<configuration>
<name>Release</name>


+ 6
- 0
IAR/test01.ewp View File

@@ -2136,8 +2136,14 @@
</group>
<group>
<name>user</name>
<file>
<name>$PROJ_DIR$\..\user\delay.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\user\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\user\pin_Init.c</name>
</file>
</group>
</project>

+ 6
- 0
IAR/test01.ewt View File

@@ -2398,8 +2398,14 @@
</group>
<group>
<name>user</name>
<file>
<name>$PROJ_DIR$\..\user\delay.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\user\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\user\pin_Init.c</name>
</file>
</group>
</project>

+ 33
- 0
user/delay.c View File

@@ -0,0 +1,33 @@
/*****************头文件*************************/
#include "fsl_common.h"
#include "delay.h"

/*****************全局变量*************************/
volatile uint32_t g_systickCounter; //滴答定时器延时时间计数

/*****************延时函数初始化*************************/
void Delay_Init()
{
if (SysTick_Config(SystemCoreClock / 1000U)) //设置1ms中断一次
{
while (1)
{
}
}
}
/*****************延时函数*************************/
void Delay_ms(uint32_t n)
{
g_systickCounter = n;
while (g_systickCounter != 0U)
{
}
}
/*****************延时函数中断*************************/
void SysTick_Handler(void)
{
if (g_systickCounter != 0U)
{
g_systickCounter--;
}
}

+ 7
- 0
user/delay.h View File

@@ -0,0 +1,7 @@
#ifndef _DELAY_H_
#define _DELAY_H_

/*****************函数声明*************************/
void Delay_ms(uint32_t n); //滴答定时器延时函数
void Delay_Init(); //初始化延时函数
#endif

+ 8
- 46
user/main.c View File

@@ -1,66 +1,28 @@
#include "MKV56F24.h"
/*****************头文件*************************/
#include "fsl_common.h"
#include "fsl_gpio.h"
#include "fsl_port.h"
#include "pin_Init.h"
#include "delay.h"

/*********************************************
PTA15——LED灯闪烁
**********************************************/
volatile uint32_t g_systickCounter;
void SysTick_DelayTicks(uint32_t n); //滴答定时器延时函数

void main()
{
CLOCK_EnableClock(kCLOCK_PortA); //开启PORT时钟
port_pin_config_t GPIO_Port_Init =
{
kPORT_PullUp , //上拉
kPORT_FastSlewRate, //快速压摆率
kPORT_PassiveFilterDisable, //无源滤波器
kPORT_OpenDrainDisable, //推挽输出
kPORT_LowDriveStrength, //低驱动力
kPORT_MuxAsGpio, //普通GPIO模式
kPORT_UnlockRegister, //
};
PORT_SetPinConfig(PORTA, 15U, &GPIO_Port_Init); //设置引脚复用方式
gpio_pin_config_t config =
{
kGPIO_DigitalOutput, //输出模式
0,
};
GPIO_PinInit(GPIOA, 15U, &config); //初始化PTA15
GPIO_PinWrite(GPIOA, 15, 1); //PTA15写1
/* Set systick reload value to generate 1ms interrupt */
if (SysTick_Config(SystemCoreClock / 1000U))
{
while (1)
{
}
}
Delay_Init(); //延时函数初始化
pin_Init(); //GPIO初始化
while (1)
{
GPIO_PinWrite(GPIOA, 15, 0);
SysTick_DelayTicks(500U);
Delay_ms(500U);
GPIO_PinWrite(GPIOA, 15, 1);
SysTick_DelayTicks(500U);
Delay_ms(500U);
}

}


void SysTick_Handler(void)
{
if (g_systickCounter != 0U)
{
g_systickCounter--;
}
}

void SysTick_DelayTicks(uint32_t n)
{
g_systickCounter = n;
while (g_systickCounter != 0U)
{
}
}


+ 28
- 0
user/pin_Init.c View File

@@ -0,0 +1,28 @@
/*****************头文件*************************/
#include "fsl_common.h"
#include "fsl_port.h"
#include "fsl_gpio.h"
#include "pin_Init.h"

/*****************GPIO初始化*************************/
void pin_Init()
{
port_pin_config_t GPIO_Port_Init =
{
kPORT_PullUp , //上拉
kPORT_FastSlewRate, //快速压摆率
kPORT_PassiveFilterDisable, //无源滤波器
kPORT_OpenDrainDisable, //推挽输出
kPORT_LowDriveStrength, //低驱动力
kPORT_MuxAsGpio, //普通GPIO模式
kPORT_UnlockRegister, //
};
PORT_SetPinConfig(PORTA, 15U, &GPIO_Port_Init); //设置引脚复用方式
gpio_pin_config_t config =
{
kGPIO_DigitalOutput, //输出模式
0,
};
GPIO_PinInit(GPIOA, 15U, &config); //初始化PTA15
GPIO_PinWrite(GPIOA, 15, 1); //PTA15写1
}

+ 8
- 0
user/pin_Init.h View File

@@ -0,0 +1,8 @@
#ifndef _PIN_INIT_H_
#define _PIN_INIT_H_

/*****************函数声明*************************/
void pin_Init();


#endif

Loading…
Cancel
Save