Skip to content

Instantly share code, notes, and snippets.

@9names
Created May 15, 2021 03:43
Show Gist options
  • Save 9names/ab435db6bdf9056cd285c2710825ae5f to your computer and use it in GitHub Desktop.
Save 9names/ab435db6bdf9056cd285c2710825ae5f to your computer and use it in GitHub Desktop.
Blinky on TM4C123GXL
#![no_std]
#![no_main]
use panic_halt as _;
use cortex_m_rt::entry;
use tm4c123x_hal::{self as hal, prelude::*, delay::Delay};
#[entry]
fn main() -> ! {
let p = hal::Peripherals::take().unwrap();
let cp = hal::CorePeripherals::take().unwrap();
let mut sc = p.SYSCTL.constrain();
sc.clock_setup.oscillator = hal::sysctl::Oscillator::Main(
hal::sysctl::CrystalFrequency::_16mhz,
hal::sysctl::SystemClock::UsePll(hal::sysctl::PllOutputFrequency::_80_00mhz),
);
let clocks = sc.clock_setup.freeze();
let mut delay = Delay::new(cp.SYST, &clocks);
let portb = p.GPIO_PORTB.split(&sc.power_control);
let mut led = portb.pb3.into_push_pull_output();
loop {
led.set_high();
delay.delay_ms(500u16);
led.set_low();
delay.delay_ms(500u16);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment