From cad70d6e39ced05919f5f77a0b47a9d8ced1ba1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=AA=E6=9D=A5=E6=96=B9=E8=88=9F?= Date: Sun, 23 Aug 2026 18:20:14 +0800 Subject: [PATCH] gpio fix; author: HTotoo (#3302) --- firmware/common/gpio.hpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/firmware/common/gpio.hpp b/firmware/common/gpio.hpp index d1ff17f08..4145742c9 100644 --- a/firmware/common/gpio.hpp +++ b/firmware/common/gpio.hpp @@ -251,36 +251,36 @@ struct GPIO { // Physical Level Operations - void set() const { + __attribute__((always_inline)) void set() const { palSetPad(_gpio_port, _gpio_pad); } - void clear() const { + __attribute__((always_inline)) void clear() const { palClearPad(_gpio_port, _gpio_pad); } - void toggle() const { + __attribute__((always_inline)) void toggle() const { palTogglePad(_gpio_port, _gpio_pad); } - void output() const { + __attribute__((always_inline)) void output() const { palSetPadMode(_gpio_port, _gpio_pad, PAL_MODE_OUTPUT_PUSHPULL); } - void input() const { + __attribute__((always_inline)) void input() const { palSetPadMode(_gpio_port, _gpio_pad, PAL_MODE_INPUT); } - void write(const bool value) const { + __attribute__((always_inline)) void write(const bool value) const { palWritePad(_gpio_port, _gpio_pad, value); } - bool read() const { + __attribute__((always_inline)) bool read() const { return palReadPad(_gpio_port, _gpio_pad); } // Turns the feature ON based on its polarity - void setActive() const { + __attribute__((always_inline)) void setActive() const { if (_polarity == Polarity::ActiveHigh) { set(); } else { @@ -289,7 +289,7 @@ struct GPIO { } // Turns the feature OFF based on its polarity - void setInactive() const { + __attribute__((always_inline)) void setInactive() const { if (_polarity == Polarity::ActiveHigh) { clear(); } else { @@ -298,7 +298,7 @@ struct GPIO { } // Sets the logical state of the feature - void setState(const bool active) const { + __attribute__((always_inline)) void setState(const bool active) const { if (active) { setActive(); } else { @@ -307,12 +307,12 @@ struct GPIO { } // Returns true if the feature is logically active/enabled - bool isEnabled() const { + __attribute__((always_inline)) bool isEnabled() const { const bool physical_state = read(); return (_polarity == Polarity::ActiveHigh) ? physical_state : !physical_state; } - bool operator!=(const GPIO& other) const { + __attribute__((always_inline)) bool operator!=(const GPIO& other) const { return (port() != other.port()) || (pad() != other.pad()); }