Skip to content

Rev3: Configure timer for buzzer#290

Merged
NArmistead merged 4 commits into
mainfrom
na/rev3-buzzer
Jun 21, 2026
Merged

Rev3: Configure timer for buzzer#290
NArmistead merged 4 commits into
mainfrom
na/rev3-buzzer

Conversation

@NArmistead

@NArmistead NArmistead commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Set up a timer for PWM output on the buzzer pin. Unfortunately this uses one of the "nicer" 32 bit timers but it's probably this or do some hack to get PWM through the regular GPIO.

.ioc changes:

  • Change buzzer pin from GPIO analog to TIM2 channel 4
  • Set the TIM2 prescaler to 4, auto reload register to 13749, and pulse to 12375 (90% duty cylce) to make a 4000 Hz timer

The rest is copying over autogen code.

Issue Link

Children:
Driver: SunDevilRocketry/driver#45
Lib: SunDevilRocketry/lib#21

Closes #10

Testing

  • Passes existing unit tests
  • Unit tests modified
  • Integration test performed

Testing N/A (rev3)

Reviewer Checklist

Standards

  • Follows FCF Architectural Standards
  • Follows SDR Coding Standards
  • Code complexity/function Size is minimized
  • Code is testable
  • Code is readable and commented properly
  • License terms are respected

Accuracy

  • Code implements the correct requirement (a.k.a. does the right thing)
  • Code is logically correct (a.k.a. does the thing right)

Error Handling

  • Potentially unsafe functions return a status code
  • Error returns properly handled
  • Fail-fast errors are only thrown when unsafe to continue software execution
  • Debug errors are thrown for exceptions where execution should still continue (to be noticed during development)

Memory

  • Stack allocated memory is scoped correctly
  • Heap allocated memory is not used
  • Statically/Globally allocated memory is minimized except when necessary
  • Pointers are used correctly
  • Concurrent access has been considered (especially by/from interrupt service routines)

Performance

  • Rate limiters are respected
  • Busy waiting is avoided in performance sensitive code
  • "Delay" calls are not used in performance sensitive code
  • If performance is negatively impacted, a justification is provided and the impact is quantified

@NArmistead NArmistead marked this pull request as draft June 19, 2026 23:54
@NArmistead NArmistead marked this pull request as ready for review June 20, 2026 00:11
@NArmistead NArmistead requested a review from ETSells June 20, 2026 00:11

@ETSells ETSells left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One CR: Please add buzzer to the makefile.

Nit: Also consider adding a quick validation routine

@ETSells ETSells left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ship it

blanket approval for child prs

@NArmistead NArmistead merged commit 839c743 into main Jun 21, 2026
14 of 16 checks passed
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.

Buzzer: Initial R3 Driver Implementation

2 participants