Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build-tof-software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- takeru-dev
pull_request:

env:
Expand Down
10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
[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

[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"
Expand Down
13 changes: 6 additions & 7 deletions src/device/ad5675.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -32,13 +31,13 @@ impl AD5675 {

pub fn read_dac(&self, channel: u8) -> Result<u16, LinuxI2CError> {
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);

Expand Down