Merge pull request #96 from SamTebbs33/feature/ci-formatting-check
Add formatting check to CI
This commit is contained in:
commit
032d08ebfe
2 changed files with 7 additions and 5 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -29,3 +29,5 @@ jobs:
|
||||||
sudo apt-get install qemu qemu-system --fix-missing
|
sudo apt-get install qemu qemu-system --fix-missing
|
||||||
- name: Run runtime tests
|
- name: Run runtime tests
|
||||||
run: zig*/zig build test -Drt-test=true ${{ matrix.build_mode }}
|
run: zig*/zig build test -Drt-test=true ${{ matrix.build_mode }}
|
||||||
|
- name: Check formatting
|
||||||
|
run: zig*/zig fmt --check src
|
||||||
|
|
|
@ -13,15 +13,13 @@ const PARITY_BIT = false;
|
||||||
|
|
||||||
pub const DEFAULT_BAUDRATE = 38400;
|
pub const DEFAULT_BAUDRATE = 38400;
|
||||||
|
|
||||||
const SerialError = error {
|
const SerialError = error{InvalidBaud};
|
||||||
InvalidBaud
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const Port = enum(u16) {
|
pub const Port = enum(u16) {
|
||||||
COM1 = 0x3F8,
|
COM1 = 0x3F8,
|
||||||
COM2 = 0x2F8,
|
COM2 = 0x2F8,
|
||||||
COM3 = 0x3E8,
|
COM3 = 0x3E8,
|
||||||
COM4 = 0x2E8
|
COM4 = 0x2E8,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Compute a value that encodes the serial properties
|
// Compute a value that encodes the serial properties
|
||||||
|
@ -69,7 +67,9 @@ pub fn init(baud: u32, port: Port) SerialError!void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write(char: u8, port: Port) void {
|
pub fn write(char: u8, port: Port) void {
|
||||||
while (!transmitIsEmpty(port)) { arch.halt(); }
|
while (!transmitIsEmpty(port)) {
|
||||||
|
arch.halt();
|
||||||
|
}
|
||||||
arch.outb(@enumToInt(port), char);
|
arch.outb(@enumToInt(port), char);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue