Browse Source

增加组件:PWM,HX711称重传感器,读AB相霍尔编码;更新readme;更新工程模板

woshiashuai 1 year ago
parent
commit
7c09b1580b
34 changed files with 814 additions and 3994 deletions
  1. 8 5
      README.md
  2. 0 7
      module_Template/DS18B20温度传感器/DS18B20.h
  3. BIN
      module_Template/DS18B20温度传感器/DS18B20接口图.jpg
  4. 155 0
      module_Template/HX711称重传感器/HX711.c
  5. 22 0
      module_Template/HX711称重传感器/HX711.h
  6. 13 0
      module_Template/HX711称重传感器/use_example.c
  7. 0 0
      module_Template/MLX90614红外测温/MLX90614红外测温接口图.jpg
  8. 0 29
      module_Template/OLED屏幕0.96/OLED.c
  9. 0 2
      module_Template/OLED屏幕0.96/OLEDFont.h
  10. 0 3
      module_Template/RC522-RFID模块/SPI.c
  11. 0 3
      module_Template/SIM900A短信模块/GSM_func.h
  12. 0 7
      module_Template/SR04超声波/SR04.h
  13. 0 245
      module_Template/分时调度系统/TimeScheduleSystem.c
  14. 0 43
      module_Template/分时调度系统/TimeScheduleSystem.h
  15. 0 1
      module_Template/分时调度系统/readme.txt
  16. 0 45
      module_Template/分时调度系统/use_example.c
  17. 113 0
      module_Template/读AB相霍尔编码/Encoder.c
  18. 14 0
      module_Template/读AB相霍尔编码/Encoder.h
  19. 14 0
      module_Template/读AB相霍尔编码/use_example.c
  20. 202 0
      project_Template/Drive/MultiTimerA.c
  21. 56 0
      project_Template/Drive/MultiTimerA.h
  22. 0 245
      project_Template/Drive/TimeScheduleSystem.c
  23. 0 43
      project_Template/Drive/TimeScheduleSystem.h
  24. 0 1429
      project_Template/Project/Listings/startup_stm32f10x_hd.lst
  25. 0 40
      project_Template/Project/Objects/myProject.lnp
  26. 0 16
      project_Template/Project/Objects/myProject.sct
  27. 0 1801
      project_Template/Project/myProject.uvguix.AS
  28. 2 2
      project_Template/Project/myProject.uvoptx
  29. 2 2
      project_Template/Project/myProject.uvprojx
  30. 6 17
      project_Template/User/handle.c
  31. 1 1
      project_Template/User/main.h
  32. 9 8
      system_Template/ADC.c
  33. 179 0
      system_Template/PWM.c
  34. 18 0
      system_Template/PWM.h

+ 8 - 5
README.md

@@ -2,7 +2,9 @@
 
 开发平台:KEIL MDK5
 
-MCU型号:STM32F103C8T6
+测试MCU:STM32F103C8T6
+
+*注意:代码里面的#include <main.h>中的main.h头文件是头文件集合(即把使用到的头文件全写进main.h一个文件内,这样只需要引入它就引入了全部头文件),可在projectTemplate/projectTemplate/User文件内查看。*
 
 文件夹描述:
 
@@ -12,6 +14,8 @@ project_Template:工程模板
 
 system_Template:外设模板
 
+单片机裸机项目开发模板(学习为主):[mcu_development_module: 单片机开发模块,内含消息队列,类线程间同步方法(信号量、互斥锁、事件集),软件定时器,非阻塞延时,数据转换等。 (gitee.com)](https://gitee.com/woshiashuai/mcu_development_module)
+
 模块模板有以下内容:
 
 1. ADXL345三轴传感器
@@ -37,10 +41,9 @@ system_Template:外设模板
 21. USART&TIM
 22. WIFIGetAPI
 23. 单向链表
-24. 分时调度系统
 25. 智能健康检测模块
-
-
+25. 读AB相霍尔编码
+26. HX711称重模块
 
 外设模板有以下内容:
 
@@ -59,4 +62,4 @@ system_Template:外设模板
 13. TIM.c.h
 14. USART.c.h
 15. WDOG.c.h
-
+16. PWM.c.h

+ 0 - 7
module_Template/DS18B20温度传感器/DS18B20.h

@@ -11,13 +11,6 @@ typedef struct
 	float (*GetTemp_MatchRom)(uint8_t*);
 }DS18B20_t;
 
-
-/* extern variables ------------------------------------------------*/
 extern DS18B20_t  DS18B20;
 
-/* extern function prototypes --------------------------------------*/
-
-
-
 #endif
-

BIN
module_Template/DS18B20温度传感器/DS18B20接口图.jpg


+ 155 - 0
module_Template/HX711称重传感器/HX711.c

@@ -0,0 +1,155 @@
+/* include ---------------------------------------------------------*/
+#include <main.h>
+
+
+
+/* private define -------------------------------------------------*/
+// SCK=Tx DT=Rx
+#define HX711_SCK_GPIO_PORT    			GPIOA			              /* GPIO端口 */
+#define HX711_SCK_GPIO_CLK 	    		RCC_APB2Periph_GPIOA		/* GPIO端口时钟 */
+#define HX711_SCK_GPIO_PIN				GPIO_Pin_4			        /* 连接到SCL时钟线的GPIO */
+
+#define HX711_DT_GPIO_PORT    			GPIOA			              /* GPIO端口 */
+#define HX711_DT_GPIO_CLK 	    		RCC_APB2Periph_GPIOA		/* GPIO端口时钟 */
+#define HX711_DT_GPIO_PIN				GPIO_Pin_5			        /* 连接到SCL时钟线的GPIO */
+
+/* private variables ----------------------------------------------*/
+ uint32_t HX711_Buffer = 0;
+
+/* private function prototypes ------------------------------------*/
+static void Init(void);
+static uint32_t Read(void);
+static uint32_t GetValue(void);
+
+/* public variables -----------------------------------------------*/
+HX711_t HX711 =
+{
+    Init,
+    GetValue
+};
+
+/**
+  * @brief  初始化
+  * @param  None
+  * @retval None
+  * @note   None
+*/
+static void Init(void)
+{
+    GPIO_InitTypeDef GPIO_InitStructure;
+	
+	RCC_APB2PeriphClockCmd(HX711_SCK_GPIO_CLK | HX711_DT_GPIO_CLK, ENABLE);
+	
+	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+	GPIO_InitStructure.GPIO_Pin = HX711_DT_GPIO_PIN;
+	GPIO_Init(HX711_DT_GPIO_PORT, &GPIO_InitStructure);
+	
+	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
+	GPIO_InitStructure.GPIO_Pin = HX711_SCK_GPIO_PIN;
+	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+	GPIO_Init(HX711_SCK_GPIO_PORT, &GPIO_InitStructure);
+	
+	DELAYClass.DelayMs(500);
+	
+	HX711_Buffer = Read();
+	
+	DELAYClass.DelayMs(500);
+	
+	HX711_Buffer = Read();
+}
+
+/**
+  * @brief  读取数据
+  * @param  None
+  * @retval None
+  * @note   None
+*/
+static uint32_t Read(void)
+{
+	uint8_t i;
+	uint32_t value = 0;
+	uint16_t cnt = 65535;
+	
+	/**
+	数据手册写到,当数据输出管脚 DOUT 为高电平时,表明A/D 转换器还未准备好输出数据,此时串口时
+	钟输入信号 PD_SCK 应为低电平,所以下面设置引脚状态。
+	**/
+	GPIO_SetBits(HX711_DT_GPIO_PORT, HX711_DT_GPIO_PIN); //初始状态DT引脚为高电平
+	GPIO_ResetBits(HX711_SCK_GPIO_PORT, HX711_SCK_GPIO_PIN); //初始状态SCK引脚为低电平
+	
+	/**
+	等待DT引脚变为高电平
+	**/
+	while(GPIO_ReadInputDataBit(HX711_DT_GPIO_PORT, HX711_DT_GPIO_PIN)) {
+		cnt--;
+		if(!cnt) break;
+	}
+	DELAYClass.DelayUs(1);
+	
+	/**
+	当 DOUT 从高电平变低电平后,PD_SCK 应输入 25 至 27 个不等的时钟脉冲
+	25个时钟脉冲 ---> 通道A 增益128
+	26个时钟脉冲 ---> 通道B 增益32
+	27个时钟脉冲 ---> 通道A 增益64
+	**/
+	for(i=0; i<24; i++) //24位输出数据从最高位至最低位逐位输出完成
+	{
+		//方法二:
+		GPIO_SetBits(HX711_SCK_GPIO_PORT, HX711_SCK_GPIO_PIN);
+		DELAYClass.DelayUs(1);
+		GPIO_ResetBits(HX711_SCK_GPIO_PORT, HX711_SCK_GPIO_PIN);
+		if(GPIO_ReadInputDataBit(HX711_DT_GPIO_PORT, HX711_DT_GPIO_PIN) == 0)
+		{
+			value = value << 1;
+			value |= 0x00;
+		}
+		if(GPIO_ReadInputDataBit(HX711_DT_GPIO_PORT, HX711_DT_GPIO_PIN) == 1)
+		{
+			value = value << 1;
+			value |= 0x01;
+		}
+		DELAYClass.DelayUs(1);
+	}
+	
+	//第 25至 27 个时钟脉冲用来选择下一次 A/D 转换的输入通道和增益
+	GPIO_SetBits(HX711_SCK_GPIO_PORT, HX711_SCK_GPIO_PIN); 
+	value = value^0x800000; 
+	DELAYClass.DelayUs(1); 
+	GPIO_ResetBits(HX711_SCK_GPIO_PORT, HX711_SCK_GPIO_PIN); 
+	DELAYClass.DelayUs(1);  
+	return value;
+}
+
+
+/**
+  * @brief  读取数据
+  * @param  None
+  * @retval None
+  * @note   None
+*/
+static uint32_t GetValue(void)
+{
+	uint32_t value_t = Read();
+	uint32_t Weight_Shiwu = 0;
+
+	if ( value_t > HX711_Buffer )
+	{
+		Weight_Shiwu	= value_t;
+		Weight_Shiwu	= Weight_Shiwu - HX711_Buffer;                          /* 获取实物的AD采样数值。 */
+
+		Weight_Shiwu = (unsigned long) ( (float) Weight_Shiwu / 0.38755);      /* 计算实物的实际重量 */
+
+
+		/*
+		 * 因为不同的传感器特性曲线不一样,因此,每一个传感器需要矫正这里的GapValue这个除数。
+		 * 当发现测试出来的重量偏大时,增加该数值。
+		 * 如果测试出来的重量偏小时,减小改数值。
+		 * 该数值一般在4.0-5.0之间。因传感器不同而定。
+		 * +0.05是为了四舍五入百分位
+		 */
+	}
+	
+	return Weight_Shiwu/1000;
+	
+}
+

+ 22 - 0
module_Template/HX711称重传感器/HX711.h

@@ -0,0 +1,22 @@
+#ifndef __HX711_H_
+#define __HX711_H_
+
+
+#include <stdint.h>
+
+typedef struct
+{
+    void (*Init)(void);
+    uint32_t (*GetValue)(void);
+}HX711_t;
+
+
+/* extern variables ------------------------------------------------*/
+extern HX711_t HX711;
+
+/* extern function prototypes --------------------------------------*/
+
+
+
+#endif
+

+ 13 - 0
module_Template/HX711称重传感器/use_example.c

@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include "HX711.h"
+
+int main()
+{
+	int weight = 0;
+	HX711.Init(); // 初始化
+	while(1) {
+		weight = HX711.GetValue();
+		printf("hx711 weight:%d\n", weight);
+		delayMs(1000);
+	}
+}

+ 0 - 0
module_Template/MLX90614红外测温/MLX9014红外测温接口图.jpg → module_Template/MLX90614红外测温/MLX90614红外测温接口图.jpg


+ 0 - 29
module_Template/OLED屏幕0.96/OLED.c

@@ -318,32 +318,3 @@ void OLED_Init(void)
 	DELAYClass.DelayMs(10);
 	OLED_Clear();
 }  
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 2
module_Template/OLED屏幕0.96/OLEDFont.h

@@ -215,5 +215,3 @@ const char Hzk[][32]={
 };                                       
                                 
 #endif                                                                          
-
-

+ 0 - 3
module_Template/RC522-RFID模块/SPI.c

@@ -147,6 +147,3 @@ static void SPI_CS_WritePin(SPI_TypeDef* SPIx, BitAction bitVal)
 		GPIO_WriteBit(SPI2_CS_GPIO_PORT, SPI2_CS_GPIO_PIN, bitVal);
 	}
 }
-
-
-

+ 0 - 3
module_Template/SIM900A短信模块/GSM_func.h

@@ -12,6 +12,3 @@ char GSM_readMessage(uint8_t addrNum);
 void GSM_Init(void);
 
 #endif
-
-
-

+ 0 - 7
module_Template/SR04超声波/SR04.h

@@ -1,7 +1,6 @@
 #ifndef __SR04_H_
 #define __SR04_H_
 
-
 #include <main.h>
 
 typedef struct
@@ -10,12 +9,6 @@ typedef struct
     uint16_t (*Read)(void);
 }SR04_t;
 
-/* extern variables ------------------------------------------------*/
 extern SR04_t SR04;
 
-/* extern function prototypes --------------------------------------*/
-
-
-
 #endif
-

+ 0 - 245
module_Template/分时调度系统/TimeScheduleSystem.c

@@ -1,245 +0,0 @@
-/************************************/
-/* @Author: @woshiashuai            */
-/* @Version: V1.0                   */
-/* @Date: 2023-02-13 10:49:00       */
-/* @Description:                    */
-/* V1.0: create                     */
-/************************************/
-#include "TimeScheduleSystem.h"
-
-TSS_t *TSS_head = NULL; // 分时调度系统工作链表头节点
-
-/**
-  * @brief  分时调度事件初始化
-  * @note	加入到初始化中
-  * @param  TSS: 事件指针
-  * @param  targetTicks: 目标计数值 = 事件调度周期 / 调度器周期 例如: 100 = 500ms / 5ms
-  * @param  callback: 事件回调函数
-  * @retval 0: 初始化成功 1: 参数二为零 2: 参数三为空 3: 事件已存在
-  */
-unsigned char TSS_init(TSS_t *TSS, unsigned int targetTicks, void (* callback)(void))
-{
-    if(targetTicks == 0) return 1;
-    if(callback == NULL) return 2;
-    memset(TSS, 0, sizeof(TSS_t));
-    TSS->targetTicks = targetTicks;
-    TSS->callback = callback;
-    return 0;
-}
-/**
-  * @brief  分时调度事件执行(循环)处理的内部方法
-  * @note	None
-  * @param  TSS: 事件指针
-  * @retval None
-  */
-static void TSS_whileHandle(TSS_t *TSS)
-{
-    // 分时调度结果是等待中或跳过调度则退出
-    if(!TSS->result || TSS->skip) return ;
-	TSS->callback(); // 执行绑定的回调函数
-	TSS->ticks = 0; // 防止因手动切换状态导致的ticks不为0
-	TSS->result = 0; // 切换分时调度结果为等待中
-}
-/**
-  * @brief  分时调度事件执行(循环)处理
-  * @note	加入到主循环中
-  * @param  None
-  * @retval None
-  */
-void TSS_while(void)
-{
-    TSS_t *TSS_target;
-    for(TSS_target = TSS_head; TSS_target; TSS_target = TSS_target->next) {
-        TSS_whileHandle(TSS_target);
-    }
-}
-/**
-  * @brief  分时调度事件调度处理的内部方法
-  * @note	None
-  * @param  TSS: 事件指针
-  * @retval None
-  */
-static void TSS_timerHandle(TSS_t *TSS)
-{
-    // 分时调度结果是可执行或跳过调度则退出
-    if(TSS->result || TSS->skip) return ;
-	TSS->ticks += 1; // 计数自加
-	// 计数大于等于目标计数
-	if(TSS->ticks >= TSS->targetTicks) {
-			TSS->ticks = 0; // 计数清零
-			TSS->result = 1; // 切换分时调度结果为可执行
-	}
-}
-/**
-  * @brief  分时调度事件调度处理
-  * @note	加入到调度器中
-  * @param  None
-  * @retval None
-  */
-void TSS_timer(void)
-{
-    TSS_t *TSS_target;
-    for(TSS_target = TSS_head; TSS_target; TSS_target = TSS_target->next) {
-        TSS_timerHandle(TSS_target);
-    }
-}
-
-
-/**
-  * @brief  分时调度事件挂起处理
-  * @note	主要用于将事件从工作链表中取下
-  * @param  TSS: 事件指针
-  * @retval 0: 挂起成功 1: 事件未初始化/初始化失败 2: 事件不在工作链表中(可能已被挂起)
-  */
-unsigned char TSS_pending(TSS_t *TSS)
-{
-    if((TSS->targetTicks == 0) || (TSS->callback == NULL)) return 1;
-    TSS_t *TSS_target = TSS_head;
-    TSS_t *TSS_last = NULL;
-    while(TSS_target) {
-        // 查找事件是否存在
-        if(TSS_target == TSS) {
-            // 是否在头节点
-            if(TSS_last == NULL) {
-                TSS_head = TSS_target->next; // 在头节点则将下一个节点作为新的头节点
-            } else {
-                // 不在头节点则将下一个节点链接到上一个节点
-                TSS_last->next = TSS_target->next;
-                TSS_head = TSS_last;
-            }
-            TSS->state = 0; // 退出工作链表则改变状态为不在工作链表
-            return 0;
-        }
-        TSS_last = TSS_target;
-        TSS_target = TSS_target->next;
-    }
-    return 2;
-}
-/**
-  * @brief  分时调度事件启动处理
-  * @note	主要用于将事件加入到工作链表中
-  * @param  TSS: 事件指针
-  * @retval 0: 启动成功 1: 事件未初始化/初始化失败 2: 事件已在工作链表中(可能已被恢复)
-  */
-unsigned char TSS_start(TSS_t *TSS)
-{
-    if((TSS->targetTicks == 0) || (TSS->callback == NULL)) return 1;
-    TSS_t *TSS_target = TSS_head;
-    while(TSS_target) {
-        if(TSS_target == TSS) return 2;
-        TSS_target = TSS_target->next;
-    }
-    TSS->state = 1; // 加入工作链表则改变状态为在工作链表
-    TSS->next = TSS_head;
-    TSS_head = TSS;
-    return 0;
-}
-
-
-/**
-  * @brief  分时调度事件设置计数值处理
-  * @note	None
-  * @param  TSS: 事件指针
-  * @param  ticks: 设置的计数值
-  * @retval None
-  */
-void TSS_setTicks(TSS_t *TSS, unsigned char ticks)
-{
-   TSS->ticks = ticks;
-}
-/**
-  * @brief  分时调度事件获取计数值处理
-  * @note	None
-  * @param  TSS: 事件指针
-  * @retval 事件计数值
-  */
-unsigned int TSS_getTicks(TSS_t *TSS)
-{
-    return TSS->ticks;
-}
-/**
-  * @brief  分时调度事件设置目标计数值处理
-  * @note	主要用于修改事件执行周期,若较上次改小则可能立即触发事件执行
-  * @param  TSS: 事件指针
-  * @param  result: 设置的目标计数值
-  * @retval None
-  */
-void TSS_setTargetTicks(TSS_t *TSS, unsigned char targetTicks)
-{
-   TSS->targetTicks = targetTicks;
-}
-/**
-  * @brief  分时调度事件获取目标计数值处理
-  * @note	主要用于查看事件执行周期
-  * @param  TSS: 事件指针
-  * @retval 事件目标计数值
-  */
-unsigned int TSS_TargetTicks(TSS_t *TSS)
-{
-    return TSS->targetTicks;
-}
-/**
-  * @brief  分时调度事件设置结果值处理
-  * @note	主要用于立即切换事件结果为1:可执行
-  * @param  TSS: 事件指针
-  * @param  result: 设置的结果值
-  * @retval None
-  */
-void TSS_setResult(TSS_t *TSS, unsigned char result)
-{
-   TSS->result = result;
-}
-/**
-  * @brief  分时调度事件获取结果值处理 
-  * @note	一般获取到的事件结果多为0:等待中,因为在事件执行后事件结果值即清零
-  * @param  TSS: 事件指针
-  * @retval 事件结果值 0: 等待中 1: 可执行
-  */
-unsigned char TSS_getResult(TSS_t *TSS)
-{
-    return TSS->result;
-}
-
-/**
-  * @brief  分时调度事件设置状态值处理
-  * @note	手动操作此函数无效,因为事件状态只与事件是否存在于工作链表中有关
-  * @param  TSS: 事件指针
-  * @param  state: 设置的状态值
-  * @retval None
-  */
-void TSS_setState(TSS_t *TSS, unsigned char state)
-{
-//   TSS->state = state;
-}
-/**
-  * @brief  分时调度事件获取状态值处理
-  * @note	主要用于查看事件是否存在于工作链表中
-  * @param  TSS: 事件指针
-  * @retval 事件的状态值 0:不在工作链表 1:在工作链表
-  */
-unsigned char TSS_getState(TSS_t *TSS)
-{
-    return TSS->state;
-}
-
-/**
-  * @brief  分时调度事件设置跳过值处理 
-  * @note	主要用于事件仍在工作链表中的启动或挂起,相较于把事件从工作链表取下和恢复,此操作更快
-  * @param  TSS: 事件指针
-  * @param  state: 设置的跳过值
-  * @retval None
-  */
-void TSS_setSkip(TSS_t *TSS, unsigned char skip)
-{
-   TSS->skip = skip;
-}
-/**
-  * @brief  分时调度事件获取跳过值处理
-  * @note	主要用于查看事件是否跳过事件调度,事件仍在工作链表中的启动或挂起
-  * @param  TSS: 事件指针
-  * @retval 事件的跳过值 0:不跳过调度 1: 跳过调度
-  */
-unsigned char TSS_getSkip(TSS_t *TSS)
-{
-    return TSS->skip;
-}

+ 0 - 43
module_Template/分时调度系统/TimeScheduleSystem.h

@@ -1,43 +0,0 @@
-#ifndef TIMESCHEDULESYSTEM_H
-#define TIMESCHEDULESYSTEM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <string.h>
-
-typedef struct TimeScheduleSystem{
-    unsigned int ticks;
-    unsigned int targetTicks;
-    unsigned char result : 1; // 0:等待中 1:可执行
-    unsigned char state : 1; // 0:不在工作链表 1:在工作链表
-		unsigned char skip : 1; // 0:不跳过调度 1:跳过调度
-    void (* callback)(void);
-    struct TimeScheduleSystem *next;
-} TSS_t;
-
-unsigned char TSS_init(TSS_t *TSS, unsigned int targetTicks, void (* callback)(void));
-void TSS_while(void);
-void TSS_timer(void);
-
-unsigned char TSS_pending(TSS_t *TSS);
-unsigned char TSS_start(TSS_t *TSS);
-
-void TSS_setTicks(TSS_t *TSS, unsigned char ticks);
-unsigned int TSS_getTicks(TSS_t *TSS);
-void TSS_setTargetTicks(TSS_t *TSS, unsigned char targetTicks);
-unsigned int TSS_TargetTicks(TSS_t *TSS);
-void TSS_setResult(TSS_t *TSS, unsigned char result);
-unsigned char TSS_getResult(TSS_t *TSS);
-void TSS_setState(TSS_t *TSS, unsigned char state);
-unsigned char TSS_getState(TSS_t *TSS);
-void TSS_setSkip(TSS_t *TSS, unsigned char skip);
-unsigned char TSS_getSkip(TSS_t *TSS);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // TIMESCHEDULESYSTEM_H

+ 0 - 1
module_Template/分时调度系统/readme.txt

@@ -1 +0,0 @@
-分时调度系统,用法参见main.c,详细了解文件内注释

+ 0 - 45
module_Template/分时调度系统/use_example.c

@@ -1,45 +0,0 @@
-#include <stdio.h>
-#include "TimeScheduleSystem.h"
-// 事件调度定时器周期ms
-#define TIMER_PERIOD_MS	5
-
-TSS_t myTSS1; // 事件结构体实例
-TSS_t myTSS2;
-
-// 事件回调函数
-void myTSS1_callback(void)
-{
-    printf("11111111\n");
-}
-
-void myTSS2_callback(void)
-{
-    printf("22222222\n");
-}
-
-int main()
-{
-    int ret = 0;
-    // 1.初始化事件
-    ret = TSS_init(&myTSS1, 500/TIMER_PERIOD_MS, myTSS1_callback); // 500ms
-    if(!ret) {
-        TSS_start(&myTSS1);
-        printf("myTSS1 init success\n");
-    }
-    else printf("myTSS1 init fail : %d\n", ret);
-    ret = TSS_init(&myTSS2, 1000/TIMER_PERIOD_MS, myTSS2_callback); // 1000ms
-    if(!ret) {
-        TSS_start(&myTSS2);
-        printf("myTSS2 init success\n");
-    }
-    else printf("myTSS2 init fail : %d\n", ret);
-
-    while(1) {
-        TSS_while(); // 2.事件循环
-    }
-}
-// 5ms定时器中断
-void timerInterrupt()
-{
-    TSS_timer(); // 3.事件调度
-}

+ 113 - 0
module_Template/读AB相霍尔编码/Encoder.c

@@ -0,0 +1,113 @@
+#include "Encoder.h"
+
+
+// TIM3 CH1 GPIO DEFINE
+#define TIM3_CH1_GPIO_PORT              GPIOA
+#define TIM3_CH1_GPIO_CLK               RCC_APB2Periph_GPIOA
+#define TIM3_CH1_GPIO_PIN               GPIO_Pin_6
+// TIM3 CH2 GPIO DEFINE
+#define TIM3_CH2_GPIO_PORT              GPIOA
+#define TIM3_CH2_GPIO_CLK               RCC_APB2Periph_GPIOA
+#define TIM3_CH2_GPIO_PIN               GPIO_Pin_7
+
+// TIM4 CH1 GPIO DEFINE
+#define TIM4_CH1_GPIO_PORT              GPIOB
+#define TIM4_CH1_GPIO_CLK               RCC_APB2Periph_GPIOB
+#define TIM4_CH1_GPIO_PIN               GPIO_Pin_6
+// TIM4 CH2 GPIO DEFINE
+#define TIM4_CH2_GPIO_PORT              GPIOB
+#define TIM4_CH2_GPIO_CLK               RCC_APB2Periph_GPIOB
+#define TIM4_CH2_GPIO_PIN               GPIO_Pin_7
+
+void TIM3_IRQHandler(void)
+{
+	TIM3->SR&=~(1<<0);
+}
+
+void TIM4_IRQHandler(void)
+{
+	TIM4->SR&=~(1<<0);
+}
+
+void encoder_init_TIM3(void)
+{
+	TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;  
+	TIM_ICInitTypeDef TIM_ICInitStructure;  
+	GPIO_InitTypeDef GPIO_InitStructure;
+	
+	RCC_APB2PeriphClockCmd(TIM3_CH1_GPIO_CLK | TIM3_CH2_GPIO_CLK, ENABLE);
+	RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
+	
+	// 若引脚使用了重映射 切记增加重映射使能函数和开启AFIO
+	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+	GPIO_InitStructure.GPIO_Pin = TIM3_CH1_GPIO_PIN;
+	GPIO_Init(TIM3_CH1_GPIO_PORT, &GPIO_InitStructure);
+	GPIO_InitStructure.GPIO_Pin = TIM3_CH2_GPIO_PIN;
+	GPIO_Init(TIM3_CH2_GPIO_PORT, &GPIO_InitStructure);
+
+	TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
+	TIM_TimeBaseStructure.TIM_Prescaler = 0; // 预分频器 
+	TIM_TimeBaseStructure.TIM_Period = 0xFFFF; //设定计数器自动重装值
+	TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;//选择时钟分频:不分频
+	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;////TIM向上计数  
+	TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
+	
+	TIM_EncoderInterfaceConfig(TIM3, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising);//使用编码器模式3
+	TIM_ICStructInit(&TIM_ICInitStructure);
+	TIM_ICInitStructure.TIM_ICFilter = 10;
+	TIM_ICInit(TIM3, &TIM_ICInitStructure);
+	
+	TIM_ClearFlag(TIM3, TIM_FLAG_Update);
+	TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE);
+	//Reset counter
+	TIM_SetCounter(TIM3, 0);
+	TIM_Cmd(TIM3, ENABLE); 
+}
+
+void encoder_init_TIM4(void)
+{
+	TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;  
+	TIM_ICInitTypeDef TIM_ICInitStructure;  
+	GPIO_InitTypeDef GPIO_InitStructure;
+	
+	RCC_APB2PeriphClockCmd(TIM4_CH1_GPIO_CLK | TIM4_CH2_GPIO_CLK, ENABLE);
+	RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
+	
+	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+	GPIO_InitStructure.GPIO_Pin = TIM4_CH1_GPIO_PIN;
+	GPIO_Init(TIM4_CH1_GPIO_PORT, &GPIO_InitStructure);
+	GPIO_InitStructure.GPIO_Pin = TIM4_CH2_GPIO_PIN;
+	GPIO_Init(TIM4_CH2_GPIO_PORT, &GPIO_InitStructure);
+	
+	TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
+	TIM_TimeBaseStructure.TIM_Prescaler = 0; // 预分频器 
+	TIM_TimeBaseStructure.TIM_Period = 0xFFFF; //设定计数器自动重装值
+	TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;//选择时钟分频:不分频
+	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;////TIM向上计数  
+	TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure);
+	
+	TIM_EncoderInterfaceConfig(TIM4, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising);//使用编码器模式3
+	TIM_ICStructInit(&TIM_ICInitStructure);
+	TIM_ICInitStructure.TIM_ICFilter = 10;
+	TIM_ICInit(TIM4, &TIM_ICInitStructure);
+	
+	TIM_ClearFlag(TIM4, TIM_FLAG_Update);
+	TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE);
+	//Reset counter
+	TIM_SetCounter(TIM4, 0);
+	TIM_Cmd(TIM4, ENABLE); 
+}
+
+// 读取编码器数据 读取后清零(TIM3->CNT = 0;)
+int encoder_read(uint8_t who)
+{
+	int Encoder_TIM;
+	
+	switch(who) {
+		case TIM3_Encoder: Encoder_TIM = (short)TIM3->CNT; TIM3->CNT = 0; break;
+		case TIM4_Encoder: Encoder_TIM = (short)TIM4->CNT; TIM4->CNT = 0; break;
+		default: Encoder_TIM = 0; break;
+	}
+	
+	return Encoder_TIM;
+}

+ 14 - 0
module_Template/读AB相霍尔编码/Encoder.h

@@ -0,0 +1,14 @@
+#ifndef __ENCODER_AS_H
+#define __ENCODER_AS_H
+
+
+typedef enum {
+	TIM3_Encoder = 0,
+	TIM4_Encoder
+}EncoderEnum_t;
+
+void encoder_init_TIM3(void);
+void encoder_init_TIM4(void);
+int encoder_read(unsigned char who);
+
+#endif

+ 14 - 0
module_Template/读AB相霍尔编码/use_example.c

@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include "Encoder.h"
+
+int main()
+{
+	int encoder = 0;
+	encoder_init_TIM3(); // 初始化
+	while(1) {
+		// 间隔100ms读取一次霍尔编码
+		encoder = encoder_read(TIM3_Encoder);
+		printf("hall sensor code:%d\n", encoder);
+		delayMs(100);
+	}
+}

+ 202 - 0
project_Template/Drive/MultiTimerA.c

@@ -0,0 +1,202 @@
+/**
+  ******************************************************************************
+  * @file    MultiTimerA.c
+  * @author  woshiashuai
+  * @version V1.0
+  * @date    2023-05-11
+  * @brief   软件定时器-数组版
+  *
+  ******************************************************************************
+  * @attention
+  *
+  * 版权声明:内容为编者原创,遵循CC4.0BY-SA版权协议,转载请附上出处链接和本声明
+  * 出处链接:https://gitee.com/woshiashuai/mcu_development_module.git
+  *
+  ******************************************************************************
+  */
+
+/* 包含头文件-----------------------------------------------------------------*/
+#include "MultiTimerA.h"
+/* 私有宏定义-----------------------------------------------------------------*/
+#define TIMER_A_TASK_SIZE (20u)     // 最大任务数量(1-255)
+/* 私有类型定义---------------------------------------------------------------*/
+typedef struct timerACtrl {
+	volatile unsigned int curTicks; // 当前计数值
+	unsigned int targetTicks;       // 目标计数值
+	unsigned char run;              // 运行状态 0:不运行 1:运行
+	void(* callback)(void);         // 回调函数
+} timerA_t;
+/* 私有变量-------------------------------------------------------------------*/
+static timerA_t timerATasks[TIMER_A_TASK_SIZE]; // 软件定时器任务数组
+/* 全局变量-------------------------------------------------------------------*/
+/* 私有函数原型---------------------------------------------------------------*/
+
+/* 软件定时器使用举例
+// LED翻转函数
+void ledToggleProc(void)
+{
+	// user write handle
+	;
+}
+// 1ms定时器
+void TIM1_IRQHandler(void)
+{
+	timerA_timer();
+}
+int main()
+{
+	unsigned char timerID = 0;
+
+	timerID = timerA_create(0, 500, ledToggleProc, TIMER_A_START);
+	
+	while(1) {
+		timerA_loop();
+	}
+}
+*/
+
+/**
+  * @brief  创建软件定时器任务
+  * @note   None
+  * @param  id:定时器任务ID  0:新建任务  !0:更新此任务
+  * @param  targetTicks:定时器装载值(目前计数)
+  * @param  callback:定时器回调函数
+  * @param  run:是否运行  0:不运行  1:运行
+  * @retval 0:定时器任务已满  !0:定时器任务ID
+  */
+unsigned char timerA_create(unsigned char id, unsigned int targetTicks, void(* callback)(void), unsigned char run)
+{
+	unsigned char i = 0;
+	
+	if(0 == id) {
+		for(i = 0; i < TIMER_A_TASK_SIZE; i++) {
+			if(0 == timerATasks[i].targetTicks) {
+				timerATasks[i].targetTicks = targetTicks;
+				timerATasks[i].curTicks = 0;
+				timerATasks[i].run	= run;
+				timerATasks[i].callback = callback;
+				return i + 1;
+			}
+		}
+	} else {
+		timerATasks[id - 1].targetTicks = targetTicks;
+		timerATasks[id - 1].curTicks = 0;
+		timerATasks[id - 1].run = run;
+		timerATasks[id - 1].callback = callback;
+		return id;
+	}
+	
+	return 0;
+}
+/**
+  * @brief  删除软件定时器任务
+  * @note   None
+  * @param  None
+  * @retval None
+  */
+void timerA_delete(unsigned char id)
+{
+	if(id < 1 || id > TIMER_A_TASK_SIZE) return ;
+	
+	timerATasks[id - 1].targetTicks = 0;
+	timerATasks[id - 1].curTicks = 0;
+	timerATasks[id - 1].run = 0;
+}
+
+/**
+  * @brief  软件定时器任务循环调度
+  * @note   此函数一般放置在大循环中,回调函数在此执行
+  * @param  None
+  * @retval None
+  */
+void timerA_loop(void)
+{
+	static unsigned char i = 0;
+	
+	for(i = 0; i < TIMER_A_TASK_SIZE; i++) {
+		if(timerATasks[i].curTicks >= timerATasks[i].targetTicks && timerATasks[i].run) {
+			timerATasks[i].callback();
+			timerATasks[i].curTicks = 0;
+		}
+	}
+}
+/**
+  * @brief  软件定时器任务时基函数
+  * @note   此函数加入到定时器中,此函数执行周期即是软件定时器时基周期
+  * @param  None
+  * @retval None
+  */
+void timerA_timer(void)
+{
+	static unsigned char i = 0;
+	
+	for(i = 0; i < TIMER_A_TASK_SIZE; i++) {
+		if(timerATasks[i].curTicks < timerATasks[i].targetTicks && timerATasks[i].run) {
+			timerATasks[i].curTicks++;
+		}
+	}
+}
+
+/**
+  * @brief  设置指定软件定时器任务的当前计数值
+  * @note   None
+  * @param  id:软件定时器任务ID
+  * @param  curTicks:设置的当前计数值
+  * @retval None
+  */
+void timerA_setCurTicks(unsigned char id, unsigned int curTicks)
+{
+	timerATasks[id - 1].curTicks = curTicks;
+}
+/**
+  * @brief  获取指定软件定时器任务的当前计数值
+  * @note   None
+  * @param  id:软件定时器任务ID
+  * @retval 返回当前计数值
+  */
+unsigned int timerA_getCurTicks(unsigned char id)
+{
+	return timerATasks[id - 1].curTicks;
+}
+/**
+  * @brief  设置指定软件定时器任务的目标计数值
+  * @note   None
+  * @param  id:软件定时器任务ID
+  * @param  targetTicks:设置的目标计数值
+  * @retval None
+  */
+void timerA_setTargetTicks(unsigned char id, unsigned int targetTicks)
+{
+	timerATasks[id - 1].targetTicks = targetTicks;
+}
+/**
+  * @brief  获取指定软件定时器任务的目标计数值
+  * @note   None
+  * @param  id:软件定时器任务ID
+  * @retval 返回目标计数值
+  */
+unsigned int timerA_getTargetTicks(unsigned char id)
+{
+	return timerATasks[id - 1].targetTicks;
+}
+/**
+  * @brief  设置指定软件定时器任务ID的运行状态
+  * @note   None
+  * @param  id:软件定时器任务ID
+  * @param  run:设置的运行状态
+  * @retval None
+  */
+void timerA_setRun(unsigned char id, unsigned char run)
+{
+	timerATasks[id - 1].run = run;
+}
+/**
+  * @brief  获取指定软件定时器任务的运行状态
+  * @note   None
+  * @param  id:软件定时器任务ID
+  * @retval 返回运行状态
+  */
+unsigned char timerA_getRun(unsigned char id)
+{
+	return timerATasks[id - 1].run;
+}

+ 56 - 0
project_Template/Drive/MultiTimerA.h

@@ -0,0 +1,56 @@
+/**
+  ******************************************************************************
+  * @file    MultiTimerA.h
+  * @author  woshiashuai
+  * @version V1.0
+  * @date    2023-05-11
+  * @brief   软件定时器-数组版
+  *
+  ******************************************************************************
+  * @attention
+  *
+  * 版权声明:内容为编者原创,遵循CC4.0BY-SA版权协议,转载请附上出处链接和本声明
+  * 出处链接:https://gitee.com/woshiashuai/mcu_development_module.git
+  *
+  ******************************************************************************
+  */
+
+#ifndef __MULTITIMERA_H
+#define __MULTITIMERA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 包含头文件-----------------------------------------------------------------*/
+/* 宏定义---------------------------------------------------------------------*/
+#define TIMER_A_STOP     (0u) // 不运行
+#define TIMER_A_START    (1u) // 运行
+// 任务停止运行
+#define timerA_stop(id)   (timerA_setRun(id, TIMER_A_STOP))
+// 任务开始运行
+#define timerA_start(id)  (timerA_setRun(id, TIMER_A_START))
+// 任务立即执行
+#define timerA_work(id)   { timerA_setRun(id, TIMER_A_START); \
+                            timerA_setCurTicks(id, timerA_getTargetTicks(id)); }
+/* 类型定义-------------------------------------------------------------------*/
+/* 全局变量-------------------------------------------------------------------*/
+/* 函数原型-------------------------------------------------------------------*/
+unsigned char timerA_create(unsigned char id, unsigned int targetTicks, void(* callback)(void), unsigned char run);
+void timerA_delete(unsigned char id);
+
+void timerA_loop(void);
+void timerA_timer(void);
+
+void timerA_setCurTicks(unsigned char id, unsigned int curTicks);
+unsigned int timerA_getCurTicks(unsigned char id);
+void timerA_setTargetTicks(unsigned char id, unsigned int targetTicks);
+unsigned int timerA_getTargetTicks(unsigned char id);
+void timerA_setRun(unsigned char id, unsigned char run);
+unsigned char timerA_getRun(unsigned char id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MultiTimerA.h */

+ 0 - 245
project_Template/Drive/TimeScheduleSystem.c

@@ -1,245 +0,0 @@
-/************************************/
-/* @Author: @woshiashuai            */
-/* @Version: V1.0                   */
-/* @Date: 2023-02-13 10:49:00       */
-/* @Description:                    */
-/* V1.0: create                     */
-/************************************/
-#include "TimeScheduleSystem.h"
-
-TSS_t *TSS_head = NULL; // 分时调度系统工作链表头节点
-
-/**
-  * @brief  分时调度事件初始化
-  * @note	加入到初始化中
-  * @param  TSS: 事件指针
-  * @param  targetTicks: 目标计数值 = 事件调度周期 / 调度器周期 例如: 100 = 500ms / 5ms
-  * @param  callback: 事件回调函数
-  * @retval 0: 初始化成功 1: 参数二为零 2: 参数三为空 3: 事件已存在
-  */
-unsigned char TSS_init(TSS_t *TSS, unsigned int targetTicks, void (* callback)(void))
-{
-    if(targetTicks == 0) return 1;
-    if(callback == NULL) return 2;
-    memset(TSS, 0, sizeof(TSS_t));
-    TSS->targetTicks = targetTicks;
-    TSS->callback = callback;
-    return 0;
-}
-/**
-  * @brief  分时调度事件执行(循环)处理的内部方法
-  * @note	None
-  * @param  TSS: 事件指针
-  * @retval None
-  */
-static void TSS_whileHandle(TSS_t *TSS)
-{
-    // 分时调度结果是等待中或跳过调度则退出
-    if(!TSS->result || TSS->skip) return ;
-	TSS->callback(); // 执行绑定的回调函数
-	TSS->ticks = 0; // 防止因手动切换状态导致的ticks不为0
-	TSS->result = 0; // 切换分时调度结果为等待中
-}
-/**
-  * @brief  分时调度事件执行(循环)处理
-  * @note	加入到主循环中
-  * @param  None
-  * @retval None
-  */
-void TSS_while(void)
-{
-    TSS_t *TSS_target;
-    for(TSS_target = TSS_head; TSS_target; TSS_target = TSS_target->next) {
-        TSS_whileHandle(TSS_target);
-    }
-}
-/**
-  * @brief  分时调度事件调度处理的内部方法
-  * @note	None
-  * @param  TSS: 事件指针
-  * @retval None
-  */
-static void TSS_timerHandle(TSS_t *TSS)
-{
-    // 分时调度结果是可执行或跳过调度则退出
-    if(TSS->result || TSS->skip) return ;
-	TSS->ticks += 1; // 计数自加
-	// 计数大于等于目标计数
-	if(TSS->ticks >= TSS->targetTicks) {
-			TSS->ticks = 0; // 计数清零
-			TSS->result = 1; // 切换分时调度结果为可执行
-	}
-}
-/**
-  * @brief  分时调度事件调度处理
-  * @note	加入到调度器中
-  * @param  None
-  * @retval None
-  */
-void TSS_timer(void)
-{
-    TSS_t *TSS_target;
-    for(TSS_target = TSS_head; TSS_target; TSS_target = TSS_target->next) {
-        TSS_timerHandle(TSS_target);
-    }
-}
-
-
-/**
-  * @brief  分时调度事件挂起处理
-  * @note	主要用于将事件从工作链表中取下
-  * @param  TSS: 事件指针
-  * @retval 0: 挂起成功 1: 事件未初始化/初始化失败 2: 事件不在工作链表中(可能已被挂起)
-  */
-unsigned char TSS_pending(TSS_t *TSS)
-{
-    if((TSS->targetTicks == 0) || (TSS->callback == NULL)) return 1;
-    TSS_t *TSS_target = TSS_head;
-    TSS_t *TSS_last = NULL;
-    while(TSS_target) {
-        // 查找事件是否存在
-        if(TSS_target == TSS) {
-            // 是否在头节点
-            if(TSS_last == NULL) {
-                TSS_head = TSS_target->next; // 在头节点则将下一个节点作为新的头节点
-            } else {
-                // 不在头节点则将下一个节点链接到上一个节点
-                TSS_last->next = TSS_target->next;
-                TSS_head = TSS_last;
-            }
-            TSS->state = 0; // 退出工作链表则改变状态为不在工作链表
-            return 0;
-        }
-        TSS_last = TSS_target;
-        TSS_target = TSS_target->next;
-    }
-    return 2;
-}
-/**
-  * @brief  分时调度事件启动处理
-  * @note	主要用于将事件加入到工作链表中
-  * @param  TSS: 事件指针
-  * @retval 0: 启动成功 1: 事件未初始化/初始化失败 2: 事件已在工作链表中(可能已被恢复)
-  */
-unsigned char TSS_start(TSS_t *TSS)
-{
-    if((TSS->targetTicks == 0) || (TSS->callback == NULL)) return 1;
-    TSS_t *TSS_target = TSS_head;
-    while(TSS_target) {
-        if(TSS_target == TSS) return 2;
-        TSS_target = TSS_target->next;
-    }
-    TSS->state = 1; // 加入工作链表则改变状态为在工作链表
-    TSS->next = TSS_head;
-    TSS_head = TSS;
-    return 0;
-}
-
-
-/**
-  * @brief  分时调度事件设置计数值处理
-  * @note	None
-  * @param  TSS: 事件指针
-  * @param  ticks: 设置的计数值
-  * @retval None
-  */
-void TSS_setTicks(TSS_t *TSS, unsigned char ticks)
-{
-   TSS->ticks = ticks;
-}
-/**
-  * @brief  分时调度事件获取计数值处理
-  * @note	None
-  * @param  TSS: 事件指针
-  * @retval 事件计数值
-  */
-unsigned int TSS_getTicks(TSS_t *TSS)
-{
-    return TSS->ticks;
-}
-/**
-  * @brief  分时调度事件设置目标计数值处理
-  * @note	主要用于修改事件执行周期,若较上次改小则可能立即触发事件执行
-  * @param  TSS: 事件指针
-  * @param  result: 设置的目标计数值
-  * @retval None
-  */
-void TSS_setTargetTicks(TSS_t *TSS, unsigned char targetTicks)
-{
-   TSS->targetTicks = targetTicks;
-}
-/**
-  * @brief  分时调度事件获取目标计数值处理
-  * @note	主要用于查看事件执行周期
-  * @param  TSS: 事件指针
-  * @retval 事件目标计数值
-  */
-unsigned int TSS_TargetTicks(TSS_t *TSS)
-{
-    return TSS->targetTicks;
-}
-/**
-  * @brief  分时调度事件设置结果值处理
-  * @note	主要用于立即切换事件结果为1:可执行
-  * @param  TSS: 事件指针
-  * @param  result: 设置的结果值
-  * @retval None
-  */
-void TSS_setResult(TSS_t *TSS, unsigned char result)
-{
-   TSS->result = result;
-}
-/**
-  * @brief  分时调度事件获取结果值处理 
-  * @note	一般获取到的事件结果多为0:等待中,因为在事件执行后事件结果值即清零
-  * @param  TSS: 事件指针
-  * @retval 事件结果值 0: 等待中 1: 可执行
-  */
-unsigned char TSS_getResult(TSS_t *TSS)
-{
-    return TSS->result;
-}
-
-/**
-  * @brief  分时调度事件设置状态值处理
-  * @note	手动操作此函数无效,因为事件状态只与事件是否存在于工作链表中有关
-  * @param  TSS: 事件指针
-  * @param  state: 设置的状态值
-  * @retval None
-  */
-void TSS_setState(TSS_t *TSS, unsigned char state)
-{
-//   TSS->state = state;
-}
-/**
-  * @brief  分时调度事件获取状态值处理
-  * @note	主要用于查看事件是否存在于工作链表中
-  * @param  TSS: 事件指针
-  * @retval 事件的状态值 0:不在工作链表 1:在工作链表
-  */
-unsigned char TSS_getState(TSS_t *TSS)
-{
-    return TSS->state;
-}
-
-/**
-  * @brief  分时调度事件设置跳过值处理 
-  * @note	主要用于事件仍在工作链表中的启动或挂起,相较于把事件从工作链表取下和恢复,此操作更快
-  * @param  TSS: 事件指针
-  * @param  state: 设置的跳过值
-  * @retval None
-  */
-void TSS_setSkip(TSS_t *TSS, unsigned char skip)
-{
-   TSS->skip = skip;
-}
-/**
-  * @brief  分时调度事件获取跳过值处理
-  * @note	主要用于查看事件是否跳过事件调度,事件仍在工作链表中的启动或挂起
-  * @param  TSS: 事件指针
-  * @retval 事件的跳过值 0:不跳过调度 1: 跳过调度
-  */
-unsigned char TSS_getSkip(TSS_t *TSS)
-{
-    return TSS->skip;
-}

+ 0 - 43
project_Template/Drive/TimeScheduleSystem.h

@@ -1,43 +0,0 @@
-#ifndef TIMESCHEDULESYSTEM_H
-#define TIMESCHEDULESYSTEM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <string.h>
-
-typedef struct TimeScheduleSystem{
-    unsigned int ticks;
-    unsigned int targetTicks;
-    unsigned char result : 1; // 0:等待中 1:可执行
-    unsigned char state : 1; // 0:不在工作链表 1:在工作链表
-		unsigned char skip : 1; // 0:不跳过调度 1:跳过调度
-    void (* callback)(void);
-    struct TimeScheduleSystem *next;
-} TSS_t;
-
-unsigned char TSS_init(TSS_t *TSS, unsigned int targetTicks, void (* callback)(void));
-void TSS_while(void);
-void TSS_timer(void);
-
-unsigned char TSS_pending(TSS_t *TSS);
-unsigned char TSS_start(TSS_t *TSS);
-
-void TSS_setTicks(TSS_t *TSS, unsigned char ticks);
-unsigned int TSS_getTicks(TSS_t *TSS);
-void TSS_setTargetTicks(TSS_t *TSS, unsigned char targetTicks);
-unsigned int TSS_TargetTicks(TSS_t *TSS);
-void TSS_setResult(TSS_t *TSS, unsigned char result);
-unsigned char TSS_getResult(TSS_t *TSS);
-void TSS_setState(TSS_t *TSS, unsigned char state);
-unsigned char TSS_getState(TSS_t *TSS);
-void TSS_setSkip(TSS_t *TSS, unsigned char skip);
-unsigned char TSS_getSkip(TSS_t *TSS);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // TIMESCHEDULESYSTEM_H

+ 0 - 1429
project_Template/Project/Listings/startup_stm32f10x_hd.lst

@@ -1,1429 +0,0 @@
-
-
-
-ARM Macro Assembler    Page 1 
-
-
-    1 00000000         ;******************** (C) COPYRIGHT 2011 STMicroelectron
-                       ics ********************
-    2 00000000         ;* File Name          : startup_stm32f10x_hd.s
-    3 00000000         ;* Author             : MCD Application Team
-    4 00000000         ;* Version            : V3.5.1
-    5 00000000         ;* Date               : 08-September-2021
-    6 00000000         ;* Description        : STM32F10x High Density Devices v
-                       ector table for MDK-ARM 
-    7 00000000         ;*                      toolchain. 
-    8 00000000         ;*                      This module performs:
-    9 00000000         ;*                      - Set the initial SP
-   10 00000000         ;*                      - Set the initial PC == Reset_Ha
-                       ndler
-   11 00000000         ;*                      - Set the vector table entries w
-                       ith the exceptions ISR address
-   12 00000000         ;*                      - Configure the clock system and
-                        also configure the external 
-   13 00000000         ;*                        SRAM mounted on STM3210E-EVAL 
-                       board to be used as data 
-   14 00000000         ;*                        memory (optional, to be enable
-                       d by user)
-   15 00000000         ;*                      - Branches to __main in the C li
-                       brary (which eventually
-   16 00000000         ;*                        calls main()).
-   17 00000000         ;*                      After Reset the CortexM3 process
-                       or is in Thread mode,
-   18 00000000         ;*                      priority is Privileged, and the 
-                       Stack is set to Main.
-   19 00000000         ;* <<< Use Configuration Wizard in Context Menu >>>   
-   20 00000000         ;*******************************************************
-                       ************************
-   21 00000000         ;*
-   22 00000000         ;* Copyright (c) 2011 STMicroelectronics.
-   23 00000000         ;* All rights reserved.
-   24 00000000         ;*
-   25 00000000         ;* This software is licensed under terms that can be fou
-                       nd in the LICENSE file
-   26 00000000         ;* in the root directory of this software component.
-   27 00000000         ;* If no LICENSE file comes with this software, it is pr
-                       ovided AS-IS.
-   28 00000000         ;
-   29 00000000         ;*******************************************************
-                       ************************
-   30 00000000         
-   31 00000000         ; Amount of memory (in bytes) allocated for Stack
-   32 00000000         ; Tailor this value to your application needs
-   33 00000000         ; <h> Stack Configuration
-   34 00000000         ;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
-   35 00000000         ; </h>
-   36 00000000         
-   37 00000000 00000400 
-                       Stack_Size
-                               EQU              0x00000400
-   38 00000000         
-   39 00000000                 AREA             STACK, NOINIT, READWRITE, ALIGN
-=3
-   40 00000000         Stack_Mem
-                               SPACE            Stack_Size
-   41 00000400         __initial_sp
-
-
-
-ARM Macro Assembler    Page 2 
-
-
-   42 00000400         
-   43 00000400         ; <h> Heap Configuration
-   44 00000400         ;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
-   45 00000400         ; </h>
-   46 00000400         
-   47 00000400 00000200 
-                       Heap_Size
-                               EQU              0x00000200
-   48 00000400         
-   49 00000400                 AREA             HEAP, NOINIT, READWRITE, ALIGN=
-3
-   50 00000000         __heap_base
-   51 00000000         Heap_Mem
-                               SPACE            Heap_Size
-   52 00000200         __heap_limit
-   53 00000200         
-   54 00000200                 PRESERVE8
-   55 00000200                 THUMB
-   56 00000200         
-   57 00000200         
-   58 00000200         ; Vector Table Mapped to Address 0 at Reset
-   59 00000200                 AREA             RESET, DATA, READONLY
-   60 00000000                 EXPORT           __Vectors
-   61 00000000                 EXPORT           __Vectors_End
-   62 00000000                 EXPORT           __Vectors_Size
-   63 00000000         
-   64 00000000 00000000 
-                       __Vectors
-                               DCD              __initial_sp ; Top of Stack
-   65 00000004 00000000        DCD              Reset_Handler ; Reset Handler
-   66 00000008 00000000        DCD              NMI_Handler ; NMI Handler
-   67 0000000C 00000000        DCD              HardFault_Handler ; Hard Fault 
-                                                            Handler
-   68 00000010 00000000        DCD              MemManage_Handler 
-                                                            ; MPU Fault Handler
-                                                            
-   69 00000014 00000000        DCD              BusFault_Handler 
-                                                            ; Bus Fault Handler
-                                                            
-   70 00000018 00000000        DCD              UsageFault_Handler ; Usage Faul
-                                                            t Handler
-   71 0000001C 00000000        DCD              0           ; Reserved
-   72 00000020 00000000        DCD              0           ; Reserved
-   73 00000024 00000000        DCD              0           ; Reserved
-   74 00000028 00000000        DCD              0           ; Reserved
-   75 0000002C 00000000        DCD              SVC_Handler ; SVCall Handler
-   76 00000030 00000000        DCD              DebugMon_Handler ; Debug Monito
-                                                            r Handler
-   77 00000034 00000000        DCD              0           ; Reserved
-   78 00000038 00000000        DCD              PendSV_Handler ; PendSV Handler
-                                                            
-   79 0000003C 00000000        DCD              SysTick_Handler 
-                                                            ; SysTick Handler
-   80 00000040         
-   81 00000040         ; External Interrupts
-   82 00000040 00000000        DCD              WWDG_IRQHandler 
-                                                            ; Window Watchdog
-   83 00000044 00000000        DCD              PVD_IRQHandler ; PVD through EX
-                                                            TI Line detect
-
-
-
-ARM Macro Assembler    Page 3 
-
-
-   84 00000048 00000000        DCD              TAMPER_IRQHandler ; Tamper
-   85 0000004C 00000000        DCD              RTC_IRQHandler ; RTC
-   86 00000050 00000000        DCD              FLASH_IRQHandler ; Flash
-   87 00000054 00000000        DCD              RCC_IRQHandler ; RCC
-   88 00000058 00000000        DCD              EXTI0_IRQHandler ; EXTI Line 0
-   89 0000005C 00000000        DCD              EXTI1_IRQHandler ; EXTI Line 1
-   90 00000060 00000000        DCD              EXTI2_IRQHandler ; EXTI Line 2
-   91 00000064 00000000        DCD              EXTI3_IRQHandler ; EXTI Line 3
-   92 00000068 00000000        DCD              EXTI4_IRQHandler ; EXTI Line 4
-   93 0000006C 00000000        DCD              DMA1_Channel1_IRQHandler 
-                                                            ; DMA1 Channel 1
-   94 00000070 00000000        DCD              DMA1_Channel2_IRQHandler 
-                                                            ; DMA1 Channel 2
-   95 00000074 00000000        DCD              DMA1_Channel3_IRQHandler 
-                                                            ; DMA1 Channel 3
-   96 00000078 00000000        DCD              DMA1_Channel4_IRQHandler 
-                                                            ; DMA1 Channel 4
-   97 0000007C 00000000        DCD              DMA1_Channel5_IRQHandler 
-                                                            ; DMA1 Channel 5
-   98 00000080 00000000        DCD              DMA1_Channel6_IRQHandler 
-                                                            ; DMA1 Channel 6
-   99 00000084 00000000        DCD              DMA1_Channel7_IRQHandler 
-                                                            ; DMA1 Channel 7
-  100 00000088 00000000        DCD              ADC1_2_IRQHandler ; ADC1 & ADC2
-                                                            
-  101 0000008C 00000000        DCD              USB_HP_CAN1_TX_IRQHandler ; USB
-                                                             High Priority or C
-                                                            AN1 TX
-  102 00000090 00000000        DCD              USB_LP_CAN1_RX0_IRQHandler ; US
-                                                            B Low  Priority or 
-                                                            CAN1 RX0
-  103 00000094 00000000        DCD              CAN1_RX1_IRQHandler ; CAN1 RX1
-  104 00000098 00000000        DCD              CAN1_SCE_IRQHandler ; CAN1 SCE
-  105 0000009C 00000000        DCD              EXTI9_5_IRQHandler 
-                                                            ; EXTI Line 9..5
-  106 000000A0 00000000        DCD              TIM1_BRK_IRQHandler 
-                                                            ; TIM1 Break
-  107 000000A4 00000000        DCD              TIM1_UP_IRQHandler 
-                                                            ; TIM1 Update
-  108 000000A8 00000000        DCD              TIM1_TRG_COM_IRQHandler ; TIM1 
-                                                            Trigger and Commuta
-                                                            tion
-  109 000000AC 00000000        DCD              TIM1_CC_IRQHandler ; TIM1 Captu
-                                                            re Compare
-  110 000000B0 00000000        DCD              TIM2_IRQHandler ; TIM2
-  111 000000B4 00000000        DCD              TIM3_IRQHandler ; TIM3
-  112 000000B8 00000000        DCD              TIM4_IRQHandler ; TIM4
-  113 000000BC 00000000        DCD              I2C1_EV_IRQHandler ; I2C1 Event
-                                                            
-  114 000000C0 00000000        DCD              I2C1_ER_IRQHandler ; I2C1 Error
-                                                            
-  115 000000C4 00000000        DCD              I2C2_EV_IRQHandler ; I2C2 Event
-                                                            
-  116 000000C8 00000000        DCD              I2C2_ER_IRQHandler ; I2C2 Error
-                                                            
-  117 000000CC 00000000        DCD              SPI1_IRQHandler ; SPI1
-  118 000000D0 00000000        DCD              SPI2_IRQHandler ; SPI2
-  119 000000D4 00000000        DCD              USART1_IRQHandler ; USART1
-  120 000000D8 00000000        DCD              USART2_IRQHandler ; USART2
-
-
-
-ARM Macro Assembler    Page 4 
-
-
-  121 000000DC 00000000        DCD              USART3_IRQHandler ; USART3
-  122 000000E0 00000000        DCD              EXTI15_10_IRQHandler 
-                                                            ; EXTI Line 15..10
-  123 000000E4 00000000        DCD              RTCAlarm_IRQHandler ; RTC Alarm
-                                                             through EXTI Line
-  124 000000E8 00000000        DCD              USBWakeUp_IRQHandler ; USB Wake
-                                                            up from suspend
-  125 000000EC 00000000        DCD              TIM8_BRK_IRQHandler 
-                                                            ; TIM8 Break
-  126 000000F0 00000000        DCD              TIM8_UP_IRQHandler 
-                                                            ; TIM8 Update
-  127 000000F4 00000000        DCD              TIM8_TRG_COM_IRQHandler ; TIM8 
-                                                            Trigger and Commuta
-                                                            tion
-  128 000000F8 00000000        DCD              TIM8_CC_IRQHandler ; TIM8 Captu
-                                                            re Compare
-  129 000000FC 00000000        DCD              ADC3_IRQHandler ; ADC3
-  130 00000100 00000000        DCD              FSMC_IRQHandler ; FSMC
-  131 00000104 00000000        DCD              SDIO_IRQHandler ; SDIO
-  132 00000108 00000000        DCD              TIM5_IRQHandler ; TIM5
-  133 0000010C 00000000        DCD              SPI3_IRQHandler ; SPI3
-  134 00000110 00000000        DCD              UART4_IRQHandler ; UART4
-  135 00000114 00000000        DCD              UART5_IRQHandler ; UART5
-  136 00000118 00000000        DCD              TIM6_IRQHandler ; TIM6
-  137 0000011C 00000000        DCD              TIM7_IRQHandler ; TIM7
-  138 00000120 00000000        DCD              DMA2_Channel1_IRQHandler 
-                                                            ; DMA2 Channel1
-  139 00000124 00000000        DCD              DMA2_Channel2_IRQHandler 
-                                                            ; DMA2 Channel2
-  140 00000128 00000000        DCD              DMA2_Channel3_IRQHandler 
-                                                            ; DMA2 Channel3
-  141 0000012C 00000000        DCD              DMA2_Channel4_5_IRQHandler ; DM
-                                                            A2 Channel4 & Chann
-                                                            el5
-  142 00000130         __Vectors_End
-  143 00000130         
-  144 00000130 00000130 
-                       __Vectors_Size
-                               EQU              __Vectors_End - __Vectors
-  145 00000130         
-  146 00000130                 AREA             |.text|, CODE, READONLY
-  147 00000000         
-  148 00000000         ; Reset handler
-  149 00000000         Reset_Handler
-                               PROC
-  150 00000000                 EXPORT           Reset_Handler             [WEAK
-]
-  151 00000000                 IMPORT           __main
-  152 00000000                 IMPORT           SystemInit
-  153 00000000 4806            LDR              R0, =SystemInit
-  154 00000002 4780            BLX              R0
-  155 00000004 4806            LDR              R0, =__main
-  156 00000006 4700            BX               R0
-  157 00000008                 ENDP
-  158 00000008         
-  159 00000008         ; Dummy Exception Handlers (infinite loops which can be 
-                       modified)
-  160 00000008         
-  161 00000008         NMI_Handler
-
-
-
-ARM Macro Assembler    Page 5 
-
-
-                               PROC
-  162 00000008                 EXPORT           NMI_Handler                [WEA
-K]
-  163 00000008 E7FE            B                .
-  164 0000000A                 ENDP
-  166 0000000A         HardFault_Handler
-                               PROC
-  167 0000000A                 EXPORT           HardFault_Handler          [WEA
-K]
-  168 0000000A E7FE            B                .
-  169 0000000C                 ENDP
-  171 0000000C         MemManage_Handler
-                               PROC
-  172 0000000C                 EXPORT           MemManage_Handler          [WEA
-K]
-  173 0000000C E7FE            B                .
-  174 0000000E                 ENDP
-  176 0000000E         BusFault_Handler
-                               PROC
-  177 0000000E                 EXPORT           BusFault_Handler           [WEA
-K]
-  178 0000000E E7FE            B                .
-  179 00000010                 ENDP
-  181 00000010         UsageFault_Handler
-                               PROC
-  182 00000010                 EXPORT           UsageFault_Handler         [WEA
-K]
-  183 00000010 E7FE            B                .
-  184 00000012                 ENDP
-  185 00000012         SVC_Handler
-                               PROC
-  186 00000012                 EXPORT           SVC_Handler                [WEA
-K]
-  187 00000012 E7FE            B                .
-  188 00000014                 ENDP
-  190 00000014         DebugMon_Handler
-                               PROC
-  191 00000014                 EXPORT           DebugMon_Handler           [WEA
-K]
-  192 00000014 E7FE            B                .
-  193 00000016                 ENDP
-  194 00000016         PendSV_Handler
-                               PROC
-  195 00000016                 EXPORT           PendSV_Handler             [WEA
-K]
-  196 00000016 E7FE            B                .
-  197 00000018                 ENDP
-  198 00000018         SysTick_Handler
-                               PROC
-  199 00000018                 EXPORT           SysTick_Handler            [WEA
-K]
-  200 00000018 E7FE            B                .
-  201 0000001A                 ENDP
-  202 0000001A         
-  203 0000001A         Default_Handler
-                               PROC
-  204 0000001A         
-  205 0000001A                 EXPORT           WWDG_IRQHandler            [WEA
-K]
-
-
-
-ARM Macro Assembler    Page 6 
-
-
-  206 0000001A                 EXPORT           PVD_IRQHandler             [WEA
-K]
-  207 0000001A                 EXPORT           TAMPER_IRQHandler          [WEA
-K]
-  208 0000001A                 EXPORT           RTC_IRQHandler             [WEA
-K]
-  209 0000001A                 EXPORT           FLASH_IRQHandler           [WEA
-K]
-  210 0000001A                 EXPORT           RCC_IRQHandler             [WEA
-K]
-  211 0000001A                 EXPORT           EXTI0_IRQHandler           [WEA
-K]
-  212 0000001A                 EXPORT           EXTI1_IRQHandler           [WEA
-K]
-  213 0000001A                 EXPORT           EXTI2_IRQHandler           [WEA
-K]
-  214 0000001A                 EXPORT           EXTI3_IRQHandler           [WEA
-K]
-  215 0000001A                 EXPORT           EXTI4_IRQHandler           [WEA
-K]
-  216 0000001A                 EXPORT           DMA1_Channel1_IRQHandler   [WEA
-K]
-  217 0000001A                 EXPORT           DMA1_Channel2_IRQHandler   [WEA
-K]
-  218 0000001A                 EXPORT           DMA1_Channel3_IRQHandler   [WEA
-K]
-  219 0000001A                 EXPORT           DMA1_Channel4_IRQHandler   [WEA
-K]
-  220 0000001A                 EXPORT           DMA1_Channel5_IRQHandler   [WEA
-K]
-  221 0000001A                 EXPORT           DMA1_Channel6_IRQHandler   [WEA
-K]
-  222 0000001A                 EXPORT           DMA1_Channel7_IRQHandler   [WEA
-K]
-  223 0000001A                 EXPORT           ADC1_2_IRQHandler          [WEA
-K]
-  224 0000001A                 EXPORT           USB_HP_CAN1_TX_IRQHandler  [WEA
-K]
-  225 0000001A                 EXPORT           USB_LP_CAN1_RX0_IRQHandler [WEA
-K]
-  226 0000001A                 EXPORT           CAN1_RX1_IRQHandler        [WEA
-K]
-  227 0000001A                 EXPORT           CAN1_SCE_IRQHandler        [WEA
-K]
-  228 0000001A                 EXPORT           EXTI9_5_IRQHandler         [WEA
-K]
-  229 0000001A                 EXPORT           TIM1_BRK_IRQHandler        [WEA
-K]
-  230 0000001A                 EXPORT           TIM1_UP_IRQHandler         [WEA
-K]
-  231 0000001A                 EXPORT           TIM1_TRG_COM_IRQHandler    [WEA
-K]
-  232 0000001A                 EXPORT           TIM1_CC_IRQHandler         [WEA
-K]
-  233 0000001A                 EXPORT           TIM2_IRQHandler            [WEA
-K]
-  234 0000001A                 EXPORT           TIM3_IRQHandler            [WEA
-K]
-  235 0000001A                 EXPORT           TIM4_IRQHandler            [WEA
-
-
-
-ARM Macro Assembler    Page 7 
-
-
-K]
-  236 0000001A                 EXPORT           I2C1_EV_IRQHandler         [WEA
-K]
-  237 0000001A                 EXPORT           I2C1_ER_IRQHandler         [WEA
-K]
-  238 0000001A                 EXPORT           I2C2_EV_IRQHandler         [WEA
-K]
-  239 0000001A                 EXPORT           I2C2_ER_IRQHandler         [WEA
-K]
-  240 0000001A                 EXPORT           SPI1_IRQHandler            [WEA
-K]
-  241 0000001A                 EXPORT           SPI2_IRQHandler            [WEA
-K]
-  242 0000001A                 EXPORT           USART1_IRQHandler          [WEA
-K]
-  243 0000001A                 EXPORT           USART2_IRQHandler          [WEA
-K]
-  244 0000001A                 EXPORT           USART3_IRQHandler          [WEA
-K]
-  245 0000001A                 EXPORT           EXTI15_10_IRQHandler       [WEA
-K]
-  246 0000001A                 EXPORT           RTCAlarm_IRQHandler        [WEA
-K]
-  247 0000001A                 EXPORT           USBWakeUp_IRQHandler       [WEA
-K]
-  248 0000001A                 EXPORT           TIM8_BRK_IRQHandler        [WEA
-K]
-  249 0000001A                 EXPORT           TIM8_UP_IRQHandler         [WEA
-K]
-  250 0000001A                 EXPORT           TIM8_TRG_COM_IRQHandler    [WEA
-K]
-  251 0000001A                 EXPORT           TIM8_CC_IRQHandler         [WEA
-K]
-  252 0000001A                 EXPORT           ADC3_IRQHandler            [WEA
-K]
-  253 0000001A                 EXPORT           FSMC_IRQHandler            [WEA
-K]
-  254 0000001A                 EXPORT           SDIO_IRQHandler            [WEA
-K]
-  255 0000001A                 EXPORT           TIM5_IRQHandler            [WEA
-K]
-  256 0000001A                 EXPORT           SPI3_IRQHandler            [WEA
-K]
-  257 0000001A                 EXPORT           UART4_IRQHandler           [WEA
-K]
-  258 0000001A                 EXPORT           UART5_IRQHandler           [WEA
-K]
-  259 0000001A                 EXPORT           TIM6_IRQHandler            [WEA
-K]
-  260 0000001A                 EXPORT           TIM7_IRQHandler            [WEA
-K]
-  261 0000001A                 EXPORT           DMA2_Channel1_IRQHandler   [WEA
-K]
-  262 0000001A                 EXPORT           DMA2_Channel2_IRQHandler   [WEA
-K]
-  263 0000001A                 EXPORT           DMA2_Channel3_IRQHandler   [WEA
-K]
-  264 0000001A                 EXPORT           DMA2_Channel4_5_IRQHandler [WEA
-K]
-
-
-
-ARM Macro Assembler    Page 8 
-
-
-  265 0000001A         
-  266 0000001A         WWDG_IRQHandler
-  267 0000001A         PVD_IRQHandler
-  268 0000001A         TAMPER_IRQHandler
-  269 0000001A         RTC_IRQHandler
-  270 0000001A         FLASH_IRQHandler
-  271 0000001A         RCC_IRQHandler
-  272 0000001A         EXTI0_IRQHandler
-  273 0000001A         EXTI1_IRQHandler
-  274 0000001A         EXTI2_IRQHandler
-  275 0000001A         EXTI3_IRQHandler
-  276 0000001A         EXTI4_IRQHandler
-  277 0000001A         DMA1_Channel1_IRQHandler
-  278 0000001A         DMA1_Channel2_IRQHandler
-  279 0000001A         DMA1_Channel3_IRQHandler
-  280 0000001A         DMA1_Channel4_IRQHandler
-  281 0000001A         DMA1_Channel5_IRQHandler
-  282 0000001A         DMA1_Channel6_IRQHandler
-  283 0000001A         DMA1_Channel7_IRQHandler
-  284 0000001A         ADC1_2_IRQHandler
-  285 0000001A         USB_HP_CAN1_TX_IRQHandler
-  286 0000001A         USB_LP_CAN1_RX0_IRQHandler
-  287 0000001A         CAN1_RX1_IRQHandler
-  288 0000001A         CAN1_SCE_IRQHandler
-  289 0000001A         EXTI9_5_IRQHandler
-  290 0000001A         TIM1_BRK_IRQHandler
-  291 0000001A         TIM1_UP_IRQHandler
-  292 0000001A         TIM1_TRG_COM_IRQHandler
-  293 0000001A         TIM1_CC_IRQHandler
-  294 0000001A         TIM2_IRQHandler
-  295 0000001A         TIM3_IRQHandler
-  296 0000001A         TIM4_IRQHandler
-  297 0000001A         I2C1_EV_IRQHandler
-  298 0000001A         I2C1_ER_IRQHandler
-  299 0000001A         I2C2_EV_IRQHandler
-  300 0000001A         I2C2_ER_IRQHandler
-  301 0000001A         SPI1_IRQHandler
-  302 0000001A         SPI2_IRQHandler
-  303 0000001A         USART1_IRQHandler
-  304 0000001A         USART2_IRQHandler
-  305 0000001A         USART3_IRQHandler
-  306 0000001A         EXTI15_10_IRQHandler
-  307 0000001A         RTCAlarm_IRQHandler
-  308 0000001A         USBWakeUp_IRQHandler
-  309 0000001A         TIM8_BRK_IRQHandler
-  310 0000001A         TIM8_UP_IRQHandler
-  311 0000001A         TIM8_TRG_COM_IRQHandler
-  312 0000001A         TIM8_CC_IRQHandler
-  313 0000001A         ADC3_IRQHandler
-  314 0000001A         FSMC_IRQHandler
-  315 0000001A         SDIO_IRQHandler
-  316 0000001A         TIM5_IRQHandler
-  317 0000001A         SPI3_IRQHandler
-  318 0000001A         UART4_IRQHandler
-  319 0000001A         UART5_IRQHandler
-  320 0000001A         TIM6_IRQHandler
-  321 0000001A         TIM7_IRQHandler
-  322 0000001A         DMA2_Channel1_IRQHandler
-  323 0000001A         DMA2_Channel2_IRQHandler
-
-
-
-ARM Macro Assembler    Page 9 
-
-
-  324 0000001A         DMA2_Channel3_IRQHandler
-  325 0000001A         DMA2_Channel4_5_IRQHandler
-  326 0000001A E7FE            B                .
-  327 0000001C         
-  328 0000001C                 ENDP
-  329 0000001C         
-  330 0000001C                 ALIGN
-  331 0000001C         
-  332 0000001C         ;*******************************************************
-                       ************************
-  333 0000001C         ; User Stack and Heap initialization
-  334 0000001C         ;*******************************************************
-                       ************************
-  335 0000001C                 IF               :DEF:__MICROLIB
-  336 0000001C         
-  337 0000001C                 EXPORT           __initial_sp
-  338 0000001C                 EXPORT           __heap_base
-  339 0000001C                 EXPORT           __heap_limit
-  340 0000001C         
-  341 0000001C                 ELSE
-  356                          ENDIF
-  357 0000001C         
-  358 0000001C                 END
-              00000000 
-              00000000 
-Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
-ork --depend=.\objects\startup_stm32f10x_hd.d -o.\objects\startup_stm32f10x_hd.
-o -ID:\Keil_v5\Packs\Keil\STM32F1xx_DFP\2.3.0\Device\Include --predefine="__MIC
-ROLIB SETA 1" --predefine="__UVISION_VERSION SETA 536" --predefine="STM32F10X_M
-D SETA 1" --list=.\listings\startup_stm32f10x_hd.lst ..\Libraries\CMSIS\startup
-\startup_stm32f10x_hd.s
-
-
-
-ARM Macro Assembler    Page 1 Alphabetic symbol ordering
-Relocatable symbols
-
-STACK 00000000
-
-Symbol: STACK
-   Definitions
-      At line 39 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      None
-Comment: STACK unused
-Stack_Mem 00000000
-
-Symbol: Stack_Mem
-   Definitions
-      At line 40 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      None
-Comment: Stack_Mem unused
-__initial_sp 00000400
-
-Symbol: __initial_sp
-   Definitions
-      At line 41 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 64 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 337 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-3 symbols
-
-
-
-ARM Macro Assembler    Page 1 Alphabetic symbol ordering
-Relocatable symbols
-
-HEAP 00000000
-
-Symbol: HEAP
-   Definitions
-      At line 49 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      None
-Comment: HEAP unused
-Heap_Mem 00000000
-
-Symbol: Heap_Mem
-   Definitions
-      At line 51 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      None
-Comment: Heap_Mem unused
-__heap_base 00000000
-
-Symbol: __heap_base
-   Definitions
-      At line 50 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 338 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-Comment: __heap_base used once
-__heap_limit 00000200
-
-Symbol: __heap_limit
-   Definitions
-      At line 52 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 339 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-Comment: __heap_limit used once
-4 symbols
-
-
-
-ARM Macro Assembler    Page 1 Alphabetic symbol ordering
-Relocatable symbols
-
-RESET 00000000
-
-Symbol: RESET
-   Definitions
-      At line 59 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      None
-Comment: RESET unused
-__Vectors 00000000
-
-Symbol: __Vectors
-   Definitions
-      At line 64 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 60 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 144 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-__Vectors_End 00000130
-
-Symbol: __Vectors_End
-   Definitions
-      At line 142 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 61 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 144 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-3 symbols
-
-
-
-ARM Macro Assembler    Page 1 Alphabetic symbol ordering
-Relocatable symbols
-
-.text 00000000
-
-Symbol: .text
-   Definitions
-      At line 146 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      None
-Comment: .text unused
-ADC1_2_IRQHandler 0000001A
-
-Symbol: ADC1_2_IRQHandler
-   Definitions
-      At line 284 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 100 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 223 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-ADC3_IRQHandler 0000001A
-
-Symbol: ADC3_IRQHandler
-   Definitions
-      At line 313 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 129 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 252 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-BusFault_Handler 0000000E
-
-Symbol: BusFault_Handler
-   Definitions
-      At line 176 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 69 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 177 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-CAN1_RX1_IRQHandler 0000001A
-
-Symbol: CAN1_RX1_IRQHandler
-   Definitions
-      At line 287 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 103 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 226 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-CAN1_SCE_IRQHandler 0000001A
-
-Symbol: CAN1_SCE_IRQHandler
-   Definitions
-      At line 288 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 104 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 227 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA1_Channel1_IRQHandler 0000001A
-
-Symbol: DMA1_Channel1_IRQHandler
-   Definitions
-      At line 277 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-
-
-
-ARM Macro Assembler    Page 2 Alphabetic symbol ordering
-Relocatable symbols
-
-      At line 93 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 216 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA1_Channel2_IRQHandler 0000001A
-
-Symbol: DMA1_Channel2_IRQHandler
-   Definitions
-      At line 278 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 94 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 217 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA1_Channel3_IRQHandler 0000001A
-
-Symbol: DMA1_Channel3_IRQHandler
-   Definitions
-      At line 279 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 95 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 218 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA1_Channel4_IRQHandler 0000001A
-
-Symbol: DMA1_Channel4_IRQHandler
-   Definitions
-      At line 280 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 96 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 219 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA1_Channel5_IRQHandler 0000001A
-
-Symbol: DMA1_Channel5_IRQHandler
-   Definitions
-      At line 281 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 97 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 220 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA1_Channel6_IRQHandler 0000001A
-
-Symbol: DMA1_Channel6_IRQHandler
-   Definitions
-      At line 282 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 98 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 221 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA1_Channel7_IRQHandler 0000001A
-
-Symbol: DMA1_Channel7_IRQHandler
-   Definitions
-      At line 283 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 99 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 222 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA2_Channel1_IRQHandler 0000001A
-
-
-
-
-ARM Macro Assembler    Page 3 Alphabetic symbol ordering
-Relocatable symbols
-
-Symbol: DMA2_Channel1_IRQHandler
-   Definitions
-      At line 322 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 138 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 261 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA2_Channel2_IRQHandler 0000001A
-
-Symbol: DMA2_Channel2_IRQHandler
-   Definitions
-      At line 323 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 139 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 262 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA2_Channel3_IRQHandler 0000001A
-
-Symbol: DMA2_Channel3_IRQHandler
-   Definitions
-      At line 324 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 140 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 263 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DMA2_Channel4_5_IRQHandler 0000001A
-
-Symbol: DMA2_Channel4_5_IRQHandler
-   Definitions
-      At line 325 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 141 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 264 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-DebugMon_Handler 00000014
-
-Symbol: DebugMon_Handler
-   Definitions
-      At line 190 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 76 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 191 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-Default_Handler 0000001A
-
-Symbol: Default_Handler
-   Definitions
-      At line 203 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      None
-Comment: Default_Handler unused
-EXTI0_IRQHandler 0000001A
-
-Symbol: EXTI0_IRQHandler
-   Definitions
-      At line 272 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 88 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 211 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-
-
-ARM Macro Assembler    Page 4 Alphabetic symbol ordering
-Relocatable symbols
-
-
-EXTI15_10_IRQHandler 0000001A
-
-Symbol: EXTI15_10_IRQHandler
-   Definitions
-      At line 306 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 122 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 245 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-EXTI1_IRQHandler 0000001A
-
-Symbol: EXTI1_IRQHandler
-   Definitions
-      At line 273 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 89 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 212 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-EXTI2_IRQHandler 0000001A
-
-Symbol: EXTI2_IRQHandler
-   Definitions
-      At line 274 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 90 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 213 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-EXTI3_IRQHandler 0000001A
-
-Symbol: EXTI3_IRQHandler
-   Definitions
-      At line 275 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 91 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 214 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-EXTI4_IRQHandler 0000001A
-
-Symbol: EXTI4_IRQHandler
-   Definitions
-      At line 276 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 92 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 215 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-EXTI9_5_IRQHandler 0000001A
-
-Symbol: EXTI9_5_IRQHandler
-   Definitions
-      At line 289 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 105 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 228 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-FLASH_IRQHandler 0000001A
-
-Symbol: FLASH_IRQHandler
-   Definitions
-
-
-
-ARM Macro Assembler    Page 5 Alphabetic symbol ordering
-Relocatable symbols
-
-      At line 270 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 86 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 209 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-FSMC_IRQHandler 0000001A
-
-Symbol: FSMC_IRQHandler
-   Definitions
-      At line 314 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 130 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 253 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-HardFault_Handler 0000000A
-
-Symbol: HardFault_Handler
-   Definitions
-      At line 166 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 67 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 167 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-I2C1_ER_IRQHandler 0000001A
-
-Symbol: I2C1_ER_IRQHandler
-   Definitions
-      At line 298 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 114 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 237 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-I2C1_EV_IRQHandler 0000001A
-
-Symbol: I2C1_EV_IRQHandler
-   Definitions
-      At line 297 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 113 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 236 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-I2C2_ER_IRQHandler 0000001A
-
-Symbol: I2C2_ER_IRQHandler
-   Definitions
-      At line 300 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 116 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 239 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-I2C2_EV_IRQHandler 0000001A
-
-Symbol: I2C2_EV_IRQHandler
-   Definitions
-      At line 299 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 115 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 238 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-
-
-
-ARM Macro Assembler    Page 6 Alphabetic symbol ordering
-Relocatable symbols
-
-MemManage_Handler 0000000C
-
-Symbol: MemManage_Handler
-   Definitions
-      At line 171 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 68 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 172 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-NMI_Handler 00000008
-
-Symbol: NMI_Handler
-   Definitions
-      At line 161 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 66 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 162 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-PVD_IRQHandler 0000001A
-
-Symbol: PVD_IRQHandler
-   Definitions
-      At line 267 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 83 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 206 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-PendSV_Handler 00000016
-
-Symbol: PendSV_Handler
-   Definitions
-      At line 194 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 78 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 195 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-RCC_IRQHandler 0000001A
-
-Symbol: RCC_IRQHandler
-   Definitions
-      At line 271 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 87 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 210 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-RTCAlarm_IRQHandler 0000001A
-
-Symbol: RTCAlarm_IRQHandler
-   Definitions
-      At line 307 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 123 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 246 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-RTC_IRQHandler 0000001A
-
-Symbol: RTC_IRQHandler
-   Definitions
-      At line 269 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-
-
-ARM Macro Assembler    Page 7 Alphabetic symbol ordering
-Relocatable symbols
-
-   Uses
-      At line 85 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 208 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-Reset_Handler 00000000
-
-Symbol: Reset_Handler
-   Definitions
-      At line 149 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 65 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 150 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-SDIO_IRQHandler 0000001A
-
-Symbol: SDIO_IRQHandler
-   Definitions
-      At line 315 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 131 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 254 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-SPI1_IRQHandler 0000001A
-
-Symbol: SPI1_IRQHandler
-   Definitions
-      At line 301 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 117 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 240 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-SPI2_IRQHandler 0000001A
-
-Symbol: SPI2_IRQHandler
-   Definitions
-      At line 302 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 118 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 241 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-SPI3_IRQHandler 0000001A
-
-Symbol: SPI3_IRQHandler
-   Definitions
-      At line 317 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 133 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 256 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-SVC_Handler 00000012
-
-Symbol: SVC_Handler
-   Definitions
-      At line 185 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 75 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 186 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-SysTick_Handler 00000018
-
-
-
-ARM Macro Assembler    Page 8 Alphabetic symbol ordering
-Relocatable symbols
-
-
-Symbol: SysTick_Handler
-   Definitions
-      At line 198 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 79 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 199 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TAMPER_IRQHandler 0000001A
-
-Symbol: TAMPER_IRQHandler
-   Definitions
-      At line 268 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 84 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 207 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM1_BRK_IRQHandler 0000001A
-
-Symbol: TIM1_BRK_IRQHandler
-   Definitions
-      At line 290 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 106 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 229 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM1_CC_IRQHandler 0000001A
-
-Symbol: TIM1_CC_IRQHandler
-   Definitions
-      At line 293 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 109 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 232 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM1_TRG_COM_IRQHandler 0000001A
-
-Symbol: TIM1_TRG_COM_IRQHandler
-   Definitions
-      At line 292 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 108 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 231 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM1_UP_IRQHandler 0000001A
-
-Symbol: TIM1_UP_IRQHandler
-   Definitions
-      At line 291 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 107 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 230 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM2_IRQHandler 0000001A
-
-Symbol: TIM2_IRQHandler
-   Definitions
-      At line 294 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-
-
-
-ARM Macro Assembler    Page 9 Alphabetic symbol ordering
-Relocatable symbols
-
-      At line 110 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 233 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM3_IRQHandler 0000001A
-
-Symbol: TIM3_IRQHandler
-   Definitions
-      At line 295 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 111 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 234 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM4_IRQHandler 0000001A
-
-Symbol: TIM4_IRQHandler
-   Definitions
-      At line 296 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 112 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 235 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM5_IRQHandler 0000001A
-
-Symbol: TIM5_IRQHandler
-   Definitions
-      At line 316 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 132 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 255 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM6_IRQHandler 0000001A
-
-Symbol: TIM6_IRQHandler
-   Definitions
-      At line 320 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 136 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 259 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM7_IRQHandler 0000001A
-
-Symbol: TIM7_IRQHandler
-   Definitions
-      At line 321 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 137 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 260 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM8_BRK_IRQHandler 0000001A
-
-Symbol: TIM8_BRK_IRQHandler
-   Definitions
-      At line 309 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 125 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 248 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM8_CC_IRQHandler 0000001A
-
-
-
-
-ARM Macro Assembler    Page 10 Alphabetic symbol ordering
-Relocatable symbols
-
-Symbol: TIM8_CC_IRQHandler
-   Definitions
-      At line 312 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 128 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 251 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM8_TRG_COM_IRQHandler 0000001A
-
-Symbol: TIM8_TRG_COM_IRQHandler
-   Definitions
-      At line 311 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 127 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 250 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-TIM8_UP_IRQHandler 0000001A
-
-Symbol: TIM8_UP_IRQHandler
-   Definitions
-      At line 310 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 126 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 249 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-UART4_IRQHandler 0000001A
-
-Symbol: UART4_IRQHandler
-   Definitions
-      At line 318 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 134 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 257 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-UART5_IRQHandler 0000001A
-
-Symbol: UART5_IRQHandler
-   Definitions
-      At line 319 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 135 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 258 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-USART1_IRQHandler 0000001A
-
-Symbol: USART1_IRQHandler
-   Definitions
-      At line 303 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 119 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 242 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-USART2_IRQHandler 0000001A
-
-Symbol: USART2_IRQHandler
-   Definitions
-      At line 304 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 120 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-
-
-ARM Macro Assembler    Page 11 Alphabetic symbol ordering
-Relocatable symbols
-
-      At line 243 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-USART3_IRQHandler 0000001A
-
-Symbol: USART3_IRQHandler
-   Definitions
-      At line 305 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 121 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 244 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-USBWakeUp_IRQHandler 0000001A
-
-Symbol: USBWakeUp_IRQHandler
-   Definitions
-      At line 308 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 124 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 247 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-USB_HP_CAN1_TX_IRQHandler 0000001A
-
-Symbol: USB_HP_CAN1_TX_IRQHandler
-   Definitions
-      At line 285 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 101 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 224 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-USB_LP_CAN1_RX0_IRQHandler 0000001A
-
-Symbol: USB_LP_CAN1_RX0_IRQHandler
-   Definitions
-      At line 286 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 102 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 225 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-UsageFault_Handler 00000010
-
-Symbol: UsageFault_Handler
-   Definitions
-      At line 181 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 70 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 182 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-WWDG_IRQHandler 0000001A
-
-Symbol: WWDG_IRQHandler
-   Definitions
-      At line 266 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 82 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-      At line 205 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-
-72 symbols
-
-
-
-ARM Macro Assembler    Page 1 Alphabetic symbol ordering
-Absolute symbols
-
-Heap_Size 00000200
-
-Symbol: Heap_Size
-   Definitions
-      At line 47 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 51 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-Comment: Heap_Size used once
-Stack_Size 00000400
-
-Symbol: Stack_Size
-   Definitions
-      At line 37 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 40 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-Comment: Stack_Size used once
-__Vectors_Size 00000130
-
-Symbol: __Vectors_Size
-   Definitions
-      At line 144 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 62 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-Comment: __Vectors_Size used once
-3 symbols
-
-
-
-ARM Macro Assembler    Page 1 Alphabetic symbol ordering
-External symbols
-
-SystemInit 00000000
-
-Symbol: SystemInit
-   Definitions
-      At line 152 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 153 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-Comment: SystemInit used once
-__main 00000000
-
-Symbol: __main
-   Definitions
-      At line 151 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-   Uses
-      At line 155 in file ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
-Comment: __main used once
-2 symbols
-422 symbols in table

+ 0 - 40
project_Template/Project/Objects/myProject.lnp

@@ -1,40 +0,0 @@
---cpu Cortex-M3
-".\objects\startup_stm32f10x_hd.o"
-".\objects\core_cm3.o"
-".\objects\system_stm32f10x.o"
-".\objects\stm32f10x_it.o"
-".\objects\misc.o"
-".\objects\stm32f10x_adc.o"
-".\objects\stm32f10x_bkp.o"
-".\objects\stm32f10x_can.o"
-".\objects\stm32f10x_cec.o"
-".\objects\stm32f10x_crc.o"
-".\objects\stm32f10x_dac.o"
-".\objects\stm32f10x_dbgmcu.o"
-".\objects\stm32f10x_dma.o"
-".\objects\stm32f10x_exti.o"
-".\objects\stm32f10x_flash.o"
-".\objects\stm32f10x_fsmc.o"
-".\objects\stm32f10x_gpio.o"
-".\objects\stm32f10x_i2c.o"
-".\objects\stm32f10x_iwdg.o"
-".\objects\stm32f10x_pwr.o"
-".\objects\stm32f10x_rcc.o"
-".\objects\stm32f10x_rtc.o"
-".\objects\stm32f10x_sdio.o"
-".\objects\stm32f10x_spi.o"
-".\objects\stm32f10x_tim.o"
-".\objects\stm32f10x_usart.o"
-".\objects\stm32f10x_wwdg.o"
-".\objects\main.o"
-".\objects\handle.o"
-".\objects\delay.o"
-".\objects\gpio.o"
-".\objects\rcc.o"
-".\objects\tim.o"
-".\objects\usart.o"
-".\objects\timeschedulesystem.o"
---library_type=microlib --strict --scatter ".\Objects\myProject.sct"
---summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
---info sizes --info totals --info unused --info veneers
---list ".\Listings\myProject.map" -o .\Objects\myProject.axf

+ 0 - 16
project_Template/Project/Objects/myProject.sct

@@ -1,16 +0,0 @@
-; *************************************************************
-; *** Scatter-Loading Description File generated by uVision ***
-; *************************************************************
-
-LR_IROM1 0x08000000 0x00010000  {    ; load region size_region
-  ER_IROM1 0x08000000 0x00010000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-   .ANY (+XO)
-  }
-  RW_IRAM1 0x20000000 0x00005000  {  ; RW data
-   .ANY (+RW +ZI)
-  }
-}
-

