Skip to content

Conversation

@Grazfather
Copy link
Collaborator

@Grazfather Grazfather commented Jan 7, 2026

Summary

Adds a complete SPI HAL implementation for CH32V (specifically CH32V203) with optional DMA support.

Key Features:

  • Master-only mode (covers 95% of use cases)
  • Blocking I/O (always available)
  • Optional DMA support with threshold-based automatic selection
  • Vectored I/O for zero-copy operations (required for display drivers)
  • Compile-time DMA channel validation
  • All 4 SPI modes (CPOL/CPHA combinations)
  • Configurable baud rate, bit order, data size
  • SPI_Datagram_Device wrapper for integration with display drivers

DMA Integration:

  • Threshold-based selection: transfers ≥16 bytes (configurable) use DMA, smaller use polling
  • Compile-time channel validation prevents invalid configurations
  • Full-duplex DMA (both TX and RX channels required)
  • Channel mappings:
    • SPI1_TX: DMA1 Ch3
    • SPI1_RX: DMA1 Ch2
    • SPI2_TX: DMA1 Ch5

Examples Included:

  1. spi_loopback.zig - Tests all 4 SPI modes with DMA enabled, includes 32-byte pattern to trigger DMA path

  2. spi_flash_w25q.zig - W25Q128 flash operations (JEDEC ID, erase, write, read, verify):

    [0.006000] info: W25Q128 SPI Flash Test
    [0.009000] info: ======================
    [0.013000] info:
    [0.015000] info: Initializing SPI with DMA support...
    [0.019000] info: SPI initialized at 4 MHz with DMA
    [0.024000] info:
    [0.026000] info: Test 1: Reading JEDEC ID...
    [0.030000] info:   JEDEC ID: 0xEF4018
    [0.033000] info:   Device: Winbond W25Q128 - VERIFIED ✓
    [0.039000] info:
    [0.040000] info: Test 2: Reading Status Register (polling)...
    [0.046000] info:   Status: 0x00
    [0.049000] info:   BUSY: false
    [0.052000] info:   WEL:  false
    [0.055000] info:
    [0.056000] info: Test 3: Erase/Write/Read Cycle...
    [0.061000] info:   Erasing sector at 0x001000...
    [0.091000] info:   Sector erased
    [0.094000] info:   Writing 256 bytes...
    [0.100000] info:   Page written
    [0.102000] info:   Reading 256 bytes (DMA)...
    [0.108000] info:   Page read
    [0.111000] info:   Verifying data...
    [0.114000] info:   Data verified ✓
    [0.118000] info:
    [0.120000] info: All tests complete!
    [0.123000] info:
  3. sharp_niceview.zig - sharp ls0xx graphic display driver integration via SPI_Datagram_Device

Implementation Notes:

  • Follows I2C HAL patterns for consistency
  • Pin configuration is user responsibility (platform-specific)
  • Hybrid CS approach: optional user-managed or wrapper-managed
  • Uses inline for for compile-time mode iteration in examples

Tested On:

  • Hardware: LANA_TNY (CH32V203)
  • All examples verified with --release=small builds
  • Loopback test confirms both polling and DMA paths work correctly
  • nice!view hardwas for ls0xx support
  • ws28q128

🤖 This PR was AI-generated using Claude Code (claude.ai/code). Eventually I had to make my own fixes, rebases, and examples. AI probably wrote 90% by linecount.
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

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 4 files:

  • examples/wch/ch32v/src/i2c_dma.zig: 1 issue
  • examples/wch/ch32v/src/spi_loopback.zig: 1 issue
  • examples/wch/ch32v/src/spi_ssd1306.zig: 1 issue
  • port/wch/ch32v/src/hals/spi.zig: 4 issues
ℹ️ Additional issues on unchanged lines
The following 23 issue(s) exist but are not on lines changed in this PR:

