From 938a40773a1dc3efd49b2f7930396df37e2721ce Mon Sep 17 00:00:00 2001 From: Matt Knight Date: Wed, 15 May 2024 01:39:20 -0700 Subject: [PATCH] fix clock configuration in audio example (#45) --- src/badge/demos/audio.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/badge/demos/audio.zig b/src/badge/demos/audio.zig index 576e40a..a4e74b1 100644 --- a/src/badge/demos/audio.zig +++ b/src/badge/demos/audio.zig @@ -2,6 +2,7 @@ const std = @import("std"); const microzig = @import("microzig"); const hal = microzig.hal; const gclk = hal.clocks.gclk; +const mclk = hal.clocks.mclk; const timer = hal.timer; const spkr_en_pin = microzig.board.SPKR_EN; @@ -16,11 +17,18 @@ pub fn main() !void { analog_out_pin.write(.low); spkr_en_pin.write(.high); + mclk.set_apb_mask(.{ + .TC0 = .enabled, + .TC1 = .enabled, + }); + gclk.enable_generator(.GCLK1, .DFLL, .{ .divsel = .DIV1, .div = 48, }); + gclk.set_peripheral_clk_gen(.GCLK_TC0_TC1, .GCLK1); + timer.init(); while (true) { led_pin.toggle();