diff --git a/examples/raspberrypi/rp2xxx/build.zig b/examples/raspberrypi/rp2xxx/build.zig index b766509d5..30aca2a77 100644 --- a/examples/raspberrypi/rp2xxx/build.zig +++ b/examples/raspberrypi/rp2xxx/build.zig @@ -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: diff --git a/examples/raspberrypi/rp2xxx/src/usb_cdc.zig b/examples/raspberrypi/rp2xxx/src/usb_cdc.zig index da3f57c4b..eca1a1c65 100644 --- a/examples/raspberrypi/rp2xxx/src/usb_cdc.zig +++ b/examples/raspberrypi/rp2xxx/src/usb_cdc.zig @@ -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. @@ -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; diff --git a/examples/raspberrypi/rp2xxx/src/usb_hid.zig b/examples/raspberrypi/rp2xxx/src/usb_hid.zig index 802279825..39eda917d 100644 --- a/examples/raspberrypi/rp2xxx/src/usb_hid.zig +++ b/examples/raspberrypi/rp2xxx/src/usb_hid.zig @@ -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(.{}); @@ -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| diff --git a/port/raspberrypi/rp2xxx/build.zig b/port/raspberrypi/rp2xxx/build.zig index 581169e83..c966e7a0f 100644 --- a/port/raspberrypi/rp2xxx/build.zig +++ b/port/raspberrypi/rp2xxx/build.zig @@ -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"), },