File diff suppressed because it is too large
+ 0 - 1801
project_Template/Project/myProject.uvguix.AS


+ 2 - 2
project_Template/Project/myProject.uvoptx

@@ -637,8 +637,8 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\Drive\TimeScheduleSystem.c</PathWithFileName>
-      <FilenameWithoutPath>TimeScheduleSystem.c</FilenameWithoutPath>
+      <PathWithFileName>..\Drive\MultiTimerA.c</PathWithFileName>
+      <FilenameWithoutPath>MultiTimerA.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>

+ 2 - 2
project_Template/Project/myProject.uvprojx

@@ -579,9 +579,9 @@
           <GroupName>drive</GroupName>
           <Files>
             <File>
-              <FileName>TimeScheduleSystem.c</FileName>
+              <FileName>MultiTimerA.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Drive\TimeScheduleSystem.c</FilePath>
+              <FilePath>..\Drive\MultiTimerA.c</FilePath>
             </File>
           </Files>
         </Group>

+ 6 - 17
project_Template/User/handle.c

@@ -4,12 +4,9 @@ AllFlagStruct AllFlag = {
 
 };
 
-#define TIMER_PERIOD_MS	10
+#define TIMER_PERIOD_MS    10
 
-
-TSS_t m_ledBlink;
-
-void TSS_ledBlink(void);
+static void ledBlinkTask(void);
 
 /**
   * @brief  系统初始化
@@ -25,15 +22,7 @@ void SYSTEM_Init(void)
 	printf("begin\n");
 #endif
 	
-	
-	uint8_t ret = 0;
-	ret = TSS_init(&m_ledBlink, 500/TIMER_PERIOD_MS, TSS_ledBlink);
-	if(!ret) {
-		TSS_start(&m_ledBlink);
-		printf("m_ledBlink TSS init success and started\n");
-	} else {
-		printf("m_ledBlink TSS init fail:%d\n", ret);
-	}
+	timerA_create(0, 500/TIMER_PERIOD_MS, ledBlinkTask, TIMER_A_START);
 }
 /**
   * @brief  任务处理
@@ -42,14 +31,14 @@ void SYSTEM_Init(void)
   */
 void TASK_Schedule(void)
 {
-	TSS_while();
+	timerA_loop();
 }
 /**
   * @brief  运行指示灯闪烁任务
   * @param  None
   * @retval None
   */
-void TSS_ledBlink(void)
+static void ledBlinkTask(void)
 {
 	GPIOClass.Toggle(LED_Run);
 }
@@ -62,7 +51,7 @@ void TIM2_IRQHandler(void)
 {
 	if(TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) 
 	{	
-		TSS_timer();
+		timerA_timer();
 		TIM_ClearITPendingBit(TIM2, TIM_FLAG_Update);
 	}	
 }

+ 1 - 1
project_Template/User/main.h

@@ -15,7 +15,7 @@
 #include "USART.h"
 #include "GPIO.h"
 // drive
-#include "TimeScheduleSystem.h"
+#include "MultiTimerA.h"
 // user
 #include "handle.h"
 

+ 9 - 8
system_Template/ADC.c

@@ -54,13 +54,13 @@ static void ADC1_Init(void)
 	ADC_InitTypeDef ADC_InitStructure;
 	DMA_InitTypeDef DMA_InitStructure;
 
-	/*开启相关的GPIO外设时钟*/
+
 	RCC_APB2PeriphClockCmd(ADC1_A0_A7_GPIO_CLK, ENABLE);
-	/*选择要控制的GPIO引脚*/
+	/***************************************************************/
+	// 1. 修改为所使用的引脚
 	GPIO_InitStructure.GPIO_Pin = ADC1_A1_GPIO_PIN;	
