diff --git a/include/device/input.hpp b/include/device/input.hpp index 2f56c50..6de18b6 100644 --- a/include/device/input.hpp +++ b/include/device/input.hpp @@ -38,20 +38,20 @@ class InputModules { */ class Builder { private: - std::pair joy_pins; - PinName volume_pin; - std::pair mpu_pins; + std::pair _joy_pins; + PinName _volume_pin; + std::pair _mpu_pins; public: - auto joy_pins(const PinName& pin) -> Builder&; + auto joy_pins(const std::pair& pins) -> Builder&; auto volume_pin(const PinName& pin) -> Builder&; - auto mpu_pins(const PinName& pin) -> Builder&; + auto mpu_pins(const std::pair& pins) -> Builder&; }; private: InputModules( - const std::pair& joy_pins, const PinName& volume_pin, - const std::pair& mpu_pins); + const std::pair& _joy_pins, const PinName& _volume_pin, + const std::pair& _mpu_pins); public: static auto builder() -> Builder; diff --git a/src/device/input.cpp b/src/device/input.cpp index 4115709..21af31c 100644 --- a/src/device/input.cpp +++ b/src/device/input.cpp @@ -19,19 +19,18 @@ auto device::InputModules::read_gyro() -> std::array { mpu(mpu_pins.first, mpu_pins.second) {} // NOLINTEND(bugprone-easily-swappable-parameters) */ -auto device::InputModules::Builder::joy_pins(const PinName& pin) -> Builder& { - this->joy_pins - = std::make_pair(mbed::AnalogIn(joy_pins.first), mbed::AnalogIn(joy_pins.second)); +auto device::InputModules::Builder::joy_pins(const std::pair& pins) -> Builder& { + this->_joy_pins = std::make_pair((pins.first), (pins.second)); return *this; } auto device::InputModules::Builder::volume_pin(const PinName& pin) -> Builder& { - this->volume_pin = mbed::AnalogIn(volume_pin); + this->_volume_pin = pin; return *this; } -auto device::InputModules::Builder::mpu_pins(const PinName& pin) -> Builder& { - this->mpu_pins = MPU6050(mpu_pins.first, mpu_pins.second); +auto device::InputModules::Builder::mpu_pins(const std::pair& pins) -> Builder& { + this->_mpu_pins = std::make_pair((pins.first), (pins.second)); return *this; } auto device::InputModules::builder() -> Builder {