Skip to content

Conversation

kienvo
Copy link
Member

@kienvo kienvo commented Jul 23, 2025

Resolve #95

Summary by Sourcery

Introduce WIP microphone support by initializing ADC on PA7, reading audio samples via mic_adc(), and driving the LED framebuffer as an audio visualizer in the main loop.

New Features:

  • Initialize ADC on PA7 and expose mic_init() and mic_adc() functions for microphone input
  • Visualize real-time audio levels by updating the LED framebuffer based on ADC readings in the main loop

Enhancements:

  • Comment out the initial charging display call to clear the screen before running the audio visualizer

Copy link
Contributor

sourcery-ai bot commented Jul 23, 2025

Reviewer's Guide

This PR introduces basic microphone support by configuring the ADC on PA7, provides sampling functions, and updates the main loop to visualize microphone input on the LED framebuffer, while temporarily disabling the initial charging display.

Class diagram for new microphone support functions

classDiagram
    class main {
    }
    class mic {
        +void mic_init()
        +uint16_t mic_adc()
    }
    main ..> mic : uses
Loading

File-Level Changes

Change Details Files
Added microphone ADC initialization and sampling interface
  • Implemented mic_init() to configure GPIOA PA7 as analog input and set up ADC parameters
  • Implemented mic_adc() to select channel 11 and perform a single ADC conversion
src/main.c
Updated main() to visualize microphone input on LEDs in a continuous loop
  • Inserted a new infinite loop before normal operation to read mic_adc() and update fb array based on ADC readings
  • Added DelayMs(10) for loop pacing and a poweroff condition when mode is not NORMAL
  • Ensured spawn_tasks() is called before entering the mic-driven loop
src/main.c
Temporarily disabled initial charging display
  • Commented out the disp_charging() call in main initialization
src/main.c

Assessment against linked issues

Issue Objective Addressed Explanation
#95 Add support for the microphone in the firmware.
#95 Implement audio/sound visualizations based on microphone input, inspired by the provided example images.

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

kienvo added 2 commits July 28, 2025 13:30
needs a way to setup the mode as work queue cuz the current
implementation is polling inside the button interrupt routine.
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.

Add support for microphone and audio visualizations
1 participant