Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion port/raspberrypi/rp2xxx/src/hal/system_timer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ pub const Timer = enum(u1) {
/// Enables or disables the interrupt for the given alarm.
pub fn set_interrupt_enabled(timer: Timer, alarm: Alarm, enable: bool) void {
const regs = timer.get_regs();
regs.INTE.write_raw(@as(u4, @intFromBool(enable)) << @intFromEnum(alarm));
switch (alarm) {
.alarm0 => regs.INTE.modify(.{ .ALARM_0 = @intFromBool(enable) }),
.alarm1 => regs.INTE.modify(.{ .ALARM_1 = @intFromBool(enable) }),
.alarm2 => regs.INTE.modify(.{ .ALARM_2 = @intFromBool(enable) }),
.alarm3 => regs.INTE.modify(.{ .ALARM_3 = @intFromBool(enable) }),
}
}

/// Clears the interrupt flag for the given alarm.
Expand Down