15 changed files with 2632 additions and 335 deletions
-
16app/.mxproject
-
2app/Inc/stm32f4xx_hal_conf.h
-
52app/Inc/usart.h
-
9app/MDK-ARM/EventRecorderStub.scvd
-
2012app/MDK-ARM/app.uvguix.29643
-
381app/MDK-ARM/app.uvoptx
-
174app/MDK-ARM/app.uvprojx
-
96app/MDK-ARM/startup_stm32f407xx.lst
-
11app/Src/gpio.c
-
5app/Src/main.c
-
114app/Src/usart.c
-
59app/app.ioc
-
32src/hardware_main.c
-
2src/zassert.h
-
2src/zthread.c
16
app/.mxproject
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,52 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/** |
|||
****************************************************************************** |
|||
* @file usart.h |
|||
* @brief This file contains all the function prototypes for |
|||
* the usart.c file |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 STMicroelectronics. |
|||
* All rights reserved. |
|||
* |
|||
* This software is licensed under terms that can be found in the LICENSE file |
|||
* in the root directory of this software component. |
|||
* If no LICENSE file comes with this software, it is provided AS-IS. |
|||
* |
|||
****************************************************************************** |
|||
*/ |
|||
/* USER CODE END Header */ |
|||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|||
#ifndef __USART_H__ |
|||
#define __USART_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Includes ------------------------------------------------------------------*/ |
|||
#include "main.h" |
|||
|
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
extern UART_HandleTypeDef huart1; |
|||
|
|||
/* USER CODE BEGIN Private defines */ |
|||
|
|||
/* USER CODE END Private defines */ |
|||
|
|||
void MX_USART1_UART_Init(void); |
|||
|
|||
/* USER CODE BEGIN Prototypes */ |
|||
|
|||
/* USER CODE END Prototypes */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __USART_H__ */ |
|||
|
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd"> |
|||
|
|||
<component name="EventRecorderStub" version="1.0.0"/> <!--name and version of the component--> |
|||
<events> |
|||
</events> |
|||
|
|||
</component_viewer> |
2012
app/MDK-ARM/app.uvguix.29643
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
381
app/MDK-ARM/app.uvoptx
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,114 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/** |
|||
****************************************************************************** |
|||
* @file usart.c |
|||
* @brief This file provides code for the configuration |
|||
* of the USART instances. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* Copyright (c) 2023 STMicroelectronics. |
|||
* All rights reserved. |
|||
* |
|||
* This software is licensed under terms that can be found in the LICENSE file |
|||
* in the root directory of this software component. |
|||
* If no LICENSE file comes with this software, it is provided AS-IS. |
|||
* |
|||
****************************************************************************** |
|||
*/ |
|||
/* USER CODE END Header */ |
|||
/* Includes ------------------------------------------------------------------*/ |
|||
#include "usart.h" |
|||
|
|||
/* USER CODE BEGIN 0 */ |
|||
|
|||
/* USER CODE END 0 */ |
|||
|
|||
UART_HandleTypeDef huart1; |
|||
|
|||
/* USART1 init function */ |
|||
|
|||
void MX_USART1_UART_Init(void) |
|||
{ |
|||
|
|||
/* USER CODE BEGIN USART1_Init 0 */ |
|||
|
|||
/* USER CODE END USART1_Init 0 */ |
|||
|
|||
/* USER CODE BEGIN USART1_Init 1 */ |
|||
|
|||
/* USER CODE END USART1_Init 1 */ |
|||
huart1.Instance = USART1; |
|||
huart1.Init.BaudRate = 115200; |
|||
huart1.Init.WordLength = UART_WORDLENGTH_8B; |
|||
huart1.Init.StopBits = UART_STOPBITS_1; |
|||
huart1.Init.Parity = UART_PARITY_NONE; |
|||
huart1.Init.Mode = UART_MODE_TX_RX; |
|||
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; |
|||
huart1.Init.OverSampling = UART_OVERSAMPLING_16; |
|||
if (HAL_UART_Init(&huart1) != HAL_OK) |
|||
{ |
|||
Error_Handler(); |
|||
} |
|||
/* USER CODE BEGIN USART1_Init 2 */ |
|||
|
|||
/* USER CODE END USART1_Init 2 */ |
|||
|
|||
} |
|||
|
|||
void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) |
|||
{ |
|||
|
|||
GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|||
if(uartHandle->Instance==USART1) |
|||
{ |
|||
/* USER CODE BEGIN USART1_MspInit 0 */ |
|||
|
|||
/* USER CODE END USART1_MspInit 0 */ |
|||
/* USART1 clock enable */ |
|||
__HAL_RCC_USART1_CLK_ENABLE(); |
|||
|
|||
__HAL_RCC_GPIOA_CLK_ENABLE(); |
|||
/**USART1 GPIO Configuration |
|||
PA9 ------> USART1_TX |
|||
PA10 ------> USART1_RX |
|||
*/ |
|||
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10; |
|||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; |
|||
GPIO_InitStruct.Pull = GPIO_NOPULL; |
|||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; |
|||
GPIO_InitStruct.Alternate = GPIO_AF7_USART1; |
|||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|||
|
|||
/* USER CODE BEGIN USART1_MspInit 1 */ |
|||
|
|||
/* USER CODE END USART1_MspInit 1 */ |
|||
} |
|||
} |
|||
|
|||
void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) |
|||
{ |
|||
|
|||
if(uartHandle->Instance==USART1) |
|||
{ |
|||
/* USER CODE BEGIN USART1_MspDeInit 0 */ |
|||
|
|||
/* USER CODE END USART1_MspDeInit 0 */ |
|||
/* Peripheral clock disable */ |
|||
__HAL_RCC_USART1_CLK_DISABLE(); |
|||
|
|||
/**USART1 GPIO Configuration |
|||
PA9 ------> USART1_TX |
|||
PA10 ------> USART1_RX |
|||
*/ |
|||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10); |
|||
|
|||
/* USER CODE BEGIN USART1_MspDeInit 1 */ |
|||
|
|||
/* USER CODE END USART1_MspDeInit 1 */ |
|||
} |
|||
} |
|||
|
|||
/* USER CODE BEGIN 1 */ |
|||
|
|||
/* USER CODE END 1 */ |
@ -1,5 +1,5 @@ |
|||
#pragma once |
|||
#include "iflytop_microcontroller/sdk/stm32/stm32sdk.h" |
|||
#include "stm32sdk.h" |
|||
#define Z_ASSERT(condition) \ |
|||
if (!(condition)) { \ |
|||
ZLOGI(TAG, "do " #condition " fail") \ |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue