Skip to content

Commit 7c1b479

Browse files
authored
rp2xxx: fix timer interrupt enable (#912)
Enabling one alarm was disabling others. We need to modify instead of write.
1 parent 84d7a7e commit 7c1b479

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

port/raspberrypi/rp2xxx/src/hal/system_timer.zig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ pub const Timer = enum(u1) {
4343
/// Enables or disables the interrupt for the given alarm.
4444
pub fn set_interrupt_enabled(timer: Timer, alarm: Alarm, enable: bool) void {
4545
const regs = timer.get_regs();
46-
regs.INTE.write_raw(@as(u4, @intFromBool(enable)) << @intFromEnum(alarm));
46+
switch (alarm) {
47+
.alarm0 => regs.INTE.modify(.{ .ALARM_0 = @intFromBool(enable) }),
48+
.alarm1 => regs.INTE.modify(.{ .ALARM_1 = @intFromBool(enable) }),
49+
.alarm2 => regs.INTE.modify(.{ .ALARM_2 = @intFromBool(enable) }),
50+
.alarm3 => regs.INTE.modify(.{ .ALARM_3 = @intFromBool(enable) }),
51+
}
4752
}
4853

4954
/// Clears the interrupt flag for the given alarm.

0 commit comments

Comments
 (0)