Skip to content

Fix ok interface mismatch #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions rust-hdl-ok-frontpanel-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ extern crate bindgen;
use std::path::PathBuf;

fn main() {
println!("cargo:rustc-link-lib=dylib=okFrontPanel");
let root_path = PathBuf::from(std::env::var("OK_FRONTPANEL_DIR").expect(
"Set OK_FRONTPANEL_DIR to absolute path of the FrontPanel/API directory on this system",
));
println!("cargo:rustc-link-lib=dylib=okFrontPanel");

let lib_path = root_path.join("lib").join("x64");
println!(
"cargo:rustc-link-search=native={}",
root_path.to_str().unwrap()
lib_path.to_str().unwrap()
);

let bindings = bindgen::Builder::default()
.header(root_path.join("okFrontPanel.h").to_str().unwrap())
.header(root_path.join("include").join("okFrontPanel.h").to_str().unwrap())
.generate()
.expect("Unable to generate bindings");

let out_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
}
2 changes: 1 addition & 1 deletion rust-hdl-ok-frontpanel-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl OkHandle {
}

pub fn set_wire_in(&self, addr: i32, val: u16) {
unsafe { okFrontPanel_SetWireInValue(self.hnd, addr, val as u64, 0xFFFF) };
unsafe { okFrontPanel_SetWireInValue(self.hnd, addr, val as u32, 0xFFFF) };
}

pub fn update_wire_ins(&self) {
Expand Down