Skip to content

Commit

Permalink
misc: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rrbutani committed Apr 25, 2020
1 parent 05c709f commit 3f71a5f
Showing 1 changed file with 3 additions and 33 deletions.
36 changes: 3 additions & 33 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
#![no_std]
#![no_main]

extern crate panic_halt;
// extern crate panic_semihosting;
extern crate panic_halt as _;
extern crate tm4c123x_hal as hal;

use cortex_m_rt::entry;
Expand All @@ -72,20 +71,8 @@ use lc3_device_support::{
util::Fifo,
};

use core::fmt::Write;

static FLAGS: PeripheralInterruptFlags = PeripheralInterruptFlags::new();

// fn entry() -> ! { main() }

#[inline(never)]
fn foo(a: f32) -> f32 { (a * 2.0) % 203.43f32 }

#[inline(never)]
fn test() -> SimpleEventFutureSharedState {
SimpleEventFutureSharedState::new()
}

#[entry]
fn main() -> ! {
let p = hal::Peripherals::take().unwrap();
Expand Down Expand Up @@ -119,19 +106,8 @@ fn main() -> ! {
&sc.power_control,
);

let (mut tx, mut rx) = uart.split();

// write!(tx, "zero");
let state: SimpleEventFutureSharedState = SimpleEventFutureSharedState::new();

let state = test();
// write!(tx, "uno");

// let mut interp: Interpreter::<'static, PartialMemory, PeripheralsStub> = InterpreterBuilder::new()
// // .with_interrupt_flags_by_ref(&FLAGS)
// .with_defaults()
// .build();

let mut memory = PartialMemory::default();

let mut interp: Interpreter<'static, _, PeripheralsStub> = Interpreter::new(
Expand All @@ -144,15 +120,13 @@ fn main() -> ! {

);

// write!(tx, "dos");

let mut sim = Simulator::new_with_state(interp, &state);

let func: &dyn Fn() -> Cobs<Fifo<u8>> = &|| Cobs::try_new(Fifo::new()).unwrap();

let enc = PostcardEncode::<ResponseMessage, _, _>::new(func);
let dec = PostcardDecode::<RequestMessage, Cobs<Fifo<u8>>>::new();
// let transport = UartTransport::new(rx, tx);

let (mut tx, mut rx) = uart.split();

let mut device = Device::<UartTransport<_, _>, _, RequestMessage, ResponseMessage, _, _>::new(
enc,
Expand All @@ -161,8 +135,4 @@ fn main() -> ! {
);

loop { device.step(&mut sim); }

// let mut a = 2.3f32;

// loop { a = foo(a); write!(tx, "hey: {}\n", a); write!(tx, "Hello\n"); sim.step(); }
}

0 comments on commit 3f71a5f

Please sign in to comment.