Skip to content

Conversation

@mathk
Copy link
Collaborator

@mathk mathk commented Jan 19, 2026

No description provided.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Lint Results

Found 7 issues on changed lines in 1 file:

  • port/stmicro/stm32/src/hals/STM32F303/rcc.zig: 7 issues

.SPI1 => current_clock.p2_clk,
.SPI2, .SPI3 => current_clock.p1_clk,
// TODO: Patch for ClockTree
fn usart1Selection(src: anytype) USART1SW {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to usart1_selection, in MicroZig we use snake case for function names.

if (comptime std.mem.eql(u8, microzig.config.chip_name, "STM32L476VG")) {
board.init();
} else {
board.init(&board.rcc_medium_speed) catch @panic("Board init fail");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't you just have each board have its own speed configuration? Does this example need a specific speed? I don't like the examples having this chip stuff hardcoded.
#830 will have this function be called automatically, so we can't do this.

Maybe we can expose some option that has board.init select which config to use?

Copy link
Collaborator Author

@mathk mathk Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap option could be a good choice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clock speed I was thinking that this could be a user choice depending on the usage. (low power mode...) The idea is to be able to have comptime value for each ClockTree and that could be used for each peripheral at comptime too for different config computation.

if (std.mem.eql(u8, "TIMINGR", field.name)) {
break :blk field.type;
}
} else @panic("No TIMINGR register");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a compileError.

@mathk mathk force-pushed the stm32F303-clocktree branch from ba9e5e4 to b1266cd Compare January 20, 2026 10:06
@github-actions github-actions bot dismissed their stale review January 20, 2026 10:06

Updating with new lint results

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Lint Results

Found 7 issues on changed lines in 1 file:

  • port/stmicro/stm32/src/hals/STM32F303/rcc.zig: 7 issues

/// In the future we can switch on chip name to address
/// this limitation.
const microzig = @import("microzig");
const Clock_Device = microzig.drivers.base.Clock_Device;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Rename Clock_Device to ClockDevice, it should be more in line with our style guidelines. This automation is not perfect so take it with a grain of salt.

.SPI1 => current_clock.p2_clk,
.SPI2, .SPI3 => current_clock.p1_clk,
// TODO: Patch for ClockTree
fn usart1Selection(src: anytype) USART1SW {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to usart1_selection, in MicroZig we use snake case for function names.

} else {
FLASH.ACR.modify(.{ .LATENCY = .WS2, .PRFTBE = 1 });
// TODO: Patch for ClockTree
fn usart2Selection(src: anytype) USARTSW {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to usart2_selection, in MicroZig we use snake case for function names.

}

// TODO: Patch for ClockTree
fn usart3Selection(src: anytype) USARTSW {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to usart3_selection, in MicroZig we use snake case for function names.

}

// TODO: Patch for ClockTree
fn uart4Selection(src: anytype) USARTSW {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to uart4_selection, in MicroZig we use snake case for function names.

.RCC_UART4CLKSOURCE_PCLK1 => .PCLK1,
};
} // TODO: Patch for ClockTree
fn uart5Selection(src: anytype) USARTSW {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to uart5_selection, in MicroZig we use snake case for function names.

}

// TODO: Patch for ClockTree
fn i2sSelection(src: anytype) ISSRC {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to i2s_selection, in MicroZig we use snake case for function names.

@mathk mathk requested a review from Grazfather January 20, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants