Skip to content

Commit

Permalink
chg: Add support to set PWM frequency in STM32 Qemu based boards.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcgamboa committed Aug 24, 2024
1 parent 1346954 commit 4b81058
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/linux-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ jobs:
- name: build_all_static
run: bscripts/build_all_static.sh

- name: package artifacts
- name: package artifacts deb
run: |
bscripts/build_package.sh
- name: package artifacts appimage
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
bscripts/build_appimage.sh
- uses: actions/upload-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ PACKAGE=picsimlab
MAINVER=0
MINORVER=9
VERSION=0.9.2
DATE=240818
DATE=240824
VERSION_STABLE=0.9.1
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ modules:
branch: master
- type: git
url: https://github.com/sammycage/lunasvg.git
branch: master
branch: v2.4.1
dest: lunasvg
modules:
- name : wxgtk
Expand Down
8 changes: 8 additions & 0 deletions src/boards/board_Blue_Pill.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,14 @@ void cboard_Blue_Pill::PinsExtraConfig(int cfg) {
// printf("TIM %i chn %i dut set to %i\n", timer +
// 1, chn + 1, duty);
bitbang_pwm_set_duty(&pwm_out, (timer << 2) + chn, duty);
} else if ((cfg & 0xF00000) == 0xD00000) { // timer frequency
int freq = (cfg & 0xFFFFC) >> 2;
int timer = cfg & 0x0003;
// printf("TIM %i freq set to %i\n", timer + 1, freq);
bitbang_pwm_set_freq(&pwm_out, timer + 0, freq);
bitbang_pwm_set_freq(&pwm_out, timer + 1, freq);
bitbang_pwm_set_freq(&pwm_out, timer + 2, freq);
bitbang_pwm_set_freq(&pwm_out, timer + 3, freq);
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/boards/board_STM32_H103.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,14 @@ void cboard_STM32_H103::PinsExtraConfig(int cfg) {
// timer + 1, chn + 1,
// duty);
bitbang_pwm_set_duty(&pwm_out, (timer << 2) + chn, duty);
} else if ((cfg & 0xF00000) == 0xD00000) { // timer frequency
int freq = (cfg & 0xFFFFC) >> 2;
int timer = cfg & 0x0003;
// printf("TIM %i freq set to %i\n", timer + 1, freq);
bitbang_pwm_set_freq(&pwm_out, timer + 0, freq);
bitbang_pwm_set_freq(&pwm_out, timer + 1, freq);
bitbang_pwm_set_freq(&pwm_out, timer + 2, freq);
bitbang_pwm_set_freq(&pwm_out, timer + 3, freq);
}
}

Expand Down

0 comments on commit 4b81058

Please sign in to comment.