LoginSignup
0
0

More than 1 year has passed since last update.

STM32G031を使た、mbed-osでHALのLチカ(Keil Studio)

Last updated at Posted at 2022-08-09

目的
最軽量化
オンラインのKeil Studioを使う

PA_11(5ピン)をLチカする。

o_con642.jpg

o_con643.jpg

o_con644.jpg



//K_HAL_PA_11_L_TI_KA_031_1

#include "mbed.h"

//DigitalOut myled(PA_11);

int main()
{

    __HAL_RCC_GPIOA_CLK_ENABLE();
    //__HAL_RCC_GPIOB_CLK_ENABLE();

    GPIO_InitTypeDef GPIO_InitStruct = {0};

    GPIO_InitStruct.Pin = GPIO_PIN_11;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

    while(1) {

        HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_SET);

        HAL_Delay(500);

        HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_RESET);

        HAL_Delay(500);

    }//while
    
}//main

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0