/**
******************************************************************************
* [url=home.php?mod=space&uid=288409]@file[/url] main.c
* [url=home.php?mod=space&uid=187600]@author[/url] Alexander
* [url=home.php?mod=space&uid=895143]@version[/url] V1.0.0
* [url=home.php?mod=space&uid=212281]@date[/url] 04-January-2023
* [url=home.php?mod=space&uid=247401]@brief[/url] Main program body
******************************************************************************
* @attention
*
* Copyright (c) 2023 HKMicroelectronics.
* 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/** @addtogroup HK32F030Mxx_StdPeriph_Examples
* @{
*/
/** @addtogroup GPIO_IOToggle
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
#define BSRR_VAL 0x0006
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
GPIO_InitTypeDef GPIO_InitStructure;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (KEIL_startup_hk32f030m.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_hk32f030m.c file
*/
/* GPIOD Periph clock enable */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOD, ENABLE);
/* Configure PD01 and PD02 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOD, &GPIO_InitStructure);
while(1)
{
/* Set PD01 and PD02 */
GPIOD->BSRR = BSRR_VAL;
/* Reset PD01 and PD02 */
GPIOD->BRR = BSRR_VAL;
/* Set PD01 and PD02 */
GPIOD->BSRR = BSRR_VAL;
/* Reset PD01 and PD02 */
GPIOD->BRR = BSRR_VAL;
/* Set PD01 and PD02 */
GPIOD->BSRR = BSRR_VAL;
/* Reset PD01 and PD02 */
GPIOD->BRR = BSRR_VAL;
/* Set PD01 and PD02 */
GPIOD->BSRR = BSRR_VAL;
/* Reset PD01 and PD02 */
GPIOD->BRR = BSRR_VAL;
/* Set PD01 and PD02 */
GPIOD->BSRR = BSRR_VAL;
/* Reset PD01 and PD02 */
GPIOD->BRR = BSRR_VAL;
}
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
/**
* @}
*/
/**
* @}
*/
|