Skip to content

Conversation

@DanutAldea
Copy link

Fixes #12

Based on alex's previous work from here
Heavily inspired from the work done #5
This PR would ad the api, an exemple, fake driver and tests.


/// Initiate a synchronous humidity measurement.
/// Returns Ok(humidity_value) if the operation was successful
/// humidity_value is returned in hundreds of centigrades

Choose a reason for hiding this comment

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

What is the measurement unit returned?

pub fn read_sync() -> Result<u32, ErrorCode> {
let listener: Cell<Option<(u32,)>> = Cell::new(None);
share::scope(|subscribe| {
if let Ok(()) = Self::register_listener(&listener, subscribe) {

Choose a reason for hiding this comment

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

This is incorrect. This function should return the error that either subscribe or read return.

src/lib.rs Outdated
Error, GpioInterruptListener, GpioState, InputPin, OutputPin, PinInterruptEdge, Pull,
PullDown, PullNone, PullUp,
};
pub use gpio::{Error, GpioInterruptListener, GpioState, InputPin, OutputPin, PinInterruptEdge, Pull, PullDown, PullNone, PullUp};

Choose a reason for hiding this comment

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

Suggested change
pub use gpio::{Error, GpioInterruptListener, GpioState, InputPin, OutputPin, PinInterruptEdge, Pull, PullDown, PullNone, PullUp};
pub use gpio::{
Error, GpioInterruptListener, GpioState, InputPin, OutputPin, PinInterruptEdge, Pull,
PullDown, PullNone, PullUp,
};

I ran cargo fmt and this is the formatted source.

@DanutAldea DanutAldea closed this by deleting the head repository Jun 23, 2025
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.

Implement Humidity API

2 participants