drivers/sensor/ICM-20948.zig:27: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:200: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:208: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:230: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:494: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:535: Suggestion: Rename `Accel_data_unscaled` to `AccelDataUnscaled`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:556: Suggestion: Rename `Accel_data` to `AccelData`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:599: Suggestion: Rename `Gyro_data_unscaled` to `GyroDataUnscaled`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:620: Suggestion: Rename `Gyro_data` to `GyroData`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:827: Suggestion: Rename `Mag_data_unscaled` to `MagDataUnscaled`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:868: Suggestion: Rename `Mag_data` to `MagData`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:886: Suggestion: Rename `TestI2CDevice` to `Test_I2C_Device`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/dma.zig:18: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:47: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:263: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:16: Suggestion: Rename `DmaRegs` to `DMA_Regs`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:16: Suggestion: Rename `Datagram_Device` to `DatagramDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:17: Suggestion: Rename `Stream_Device` to `StreamDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:19: Suggestion: Rename `Clock_Device` to `ClockDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:20: Suggestion: Rename `I2CError` to `I2C_Error`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:21: Suggestion: Rename `I2CAddress` to `I2C_Address`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/gpio.zig:68: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/gpio.zig:119: TODO style comments need to have a linked microzig issue on the same line.

@github-actions github-actions bot dismissed their stale review January 7, 2026 18:19

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 6 issues on changed lines in 3 files:

  • examples/wch/ch32v/src/spi_loopback.zig: 1 issue
  • examples/wch/ch32v/src/spi_ssd1306.zig: 1 issue
  • port/wch/ch32v/src/hals/spi.zig: 4 issues
ℹ️ Additional issues on unchanged lines
The following 23 issue(s) exist but are not on lines changed in this PR:

drivers/sensor/ICM-20948.zig:27: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:200: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:208: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:230: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:494: TODO style comments need to have a linked microzig issue on the same line.
drivers/sensor/ICM-20948.zig:535: Suggestion: Rename `Accel_data_unscaled` to `AccelDataUnscaled`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:556: Suggestion: Rename `Accel_data` to `AccelData`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:599: Suggestion: Rename `Gyro_data_unscaled` to `GyroDataUnscaled`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:620: Suggestion: Rename `Gyro_data` to `GyroData`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:827: Suggestion: Rename `Mag_data_unscaled` to `MagDataUnscaled`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:868: Suggestion: Rename `Mag_data` to `MagData`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/sensor/ICM-20948.zig:886: Suggestion: Rename `TestI2CDevice` to `Test_I2C_Device`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/dma.zig:18: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:47: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:263: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:16: Suggestion: Rename `DmaRegs` to `DMA_Regs`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:16: Suggestion: Rename `Datagram_Device` to `DatagramDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:17: Suggestion: Rename `Stream_Device` to `StreamDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:19: Suggestion: Rename `Clock_Device` to `ClockDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:20: Suggestion: Rename `I2CError` to `I2C_Error`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:21: Suggestion: Rename `I2CAddress` to `I2C_Address`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/gpio.zig:68: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/gpio.zig:119: TODO style comments need to have a linked microzig issue on the same line.

@github-actions github-actions bot dismissed their stale review January 7, 2026 18:25

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 6 issues on changed lines in 3 files:

  • examples/wch/ch32v/src/spi_loopback.zig: 1 issue
  • examples/wch/ch32v/src/spi_ssd1306.zig: 1 issue
  • port/wch/ch32v/src/hals/spi.zig: 4 issues
ℹ️ Additional issues on unchanged lines
The following 11 issue(s) exist but are not on lines changed in this PR:

port/wch/ch32v/src/hals/dma.zig:18: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:47: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:263: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:16: Suggestion: Rename `DmaRegs` to `DMA_Regs`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:16: Suggestion: Rename `Datagram_Device` to `DatagramDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:17: Suggestion: Rename `Stream_Device` to `StreamDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:19: Suggestion: Rename `Clock_Device` to `ClockDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:20: Suggestion: Rename `I2CError` to `I2C_Error`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:21: Suggestion: Rename `I2CAddress` to `I2C_Address`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/gpio.zig:68: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/gpio.zig:119: TODO style comments need to have a linked microzig issue on the same line.

@Grazfather Grazfather marked this pull request as draft January 8, 2026 03:24
@github-actions github-actions bot dismissed their stale review January 8, 2026 23:45

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 3 issues on changed lines in 2 files:

  • examples/wch/ch32v/src/spi_loopback.zig: 1 issue
  • port/wch/ch32v/src/hals/spi.zig: 2 issues
ℹ️ Additional issues on unchanged lines
The following 11 issue(s) exist but are not on lines changed in this PR:

port/wch/ch32v/src/hals/dma.zig:18: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:47: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:263: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:16: Suggestion: Rename `DmaRegs` to `DMA_Regs`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:16: Suggestion: Rename `Datagram_Device` to `DatagramDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:17: Suggestion: Rename `Stream_Device` to `StreamDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:19: Suggestion: Rename `Clock_Device` to `ClockDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:20: Suggestion: Rename `I2CError` to `I2C_Error`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:21: Suggestion: Rename `I2CAddress` to `I2C_Address`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/gpio.zig:68: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/gpio.zig:119: TODO style comments need to have a linked microzig issue on the same line.


if (total_len >= dma_cfg.threshold) {
// For vectored DMA, we need to send chunks sequentially
// TODO: Optimize with scatter-gather DMA in the future
Copy link

Choose a reason for hiding this comment

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

TODO style comments need to have a linked microzig issue on the same line.


if (total_len >= dma_cfg.threshold) {
// For vectored DMA, we need to read chunks sequentially
// TODO: Optimize with scatter-gather DMA in the future
Copy link

Choose a reason for hiding this comment

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

TODO style comments need to have a linked microzig issue on the same line.

@github-actions github-actions bot dismissed their stale review January 8, 2026 23:47

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 2 issues on changed lines in 1 file:

  • port/wch/ch32v/src/hals/spi.zig: 2 issues
ℹ️ Additional issues on unchanged lines
The following 11 issue(s) exist but are not on lines changed in this PR:

port/wch/ch32v/src/hals/dma.zig:18: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:47: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:263: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:16: Suggestion: Rename `DmaRegs` to `DMA_Regs`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:16: Suggestion: Rename `Datagram_Device` to `DatagramDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:17: Suggestion: Rename `Stream_Device` to `StreamDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:19: Suggestion: Rename `Clock_Device` to `ClockDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:20: Suggestion: Rename `I2CError` to `I2C_Error`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:21: Suggestion: Rename `I2CAddress` to `I2C_Address`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/gpio.zig:68: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/gpio.zig:119: TODO style comments need to have a linked microzig issue on the same line.


if (total_len >= dma_cfg.threshold) {
// For vectored DMA, we need to send chunks sequentially
// TODO: Optimize with scatter-gather DMA in the future
Copy link

Choose a reason for hiding this comment

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

TODO style comments need to have a linked microzig issue on the same line.


if (total_len >= dma_cfg.threshold) {
// For vectored DMA, we need to read chunks sequentially
// TODO: Optimize with scatter-gather DMA in the future
Copy link

Choose a reason for hiding this comment

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

TODO style comments need to have a linked microzig issue on the same line.

Grazfather added a commit that referenced this pull request Jan 11, 2026
Tested on my wch branch on top of #838
@github-actions github-actions bot dismissed their stale review January 11, 2026 15:00

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 2 issues on changed lines in 1 file:

  • port/wch/ch32v/src/hals/spi.zig: 2 issues
ℹ️ Additional issues on unchanged lines
The following 11 issue(s) exist but are not on lines changed in this PR:

port/wch/ch32v/src/hals/dma.zig:18: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:47: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:263: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:16: Suggestion: Rename `DmaRegs` to `DMA_Regs`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:16: Suggestion: Rename `Datagram_Device` to `DatagramDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:17: Suggestion: Rename `Stream_Device` to `StreamDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:19: Suggestion: Rename `Clock_Device` to `ClockDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:20: Suggestion: Rename `I2CError` to `I2C_Error`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:21: Suggestion: Rename `I2CAddress` to `I2C_Address`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/gpio.zig:68: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/gpio.zig:119: TODO style comments need to have a linked microzig issue on the same line.


if (total_len >= dma_cfg.threshold) {
// For vectored DMA, we need to send chunks sequentially
// TODO: Optimize with scatter-gather DMA in the future

Choose a reason for hiding this comment

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

TODO style comments need to have a linked microzig issue on the same line.


if (total_len >= dma_cfg.threshold) {
// For vectored DMA, we need to read chunks sequentially
// TODO: Optimize with scatter-gather DMA in the future

Choose a reason for hiding this comment

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

TODO style comments need to have a linked microzig issue on the same line.

@Grazfather Grazfather marked this pull request as ready for review January 14, 2026 00:15
@github-actions github-actions bot dismissed their stale review January 14, 2026 00:15

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 2 issues on changed lines in 1 file:

  • port/wch/ch32v/src/hals/spi.zig: 2 issues
ℹ️ Additional issues on unchanged lines
The following 9 issue(s) exist but are not on lines changed in this PR:

port/wch/ch32v/src/hals/dma.zig:18: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:47: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:263: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/dma.zig:16: Suggestion: Rename `DmaRegs` to `DMA_Regs`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:16: Suggestion: Rename `Datagram_Device` to `DatagramDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:17: Suggestion: Rename `Stream_Device` to `StreamDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:19: Suggestion: Rename `Clock_Device` to `ClockDevice`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:20: Suggestion: Rename `I2CError` to `I2C_Error`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/wch/ch32v/src/hals/drivers.zig:21: Suggestion: Rename `I2CAddress` to `I2C_Address`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.


if (total_len >= dma_cfg.threshold) {
// For vectored DMA, we need to send chunks sequentially
// TODO: Optimize with scatter-gather DMA in the future

Choose a reason for hiding this comment

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

TODO style comments need to have a linked microzig issue on the same line.


if (total_len >= dma_cfg.threshold) {
// For vectored DMA, we need to read chunks sequentially
// TODO: Optimize with scatter-gather DMA in the future

Choose a reason for hiding this comment

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

TODO style comments need to have a linked microzig issue on the same line.

@Grazfather Grazfather requested a review from tact1m4n3 January 15, 2026 17:22
@github-actions github-actions bot dismissed their stale review January 15, 2026 18:05

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

@mattnite mattnite merged commit 3f2b017 into main Jan 15, 2026
56 checks passed
@mattnite mattnite deleted the wch_spi branch January 15, 2026 18:14
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.

3 participants