summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 0c9993a7..23ae18c3 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -985,3 +985,21 @@ pub const Hexdump = struct {
c.p.reportError(c.id, "hexdump", err);
}
};
+
+/// `Gpio <pin>` — flip one pad, answered on the message row as `0->1`. Bare `Gpio` draws JP1's
+/// pinout into a pane instead, because the first question about a header is which pins it has.
+///
+/// The only word here whose argument is DECIMAL, and `board_memory.gpio` says why at length: a
+/// GPIO number is part of a name, not an address.
+pub const Gpio = struct {
+ pub const takes_arg = true;
+ pub const enabled = board_memory.enabled;
+ pub const output: OutputTraits = .{ .name = config.gpio_buffer };
+ pub fn run(c: Ctx) void {
+ if (comptime enabled) apply(c) else unreachable;
+ }
+ fn apply(c: Ctx) void {
+ board_memory.gpio(c.p, c.id, c.arg orelse "") catch |err|
+ c.p.reportError(c.id, "gpio", err);
+ }
+};