started adding basic files and types in rust
parent
d7b81d56bd
commit
a141bf9eb4
@ -0,0 +1,22 @@
|
||||
use std::fmt;
|
||||
|
||||
pub struct Device {
|
||||
address: i32,
|
||||
}
|
||||
|
||||
impl Device {
|
||||
fn new(address: i32) -> Device {
|
||||
return Device {address: address};
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Device {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "{}", self.address)
|
||||
}
|
||||
}
|
||||
|
||||
/// outward factory function
|
||||
pub fn create_device(address: i32) -> Device {
|
||||
return Device::new(address);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
/// get_connected returns an array of Device objects.
|
||||
pub fn get_connected() -> Vec<i32>{
|
||||
let mut devices: Vec<i32> = Vec::new();
|
||||
return devices;
|
||||
}
|
||||
|
||||
fn send_i2c_command() -> {
|
||||
|
||||
}
|
@ -1,3 +1,12 @@
|
||||
mod i2c;
|
||||
mod device;
|
||||
|
||||
fn main() {
|
||||
println!("First reactor port");
|
||||
let addresses = i2c::get_connected();
|
||||
let mut devices: Vec<device::Device> = Vec::new();
|
||||
for address in addresses.iter() {
|
||||
let device: device::Device = device::create_device(*address);
|
||||
println!("Device: {}", device);
|
||||
devices.push(device);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
{"rustc_fingerprint":4338310799556088597,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/usr\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.68.2 (9eb3afe9e 2023-03-27) (Arch Linux rust 1:1.68.2-1)\nbinary: rustc\ncommit-hash: 9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0\ncommit-date: 2023-03-27\nhost: x86_64-unknown-linux-gnu\nrelease: 1.68.2\nLLVM version: 15.0.7\n","stderr":""}},"successes":{}}
|
@ -0,0 +1,3 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by cargo.
|
||||
# For information about cache directory tags see https://bford.info/cachedir/
|
@ -0,0 +1 @@
|
||||
4beb95d998925f48
|
@ -0,0 +1 @@
|
||||
{"rustc":146169267576008299,"features":"[]","target":1121030462635718733,"profile":9251013656241001069,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/reactor-44942f7dadc516e3/dep-bin-reactor"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
@ -0,0 +1 @@
|
||||
e22874b204dc1c4d
|
@ -0,0 +1 @@
|
||||
{"rustc":146169267576008299,"features":"[]","target":1121030462635718733,"profile":1021633075455700787,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/reactor-455a2ff9b73b7a20/dep-test-bin-reactor"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
|
@ -0,0 +1 @@
|
||||
2a60fcbe9c9c5a82
|
@ -0,0 +1 @@
|
||||
{"rustc":146169267576008299,"features":"[]","target":1121030462635718733,"profile":7309141686862299243,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/reactor-6876817230622ebe/dep-bin-reactor"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
/home/keegan/src/FRMS/reactor/target/debug/deps/reactor-44942f7dadc516e3: src/main.rs src/i2c.rs src/device.rs
|
||||
|
||||
/home/keegan/src/FRMS/reactor/target/debug/deps/reactor-44942f7dadc516e3.d: src/main.rs src/i2c.rs src/device.rs
|
||||
|
||||
src/main.rs:
|
||||
src/i2c.rs:
|
||||
src/device.rs:
|
@ -0,0 +1,7 @@
|
||||
/home/keegan/src/FRMS/reactor/target/debug/deps/reactor-455a2ff9b73b7a20.rmeta: src/main.rs src/i2c.rs src/device.rs
|
||||
|
||||
/home/keegan/src/FRMS/reactor/target/debug/deps/reactor-455a2ff9b73b7a20.d: src/main.rs src/i2c.rs src/device.rs
|
||||
|
||||
src/main.rs:
|
||||
src/i2c.rs:
|
||||
src/device.rs:
|
@ -0,0 +1,7 @@
|
||||
/home/keegan/src/FRMS/reactor/target/debug/deps/reactor-6876817230622ebe.rmeta: src/main.rs src/i2c.rs src/device.rs
|
||||
|
||||
/home/keegan/src/FRMS/reactor/target/debug/deps/reactor-6876817230622ebe.d: src/main.rs src/i2c.rs src/device.rs
|
||||
|
||||
src/main.rs:
|
||||
src/i2c.rs:
|
||||
src/device.rs:
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
/home/keegan/src/FRMS/reactor/target/debug/reactor: /home/keegan/src/FRMS/reactor/src/device.rs /home/keegan/src/FRMS/reactor/src/i2c.rs /home/keegan/src/FRMS/reactor/src/main.rs
|
Loading…
Reference in New Issue