From 93bb904aa2ae163e7ee22110bdedc21c3ce7b988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Anic=CC=81?= Date: Fri, 20 Feb 2026 22:16:17 +0100 Subject: [PATCH] rp2xxx: fix timer interrupt enable Enabling one alarm was disabling others. We need to modify instead of write. --- port/raspberrypi/rp2xxx/src/hal/system_timer.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/port/raspberrypi/rp2xxx/src/hal/system_timer.zig b/port/raspberrypi/rp2xxx/src/hal/system_timer.zig index 9b9a2a955..dc1455ad9 100644 --- a/port/raspberrypi/rp2xxx/src/hal/system_timer.zig +++ b/port/raspberrypi/rp2xxx/src/hal/system_timer.zig @@ -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.