~repos /rp2350

#zig#raspberry-pi

git clone https://pyrossh.dev/repos/rp2350.git

code to drive rp2350



docs/aa.zig



const std = @import("std");
const stdout = std.io.getStdOut().writer();
pub const User = struct {
power: u64,
name: []const u8,
pub const SUPER_POWER = 9000;
pub fn diagnose(self: User) void {
if (self.power >= SUPER_POWER) {
std.debug.print("it's over {d}!!!", .{SUPER_POWER});
}
}
};
const Stage = enum {
validate,
awaiting_confirmation,
confirmed,
err,
fn isComplete(self: Stage) bool {
return self == .confirmed or self == .err;
}
};
const TimestampType = enum {
unix,
datetime,
};
const Timestamp = union(TimestampType) {
unix: i32,
datetime: DateTime,
const DateTime = struct {
year: u16,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
};
fn seconds(self: Timestamp) u16 {
switch (self) {
.datetime => |dt| return dt.second,
.unix => |ts| {
const seconds_since_midnight: i32 = @rem(ts, 86400);
return @intCast(@rem(seconds_since_midnight, 60));
},
}
}
};
const user = User{ .name = "Goku" };
pub fn main() !void {
var i: usize = 1;
while (i <= 16) : (i += 1) {
if (i % 15 == 0) {
try stdout.writeAll("ZiggZagg\n");
} else if (i % 3 == 0) {
try stdout.writeAll("Zigg\n");
} else if (i % 5 == 0) {
try stdout.writeAll("Zagg\n");
} else {
try stdout.print("{d}\n", .{i});
}
}
for (0..10) |j| {
std.debug.print("{d}\n", .{j});
}
}