Thanks to visit codestin.com
Credit goes to github.com

Skip to content

extmod/machine_signal: Add signal_print() as repr() function. #12291

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IhorNehrutsa
Copy link
Contributor

Test code is:

from machine import Pin, Signal
signal22= Signal(Pin(22, mode=Pin.OUT))
signal22
signal21= Signal(Pin(21, mode=Pin.IN), invert=True)
signal21

Ounput is:

Signal(Pin(22))
Signal(Pin(21), invert=True)

instead of

<Signal>
<Signal>

@github-actions
Copy link

github-actions bot commented Aug 23, 2023

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:  +184 +0.023% standard
      stm32:   +80 +0.020% PYBV10
     mimxrt:   +72 +0.020% TEENSY40
        rp2:   +88 +0.027% RPI_PICO
       samd:   +76 +0.029% ADAFRUIT_ITSYBITSY_M4_EXPRESS

@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #12291 (c9843c3) into master (a00c9d5) will decrease coverage by 0.04%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master   #12291      +/-   ##
==========================================
- Coverage   98.43%   98.39%   -0.04%     
==========================================
  Files         158      158              
  Lines       20978    20985       +7     
==========================================
  Hits        20649    20649              
- Misses        329      336       +7     
Files Coverage Δ
extmod/machine_signal.c 77.77% <0.00%> (-14.33%) ⬇️

@IhorNehrutsa
Copy link
Contributor Author

@jimmo
Could you give your opinion about this PR?

Copy link
Member

@jimmo jimmo left a comment

Choose a reason for hiding this comment

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

Thanks @IhorNehrutsa -- I think this is useful.

Having this is useful for debugging and we already do it for Pin, so Signal should match. If all this printing support is too much code size we could consider making it a build option (e.g. MICROPY_PY_MACHINE_DETAILED_PRINTING) similar to how we do terse/detailed error messages.

Test code is:
```
from machine import Pin, Signal
signal22= Signal(Pin(22, mode=Pin.OUT))
signal22
signal21= Signal(Pin(21, mode=Pin.IN), invert=True)
signal21
```
Ounput is:
```
Signal(Pin(22))
Signal(Pin(21), invert=True)
```
instead of
```
<Signal>
<Signal>
```

Co-Authored-By: Jim Mussared <[email protected]>
Signed-off-by: IhorNehrutsa <[email protected]>
@projectgus
Copy link
Contributor

This is an automated heads-up that we've just merged a Pull Request
that removes the STATIC macro from MicroPython's C API.

See #13763

A search suggests this PR might apply the STATIC macro to some C code. If it
does, then next time you rebase the PR (or merge from master) then you should
please replace all the STATIC keywords with static.

Although this is an automated message, feel free to @-reply to me directly if
you have any questions about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants