Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/raspberrypi/rp2xxx/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub fn build(b: *std.Build) void {
// Adafruit boards
.{ .target = mb.ports.rp2xxx.boards.adafruit.feather_rp2350, .name = "adafruit_feather_rp2350_blinky", .file = "src/board_blinky.zig" },
.{ .target = mb.ports.rp2xxx.boards.adafruit.feather_rp2350, .name = "adafruit_feather_rp2350_multicore", .file = "src/blinky_core1.zig" },
.{ .target = mb.ports.rp2xxx.boards.adafruit.feather_rp2350, .name = "adafruit_feather_rp2350_usb-cdc", .file = "src/usb_cdc.zig" },
.{ .target = mb.ports.rp2xxx.boards.adafruit.feather_rp2350, .name = "adafruit_feather_rp2350_usb-hid", .file = "src/usb_hid.zig" },
.{ .target = mb.ports.rp2xxx.boards.adafruit.metro_rp2350, .name = "adafruit_metro_rp2350_blinky", .file = "src/board_blinky.zig" },

// WaveShare Boards:
Expand Down
3 changes: 1 addition & 2 deletions examples/raspberrypi/rp2xxx/src/usb_cdc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const microzig = @import("microzig");

const rp2xxx = microzig.hal;
const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
const usb = microzig.core.usb;
// Port-specific type which implements the DeviceInterface interface, used by the USB core to
// read from/write to the peripheral.
Expand Down Expand Up @@ -79,7 +78,7 @@ pub fn main() !void {
// Ensure that the host as finished enumerating our USB device
if (usb_controller.drivers()) |drivers| {
new = time.get_time_since_boot().to_us();
if (new - old > 500000) {
if (new - old > 500_000) {
old = new;
pins.led.toggle();
i += 1;
Expand Down
10 changes: 4 additions & 6 deletions examples/raspberrypi/rp2xxx/src/usb_hid.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const microzig = @import("microzig");

const rp2xxx = microzig.hal;
const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
const usb = microzig.core.usb;
const USB_Device = rp2xxx.usb.Polled(.{});

Expand Down Expand Up @@ -171,17 +170,16 @@ pub fn main() !void {

if (usb_controller.drivers()) |drivers| {
new = time.get_time_since_boot().to_us();
const time_since_last = new - old;
if (time_since_last < 2_000_000) {
if (new - old > 2_000_000) {
old = new;
idx = 0;
} else {
idx += @intFromBool(if (idx & 1 == 0 and idx < 2 * message.len)
drivers.keyboard.send_report(
&.{ .modifiers = .none, .keys = .{message[@intCast(idx / 2)]} ++ .{.reserved} ** 5 },
)
else
drivers.keyboard.send_report(&.empty));
} else {
old = new;
idx = 0;
}

if (drivers.keyboard.receive_report()) |report|
Expand Down
2 changes: 1 addition & 1 deletion port/raspberrypi/rp2xxx/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub fn init(dep: *std.Build.Dependency) Self {
.adafruit = .{
.feather_rp2350 = chip_rp2350_arm.derive(.{
.board = .{
.name = "Adafruit Faether RP2350",
.name = "Adafruit Feather RP2350",
.url = "https://www.adafruit.com/product/6000",
.root_source_file = b.path("src/boards/adafruit_feather_rp2350.zig"),
},
Expand Down