diff --git a/README.md b/README.md index 15534b5..ae8a811 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This driver allows you to: - Read and set date and time in 12-hour and 24-hour format. See: `get_datetime`. - Read and set date and time individual elements. For example, see: `get_year`. - Enable and disable the real-time clock. See: `enable`. -- Read the busy status. See `is_busy`. +- Read the busy status. See `busy`. - Read whether the oscillator is or has been stopped. See `has_been_stopped`. - Clear the has-been-stopped flag. See `clear_has_been_stopped_flag`. - Set and read the aging offset. See `set_aging_offset`. diff --git a/src/ds323x/configuration.rs b/src/ds323x/configuration.rs index 255fd57..5f7b0f9 100644 --- a/src/ds323x/configuration.rs +++ b/src/ds323x/configuration.rs @@ -21,7 +21,7 @@ where /// Force a temperature conversion and time compensation with TXCO algorithm. /// - /// The *busy* status should be checked before doing this. See [`is_busy()`](#method.is_busy) + /// The *busy* status should be checked before doing this. See [`busy()`](#method.busy) pub fn convert_temperature(&mut self) -> Result<(), Error> { let control = self.iface.read_register(Register::CONTROL)?; // do not overwrite if a conversion is in progress diff --git a/src/ds323x/status.rs b/src/ds323x/status.rs index 5668a9e..a3ce40e 100644 --- a/src/ds323x/status.rs +++ b/src/ds323x/status.rs @@ -8,13 +8,13 @@ where DI: ReadData> + WriteData>, { /// Read whether the oscillator is running - pub fn is_running(&mut self) -> Result> { + pub fn running(&mut self) -> Result> { let control = self.iface.read_register(Register::CONTROL)?; Ok((control & BitFlags::EOSC) == 0) } /// Read the busy status - pub fn is_busy(&mut self) -> Result> { + pub fn busy(&mut self) -> Result> { let status = self.iface.read_register(Register::STATUS)?; Ok((status & BitFlags::BUSY) != 0) } diff --git a/src/lib.rs b/src/lib.rs index 060cd23..d3a6471 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ //! - Read and set date and time in 12-hour and 24-hour format. See: [`get_datetime`]. //! - Read and set date and time individual elements. For example, see: [`get_year`]. //! - Enable and disable the real-time clock. See: [`enable`]. -//! - Read the busy status. See [`is_busy`]. +//! - Read the busy status. See [`busy`]. //! - Read whether the oscillator is or has been stopped. See [`has_been_stopped`]. //! - Clear the has-been-stopped flag. See [`clear_has_been_stopped_flag`]. //! - Set and read the aging offset. See [`set_aging_offset`]. @@ -33,7 +33,7 @@ //! [`enable`]: struct.Ds323x.html#method.enable //! [`get_temperature`]: struct.Ds323x.html#method.get_temperature //! [`convert_temperature`]: struct.Ds323x.html#method.convert_temperature -//! [`is_busy`]: struct.Ds323x.html#method.is_busy +//! [`busy`]: struct.Ds323x.html#method.busy //! [`has_been_stopped`]: struct.Ds323x.html#method.has_been_stopped //! [`clear_has_been_stopped_flag`]: struct.Ds323x.html#method.clear_has_been_stopped_flag //! [`set_aging_offset`]: struct.Ds323x.html#method.set_aging_offset @@ -277,10 +277,10 @@ //! let dev = hal::I2cdev::new("/dev/i2c-1").unwrap(); //! let mut rtc = Ds323x::new_ds3231(dev); //! rtc.disable().unwrap(); // stops the clock -//! let is_running = rtc.is_running().unwrap(); -//! println!("Is running: {}", is_running); // will print false +//! let running = rtc.running().unwrap(); +//! println!("Is running: {}", running); // will print false //! rtc.enable().unwrap(); // set clock to run -//! println!("Is running: {}", is_running); // will print true +//! println!("Is running: {}", running); // will print true //! # } //! ``` //! @@ -308,7 +308,7 @@ //! # fn main() { //! let dev = hal::I2cdev::new("/dev/i2c-1").unwrap(); //! let mut rtc = Ds323x::new_ds3231(dev); -//! let is_busy = rtc.is_busy().unwrap(); +//! let busy = rtc.busy().unwrap(); //! # } //! ``` //! diff --git a/tests/status.rs b/tests/status.rs index 69ccbf6..90d8a93 100644 --- a/tests/status.rs +++ b/tests/status.rs @@ -7,11 +7,11 @@ use common::{ BitFlags as BF, Register, DEVICE_ADDRESS as DEV_ADDR, }; -get_param_test!(is_running, is_running, CONTROL, true, 0); -get_param_test!(is_not_running, is_running, CONTROL, false, BF::EOSC); +get_param_test!(running, running, CONTROL, true, 0); +get_param_test!(is_not_running, running, CONTROL, false, BF::EOSC); -get_param_test!(is_busy, is_busy, STATUS, true, 0xFF); -get_param_test!(is_not_busy, is_busy, STATUS, false, !BF::BUSY); +get_param_test!(busy, busy, STATUS, true, 0xFF); +get_param_test!(is_not_busy, busy, STATUS, false, !BF::BUSY); get_param_test!(stopped, has_been_stopped, STATUS, true, 0xFF); get_param_test!(not_stopped, has_been_stopped, STATUS, false, !BF::OSC_STOP);