mirror of
				https://github.com/IcedRooibos/py32f0-template.git
				synced 2025-10-29 17:02:04 -07:00 
			
		
		
		
	
		
			
				
	
	
		
			80 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /**
 | |
|   ******************************************************************************
 | |
|   * @file    main.c
 | |
|   * @author  MCU Application Team
 | |
|   * @brief   Main program body
 | |
|   ******************************************************************************
 | |
|   * @attention
 | |
|   *
 | |
|   * <h2><center>© Copyright (c) Puya Semiconductor Co.
 | |
|   * All rights reserved.</center></h2>
 | |
|   *
 | |
|   * <h2><center>© Copyright (c) 2016 STMicroelectronics.
 | |
|   * All rights reserved.</center></h2>
 | |
|   *
 | |
|   * This software component is licensed by ST under BSD 3-Clause license,
 | |
|   * the "License"; You may not use this file except in compliance with the
 | |
|   * License. You may obtain a copy of the License at:
 | |
|   *                        opensource.org/licenses/BSD-3-Clause
 | |
|   *
 | |
|   ******************************************************************************
 | |
|   */
 | |
| 
 | |
| /* Includes ------------------------------------------------------------------*/
 | |
| #include "py32f0xx_bsp_printf.h"
 | |
| 
 | |
| /* Private define ------------------------------------------------------------*/
 | |
| /* Private variables ---------------------------------------------------------*/
 | |
| /* Private user code ---------------------------------------------------------*/
 | |
| /* Private macro -------------------------------------------------------------*/
 | |
| /* Private function prototypes -----------------------------------------------*/
 | |
| static void APP_LedConfig(void);
 | |
| 
 | |
| 
 | |
| int main(void)
 | |
| {
 | |
|   HAL_Init();                                 
 | |
|   
 | |
|   APP_LedConfig();
 | |
| 
 | |
|   BSP_USART_Config();
 | |
| 
 | |
|   while (1)
 | |
|   {
 | |
|     HAL_Delay(500);                            
 | |
|     HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_5);
 | |
|     printf("echo\r\n");
 | |
|   }
 | |
| }
 | |
| 
 | |
| static void APP_LedConfig(void)
 | |
| {
 | |
|   GPIO_InitTypeDef GPIO_InitStruct;
 | |
| 
 | |
|   __HAL_RCC_GPIOB_CLK_ENABLE();
 | |
| 
 | |
|   GPIO_InitStruct.Pin = GPIO_PIN_5;
 | |
|   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 | |
|   GPIO_InitStruct.Pull = GPIO_PULLUP;
 | |
|   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
 | |
| 
 | |
|   HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 | |
| }
 | |
| 
 | |
| void APP_ErrorHandler(void)
 | |
| {
 | |
|   while (1);
 | |
| }
 | |
| 
 | |
| #ifdef  USE_FULL_ASSERT
 | |
| 
 | |
| void assert_failed(uint8_t *file, uint32_t line)
 | |
| {
 | |
|   while (1)
 | |
|   {
 | |
|   }
 | |
| }
 | |
| #endif /* USE_FULL_ASSERT */
 | |
| 
 | |
| /************************ (C) COPYRIGHT Puya *****END OF FILE******************/
 | 
