Skip to content

Files

Latest commit

846c3c1 · Mar 24, 2021

History

History
138 lines (125 loc) · 2.52 KB

GPIO.md

File metadata and controls

138 lines (125 loc) · 2.52 KB

GPIO

目次

CubeMX

PinOut: GPIO_Input / GPIO_Output

コンストラクタ

GPIO::GPIO(GPIO_TypeDef*, uint16_t)
GPIO(
    GPIO_TypeDef* GPIOx,
    uint16_t GPIO_Pin
);

Read / Write をするピンを設定します

//
GPIO pa5(GPIOA, GPIO_PIN_5);

関数

GPIO::read()
GPIO_PinState read() const noexcept;

HAL_GPIO_ReadPin() の結果を返します

//
pa5.read();
GPIO::isSet()
GPIO_PinState isSet() const noexcept;

GPIO::read() の結果が GPIO_PIN_SET であれば true を返します

//
pa5.isSet();
GPIO::isReset()
GPIO_PinState isReset() const noexcept;

GPIO::read() の結果が GPIO_PIN_RESET であれば true を返します

//
pa5.isReset();
GPIO::write(GPIO_PinState)
void write(
    GPIO_PinState PinState
) const noexcept;

HAL_GPIO_WritePin() を実行します

//
pa5.write(GPIO_PIN_SET);
pa5.write(GPIO_PIN_RESET);
pa5.write(pc13.read());
GPIO::set()
void set() const noexcept;

GPIO::write(GPIO_PIN_SET) を実行します

//
pa5.set();
GPIO::setIf(bool)
void setIf(
    bool condition
) const noexcept;

conditiontrue の時に set()
false の時に reset() を実行します

//
pa5.setIf(pc13.isReset());
GPIO::reset()
void reset() const noexcept;

GPIO::write(GPIO_PIN_RESET) を実行します

//
pa5.reset();
GPIO::resetIf(bool)
void resetIf(
    bool condition
) const noexcept;

conditiontrue の時に reset()
false の時に set() を実行します

//
pa5.resetIf(pc13.isSet());
GPIO::toggle()
void toggle() const noexcept;

HAL_GPIO_TogglePin() を実行します

//
pa5.toggle();

<< 戻る