Skip to content
This repository was archived by the owner on Feb 17, 2024. It is now read-only.

update to new regz package layout #21

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Tiedye
Copy link

@Tiedye Tiedye commented Jun 9, 2023

Not sure what to call this, but these are the changes I had to make to get this program to work:

const hal = @import("microzig").hal;
const micro = @import("microzig");

pub fn main() !void {
    const led = hal.parsePin(micro.board.pin_map.D13);
    const Port = hal.Uart(0, .{});
    var serial = try Port.init(.{
        .baud_rate = 115200,
        .parity = null,
        .stop_bits = .one,
        .data_bits = .eight,
    });
    hal.gpio.setOutput(led);
    hal.gpio.write(led, .low);
    while (true) {
        busyloop();
        hal.gpio.toggle(led);
        serial.tx('a');
    }
}

fn busyloop() void {
    const limit = 1_000_000;

    var i: u24 = 0;
    while (i < limit) : (i += 1) {
        asm volatile ("");
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant