2018-10-31 09:41:54 +00:00
|
|
|
#[deny(warnings)]
|
|
|
|
|
|
|
|
extern crate embedded_hal_mock as hal;
|
2018-10-31 10:07:38 +00:00
|
|
|
use hal::spi::Transaction as SpiTrans;
|
2018-10-31 09:41:54 +00:00
|
|
|
extern crate ds323x;
|
|
|
|
|
|
|
|
#[allow(unused)]
|
|
|
|
mod common;
|
2018-10-31 10:07:38 +00:00
|
|
|
use common::{ new_ds3234, destroy_ds3234, Register, BitFlags };
|
2018-10-31 09:41:54 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn can_create_and_destroy_ds3234() {
|
|
|
|
let dev = new_ds3234(&[]);
|
|
|
|
destroy_ds3234(dev);
|
|
|
|
}
|
2018-10-31 10:07:38 +00:00
|
|
|
|
|
|
|
call_test!(can_en_temp_conv_bat, enable_temperature_conversions_on_battery, new_ds3234, destroy_ds3234,
|
|
|
|
[ SpiTrans::write(vec![Register::TEMP_CONV + 0x80, 0]) ]);
|
|
|
|
|
|
|
|
call_test!(can_dis_temp_conv_bat, disable_temperature_conversions_on_battery, new_ds3234, destroy_ds3234,
|
|
|
|
[ SpiTrans::write(vec![Register::TEMP_CONV + 0x80, BitFlags::TEMP_CONV_BAT]) ]);
|