Commit 7f69c3cb authored by Simon Wörner's avatar Simon Wörner

fixed output dirction

parent 00090d06
......@@ -8,7 +8,7 @@ use std::path::Path;
use std::os::unix::io::RawFd;
#[derive(Debug)]
#[derive(Clone, Copy, Debug)]
pub enum Direction {
Out,
In,
......@@ -30,7 +30,7 @@ impl Direction {
}
}
#[derive(Debug)]
#[derive(Clone, Copy, Debug)]
pub enum Edge {
None,
Rising,
......@@ -58,7 +58,7 @@ impl Edge {
}
}
#[derive(Debug)]
#[derive(Clone, Copy, Debug)]
pub enum Value {
High,
Low,
......@@ -99,10 +99,10 @@ pub struct AsyncPort {
}
impl Port {
pub fn new(number: u8) -> std::io::Result<Port> {
pub fn new(number: u8, direction: Direction) -> std::io::Result<Port> {
let port = Port {
number: number,
direction: Direction::In
direction: direction
};
port.init()?;
......@@ -140,7 +140,7 @@ impl Port {
impl SyncPort {
pub fn new(number: u8, direction: Direction) -> std::io::Result<SyncPort> {
Ok(SyncPort {
port: Port::new(number)?,
port: Port::new(number, direction)?,
file: SyncPort::open(number, direction)?
})
}
......@@ -173,7 +173,7 @@ impl SyncPort {
impl AsyncPort {
pub fn new(number: u8, edge: Edge) -> std::io::Result<AsyncPort> {
let port = AsyncPort {
port: Port::new(number)?,
port: Port::new(number, Direction::In)?,
edge: edge,
file: AsyncPort::open(number)?
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment