pioasm: fix fractional part of .clock_div #3190

Open
jacobmarble wants to merge 1 commit from jacobmarble/fix/pioasm-clock-div-frac into develop
jacobmarble commented 2026-09-09 01:04:50 -05:00 (Migrated from github.com)

Closes #3189

Fixes the pioasm fractional logic for .clock_div.

For example:
github.com/raspberrypi/pico-sdk@079c6f3902/tools/pioasm/test/amethyst.pio (L11)

Before this change, pioasm yields 921 for the fractional part of 3.6:

sm_config_set_clkdiv_int_frac(&c, 3, 921);

This causes GCC to complain:

amethyst.h:90:42: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '921' to '153' [-Woverflow]
   90 |     sm_config_set_clkdiv_int_frac(&c, 3, 921);

After this change, pioasm correctly yields 153:

sm_config_set_clkdiv_int_frac(&c, 3, 153);
Closes #3189 Fixes the pioasm fractional logic for `.clock_div`. For example: https://github.com/raspberrypi/pico-sdk/blob/079c6f39023649b154152db30f1d781e884879bc/tools/pioasm/test/amethyst.pio#L11 Before this change, pioasm yields 921 for the fractional part of 3.6: ```c sm_config_set_clkdiv_int_frac(&c, 3, 921); ``` This causes GCC to complain: ```text amethyst.h:90:42: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '921' to '153' [-Woverflow] 90 | sm_config_set_clkdiv_int_frac(&c, 3, 921); ``` After this change, pioasm correctly yields 153: ```c sm_config_set_clkdiv_int_frac(&c, 3, 153); ```
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'jacobmarble/fix/pioasm-clock-div-frac:jacobmarble/fix/pioasm-clock-div-frac'
git switch 'jacobmarble/fix/pioasm-clock-div-frac'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'develop'
git merge --no-ff 'jacobmarble/fix/pioasm-clock-div-frac'
git switch 'jacobmarble/fix/pioasm-clock-div-frac'
git rebase 'develop'
git switch 'develop'
git merge --ff-only 'jacobmarble/fix/pioasm-clock-div-frac'
git switch 'jacobmarble/fix/pioasm-clock-div-frac'
git rebase 'develop'
git switch 'develop'
git merge --no-ff 'jacobmarble/fix/pioasm-clock-div-frac'
git switch 'develop'
git merge --squash 'jacobmarble/fix/pioasm-clock-div-frac'
git switch 'develop'
git merge --ff-only 'jacobmarble/fix/pioasm-clock-div-frac'
git switch 'develop'
git merge 'jacobmarble/fix/pioasm-clock-div-frac'
git push origin 'develop'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!3190
No description provided.