diff --git a/.github/workflows/build-tof-software.yml b/.github/workflows/build-tof-software.yml index 31006b8..6e7d04a 100644 --- a/.github/workflows/build-tof-software.yml +++ b/.github/workflows/build-tof-software.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - takeru-dev pull_request: env: diff --git a/Cargo.toml b/Cargo.toml index 6155e48..c05360d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tof-control" -version = "1.10.0" +version = "1.11.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -8,6 +8,14 @@ edition = "2021" [profile.release] opt-level = "z" +[[bin]] +name = "liftof-rb-test" +path = "src/bin/dev/liftof_rb_test.rs" + +[[bin]] +name = "rb-info" +path = "src/bin/dev/rb_info.rs" + [[bin]] name = "calib-simulator" path = "src/bin/dev/calib_simulator.rs" diff --git a/src/device/ad5675.rs b/src/device/ad5675.rs index b8bc533..efbcacc 100644 --- a/src/device/ad5675.rs +++ b/src/device/ad5675.rs @@ -1,6 +1,5 @@ #![allow(unused)] use crate::constant::*; -use crate::rb_control::rb_dac::read_dac; use i2cdev::core::*; use i2cdev::linux::{LinuxI2CDevice, LinuxI2CMessage, LinuxI2CError}; @@ -32,13 +31,13 @@ impl AD5675 { pub fn read_dac(&self, channel: u8) -> Result { let mut dev = LinuxI2CDevice::new(&format!("/dev/i2c-{}", self.bus), self.address)?; + + let command_byte = READBACK_ENABLE | (channel & 0x0F); + let frame = [command_byte, 0x00, 0x00]; + dev.write(&frame)?; + let mut read_data = [0; 2]; - let mut msgs = [ - LinuxI2CMessage::write(&[READBACK_ENABLE+channel, 0x00, 0x00]), - LinuxI2CMessage::read(&mut read_data) - ]; - - dev.transfer(&mut msgs)?; + dev.read(&mut read_data)?; let dac_value = ((read_data[0] as u16 & 0xFF) << 8) | (read_data[1] as u16 & 0xFF);