STM32/STM32F103C8T6

    GPIO_LED_수동제어2

    이전에 수동제어1에서 했던거를 이어서 GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitStruct.Pin = GPIO_LED_Pin; //PC13 1 Pin)); assert_param(IS_GPIO_MODE(GPIO_Init->Mode)); /* Configure the port pins */ while (((GPIO_Init->Pin) >> position) != 0x00u) { /* Get the IO position */ ioposition = (0x01uL Pin) & ioposition; if (iocurrent == ioposition) { /* Check the Alternate function parameters */ assert_param(IS_G..

    GPIO_LED_수동제어1

    STM32CubeIDE에서는 HAL 드라이버를 통해 편하게 GPIO를 간편한 코드로 제어할 수 있다. 이번에는 그 원리를 알아내어 GPIO를 수동으로 제어하는 방법에 대해 알아보고자 한다. LED 핀은 PC13에 GPIO_OUPUT 연결되어 있는 상태로 진행한다. static void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIO_LED_GPIO_Port, GPIO_LED_Pin..