-	/*设置引脚模式为浮空输入*/
+	/***************************************************************/
 	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;   
-	/*调用库函数,初始化GPIO*/
 	GPIO_Init(ADC1_A0_A7_GPIO_PORT, &GPIO_InitStructure);	
 	
 	// 打开DMA时钟
@@ -77,7 +77,7 @@ static void ADC1_Init(void)
 	// 数据源来自外设
 	DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
 	/***************************************************************/
-	// 缓冲区大小,应该等于数据目的地的大小
+	// 2.缓存数量 使用1个ADC引脚就是1 使用2个ADC引脚就是2
 	DMA_InitStructure.DMA_BufferSize = 1;
 	/***************************************************************/
 	// 外设寄存器只有一个,地址不用递增
@@ -111,7 +111,7 @@ static void ADC1_Init(void)
 	// 转换结果右对齐
 	ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
 	/***************************************************************/
-	// 转换通道个数
+	// 3.转换通道个数 使用1个ADC引脚就是1 使用2个ADC引脚就是2
 	ADC_InitStructure.ADC_NbrOfChannel = 1;	
 	/***************************************************************/
 	// 初始化ADC
@@ -119,8 +119,9 @@ static void ADC1_Init(void)
 	// 配置ADC时钟N狿CLK2的8分频,即9MHz
 	RCC_ADCCLKConfig(RCC_PCLK2_Div8); 
 	/***************************************************************/
