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

I2C: Generally, follow common "good practices" and idiomatic Rust style #2770

Open
Tracked by #2493
bugadani opened this issue Dec 13, 2024 · 3 comments
Open
Tracked by #2493
Labels
1.0 non-breaking Not needed for 1.0 and can be supported without breaking the driver. peripheral:i2c I2C peripheral

Comments

@bugadani
Copy link
Contributor

bugadani commented Dec 13, 2024

We have commented-out code, at least one FIXME and TODO in the codebase.

@tom-borcin tom-borcin added the investigation Not needed for 1.0, but don't know if we can support without breaking the driver. label Dec 18, 2024
@tom-borcin
Copy link

Investigate if FIXME and TODO are user facing

@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 19, 2024

FIXME

In Driver:::setup

        // Configure filter
        // FIXME if we ever change this we need to adapt `set_frequency` for ESP32
        set_filter(self.register_block(), Some(7), Some(7));

In set_frequency (ESP32)

        // FIXME since we always set the filter threshold to 7 we don't need conditional
        // code here once that changes we need the conditional code here
        scl_high -= 7 + 6;
    #[cfg(not(any(esp32, esp32s2)))]
    /// Reads all bytes from the RX FIFO.
    fn read_all_from_fifo_blocking(&self, buffer: &mut [u8]) -> Result<(), Error> {
        // Read bytes from FIFO
        // FIXME: Handle case where less data has been provided by the slave than
        // requested? Or is this prevented from a protocol perspective?
        for byte in buffer.iter_mut() {
...
#[cfg(any(esp32, esp32s2))]
    /// Reads all bytes from the RX FIFO.
    fn read_all_from_fifo_blocking(&self, buffer: &mut [u8]) -> Result<(), Error> {
...
        // Read bytes from FIFO
        // FIXME: Handle case where less data has been provided by the slave than
        // requested? Or is this prevented from a protocol perspective?
        for byte in buffer.iter_mut() {
...

TODO

In config

    // TODO: when supporting interrupts, document that SCL = high also triggers an interrupt.
    pub timeout: Option<u32>,
    // TODO: missing interrupt APIs

@MabezDev
Copy link
Member

I don't think these are user facing issues worth blocking on. It seems timeout will be resolved by #2864

@MabezDev MabezDev added 1.0 non-breaking Not needed for 1.0 and can be supported without breaking the driver. and removed 1.0-blocker investigation Not needed for 1.0, but don't know if we can support without breaking the driver. labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 non-breaking Not needed for 1.0 and can be supported without breaking the driver. peripheral:i2c I2C peripheral
Projects
Status: Todo
Development

No branches or pull requests

4 participants