From cedb3aa9096bf68e10c4861a22c33dd8b8cbf64a Mon Sep 17 00:00:00 2001 From: andryblack Date: Wed, 23 Oct 2024 20:24:23 +0300 Subject: [PATCH] [rp] fix gpio functional --- src/modm/platform/gpio/rp/base.hpp.in | 7 ------- src/modm/platform/gpio/rp/set.hpp.in | 11 ++++++++--- src/modm/platform/gpio/rp/static.hpp.in | 6 +++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/modm/platform/gpio/rp/base.hpp.in b/src/modm/platform/gpio/rp/base.hpp.in index 3cf164344e..b3d0b74dba 100644 --- a/src/modm/platform/gpio/rp/base.hpp.in +++ b/src/modm/platform/gpio/rp/base.hpp.in @@ -59,13 +59,6 @@ struct Gpio PushPull }; - enum class - OutputSpeed - { - Slow = 0, - Fast = 1, - }; - enum class DriveStrength { diff --git a/src/modm/platform/gpio/rp/set.hpp.in b/src/modm/platform/gpio/rp/set.hpp.in index 73794548ae..ae8a865f44 100644 --- a/src/modm/platform/gpio/rp/set.hpp.in +++ b/src/modm/platform/gpio/rp/set.hpp.in @@ -62,15 +62,15 @@ public: setOutput(); } - static void setOutput(OutputType type, OutputSpeed speed = OutputSpeed::Slow) + static void setOutput(OutputType type, SlewRate speed = SlewRate::Slow) { setOutput(); configure(type, speed); } - static void configure(OutputType, OutputSpeed speed = OutputSpeed::Slow) + static void configure(OutputType, SlewRate speed = SlewRate::Slow) { - (PortRegs::set_speed(Gpios::pin, speed), ...); + (PortRegs::set_slewrate(Gpios::pin, uint8_t(speed)), ...); } static void setInput() @@ -96,6 +96,11 @@ public: (PortRegs::set_slewrate(Gpios::pin, uint8_t(rate)), ...); } + static void setDriveStrength(DriveStrength drive) + { + (PortRegs::set_drive(Gpios::pin, uint8_t(drive)), ...); + } + static void set() { %% for port, id in ports.items() diff --git a/src/modm/platform/gpio/rp/static.hpp.in b/src/modm/platform/gpio/rp/static.hpp.in index 4829f918e8..31f72c4165 100644 --- a/src/modm/platform/gpio/rp/static.hpp.in +++ b/src/modm/platform/gpio/rp/static.hpp.in @@ -45,14 +45,14 @@ public: static void setFunction(uint8_t func) { Regs::set_funcsel(pin, func); } static void setDriveStrength(DriveStrength strength) - { Regs::set_drive(pin, strength); } + { Regs::set_drive(pin, uint8_t(strength)); } public: static void setOutput() { PinSet::setOutput(); } static void setOutput(bool value) { PinSet::setOutput(value); } - static void setOutput(OutputType type, OutputSpeed speed=OutputSpeed::Slow) + static void setOutput(OutputType type, SlewRate speed=SlewRate::Slow) { PinSet::setOutput(type, speed); } - static void configure(OutputType type, OutputSpeed speed=OutputSpeed::Slow) + static void configure(OutputType type, SlewRate speed=SlewRate::Slow) { PinSet::configure(type, speed); } static void set() { PinSet::set(); }