-	// 配置ADC 通道的转换顺序和采样时间
+	// 4.配置ADC通道的转换顺序和采样时间 将所使用的所有引脚按自定义顺序填写
 	ADC_RegularChannelConfig(ADC1, ADC1_A1_CHANNEL, 1, ADC_SampleTime_55Cycles5);
+	// ADC_RegularChannelConfig(ADC1, ADC1_A2_CHANNEL, 2, ADC_SampleTime_55Cycles5);
 	/***************************************************************/
 	// 使能ADC DMA 请求
 	ADC_DMACmd(ADC1, ENABLE);
@@ -137,7 +138,7 @@ static void ADC1_Init(void)
 	// 由于没有采用外部触发,所以使用软件触发ADC转换 
 	ADC_SoftwareStartConvCmd(ADC1, ENABLE);
 }
-
+/* 0-9对应第四步中的ADC引脚通道顺序 例如顺序为ADC1_A3 ADC1_A4 则A3引脚对应0 A4引脚对应1*/
 static uint16_t getADC1Value(uint8_t ADC_channelx)
 {
 	uint16_t ADCTemp = 0;

+ 179 - 0
system_Template/PWM.c

@@ -0,0 +1,179 @@
+#include "main.h"
+
+
+// 使用TIM2哪个通道
+#define USE_TIM2_CH1
+//#define USE_TIM2_CH2
+//#define USE_TIM2_CH3
+//#define USE_TIM2_CH4
+
+#define PWM_TIM2_GPIO_CLK               RCC_APB2Periph_GPIOA
+#define PWM_TIM2_GPIO_PORT              GPIOA
+#ifdef USE_TIM2_CH1
+#define PWM_TIM2_GPIO_PIN               GPIO_Pin_0
+#endif
+#ifdef USE_TIM2_CH2
+#define PWM_TIM2_GPIO_PIN2              GPIO_Pin_1
+#endif
+#ifdef USE_TIM2_CH3
+#define PWM_TIM2_GPIO_PIN3              GPIO_Pin_2
+#endif
+#ifdef USE_TIM2_CH4
+#define PWM_TIM2_GPIO_PIN4              GPIO_Pin_3
+#endif
+
+// 使用TIM3哪个通道
+#define USE_TIM3_CH1
+//#define USE_TIM3_CH2
+//#define USE_TIM3_CH3
+//#define USE_TIM3_CH4
+
+#define PWM_TIM3_GPIO_CLK               RCC_APB2Periph_GPIOA
+#define PWM_TIM3_GPIO_PORT              GPIOA
+#ifdef USE_TIM3_CH1
+#define PWM_TIM3_GPIO_PIN               GPIO_Pin_6
+#endif
+#ifdef USE_TIM3_CH2
+#define PWM_TIM3_GPIO_PIN2              GPIO_Pin_7
+#endif
+#ifdef USE_TIM3_CH3
+#define PWM_TIM3_GPIO_PIN3              GPIO_Pin_8
+#endif
+#ifdef USE_TIM3_CH4
+#define PWM_TIM3_GPIO_PIN4              GPIO_Pin_9
+#endif
+
+void PWM_TIM2_Init(uint16_t period, uint16_t arr)
+{
+	GPIO_InitTypeDef GPIO_InitStructure;
+	TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
+	TIM_OCInitTypeDef  TIM_OCInitStructure;
+
+	RCC_APB2PeriphClockCmd(PWM_TIM2_GPIO_CLK | RCC_APB2Periph_AFIO, ENABLE);  //使能GPIO外设时钟使能
+	RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); //时钟使能
+	
+	//设置该引脚为复用输出功能,输出PWM脉冲波形
+	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;  //复用推挽输出
+	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+#ifdef USE_TIM2_CH1
+	GPIO_InitStructure.GPIO_Pin = PWM_TIM2_GPIO_PIN;
+	GPIO_Init(PWM_TIM2_GPIO_PORT, &GPIO_InitStructure);
+#endif
+#ifdef USE_TIM2_CH2
+	GPIO_InitStructure.GPIO_Pin = PWM_TIM2_GPIO_PIN2;
+	GPIO_Init(PWM_TIM2_GPIO_PORT, &GPIO_InitStructure);
+#endif
+#ifdef USE_TIM2_CH3
+	GPIO_InitStructure.GPIO_Pin = PWM_TIM2_GPIO_PIN3;
+	GPIO_Init(PWM_TIM2_GPIO_PORT, &GPIO_InitStructure);
+#endif
+#ifdef USE_TIM2_CH4
+	GPIO_InitStructure.GPIO_Pin = PWM_TIM2_GPIO_PIN4;
+	GPIO_Init(PWM_TIM2_GPIO_PORT, &GPIO_InitStructure);
+#endif
+	
+	//定时器初始化
+	TIM_TimeBaseStructure.TIM_Period = period; //设置在下一个更新事件装入活动的自动重装载寄存器周期的值
+	TIM_TimeBaseStructure.TIM_Prescaler = arr; //设置用来作为TIMx时钟频率除数的预分频值
+	TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; //设置时钟分割:TDTS = Tck_tim
+	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  //TIM向上计数模式
+	TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
+	TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure); //根据指定的参数初始化TIMx的时间基数单位
+ 
+	TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2; //选择定时器模式:TIM脉冲宽度调制模式2
+	TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; //比较输出使能
+	TIM_OCInitStructure.TIM_Pulse = 0; //设置待装入捕获比较寄存器的脉冲值
+	TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low; //输出极性:TIM输出比较极性高
+#ifdef USE_TIM2_CH1
+	TIM_OC1Init(TIM2, &TIM_OCInitStructure);  //根据TIM_OCInitStruct中指定的参数初始化外设TIMx
+	TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Enable);  	//CH1预装载使能   
+#endif	
+#ifdef USE_TIM2_CH2
+	TIM_OC2Init(TIM2, &TIM_OCInitStructure);
+	TIM_OC2PreloadConfig(TIM2, TIM_OCPreload_Enable);
+#endif
+#ifdef USE_TIM2_CH3
+	TIM_OC3Init(TIM2, &TIM_OCInitStructure);
+	TIM_OC3PreloadConfig(TIM2, TIM_OCPreload_Enable);
+#endif
+#ifdef USE_TIM2_CH4
+	TIM_OC4Init(TIM2, &TIM_OCInitStructure);
+	TIM_OC4PreloadConfig(TIM2, TIM_OCPreload_Enable);
+#endif
+	TIM_ARRPreloadConfig(TIM2, ENABLE); //使能TIMx在ARR上的预装载寄存器
+	TIM_Cmd(TIM2, ENABLE);  //使能TIMx
+	TIM_CtrlPWMOutputs(TIM2,ENABLE);  //MOE 主输出使能				 
+}
+
+void PWM_TIM3_Init(uint16_t period, uint16_t arr)
+{
+	GPIO_InitTypeDef GPIO_InitStructure;
+	TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
+	TIM_OCInitTypeDef  TIM_OCInitStructure;
+
+	RCC_APB2PeriphClockCmd(PWM_TIM3_GPIO_CLK | RCC_APB2Periph_AFIO, ENABLE);  //使能GPIO外设时钟使能
+	RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //时钟使能
+	
+	//设置该引脚为复用输出功能,输出PWM脉冲波形
+	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;  //复用推挽输出
+	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+#ifdef USE_TIM3_CH1
+	GPIO_InitStructure.GPIO_Pin = PWM_TIM3_GPIO_PIN;
+	GPIO_Init(PWM_TIM3_GPIO_PORT, &GPIO_InitStructure);
+#endif
+#ifdef USE_TIM3_CH2
+	GPIO_InitStructure.GPIO_Pin = PWM_TIM3_GPIO_PIN2;
+	GPIO_Init(PWM_TIM3_GPIO_PORT, &GPIO_InitStructure);
+#endif
+#ifdef USE_TIM3_CH3
+	GPIO_InitStructure.GPIO_Pin = PWM_TIM3_GPIO_PIN3;
+	GPIO_Init(PWM_TIM3_GPIO_PORT, &GPIO_InitStructure);
+#endif
+#ifdef USE_TIM3_CH4
+	GPIO_InitStructure.GPIO_Pin = PWM_TIM3_GPIO_PIN4;
+	GPIO_Init(PWM_TIM3_GPIO_PORT, &GPIO_InitStructure);
+#endif
+	
+	//定时器初始化
+	TIM_TimeBaseStructure.TIM_Period = period; //设置在下一个更新事件装入活动的自动重装载寄存器周期的值
+	TIM_TimeBaseStructure.TIM_Prescaler = arr; //设置用来作为TIMx时钟频率除数的预分频值
+	TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; //设置时钟分割:TDTS = Tck_tim
+	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  //TIM向上计数模式
+	TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
+	TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); //根据指定的参数初始化TIMx的时间基数单位
+ 
+	TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2; //选择定时器模式:TIM脉冲宽度调制模式2
+	TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; //比较输出使能
+	TIM_OCInitStructure.TIM_Pulse = 0; //设置待装入捕获比较寄存器的脉冲值
+	TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low; //输出极性:TIM输出比较极性高
+#ifdef USE_TIM3_CH1
+	TIM_OC1Init(TIM3, &TIM_OCInitStructure);  //根据TIM_OCInitStruct中指定的参数初始化外设TIMx
+	TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);  	//CH1预装载使能   
+#endif	
+#ifdef USE_TIM3_CH2
+	TIM_OC2Init(TIM3, &TIM_OCInitStructure);
+	TIM_OC2PreloadConfig(TIM3, TIM_OCPreload_Enable);
+#endif
+#ifdef USE_TIM3_CH3
+	TIM_OC3Init(TIM3, &TIM_OCInitStructure);
+	TIM_OC3PreloadConfig(TIM3, TIM_OCPreload_Enable);
+#endif
+#ifdef USE_TIM3_CH4
+	TIM_OC4Init(TIM3, &TIM_OCInitStructure);
+	TIM_OC4PreloadConfig(TIM3, TIM_OCPreload_Enable);
+#endif
+	TIM_ARRPreloadConfig(TIM3, ENABLE); //使能TIMx在ARR上的预装载寄存器
+	TIM_Cmd(TIM3, ENABLE);  //使能TIMx
+	TIM_CtrlPWMOutputs(TIM3,ENABLE);  //MOE 主输出使能				 
+}
+
+void PWM_setCompare(TIM_TypeDef* TIMx, uint8_t CHx, uint16_t compare)
+{
+	switch(CHx) {
+		case PWM_CH1: TIM_SetCompare1(TIMx, compare); break;
+		case PWM_CH2: TIM_SetCompare2(TIMx, compare); break;
+		case PWM_CH3: TIM_SetCompare3(TIMx, compare); break;
+		case PWM_CH4: TIM_SetCompare4(TIMx, compare); break;
+		default: break;
+	}
+}

+ 18 - 0
system_Template/PWM.h

@@ -0,0 +1,18 @@
+#ifndef __PWM_AS_H
+#define __PWM_AS_H
+
+#include "main.h"
+
+typedef enum {
+	PWM_CH1 = 0,
+	PWM_CH2,
+	PWM_CH3,
+	PWM_CH4
+
+} PWM_CHX_t;
+
+void PWM_TIM2_Init(uint16_t period, uint16_t arr);
+void PWM_TIM3_Init(uint16_t period, uint16_t arr);
+void PWM_setCompare(TIM_TypeDef* TIMx, uint8_t CHx, uint16_t compare);
+
+#endif

Some files were not shown because too many files changed in this diff