Search found 20 matches

by jim
Thu Jul 28, 2022 6:55 pm
Forum: MicroPython pyboard
Topic: Why is the interrupt queued?
Replies: 5
Views: 22512

Re: Why is the interrupt queued?

Roberthh wrote:
Wed Jul 27, 2022 9:57 am
The IRQ handler schedules the callback. If you use the option hard=True in setting up the Pin.irq, zhen the call is made immediately and not scheduled.
What is the behavior of pyb.ExtInt(), which doesn't seem to use this option?
by jim
Fri Jun 10, 2022 6:43 pm
Forum: General Discussion and Questions
Topic: Fast/efficient alternative to bytearray.index()?
Replies: 18
Views: 8118

Re: Fast/efficient alternative to bytearray.index()?

martincho wrote:
Thu Jun 09, 2022 5:07 pm
Anyone know how to get PyCharm to understand MicroPython assembler and not torture me with this view?

Code works fine, it's just PyCharm that isn't happy at all.
Add the comment

Code: Select all

# type: ignore
near the top of the file. Should work with most editors, though I haven't used PyCharm.
by jim
Tue Feb 08, 2022 11:07 pm
Forum: Programs, Libraries and Tools
Topic: VS Code Pymar microython
Replies: 9
Views: 34271

Re: VS Code Pymar microython

Language and lint checking can be disabled for individual lines by appending "type: ignore" as a comment. For example: import machine # type: ignore This will also cause any machine.[*] call to not trigger a warning. Checking for an entire file can be disable by putting the same as a line comment at...
by jim
Fri Feb 04, 2022 3:33 pm
Forum: MicroPython pyboard
Topic: How to use CRC on STM32 Hardware
Replies: 1
Views: 4513

Re: How to use CRC on STM32 Hardware

This was super helpful for me. Thank you.
by jim
Wed Nov 10, 2021 8:58 pm
Forum: General Discussion and Questions
Topic: Trying to understand f-strings...
Replies: 5
Views: 2554

Re: Trying to understand f-strings...

Would this work for your needs?

Code: Select all

def foo(s=None):
    v = 4.2
    if s is None:
        s = f"{v}"
    print(s)
by jim
Fri Aug 27, 2021 5:21 pm
Forum: Pyboard D-series
Topic: Can I specify the number of bytes to read into an over-sized buffer via SPI?
Replies: 10
Views: 25206

Re: Can I specify the number of bytes to read into an over-sized buffer via SPI?

That's a good idea. Thanks.

For this particular case, it would be sufficient if an optional integer could be passed to spi.readinto() to specify the number of bytes to read.
by jim
Fri Aug 27, 2021 3:43 pm
Forum: Pyboard D-series
Topic: Can I specify the number of bytes to read into an over-sized buffer via SPI?
Replies: 10
Views: 25206

Re: Can I specify the number of bytes to read into an over-sized buffer via SPI?

Thanks much for creating the issue. Indeed, we're streaming data too frequently for micropython.schedule(). As a workaround, I was able to pre-allocate buffers for all the potential buffer sizes (it turns out there are only a handful, but that might go up in the future), and use the buffer that matc...
by jim
Thu Aug 26, 2021 10:52 pm
Forum: Pyboard D-series
Topic: Can I specify the number of bytes to read into an over-sized buffer via SPI?
Replies: 10
Views: 25206

Re: Can I specify the number of bytes to read into an over-sized buffer via SPI?

The .readinto(mv[0:N]) generates a heap allocation exception. Here's how I set it up: In __init__(): self.header_buffer = bytearray(self._HEADER_BUFFER_SIZE) # (4 bytes) self.cargo_buffer = bytearray(self._CARGO_BUFFER_SIZE) self.cargo_memoryview = memoryview(self.cargo_buffer) self.number_of_bytes ...
by jim
Wed Aug 25, 2021 9:07 pm
Forum: Pyboard D-series
Topic: Can I specify the number of bytes to read into an over-sized buffer via SPI?
Replies: 10
Views: 25206

Re: Can I specify the number of bytes to read into an over-sized buffer via SPI?

This is the kicker. I can't figure out how to read only the number of bytes specified in the header. The spi.readinto call will keep reading to fill the buffer (which results in filling out the unnecessary part at the end with zeros). By using the largest possible buffer, I'm always taking the time ...