arduino / arduino/ArduinoCore-avr

Rewrite millis() and micros() to enable chaning of the prescaler of Timer0

Open
#79 0 comments 0 reactions 0 assignees Claimed by @GewoonGijs View on GitHub
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I like to use a different prescaler for Timer0 because I need 6 PWM outputs on a high frequency to control two stepper motors with microsteps.

I created a solution myself. The only thing I had to do was changing wiring.c to make calculations using the actual settings of the configuration registers instead of the defined default values.

See: https://github.com/GewoonGijs/platformio-pkg-framework-arduinoavr/blob/master/cores/arduino/wiring.c

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with cores/arduino/wiring.c and compare the proposed approach in linked pull request #80 and the referenced solution. Check how Timer0 prescaler configuration affects millis() and micros(), then verify that timing calculations use the actual register settings while preserving existing default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.