raulvt[m]: > <@raulvt:matrix.org> i'm checking a data\_ready bit through i2c, the sensor have 200, 100, 10...Hz modes, > > ```rust > pub fn check_data_ready(&mut self) -> Result<(), Error> { > let mut retries = 2; > while retries > 0 { > let status = self.read_register(Register::ST1)?; > if (status & 0x01) != 0 { > return Ok(()); // Data ready > } > std::thread::sleep(self.mode.into()); > retries -= 1; > } > Err(Error::DataNotReady) > } > ``` > > is better than: > > ```rust > pub fn check_data_ready(&mut self) -> Result<(), Error> { > let mut retries = 100; > while retries > 0 { > let status = self.read_register(Register::ST1)?; > if (status & 0x01) != 0 { > return Ok(()); // Data ready > } > retries -= 1; > } > Err(Error::DataNotReady) > } > ``` If you're in a non rtos then std thread sleep will almost certainly not have the resolution you want here. If you're okay waiting way longer than necessary it's fine though