Skip to content

Commit

Permalink
fix ci errors again
Browse files Browse the repository at this point in the history
  • Loading branch information
tact1m4n3 committed Jan 9, 2025
1 parent 71b0abf commit 0bb13f5
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/changing_system_clocks.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const Pin = rp2xxx.gpio.Pin;

/// The HAL provides a convenvience function for detecting which of the RP2XXX
/// family you're currently compiling for.
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

// Use the system() preset helper to change the SYS and REF clock frequencies from default
const system_clock_cfg = clocks.config.preset.system(
// Reduce the system clock by a factor of 4 (different default clock speeds for RP2350/RP2040)
switch (cpu) {
switch (chip) {
.RP2040 => 125_000_000 / 4,
.RP2350 => 150_000_000 / 4,
},
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/custom_clock_config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Pin = gpio.Pin;

/// The HAL provides a convenvience function for detecting which of the RP2XXX
/// family you're currently compiling for.
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

const xosc_freq = microzig.board.xosc_freq;

Expand Down Expand Up @@ -84,7 +84,7 @@ const system_clock_cfg: GlobalConfig = val: {
};

// GlobalConfig has a slight difference between RP2350 (has HSTX) and RP2040 (has RTC)
switch (cpu) {
switch (chip) {
.RP2040 => {
// Drive RTC off XOSC / 3 for a change of pace!
temp.rtc = .{
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/rp2040_only/adc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const rp2xxx = microzig.hal;
const gpio = rp2xxx.gpio;
const adc = rp2xxx.adc;
const time = rp2xxx.time;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

const uart = rp2xxx.uart.instance.num(0);
const baud_rate = 115200;
Expand All @@ -22,7 +22,7 @@ pub fn main() void {
.temp_sensor_enabled = true,
});

switch (cpu) {
switch (chip) {
.RP2040 => inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| {
pin.set_function(.uart);
},
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/rp2040_only/flash_id.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const rp2xxx = microzig.hal;
const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
const flash = rp2xxx.flash;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

const uart = rp2xxx.uart.instance.num(0);
const baud_rate = 115200;
Expand All @@ -24,7 +24,7 @@ pub const std_options = struct {
};

pub fn main() !void {
switch (cpu) {
switch (chip) {
.RP2040 => inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| {
pin.set_function(.uart);
},
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/rp2040_only/flash_program.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const flash = rp2xxx.flash;
const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
const clocks = rp2xxx.clocks;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

const led = gpio.num(25);
const uart = rp2xxx.uart.instance.num(0);
Expand All @@ -33,7 +33,7 @@ pub fn main() !void {
led.set_direction(.out);
led.put(1);

switch (cpu) {
switch (chip) {
.RP2040 => inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| {
pin.set_function(.uart);
},
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/rp2040_only/i2c_bus_scan.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const rp2xxx = microzig.hal;
const i2c = rp2xxx.i2c;
const gpio = rp2xxx.gpio;
const peripherals = microzig.chip.peripherals;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

pub const microzig_options = .{
.log_level = .info,
Expand All @@ -20,7 +20,7 @@ const uart_rx_pin = gpio.num(1);
const i2c0 = i2c.instance.num(0);

pub fn main() !void {
switch (cpu) {
switch (chip) {
.RP2040 => inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| {
pin.set_function(.uart);
},
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/rp2040_only/random.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
const clocks = rp2xxx.clocks;
const rand = rp2xxx.rand;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

const led = gpio.num(25);
const uart = rp2xxx.uart.instance.num(0);
Expand All @@ -33,7 +33,7 @@ pub fn main() !void {
led.set_direction(.out);
led.put(1);

switch (cpu) {
switch (chip) {
.RP2040 => inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| {
pin.set_function(.uart);
},
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/rp2040_only/uart_log.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const rp2xxx = microzig.hal;
const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
const clocks = rp2xxx.clocks;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

const led = gpio.num(25);
const uart = rp2xxx.uart.instance.num(0);
Expand All @@ -29,7 +29,7 @@ pub fn main() !void {
led.set_direction(.out);
led.put(1);

switch (cpu) {
switch (chip) {
.RP2040 => inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| {
pin.set_function(.uart);
},
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/rp2040_only/usb_cdc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
const clocks = rp2xxx.clocks;
const usb = rp2xxx.usb;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

const led = gpio.num(25);
const uart = rp2xxx.uart.instance.num(0);
Expand Down Expand Up @@ -69,7 +69,7 @@ pub fn main() !void {
led.set_direction(.out);
led.put(1);

switch (cpu) {
switch (chip) {
.RP2040 => inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| {
pin.set_function(.uart);
},
Expand Down
4 changes: 2 additions & 2 deletions examples/raspberrypi/rp2xxx/src/rp2040_only/usb_hid.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
const clocks = rp2xxx.clocks;
const usb = rp2xxx.usb;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;

const led = gpio.num(25);
const uart = rp2xxx.uart.instance.num(0);
Expand Down Expand Up @@ -71,7 +71,7 @@ pub fn main() !void {
led.set_direction(.out);
led.put(1);

switch (cpu) {
switch (chip) {
.RP2040 => inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| {
pin.set_function(.uart);
},
Expand Down
2 changes: 1 addition & 1 deletion port/raspberrypi/rp2xxx/src/hal.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub const pwm = @import("hal/pwm.zig");
pub const rand = @import("hal/random.zig");
pub const resets = @import("hal/resets.zig");
pub const rom = @import("hal/rom.zig");
pub const rtc = switch (compatibility.cpu) {
pub const rtc = switch (compatibility.chip) {
.RP2040 => @import("hal/rtc.zig"),
.RP2350 => {}, // No explicit "RTC" module on RP2350
};
Expand Down
4 changes: 2 additions & 2 deletions port/raspberrypi/rp2xxx/src/hal/adc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ADC = microzig.chip.peripherals.ADC;
const gpio = @import("gpio.zig");
const resets = @import("resets.zig");
const clocks = @import("clocks.zig");
const cpu = @import("compatibility.zig").cpu;
const chip = @import("compatibility.zig").chip;

pub const Error = error{
/// ADC conversion failed, one such reason is that the controller failed to
Expand Down Expand Up @@ -40,7 +40,7 @@ const Config = struct {
/// CS.EN = 1. The global clock configuration is not needed to configure the
/// sample rate because the ADC hardware block requires a 48MHz clock.
pub fn apply(config: Config) void {
switch (cpu) {
switch (chip) {
.RP2040 => ADC.CS.write(.{
.EN = 0,
.TS_EN = @intFromBool(config.temp_sensor_enabled),
Expand Down
8 changes: 4 additions & 4 deletions port/raspberrypi/rp2xxx/src/hal/irq.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
/// this is only to control the NVIC enable/disable of the actual processor.
const microzig = @import("microzig");
const rp2xxx = microzig.hal;
const cpu = rp2xxx.compatibility.cpu;
const chip = rp2xxx.compatibility.chip;
const PPB = microzig.chip.peripherals.PPB;

pub const Mask = switch (cpu) {
pub const Mask = switch (chip) {
// RP2040 only has a single set of registers for interrupts
.RP2040 => enum(u5) {
TIMER_IRQ_0 = 0,
Expand Down Expand Up @@ -97,7 +97,7 @@ pub const Mask = switch (cpu) {
};

pub fn enable(mask: Mask) void {
switch (cpu) {
switch (chip) {
.RP2040 => {
PPB.NVIC_ICPR.write(.{ .CLRPEND = @as(u32, 1) << @intFromEnum(mask) });
PPB.NVIC_ISER.write(.{ .SETENA = @as(u32, 1) << @intFromEnum(mask) });
Expand All @@ -122,7 +122,7 @@ pub fn enable(mask: Mask) void {
}

pub fn disable(mask: Mask) void {
switch (cpu) {
switch (chip) {
.RP2040 => {
PPB.NVIC_ICER.write(.{ .CLRENA = @as(u32, 1) << @as(u5, @intFromEnum(mask)) });
},
Expand Down
6 changes: 3 additions & 3 deletions port/raspberrypi/rp2xxx/src/hal/pio.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const std = @import("std");
const assert = std.debug.assert;

const microzig = @import("microzig");
const cpu = @import("compatibility.zig").cpu;
const chip = @import("compatibility.zig").chip;

// Re-export of platform rectified pio implementation
const common = @import("pio/common.zig");
const chip_specific = switch (cpu) {
const chip_specific = switch (chip) {
.RP2040 => @import("pio/rp2040.zig"),
.RP2350 => @import("pio/rp2350.zig"),
};
Expand All @@ -27,7 +27,7 @@ pub const Program = assembler.Program;
pub const assemble = assembler.assemble;

pub fn num(n: u2) Pio {
switch (cpu) {
switch (chip) {
.RP2040 => {
if (n > 1)
@panic("the RP2040 only has PIO0 and PIO1");
Expand Down
8 changes: 4 additions & 4 deletions port/raspberrypi/rp2xxx/src/hal/pio/common.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const std = @import("std");
const assert = std.debug.assert;

const microzig = @import("microzig");
const cpu = @import("../compatibility.zig").cpu;
const chip = @import("../compatibility.zig").chip;

pub const PIO = microzig.chip.types.peripherals.PIO0;
pub const PIO0 = microzig.chip.peripherals.PIO0;
Expand All @@ -17,11 +17,11 @@ pub const Instruction = encoder.Instruction;
pub const Program = assembler.Program;

// global state for keeping track of used things
var used_instruction_space = switch (cpu) {
var used_instruction_space = switch (chip) {
.RP2040 => [_]u32{ 0, 0 },
.RP2350 => [_]u32{ 0, 0, 0 },
};
var claimed_state_machines = switch (cpu) {
var claimed_state_machines = switch (chip) {
.RP2040 => [_]u4{ 0, 0 },
.RP2350 => [_]u4{ 0, 0, 0 },
};
Expand Down Expand Up @@ -552,7 +552,7 @@ pub fn PioImpl(EnumType: type) type {
};
}

pub const ShiftOptions = switch (cpu) {
pub const ShiftOptions = switch (chip) {
.RP2040 => struct {
autopush: bool = false,
autopull: bool = false,
Expand Down

0 comments on commit 0bb13f5

Please sign in to comment.