fc8c2e27 by 张亚玄

add key time state & tim & new beep

1 parent 499ce9a5
......@@ -17,5 +17,6 @@
#define BEEP_Set() HAL_GPIO_WritePin(BEEP_GPIO_Port, BEEP_Pin, GPIO_PIN_SET)
extern void BEEP_call();
extern void BEEP_close();
#endif /* INC_HARDWARE_BEEP_H_ */
......
......@@ -22,6 +22,17 @@
#define KEY2_UP 0
#define KEY2_DOWN !KEY2_UP
#define KEY1 1
#define KEY2 2
#define KEY_CONTINUE_TRIGGLE_MODE 1
#define KEY_UNCONTINUE_TRIGGLE_MODE 0
#define KEY_PRESS_0_5S 1
#define KEY_PRESS_5_10S 2
#define KEY_PRESS_10_15S 3
#define KEY_PRESS_UP_15S 4
/* Exported functions --------------------------------------------------------*/
extern uint8_t KEY_Scan(uint8_t mode);
......
#ifndef AT_PRINTF_H
#define AT_PRINTF_H
#ifdef __cplusplus
extern "C"
{
#endif
int mprintf(const char *format, ...);
int msprintf(char *out, const char *format, ...);
#ifdef __cplusplus
}
#endif
#endif /* AT_PRINTF_H */
......@@ -51,6 +51,8 @@ void NMI_Handler(void);
void HardFault_Handler(void);
void EXTI4_15_IRQHandler(void);
void TIM1_BRK_UP_TRG_COM_IRQHandler(void);
void TIM3_IRQHandler(void);
void TIM6_IRQHandler(void);
void USART2_IRQHandler(void);
/* USER CODE BEGIN EFP */
......
/**
******************************************************************************
* File Name : TIM.h
* Description : This file provides code for the configuration
* of the TIM instances.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __tim_H
#define __tim_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim6;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_TIM3_Init(void);
void MX_TIM6_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /*__ tim_H */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
......@@ -27,7 +27,7 @@
#include "main.h"
/* USER CODE BEGIN Includes */
#include <stdio.h>
#include <mprintf.h>
/* USER CODE END Includes */
extern UART_HandleTypeDef huart1;
......@@ -41,6 +41,8 @@ extern uint16_t USART_RX_STA;
#define RXBUFFERSIZE 1 // 缓存大小
extern uint8_t aRxBuffer[RXBUFFERSIZE]; // HAL库USART接收Buffer
#define DEBUG_PRINT(str, len) HAL_UART_Transmit(&huart1, (uint8_t*)str, len, 1000);
/* USER CODE END Private defines */
void MX_USART1_UART_Init(void);
......
......@@ -7,7 +7,7 @@
/* Includes ------------------------------------------------------------------*/
#include "beep.h"
#include "cmsis_os.h"
#include "tim.h"
/**
* crazy beep
......@@ -15,6 +15,13 @@
void BEEP_call()
{
BEEP_Set();
osDelay(300);
HAL_TIM_Base_Start_IT(&htim6);
}
/**
* close crazy beep
*/
void BEEP_close()
{
BEEP_Reset();
}
......
......@@ -12,7 +12,7 @@
/**
* 按键处理函数
* @param mode 0 - 连续触发 1 - 不连续触发
* @param mode 0 - 不连续触发 1 - 连续触发
*/
uint8_t KEY_Scan(uint8_t mode)
{
......@@ -21,16 +21,20 @@ uint8_t KEY_Scan(uint8_t mode)
{
key_up = 1;
}
if (key_up && KEY2_read() == KEY2_DOWN)
if (key_up && (KEY1_read() == KEY1_DOWN || KEY2_read() == KEY2_DOWN))
{
osDelay(10);
key_up = 0;
if (KEY1_read() == KEY1_DOWN)
{
return KEY1;
}
if (KEY2_read() == KEY2_DOWN)
{
return 1;
return KEY2;
}
}
else if (KEY2_read() == KEY2_UP)
else if (KEY1_read() == KEY1_UP && KEY2_read() == KEY2_UP)
{
key_up = 1;
}
......@@ -38,17 +42,17 @@ uint8_t KEY_Scan(uint8_t mode)
return 0;
}
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
switch (GPIO_Pin) {
case GPIO_PIN_8:
osDelay(30);
if (KEY1_read() == KEY1_DOWN)
{
ledState++;
}
break;
default:
break;
}
}
//void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
//{
// switch (GPIO_Pin) {
// case GPIO_PIN_8:
// osDelay(30);
// if (KEY1_read() == KEY1_DOWN)
// {
// //ledState++;
// }
// break;
// default:
// break;
// }
//}
......
......@@ -26,7 +26,6 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdio.h>
#include "led.h"
#include "beep.h"
#include "key.h"
......@@ -119,7 +118,7 @@ osKernelInitialize();
const osThreadAttr_t UartTask_attributes = {
.name = "UartTask",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 128
.stack_size = 512
};
UartTaskHandle = osThreadNew(StartUartTask, NULL, &UartTask_attributes);
......@@ -134,7 +133,7 @@ osKernelInitialize();
/* definition and creation of SensorTask */
const osThreadAttr_t SensorTask_attributes = {
.name = "SensorTask",
.priority = (osPriority_t) osPriorityLow,
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 128
};
SensorTaskHandle = osThreadNew(StartSensorTask, NULL, &SensorTask_attributes);
......@@ -159,8 +158,8 @@ void StartLEDTask(void *argument)
/* Infinite loop */
for(;;)
{
ledState = ledState % LED_TOTAL_STATE_NUM;
LED_StateControl(ledState);
// ledState = ledState % LED_TOTAL_STATE_NUM;
// LED_StateControl(ledState);
osDelay(1);
}
/* USER CODE END StartLEDTask */
......@@ -176,12 +175,60 @@ void StartLEDTask(void *argument)
void StartKeyScanTask(void *argument)
{
/* USER CODE BEGIN StartKeyScanTask */
uint16_t count = 0;
uint8_t flag = 0;
/* Infinite loop */
for(;;)
{
if(KEY_Scan(0)) {
BEEP_call();
/* Infinite loop */
if(KEY1_read() == KEY1_DOWN)
{
osDelay(10);
if (KEY1_read() == KEY1_UP)
{
LED2_Reset();
count = 0;
flag = 0;
goto DONE;
}
if(count < 500)// 0 ~ 5 000 ms
{
flag = KEY_PRESS_0_5S;
if(count % 10 == 0)
{
HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin);
}
}
else if((count >= 500) && (count < 1000))// 5 000 ~ 10 000 ms
{
flag = KEY_PRESS_5_10S;
if(count % 30 == 0)
{
HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin);
}
}
else if((count >= 1000) && (count < 1500))// 10 000 ~ 15 000 ms
{
flag = KEY_PRESS_10_15S;
if(count % 50 == 0)
{
HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin);
}
}
else
{
flag = KEY_PRESS_UP_15S;
}
count++;
}
else
{
LED2_Reset();
count = 0;
flag = 0;
}
DONE:
osDelay(1);
}
/* USER CODE END StartKeyScanTask */
......@@ -205,10 +252,10 @@ void StartUartTask(void *argument)
if (USART_RX_STA & 0x8000)
{
len = USART_RX_STA & 0x3fff; // 获取接收到的数据长度
HAL_UART_Transmit(&huart1, (uint8_t*)"\r\nReceived:\r\n", sizeof("\r\nReceived:\r\n"), 1000);
mprintf("\r\nReceived:\r\n");
HAL_UART_Transmit(&huart1, (uint8_t*)USART_RX_BUF, len, 1000);
while (__HAL_UART_GET_FLAG(&huart1, UART_FLAG_TC) != SET);
HAL_UART_Transmit(&huart1, (uint8_t*)"\r\n\r\n", sizeof("\r\n\r\n"), 1000);
mprintf("\r\n\r\n");
USART_RX_STA=0;
}
else
......@@ -216,10 +263,12 @@ void StartUartTask(void *argument)
times++;
if (times % 5000 == 0)
{
HAL_UART_Transmit(&huart1, (uint8_t*)"\r\nUART Test\r\n", sizeof("\r\nUART Test\r\n"), 1000);
mprintf("\r\nUART Test\r\n");
}
if (times % 1000 == 0)
HAL_UART_Transmit(&huart1, (uint8_t*)"print char\r\n", sizeof("print char\r\n"), 1000);
// if (times % 1000 == 0)
// {
// mprintf("print char\r\n");
// }
}
osDelay(1);
......@@ -265,7 +314,6 @@ void StartSensorTask(void *argument)
/* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */
/* USER CODE END Application */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
......
......@@ -21,12 +21,13 @@
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "cmsis_os.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "beep.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
......@@ -92,7 +93,11 @@ int main(void)
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_USART2_UART_Init();
MX_TIM3_Init();
MX_TIM6_Init();
/* USER CODE BEGIN 2 */
// 使能TIM3中断
HAL_TIM_Base_Start_IT(&htim3);
// 使能UART2中断
HAL_UART_Receive_IT(&huart2, (uint8_t*)aRxBuffer, RXBUFFERSIZE);
/* USER CODE END 2 */
......@@ -180,7 +185,17 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
HAL_IncTick();
}
/* USER CODE BEGIN Callback 1 */
if(htim->Instance == TIM3)
{
mprintf("TIM3 elapsed\r\n");
BEEP_call();
}
if(htim->Instance == TIM6)
{
mprintf("TIM6 elapsed\r\n");
HAL_TIM_Base_Stop_IT(&htim6);
BEEP_close();
}
/* USER CODE END Callback 1 */
}
......
/*
Copyright 2001, 2002 Georges Menie (www.menie.org)
stdarg version contributed by Christian Ettinger
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
putchar is the only external dependency for this file,
if you have a working putchar, leave it commented out.
If not, uncomment the define below and
replace outbyte(c) by your own function call.
#define putchar(c) outbyte(c)
*/
#include <mprintf.h>
#include "stdarg.h"
#include "usart.h"
void mputc(char c);
void mputc(char c){
DEBUG_PRINT(&c,1);
}
static void printchar(char **str, int c)
{
extern void mputc(char c);
if (str) {
**str = c;
++(*str);
}
else (void)mputc((char)c);
}
#define PAD_RIGHT 1
#define PAD_ZERO 2
static int prints(char **out, const char *string, int width, int pad)
{
register int pc = 0, padchar = ' ';
if (width > 0) {
register int len = 0;
register const char *ptr;
for (ptr = string; *ptr; ++ptr) ++len;
if (len >= width) width = 0;
else width -= len;
if (pad & PAD_ZERO) padchar = '0';
}
if (!(pad & PAD_RIGHT)) {
for ( ; width > 0; --width) {
printchar (out, padchar);
++pc;
}
}
for ( ; *string ; ++string) {
printchar (out, *string);
++pc;
}
for ( ; width > 0; --width) {
printchar (out, padchar);
++pc;
}
return pc;
}
/* the following should be enough for 16 bit int */
#define PRINT_BUF_LEN 6
static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase)
{
char print_buf[PRINT_BUF_LEN];
register char *s;
register int t, neg = 0, pc = 0;
register unsigned int u = i;
if (i == 0) {
print_buf[0] = '0';
print_buf[1] = '\0';
return prints (out, print_buf, width, pad);
}
if (sg && b == 10 && i < 0) {
neg = 1;
u = -i;
}
s = print_buf + PRINT_BUF_LEN-1;
*s = '\0';
while (u) {
t = u % b;
if( t >= 10 )
t += letbase - '0' - 10;
*--s = t + '0';
u /= b;
}
if (neg) {
if( width && (pad & PAD_ZERO) ) {
printchar (out, '-');
++pc;
--width;
}
else {
*--s = '-';
}
}
return pc + prints (out, s, width, pad);
}
static int print(char **out, const char *format, va_list args )
{
register int width, pad;
register int pc = 0;
char scr[2];
for (; *format != 0; ++format) {
if (*format == '%') {
++format;
width = pad = 0;
if (*format == '\0') break;
if (*format == '%') goto out;
if (*format == '-') {
++format;
pad = PAD_RIGHT;
}
while (*format == '0') {
++format;
pad |= PAD_ZERO;
}
for ( ; *format >= '0' && *format <= '9'; ++format) {
width *= 10;
width += *format - '0';
}
if( *format == 's' ) {
register char *s = (char *)va_arg( args, int );
pc += prints (out, s?s:"(null)", width, pad);
continue;
}
if( *format == 'd' ) {
pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a');
continue;
}
if( *format == 'x' ) {
pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a');
continue;
}
if( *format == 'X' ) {
pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A');
continue;
}
if( *format == 'u' ) {
pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a');
continue;
}
if( *format == 'c' ) {
/* char are converted to int then pushed on the stack */
scr[0] = (char)va_arg( args, int );
scr[1] = '\0';
pc += prints (out, scr, width, pad);
continue;
}
}
else {
out:
printchar (out, *format);
++pc;
}
}
if (out) **out = '\0';
va_end( args );
return pc;
}
int mprintf(const char *format, ...)
{
va_list args;
va_start( args, format );
return print( 0, format, args );
}
int msprintf(char *out, const char *format, ...)
{
va_list args;
va_start( args, format );
return print( &out, format, args );
}
......@@ -59,6 +59,8 @@
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim6;
extern UART_HandleTypeDef huart2;
extern TIM_HandleTypeDef htim1;
......@@ -133,6 +135,34 @@ void TIM1_BRK_UP_TRG_COM_IRQHandler(void)
}
/**
* @brief This function handles TIM3 global interrupt.
*/
void TIM3_IRQHandler(void)
{
/* USER CODE BEGIN TIM3_IRQn 0 */
/* USER CODE END TIM3_IRQn 0 */
HAL_TIM_IRQHandler(&htim3);
/* USER CODE BEGIN TIM3_IRQn 1 */
/* USER CODE END TIM3_IRQn 1 */
}
/**
* @brief This function handles TIM6 global interrupt.
*/
void TIM6_IRQHandler(void)
{
/* USER CODE BEGIN TIM6_IRQn 0 */
/* USER CODE END TIM6_IRQn 0 */
HAL_TIM_IRQHandler(&htim6);
/* USER CODE BEGIN TIM6_IRQn 1 */
/* USER CODE END TIM6_IRQn 1 */
}
/**
* @brief This function handles USART2 global interrupt.
*/
void USART2_IRQHandler(void)
......
/**
******************************************************************************
* File Name : TIM.c
* Description : This file provides code for the configuration
* of the TIM instances.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "tim.h"
/* USER CODE BEGIN 0 */
#include "beep.h"
/* USER CODE END 0 */
TIM_HandleTypeDef htim3;
TIM_HandleTypeDef htim6;
/* TIM3 init function */
void MX_TIM3_Init(void)
{
TIM_MasterConfigTypeDef sMasterConfig = {0};
TIM_OC_InitTypeDef sConfigOC = {0};
htim3.Instance = TIM3;
htim3.Init.Prescaler = 23999;
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
htim3.Init.Period = 1999;
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_OC_Init(&htim3) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_TIMING;
sConfigOC.Pulse = 0;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
if (HAL_TIM_OC_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
}
/* TIM6 init function */
void MX_TIM6_Init(void)
{
htim6.Instance = TIM6;
htim6.Init.Prescaler = 47999;
htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
htim6.Init.Period = 299;
htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim6) != HAL_OK)
{
Error_Handler();
}
}
void HAL_TIM_OC_MspInit(TIM_HandleTypeDef* tim_ocHandle)
{
if(tim_ocHandle->Instance==TIM3)
{
/* USER CODE BEGIN TIM3_MspInit 0 */
/* USER CODE END TIM3_MspInit 0 */
/* TIM3 clock enable */
__HAL_RCC_TIM3_CLK_ENABLE();
/* TIM3 interrupt Init */
HAL_NVIC_SetPriority(TIM3_IRQn, 3, 0);
HAL_NVIC_EnableIRQ(TIM3_IRQn);
/* USER CODE BEGIN TIM3_MspInit 1 */
/* USER CODE END TIM3_MspInit 1 */
}
}
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
{
if(tim_baseHandle->Instance==TIM6)
{
/* USER CODE BEGIN TIM6_MspInit 0 */
/* USER CODE END TIM6_MspInit 0 */
/* TIM6 clock enable */
__HAL_RCC_TIM6_CLK_ENABLE();
/* TIM6 interrupt Init */
HAL_NVIC_SetPriority(TIM6_IRQn, 3, 0);
HAL_NVIC_EnableIRQ(TIM6_IRQn);
/* USER CODE BEGIN TIM6_MspInit 1 */
/* USER CODE END TIM6_MspInit 1 */
}
}
void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef* tim_ocHandle)
{
if(tim_ocHandle->Instance==TIM3)
{
/* USER CODE BEGIN TIM3_MspDeInit 0 */
/* USER CODE END TIM3_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM3_CLK_DISABLE();
/* TIM3 interrupt Deinit */
HAL_NVIC_DisableIRQ(TIM3_IRQn);
/* USER CODE BEGIN TIM3_MspDeInit 1 */
/* USER CODE END TIM3_MspDeInit 1 */
}
}
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
{
if(tim_baseHandle->Instance==TIM6)
{
/* USER CODE BEGIN TIM6_MspDeInit 0 */
/* USER CODE END TIM6_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM6_CLK_DISABLE();
/* TIM6 interrupt Deinit */
HAL_NVIC_DisableIRQ(TIM6_IRQn);
/* USER CODE BEGIN TIM6_MspDeInit 1 */
/* USER CODE END TIM6_MspDeInit 1 */
}
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
......@@ -21,14 +21,6 @@
#include "usart.h"
/* USER CODE BEGIN 0 */
// 标准库需要的支持函数
struct __FILE
{
int handle;
};
FILE __stdout;
uint8_t USART_RX_BUF[USART_REC_LEN];
uint16_t USART_RX_STA = 0;
......@@ -185,40 +177,22 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* USER CODE BEGIN 1 */
/**
* 定义_sys_exit以避免使用半主机模式
*/
void _sys_exit(int x)
{
x = x;
}
/**
* 重定义fputc函数
*/
int fputc(int ch, FILE *f)
{
while ((USART1->ISR & 0X40) == 0); // 循环发�??
USART1->RDR = (uint8_t) ch;
return ch;
}
/**
* 串口接收回调函数
*/
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if (huart->Instance == USART2) // 串口1
{
if ((USART_RX_STA & 0x8000) == 0) // 接收未完????
if ((USART_RX_STA & 0x8000) == 0) // 接收未完?????
{
if (USART_RX_STA & 0x4000) // 接收到了0x0D
{
if (aRxBuffer[0] != 0x0a)
USART_RX_STA = 0; // 接收错误,重新接????
USART_RX_STA = 0; // 接收错误,重新接?????
else
USART_RX_STA |= 0x8000; // 接收完成
}
else // 还没接收????0x0D
else // 还没接收?????0x0D
{
if (aRxBuffer[0] == 0x0d)
{
......@@ -230,7 +204,7 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
USART_RX_STA++;
if (USART_RX_STA > (USART_REC_LEN-1))
{
USART_RX_STA = 0; // 接收错误,重新开始接????
USART_RX_STA = 0; // 接收错误,重新开始接?????
}
}
}
......
#MicroXplorer Configuration settings - do not modify
FREERTOS.FootprintOK=false
FREERTOS.IPParameters=Tasks01,FootprintOK,configTOTAL_HEAP_SIZE,configTIMER_TASK_STACK_DEPTH
FREERTOS.Tasks01=LEDTask,24,128,StartLEDTask,Default,NULL,Dynamic,NULL,NULL;KeyScanTask,24,128,StartKeyScanTask,Default,NULL,Dynamic,NULL,NULL;UartTask,24,128,StartUartTask,Default,NULL,Dynamic,NULL,NULL;CoreTask,24,128,StartCoreTask,Default,NULL,Dynamic,NULL,NULL;SensorTask,8,128,StartSensorTask,Default,NULL,Dynamic,NULL,NULL
FREERTOS.IPParameters=Tasks01,configTOTAL_HEAP_SIZE,configTIMER_TASK_STACK_DEPTH,FootprintOK
FREERTOS.Tasks01=LEDTask,24,128,StartLEDTask,Default,NULL,Dynamic,NULL,NULL;KeyScanTask,24,128,StartKeyScanTask,Default,NULL,Dynamic,NULL,NULL;UartTask,24,512,StartUartTask,Default,NULL,Dynamic,NULL,NULL;CoreTask,24,128,StartCoreTask,Default,NULL,Dynamic,NULL,NULL;SensorTask,24,128,StartSensorTask,Default,NULL,Dynamic,NULL,NULL
FREERTOS.configTIMER_TASK_STACK_DEPTH=128
FREERTOS.configTOTAL_HEAP_SIZE=2560
File.Version=6
......@@ -11,9 +11,11 @@ Mcu.IP0=FREERTOS
Mcu.IP1=NVIC
Mcu.IP2=RCC
Mcu.IP3=SYS
Mcu.IP4=USART1
Mcu.IP5=USART2
Mcu.IPNb=6
Mcu.IP4=TIM3
Mcu.IP5=TIM6
Mcu.IP6=USART1
Mcu.IP7=USART2
Mcu.IPNb=8
Mcu.Name=STM32F030C8Tx
Mcu.Package=LQFP48
Mcu.Pin0=PC14-OSC32_IN
......@@ -25,6 +27,8 @@ Mcu.Pin13=PB8
Mcu.Pin14=PB9
Mcu.Pin15=VP_FREERTOS_VS_CMSIS_V2
Mcu.Pin16=VP_SYS_VS_tim1
Mcu.Pin17=VP_TIM3_VS_no_output1
Mcu.Pin18=VP_TIM6_VS_ClockSourceINT
Mcu.Pin2=PF0-OSC_IN
Mcu.Pin3=PF1-OSC_OUT
Mcu.Pin4=PA2
......@@ -33,7 +37,7 @@ Mcu.Pin6=PA9
Mcu.Pin7=PA10
Mcu.Pin8=PA12
Mcu.Pin9=PA13
Mcu.PinsNb=17
Mcu.PinsNb=19
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F030C8Tx
......@@ -47,6 +51,8 @@ NVIC.PendSV_IRQn=true\:3\:0\:false\:false\:false\:true\:false\:false
NVIC.SVC_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false
NVIC.SysTick_IRQn=true\:3\:0\:false\:false\:false\:true\:false\:false
NVIC.TIM1_BRK_UP_TRG_COM_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
NVIC.TIM3_IRQn=true\:3\:0\:true\:false\:true\:true\:true\:true
NVIC.TIM6_IRQn=true\:3\:0\:false\:false\:true\:true\:true\:true
NVIC.TimeBase=TIM1_BRK_UP_TRG_COM_IRQn
NVIC.TimeBaseIP=TIM1
NVIC.USART2_IRQn=true\:3\:0\:false\:false\:true\:true\:true\:true
......@@ -159,6 +165,13 @@ RCC.TimSysFreq_Value=48000000
RCC.USART1Freq_Value=48000000
SH.GPXTI8.0=GPIO_EXTI8
SH.GPXTI8.ConfNb=1
TIM3.Channel-Output\ Compare1\ No\ Output=TIM_CHANNEL_1
TIM3.IPParameters=Channel-Output Compare1 No Output,Prescaler,Period
TIM3.Period=1999
TIM3.Prescaler=23999
TIM6.IPParameters=Prescaler,Period
TIM6.Period=299
TIM6.Prescaler=47999
USART1.BaudRate=115200
USART1.IPParameters=VirtualMode-Asynchronous,BaudRate
USART1.VirtualMode-Asynchronous=VM_ASYNC
......@@ -169,5 +182,9 @@ VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2
VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
VP_SYS_VS_tim1.Mode=TIM1
VP_SYS_VS_tim1.Signal=SYS_VS_tim1
VP_TIM3_VS_no_output1.Mode=Output Compare1 No Output
VP_TIM3_VS_no_output1.Signal=TIM3_VS_no_output1
VP_TIM6_VS_ClockSourceINT.Mode=Enable_Timer
VP_TIM6_VS_ClockSourceINT.Signal=TIM6_VS_ClockSourceINT
board=custom
isbadioc=false
......