Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework drivers #83

Merged
merged 11 commits into from
Nov 26, 2024
Merged

rework drivers #83

merged 11 commits into from
Nov 26, 2024

Conversation

patrickelectric
Copy link
Member

@patrickelectric patrickelectric commented Nov 19, 2024

Major rework that:

  • break each sensor as a module
  • Use builder pattern for board definition
  • change some api to use higher level functions
  • allow multiple board definitions and combinations
    • next PR

@patrickelectric patrickelectric force-pushed the rework branch 4 times, most recently from 3f000a2 to b2285fc Compare November 23, 2024 16:07
@patrickelectric patrickelectric marked this pull request as ready for review November 23, 2024 16:07
Copy link
Member

@RaulTrombin RaulTrombin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick-tests were changed to run on self-hosted CI, it's feature that's only available inside BR, and takes from 20~30 minutes to a rpi compile it from zero.
Some features were removed: self_test, read_all.
Benchmark output is different from the shown on PR.
The newer structure still can't handle the case where we have multiple PeripheralClasses, such the second Magnetometer, PWM0 (rpi one) and BR bars

.github/workflows/action.yml Outdated Show resolved Hide resolved
.github/workflows/action.yml Outdated Show resolved Hide resolved
benches/bench.rs Show resolved Hide resolved
examples/raspberry-pi-threads.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
if approx::relative_eq!(duty_cycle, 1.0) {
self.pwm.set_channel_full_on(channel.into(), 0).unwrap();
return;
fn get_magnetometer_sensor(&mut self) -> Option<&mut dyn MagnetometerSensor> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How the newer API will handle the second Magnetometer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll return a vector of an option


self.set_led(select, !state)
}
devices: Vec<Box<dyn AnyHardware>>,
Copy link
Member Author

@patrickelectric patrickelectric Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind to investigate map in the future

Copy link
Member

@joaoantoniocardoso joaoantoniocardoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't go into the details of each sensor, but the architecture seems good.

src/peripherals.rs Show resolved Hide resolved
src/peripherals.rs Outdated Show resolved Hide resolved
@patrickelectric patrickelectric force-pushed the rework branch 9 times, most recently from 646e981 to 2806c56 Compare November 26, 2024 07:04
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
Signed-off-by: Patrick José Pereira <[email protected]>
@patrickelectric
Copy link
Member Author

@RaulTrombin all comments are fixed.

@RaulTrombin RaulTrombin merged commit 3f2d1c9 into bluerobotics:master Nov 26, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants