-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into rp2350_pio_assembler
- Loading branch information
Showing
53 changed files
with
18,925 additions
and
3,735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ boxzer-out | |
microzig-deploy/ | ||
zig-cache/ | ||
zig-out/ | ||
|
||
*.regz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const std = @import("std"); | ||
const microzig = @import("microzig"); | ||
const rp2xxx = microzig.hal; | ||
const watchdog = rp2xxx.watchdog; | ||
const time = rp2xxx.time; | ||
|
||
const pin_config = rp2xxx.pins.GlobalConfiguration{ | ||
.GPIO25 = .{ | ||
.name = "led", | ||
.direction = .out, | ||
}, | ||
}; | ||
const pins = pin_config.pins(); | ||
|
||
pub fn main() !void { | ||
pin_config.apply(); | ||
|
||
// Set up different blinking behavior if this reset was due to a WD trip | ||
const wd_reset: bool = if (watchdog.caused_reboot()) |_| | ||
true | ||
else | ||
false; | ||
|
||
watchdog.apply(.{ | ||
// Set up the watchdog timer to trip after 1 second | ||
.duration_us = 1000 * 1000, | ||
// Watchdog timer should NOT trip if a debugger is connected | ||
// NOTE: This doesn't appear to work with a JLink, your mileage may vary | ||
.pause_during_debug = true, | ||
}); | ||
|
||
var blink_time: usize = 100; | ||
var fast_counter: usize = 0; | ||
|
||
// Slowly decrease blink frequency until a watchdog reset is triggered from waiting too long between watchdog.update() calls | ||
while (true) { | ||
|
||
// "null" uses whatever the previously configured timeout period for the watchdog was | ||
watchdog.update(null); | ||
pins.led.toggle(); | ||
time.sleep_ms(@as(usize, @intCast(blink_time))); | ||
|
||
// 10 fast blinks to start if the WD caused reset | ||
if (wd_reset and fast_counter < 10) { | ||
fast_counter += 1; | ||
} else { | ||
blink_time += 100; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.