32 lines
732 B
Zig
32 lines
732 B
Zig
const cmsis = @cImport({
|
|
@cDefine("TM4C123GH6PM", "");
|
|
@cInclude("TM4C123GH6PM.h");
|
|
});
|
|
|
|
const GPIO_PORTF_CLK_EN: u32 = 0x20; // Bit 5 (Port F)
|
|
const GPIO_PORTF_PIN1_EN: u32 = 0x02; // Bit 1
|
|
|
|
const LED_ON1: u32 = 0x02;
|
|
|
|
export fn _start() noreturn {
|
|
cmsis.SYSCTL.*.RCGCGPIO |= GPIO_PORTF_CLK_EN;
|
|
_ = cmsis.SYSCTL.*.RCGCGPIO;
|
|
|
|
cmsis.GPIOF.*.DEN |= GPIO_PORTF_PIN1_EN;
|
|
cmsis.GPIOF.*.DIR |= GPIO_PORTF_PIN1_EN;
|
|
|
|
const DELAY_VALUE = 4000000;
|
|
while (true) {
|
|
cmsis.GPIOF.*.DATA = LED_ON1; // LED On
|
|
Delay(DELAY_VALUE);
|
|
cmsis.GPIOF.*.DATA = 0; // LED On
|
|
Delay(DELAY_VALUE);
|
|
}
|
|
}
|
|
|
|
fn Delay(delay: usize) void{
|
|
for(0..delay) |_| {
|
|
asm volatile ("nop");
|
|
}
|
|
}
|