rogy-AquaLab / omniboat_robokit

新歓で使うロボキット
https://rogy-aqualab.github.io/omniboat_robokit/
Apache License 2.0
0 stars 0 forks source link

Builder #192

Open H1rono opened 1 month ago

H1rono commented 1 month ago

https://github.com/rogy-AquaLab/omniboat_robokit/blob/2d3b5b3c458545a219c165dd51108eb6995a1f62/include/device/input.hpp#L39-L41

https://github.com/rogy-AquaLab/omniboat_robokit/blob/2d3b5b3c458545a219c165dd51108eb6995a1f62/src/schneider_model.cpp#L29

ここなど

位置引数で与えるのはわかりづらすぎるので、RustのBuilderパターンのようにメソッドチェーンで与えられるようにしたい

InputModules input_modules = InputModules::builder()
    .joy_pins(A4, A5)
    .volume_pin(A6)
    .mpu_sda_pin(D4)
    .mpu_scl_pin(D5)
    .build();

ref: