Skip to content

Commit

Permalink
updated main to get rid of steal
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranav Rama committed May 1, 2020
1 parent b13a41a commit 9a02b17
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ lc3-isa = { git = "https://github.com/ut-utp/prototype.git", branch = "staging",
lc3-traits = { git = "https://github.com/ut-utp/prototype.git", branch = "staging", version = "0.1.0", default-features = false, features = ["no_std"] }

# tm4c123x-hal = { version = "0.9.0", features = ["rt"] }
tm4c123x-hal = { git = "https://github.com/ut-utp/tm4c-hal", version= "0.10.0" , features=["rt"], rev="f4f7487202c7b777c6d2092cd6504f8d4c638ede"}
tm4c123x-hal = { git = "https://github.com/ut-utp/tm4c-hal", version= "0.10.0" , features=["rt"], }
tm4c123x = "0.9.0"
embedded-hal = "0.2.3"

lc3-tm4c = { git = "https://github.com/ut-utp/tm4c", branch = "feat-non-generic" }
lc3-tm4c = { git = "https://github.com/ut-utp/tm4c", branch = "feat-non-generic", rev="67308058926a04ca83427e2063d845cc502263fb" }

[profile.release]
codegen-units = 1 # better optimizations
Expand Down
24 changes: 14 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,22 @@ fn main() -> ! {

let mut porta = p.GPIO_PORTA.split(&sc.power_control);
let mut u0 = p.UART0;

let mut portf = p.GPIO_PORTF.split(&sc.power_control);
let mut portb = p.GPIO_PORTB.split(&sc.power_control);
// Peripheral Init:
let peripheral_set = {
let portf = p.GPIO_PORTF;
let portb = p.GPIO_PORTB;
let gpio = Tm4cGpio::new(
&sc.power_control,
GpioComponents {
portf,
portb,
}
pf1: portf.pf1.into_push_pull_output(),
pf2: portf.pf2.into_push_pull_output(),
pf4: portf.pf4.into_push_pull_output(),
pb0: portb.pb0.into_push_pull_output(),
pb1: portb.pb1.into_pull_up_input(),
pb2: portb.pb2.into_pull_up_input(),
pb3: portb.pb3.into_pull_up_input(),
pb4: portb.pb4.into_pull_up_input(),
},
);

let adc0 = p.ADC0;
Expand All @@ -159,14 +164,13 @@ fn main() -> ! {
// This is bad because we're forfeiting compile time checking that we
// don't try to use the same pins for PWM and GPIO *for absolutely no
// reason*.
let portb = unsafe { hal::Peripherals::steal() }.GPIO_PORTB;
let portd = p.GPIO_PORTD;
// let portb = unsafe { hal::Peripherals::steal() }.GPIO_PORTB;
let pwm0 = p.PWM0;
let pwm1 = p.PWM1;
let pwm = Tm4cPwm::new(
PwmComponents {
portb,
portd,
pb6: portb.pb6.into_af_push_pull::<tm4c123x_hal::gpio::AF4>(&mut portb.control),
pb7: portb.pb7.into_af_push_pull::<tm4c123x_hal::gpio::AF4>(&mut portb.control),
pwm0,
pwm1,
},
Expand Down

0 comments on commit 9a02b17

Please sign in to comment.