Skip to content

PWM from 10845 and time_hardware_pulse_us() and test from 16147. #16161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

IhorNehrutsa
Copy link
Contributor

@IhorNehrutsa IhorNehrutsa commented Nov 5, 2024

Do not merge to the master.
Only for tests.

Merged form:
esp32/PWM: Reduce inconsitencies between ports. #10854
machine: Add time_hardware_pulse_us function. #16160
tests/extmod_hardware: Add a test for machine.PWM freq and duty. #16147

The results of the ESP32 tests are on:
50Hz -10kHz, step 12.5% of duty tests/extmod_hardware/machine_pwm_esp32_50_10k.exp
1Hz - 40MHz, step 25% of duty tests/extmod_hardware/machine_pwm_esp32_1_40M.exp

dpgeorge and others added 9 commits November 4, 2024 16:56
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
The difference from `time_pulse_us` is that if the pin is initially equal to *pulse_level*
then `time_pulse_us` counts the pulse duration immediately,
but `time_hardware_pulse_us` first waits the different *pulse_level*,
then waits the equal to *pulse_level* and then counts pulse duration.

Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
@IhorNehrutsa IhorNehrutsa marked this pull request as draft November 5, 2024 15:52
Copy link

github-actions bot commented Nov 5, 2024

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:   +88 +0.010% standard
      stm32:   +68 +0.017% PYBV10
     mimxrt:   +72 +0.020% TEENSY40
        rp2:   +56 +0.006% RPI_PICO_W
       samd:   +68 +0.025% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@robert-hh
Copy link
Contributor

You can always make these test on local instances of the repository. No need to go to github and waste processing time.

IhorNehrutsa and others added 11 commits November 6, 2024 00:06
#define TEST_JITTER 0
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
The difference from `time_pulse_us` is that if the pin is initially equal
to *pulse_level*
then `time_pulse_us` counts the pulse duration immediately,
but `time_hardware_pulse_us` first waits for the different *pulse_level*,
then waits the equal to *pulse_level* and then counts pulse duration.

Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
Co-Authored-By: Robert Hammelrath <12476868+robert-hh@users.noreply.github.com>
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 98.56%. Comparing base (39538e4) to head (fba7b3b).
Report is 29 commits behind head on master.

Files with missing lines Patch % Lines
extmod/machine_pulse.c 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #16161      +/-   ##
==========================================
- Coverage   98.57%   98.56%   -0.01%     
==========================================
  Files         164      164              
  Lines       21349    21354       +5     
==========================================
+ Hits        21045    21048       +3     
- Misses        304      306       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

IhorNehrutsa and others added 16 commits November 14, 2024 13:46
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
Co-Authored-By: Robert Hammelrath <12476868+robert-hh@users.noreply.github.com>
Co-Authored-By: Andrew Leech <3318786+andrewleech@users.noreply.github.com>
If the pin is initially equal to *pulse_level* then first waits until
the pin input becomes different from *pulse_level*.
Then the function waits until the pin input becomes equal to *pulse_level*,
then the func counts the duration that the pin is equal to *pulse_level*.

Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
Co-Authored-By: Robert Hammelrath <12476868+robert-hh@users.noreply.github.com>
If the pin is initially equal to *pulse_level* then first waits until
the pin input becomes different from *pulse_level*.
Then the function waits until the pin input becomes equal to *pulse_level*,
then the func counts the duration that the pin is equal to *pulse_level*.

Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
Co-Authored-By: Robert Hammelrath <12476868+robert-hh@users.noreply.github.com>
@IhorNehrutsa IhorNehrutsa deleted the PWM_and_Time_hardware_pulse_and_Test branch February 19, 2025 08:11
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.

3 participants