Skip to content

Conversation

kienvo
Copy link
Member

@kienvo kienvo commented Jul 3, 2025

Resolves #15

Summary by Sourcery

Add RV003USB submodule with configuration headers and demo code, update build to compile the USB stack and disable the original SystemInit to prepare for custom USB initialization.

New Features:

  • Integrate RV003USB library and demo HID API to enable USB functionality

Enhancements:

  • Disable the default SystemInit to allow custom initialization for USB support

Build:

  • Extend the Makefile to include external rv003usb C/ASM sources, include paths, and remove unused src/main.c

Chores:

  • Add usb_config.h and funconfig.h for USB and system configuration

@sourcery-ai
Copy link

sourcery-ai bot commented Jul 3, 2025

Reviewer's Guide

This PR integrates USB support by incorporating the external rv003usb library—adjusting the build and include paths, disabling conflicting clock initialization, and providing configuration headers for USB endpoints and descriptors.

Class diagram for USB descriptor configuration structures

classDiagram
    class usb_string_descriptor_struct {
        +uint8_t bLength
        +uint8_t bDescriptorType
        +uint16_t wString[]
    }
    class descriptor_list_struct {
        +uint32_t lIndexValue
        +const uint8_t *addr
        +uint8_t length
    }
    usb_string_descriptor_struct <.. descriptor_list_struct : used in
Loading

File-Level Changes

Change Details Files
Disabled default system clock initialization
  • Comment out SystemInit definition
  • Remove call to SetSysClock
  • Prevent automatic RCC register resets
src/mcu/ch32v00x-sys.c
Integrated external rv003usb library into build
  • Remove src/main.c from build sources
  • Add C and assembly sources from external/rv003usb
  • Extend include paths for USB headers
Makefile
Added USB configuration header
  • Define endpoint counts and GPIO pins
  • Configure HID report and descriptors
  • Provide string and descriptor list structures
inc/usb_config.h
Added project-wide function configuration header
  • Enable debug printf support
  • Set MCU and systick options
inc/funconfig.h
Initialized external USB submodule
  • Create .gitmodules entry
  • Add external/rv003usb directory placeholder
.gitmodules
external/rv003usb

Assessment against linked issues

Issue Objective Addressed Explanation
#15 Enable the firmware to receive input over USB.
#15 Support communication with external systems such as PCs via USB

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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.

Implement the USB interface

1 participant