Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnite committed Feb 22, 2025
1 parent 37679dc commit 6068260
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/src/mmio.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ pub fn Mmio(comptime PackedT: type) type {
inline fn toggle_field(val: anytype, comptime field_name: []const u8, value: anytype) void {
const FieldType = @TypeOf(@field(val, field_name));
switch (@typeInfo(FieldType)) {
.Int => {
.int => {
@field(val, field_name) = @field(val, field_name) ^ value;
},
.Enum => |enum_info| {
.@"enum" => |enum_info| {
// same as for the .Int case, but casting to and from the u... tag type U of the enum FieldType
const U = enum_info.tag_type;
@field(val, field_name) =
Expand Down
14 changes: 7 additions & 7 deletions port/stmicro/stm32/src/hals/STM32F303/pins.zig
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ fn PinDescription(comptime spec: []const u8) type {
pub fn Pins(comptime config: GlobalConfiguration) type {
comptime {
var fields: []const StructField = &.{};
for (@typeInfo(GlobalConfiguration).Struct.fields) |port_field| {
for (@typeInfo(GlobalConfiguration).@"struct".fields) |port_field| {
if (@field(config, port_field.name)) |port_config| {
for (@typeInfo(PortConfiguration()).Struct.fields) |field| {
for (@typeInfo(PortConfiguration()).@"struct".fields) |field| {
if (@field(port_config, field.name)) |pin_config| {
const D = PinDescription(field.name);
fields = fields ++ &[_]StructField{.{
.is_comptime = false,
.name = pin_config.name orelse field.name,
.type = GPIO(D.gpio_port_id, D.gpio_pin_number_str, pin_config.mode orelse .{ .input = .floating }),
.default_value = null,
.default_value_ptr = null,
.alignment = @alignOf(field.type),
}};
}
Expand All @@ -87,7 +87,7 @@ pub fn Pins(comptime config: GlobalConfiguration) type {
}

return @Type(.{
.Struct = .{
.@"struct" = .{
.layout = .auto,
.is_tuple = false,
.fields = fields,
Expand Down Expand Up @@ -117,7 +117,7 @@ fn PortConfiguration() type {
}

return @Type(.{
.Struct = .{
.@"struct" = .{
.layout = .auto,
.is_tuple = false,
.fields = fields,
Expand All @@ -136,12 +136,12 @@ pub const GlobalConfiguration = struct {
pub fn apply(comptime config: @This()) Pins(config) {
const pins: Pins(config) = undefined; // Later: something seems incomplete here...

inline for (@typeInfo(@This()).Struct.fields) |port_field| {
inline for (@typeInfo(@This()).@"struct".fields) |port_field| {
const gpio_port_name = port_field.name;
if (@field(config, gpio_port_name)) |port_config| {
peripherals.RCC.AHBENR.modify_one(gpio_port_name ++ "EN", 1);

inline for (@typeInfo(PortConfiguration()).Struct.fields) |pin_field| {
inline for (@typeInfo(PortConfiguration()).@"struct".fields) |pin_field| {
if (@field(port_config, pin_field.name)) |pin_config| {
@field(pins, pin_field.name).configure(pin_config);
}
Expand Down
2 changes: 1 addition & 1 deletion port/wch/ch32v/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn init(dep: *std.Build.Dependency) Self {
.abi = .eabi,
};

const qingkev4f = .{
const qingkev4f = std.Target.Query{
.cpu_arch = .riscv32,
.cpu_model = .{ .explicit = &std.Target.riscv.cpu.generic_rv32 },
// generic_rv32 has feature I.
Expand Down

0 comments on commit 6068260

Please sign in to comment.