#circuitpython-dev
1 messages ยท Page 376 of 1
[adafruit/circuitpython] New comment on pull request #4878: setup\.py: Improve installation of stubs
I will check the rtd build in a bit (not sure when it's triggered).
@idle owl we are all set with RTD now
Unfortunately, an asynchronous callback like that is not possible right now. It is sort of the the same reason we don't support interrupts. It could perhaps be done in some kind of event loop system like evento.
[adafruit/circuitpython] New comment on pull request #4878: setup\.py: Improve installation of stubs
@ladyada this is ready for testing if you're inclined & have the hardware. I also need to re-test the other boards, since the constructor was changed and I shouldn't be too confident I didn't introduce problems there.
@ladyada this is ready for testing if you're inclined & have the hardware. I also need to re-test the other boards, since the constructor was changed and I shouldn't be too confident I didn't introduce problems there.
oops that was on the wrong pull!
I think we've been keeping up with these? but maybe there's an API way to help. https://github.blog/changelog/2021-05-06-github-actions-beta-api-to-approve-actions-from-forks/ -- though you'd also need a way to list the ones requiring approval, hm
@onyx hinge Thanks, Jeff! Here is the new tag: https://github.com/v923z/micropython-ulab/releases/tag/3.0.0
This release of
ulabadds a new module,scipy.linalg, with two functions, and theemptyarray constructor function on thepythonside, and implementsnumpy-compatible handling ofndarrayproperties. In addition, it also fixes a number of bugs. More details can be found in the change log.
@ptorrone new board added (PGA2040)
Is there a way to make it so the default download for my CP Sapling Revb is the 6.3.0 release and now the 7.0 Alpha?
I may have did something wrong on my copy for the revb
your revb was added as a new board after 6.3.0 was finalized, so there is no 6.3.0 build for it. if/when we do a 6.3.1, we could add it
ah, okay that makes sense
@onyx hinge to run your parallel capture on the kaluga with an ov7670 -- did you add pullups to the ov7670? Your note i the code says it was unmodified. Or did you just add pullups to the SCL/SDA pins externlly.
I didn't add pulls. I think there's another i2c device with pull ups on the board
I got it working with pullups
having some issue with the display
the image is split and does not use the whole screen - I wonder if I have a different version of the display board.
Are you using the one that came with the Kaluga?
@jepler I tried this code with the updated ov7670 library on my Kaluga 1.3 -- It "works" but the display is a bit confused.
I wonder if my simply board is the same as yours
Here is the funky image

The pull ups are on the audio board which is originally between the main board and the LCD board so if you remove that from the stack you will have to add your own
There are at least two versions of the LCD screen, probably you have the other
Though I may also have messed up the init code while preparing the example in the pr, I originally had it in a separate file
ah - good to know about the audio board -- I'll put it back in. My display seem to have a different screen size -- I'm looking for some docs...
Still -- off to a great start!
Thanks for getting this going.
Thank you for testing, it can be so helpful
My pleasure -- I learn a lot from doing this.
Cool! it does work with the audio board and no pullups!
Good to know
hmm -- If I swap the height/width setting , then I get a normal image, but the camera size is reduced to 160 x 120 -- progress
Adafruit CircuitPython 7.0.0-alpha.3-55-g2cbdd18a2 on 2021-06-10; Kaluga 1 with ESP32S2
>>>
>>>
>>> import ov7670_test
240 320 160 120
fps 6.25582

@slender iron @tulip sleet who's the best person to talk to about the set-next-file stuff? I've finished reading all the context and I'm merging the PR with all the changes from main, but I have some questions/comments about how it's going to interact with deep sleep and what's acceptable in terms of non-volatile data storage
since Scott is out for a while, you can talk to me. I have thought about it a little.
The particular thing I'm mulling over is the storage of stuff in sleep memory, because that's a feature that actually involves per-port hardware and is not always easy to implement - for instance, the RP2040 does not have sleep memory at the moment and I really don't know how I'm going to go about implementing it
Even in the case where we do use sleep memory, it becomes a case where Circuitpython starts absorbing resources that are normally user accessible. I could treat the storage of critical variables like next-file and exception-reason as a sort of mini-heap, that extends from the end of the sleep memory and reduces the available size?
But if a port doesn't have sleep memory implemented, or doesn't have sleep at all, is next-file a feature that could afford to have port-level not-implemented errors?
or do we really want to stress that it's universal, and make sure it's available at least through the heap methods no matter what?
you can use the "storage_allocation" mechanism to reserve blocks of memory before the heap is allocated. It can reposition this memory in some cases, if that's necessary. I don't think it's a good idea to write to flash. You might look at the mechanism I used for boot.py to allow some variable-sized storage to live between VM instantiations. I save space on the stack, copy from the first VM up to stack array, and then back down to the next VM
I think sleep stuff is orthogonal to run-next. There are uses for it that have nothing to do with sleep, such as just switching between several main programs. E.g. start a menu program, choose what to run, and restart.
Thinking about it, I think my primary worry here is mostly just the RP2040, which should probably just get reworked to not actually reset on deep_sleep. It's causing a lot of problems and I think the justifications for it is fuzzy
Is this something that can be turned into a list comprehension somehow? py for p in ports: if p.pid is not None: print("Port:", p.device, "-", hex(p.pid), end="\t") if p.pid == 0x8101: rotary_trinkey_port = p print("Found rotary trinkey!") break else: print()
not with all the print()'s no, that code looks fine as is
Thanks.
you could just do if p.pid: without checking for None explicitly, but for a beginner, maybe that check is better
@tulip sleet I would not be using flash regardless, the ESP32 and STM32 sleep memory is just low power ram that doesn't get erased by sleeping. But the relevance of sleep is that when a "sub-program" wakes up from deep sleep, you probably don't want it to return to the menu - you'd want it to restart the same program. But that can't be done with deep sleep unless set-next is stored either in nvm or the sleep memory sector.
Oh hmm. Ok. Fair enough.
Having programs that deep sleep force a return to a menu strikes me as possibly being a really big inconvenience to people - it basically would mean that sub-programs can't autonomously deep sleep at all.
@idle owl also you are doing a break once you find the thing, so a comprehension is not a good choice, since you can't break out of a comprehension.
Oh good to know. It's not my code, so I was working mostly with the if not None part, and it felt comprehensionable. So I asked. Thank you.
if you could store 32-64 bytes for the filename, that's good enough (maybe less)
I don't think I can guarantee 64 bytes of scratch register access across ports.
the user might need to use some different mechanism them, like managing the restart themselves. So they do restart to the main program, and choose the menu item based on one byte in sleep memory, and then restart that immediately.
One option I haven't seen discussed is whether a set-next file could simply be stored as an index
it could be some kind of index into the filesystem, but if the filesystem changes out from under you, bad things will happen. It would have to be cleared on any write
Is there a reason it needs to be stored as a string? Can't we just search the directory, sort it in a reliable way, and store the index of the file? Same with exceptions, just store an enum
it could be anywhere in a tree of directories, not just at the top level. It's a pathname, not a filename
point taken. That could be a lot of repeated searches.
if you do it every time the fs is updated
more likely, you could store some filesystem internal index into the directory metadata
you could just give up if the filesystem changes.
maybe you can just say that you can't use run-next across deep sleep, though i guess that might have been a strong motivation for this
But that still assumes storing it on the filesystem. The index approach would be to try and get the next-file to fit in a scratch register bank
no, i mean like look in directory block nnn, and then look at an offset in there. It requires understanding the FAT structure
It's sort of the other way, you're saying that you can't use deep sleep in run-next programs, which doesn't sound great to me
Going back to the 320x240 (as opposed to 240x320) but adding a 90 degree rotation to the displayio init gives me a full screen. I guess it is just something about this display.
Adafruit CircuitPython 7.0.0-alpha.3-55-g2cbdd18a2 on 2021-06-10; Kaluga 1 with ESP32S2
>>>
>>>
>>> import ov7670_test
320 240 320 240
fps 2.50424
full screen picture
:
File "/Users/kattni/.virtualenvs/slidertrinkey/lib/python3.9/site-packages/serial/serialposix.py", line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: 'cu.usbmodem14241401'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/kattni/AdafruitDev/Slider Trinkey Code/ST_huebrightness.py", line 23, in <module>
trinkey = serial.Serial(p.name)
File "/Users/kattni/.virtualenvs/slidertrinkey/lib/python3.9/site-packages/serial/serialutil.py", line 244, in init
self.open()
File "/Users/kattni/.virtualenvs/slidertrinkey/lib/python3.9/site-packages/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port cu.usbmodem14241401: [Errno 2] No such file or directory: 'cu.usbmodem14241401'```
It's code that uses pyserial to talk to a Slider Trinkey. Should there be code running on the Trinkey or something? I wasn't given any associated code.py.
along with everything else on the chip except the scratch registers, and maybe even those because I still can't seem to get them to relay the wakeup cause properly
@idle owl no /dev/ as a prefix to tty name?
@solar whale Wrong channel.
I have no idea how to add it? It sees it earlier in the code....
@solar whale [responding to your message from another channel, probably there by mistake]
@Jeff E. (he/they) In Monday's meeting it sounded like you were all set to abandon the OV7670. Has it been given a new lease o life or is this just a temporary revival?
I was having trouble with the OV2640 so getting the OV7670 back out was a way to remove an unknown variable
This is printed immediately before it @tulip sleet Port: /dev/cu.usbmodem14241401 - 0x8102 Found rotary trinkey!
I was simultaneously trying to get the OV2640 register configuration AND the esp32-s2 parallel capture going
And I can screen to that address and it works.
@onyx hinge thanks -- sorry about the channel confusion
isntead of p.name, there is another attribute you can use that's the complete pathname
hold on a minute, i'll look it up in a minute
I wish Discord had a bookmark function for stuff you want to remember
That's what it's printing earlier, so I tried it.
Now onto another failure ๐
Thanks Dan!
so I could pin tech suggestions
@solar whale getting back to configuring the OV2640 is probably next
Adding Community libraries list
Thanks
@ionic elk the reason for a full reset is to get everything in a known state, is that right? Could we do that "manually"?
i'm not so worried about the NORETURN thing. That could be conditional compilation or something. I think we could figure that out.
@tulip sleet Yeah, I guess so. I don't know why it would be that urgent for deep sleep to get things into more of a "known state" than a regular reload or even fake deep sleep would do
i think mostly reset pins and peripherals
that's done anyway, though, by the usual functions on reload
When you fake deep sleep, it still runs port_reset() and all that stuff
yeah, so it's the NORETURN thing. I have to be afk for a while, but I think rethinking that issue is where to go
It's the point of NORETURN.
All good you've been very helpful in thinking this through, I appreciate it
Well it made me laugh. ๐
you win discord for today ๐
it is a perfect interjection
Now can someone please go hit the button on my Hue bridge? It has to be pressed within 30 seconds of running the code, and unless I inherited something from Flash Gordon, there's literally no way for me to make it back from the basement in 30 seconds.
can your cats help out?
Hilariously, when you register it in the app, it shows a cat paw pressing the button in the app.
But no, they are not interested.
Brian will be home eventually. I'm being impatient.
program a Circuitpython to poke it
lol. Overengineering 101.
do you have a laptop you could take down to the basement instead?
Honestly having a generic thing-booper around the house would probably be handy
give it a little enclosure, have some offsets that could put it at angles, pair with a ziplock of Command strips...
or can you temporarily move the hub to the area where you're working?
Hmm not sure if it's portbound. We have a.... fancy setup.
Hah right?
I guess I could de-couple the laptop from its life support system. I feel like that's more annoying than waiting though. So I guess waiting wins out.
maybe if you put the thing inside this, and modify the claw to be the thing-poker?
Home-claw-game for when you want to waste time not getting the thing you want in your own home.
I'm imagining a ESP32-S2 thing booper product now, give it a little silicon finger, WiFi access, rechargeable battery, time or trigger options...
and paperclip attachment for those hard-to-poke buttons
It being a finger seems a little uncanny valley, except in a dismembered sort of way.
But it's absolutely getting called the Thing Booper though.
https://www.adafruit.com/product/3529 I wonder if these kinds of arms are rigid enough plus one of these https://www.adafruit.com/product/2776
Just when we begin toย think that Hobby Creek couldn't possibly offer another third hand product that would raise the bar of awesome-ness, they go ahead and do it!ย The Mag Hand ...
Solenoids are basically electromagnets: they are made of a coil of copper wire with an armature (a slug of metal) in the middle. When the coil is energized, the slug is pulled into the ...
You can buy the material used in those arms separately. There were folks DIYing that setup.
yeah under names like "loc-line" I think
This is the same concept and would handle a solenoid bounce. https://www.quadhands.com/collections/all/products/quadhands-magnetic-arm-200
QuadHandsยฎ
12" Overall Length Magnetic Base Flexible Armย
ย
The perfect add on item for your QuadHands or QuadHands WorkBench is the 12 inch, magnetic arm 200. Easily add an additional flexible all metal arm to your QuadHands or ferrous surface and place it exactly where you want.
Ultra strong rare earth (N52) magnet adheres well to any QuadHands product a...
(I have a quadhands setup at all my workstations)
ooh
@onyx hinge thanks for all the work on the kaluga! Mine has sat on my shelf until now. Iโm looking forward to using it. I did the sdk demos when I got it, but was not very excited about it. Using it with CP will be fun!
@solar whale you should figure out how to upload the camera photos as a bmp over the wifi
to make a ... combination photo booth & doorbell?
@candid sun Hey! FYI, the Learning System Guides repo has moved to main. Easiest option is to delete your local clone and your remote fork and start fresh. Here is how to do that: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/starting-over-fresh That guide also has how to do it manually if you really want to. Let me, Dylan or Anne know if you have any questions.
Thank you! Coincidentally I was just moving my personal repos to main today ๐ธ
Nice! You're welcome. Let me know if the guide is unclear in any way as well - it's a new page I did up this morning, so feedback is welcome.
Will do!
I fully understand the problem of [not] having callback to save "event" taking place while the user code is doing something.
In the following PR #4877 you talk about gamepad that remember the event:
gamepad is different. It works in the background and remembers all the buttons that were ever pressed.
So maybe similar mechanism can be put in place to store what occurred and store reports (at least a few) for later processing.
Would that answer @ATMakersBill usecase and bypass the a...
It looks like some builds are too full now, I'll investigate in more depth soon
To everyone who contributes to the Community Bundle, there is a PR into cookiecutter to add a CircuitPython Community Code of Conduct. Please take a look at https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/144 and provide any feedback as to what you would like to see. It is currently a barely-modified version of the Adafruit Community CoC, and will need some changes to work as a Community CoC, and I would appreciate any input you might have. Thanks!
followed along with the page for the Learn repo. great addition! very clear
@tannewt @ladyada ,
I have been emailing back and forth with Arduino about the TLS issues experienced between both languages. The issue seems to somewhat be corrected as of right now. The WifiSSLClient sketch that I run is now able to connect and retrieve the site data for a google search query over HTTPS. The oddity is that in the process of getting the code to work, I switched the access point I was using which no longer used '8.8.8.8' and '8.8.4.4' as it's DNS servers, and started h...
@jepler On my display, I found that if I uses the "standard" ILI9341 Init sequence then I get the full display filling the screen similar to what I get with the 90 degree rotation with your init sequence.
In your modification to in the init sequence, you are changing the MV and ML bits of the Memory Access control register from the defaults. Was that just trial and error for your display?
Also, why is the color depth in your example set to 65535 and not 65536? Just curious. It does not s...
@solar whale I was trying to avoid using a displayio rotation, which is why I modified the MADCTL register, but evidently it doesn't work everywhere or my copypaste version of the script messed up. 65535 is just my mistake, I guess.
it might prevent "the whitest white" from showing properly
(avoiding displayio rotation is PROBABLY superstition, except when using OnDiskBitmaps where it can affect performance extremely negatively)
OK, I tested with rp2040 and samd51 and they both work after updating the lib & example!
bus = busio.I2C(board.D24, board.D25, frequency=10_000)
dev = I2CDevice(bus, 0x30)
with dev as i2c:
i2c.write(bytes((reg, val)))
I was running code similar to the above, but my scope showed me that the SCK signal was 238kHz.
Description
I was looking for ways to optimize some of my programs. It turns out that function calls and list comprehensions are pretty costly. Is there any syntax to do some inlining maybe?
Firmware
Adafruit CircuitPython 6.3.0 on 2021-06-01; Raspberry Pi Pico with rp2040
Code/REPL
Let's start with this, which runs at 41 Hz:
import time
def mul(x, p):
return x*x*p
def vect(x):
return [mul(x, p) for p in [2,3,5]]
che...
Anyone have a Slider Trinkey and a Windows machine, want to test a script for me? I'm on a Mac and apparently it's not supported by the Python library this script uses. It's designed to use the Slider Trinkey to change your monitor brightness. Involves both CircuitPython and Python.
When the code in the function is small, the overhead of the call becomes significant. Also you are avoiding storage allocation: you are no longer creating lists in your last example.
Try using monotonic_ns() instead of monotonic(), to avoid software floating point.
Python has never been particularly fast. If you try the same thing in CPython, you may get similar relative differences.
I'm going to remove the bug label because this is not a bug.
i could do that
Ok, thanks. Here's the two files.
For the Slider Trinkey
To run from your computer.
@tulip sleet Actually try this one.
Because the value the Trinkey is returning is 0-100 already.
This is going to be annoying to troubleshoot if it fails for you. It failed in my VM.
But I have 0 knowledge of the state of the Python situation in that VM. pip worked and so did python so there's something. But the code fails on import.
i have to install python on my laptop ๐
Ah fair enough.
@idle owl it works! of course had to do:
pip3 install screen-brightness-control pyserial first
I am using the python.org python installer, not the MS store installer. If I remember right, one installs as python3 and the other as python. Not sure about pip vs pip3
I pip installed screen-brightness-control and it installed pyserial in my VM. But I won't trust that to work.
Ok
I usually say "pip, or maybe you need pip3"
or some such.
python.org installed as python, not as python3.
Right. Thanks!
anyway it works fine once all the pre-reqs are there. screen-brightness-installer did not bring in pyserial when i installed it
Heh, yeah
Looking for suggestions to replace the word master for I2C, is Controller ok?
we have been using "main"
see several paragraphs down here, for instance: https://learn.adafruit.com/circuitpython-basics-i2c-and-spi/i2c-devices?view=all#i2c-protocol-2837704-1
main and peripheral
Thanks Danh, is to correct another learning guide (y)
I'm also having this issue on:
- latest 6.3.0 CircuitPython & libraries
- adafruit clue board (nrf52840)
Closing this because I have a Better Idea of how to do background scanning and representing scan results independent of scan method.
I'm back trying to start a port for bcm2711, I thought the mpy port would be a good start but quickly realized that CPY differs hugely in terms of api and how the ports are setup. So I'm now trying to build a makefile from scratch to get the bare minimum working. The cpy makefiles seem to call a bunch of python scripts and I'm currently getting the following error, feeling like some variable might not be set correctly but not sure how to debug this.
make: *** No rule to make target '=', needed by 'build-PI4/genhdr/qstr.split'. Stop.
Full log: https://pastebin.com/j0rC0FNJ
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
py/mkrules.mk:$(HEADER_BUILD)/qstr.split: $(SRC_QSTR) $(SRC_QSTR_PREPROCESSOR) $(QSTR_GLOBAL_DEPENDENCIES) | $(HEADER_BUILD)/mpversion.h $(PY_SRC)/genlast.py you have an incorrect value in one of these variables that qstr.split depends on. If you've added this in your Makefile, you can make print-SRC_QSTR to see the value in the SRC_QSTR variable, for instance: ```make
Print out the value of a make variable.
https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
print-%:
@echo $* = $($*)
from there you can hopefully trace what is going on. If I had to make a totally random guess, you have multiline variables like ```make
A =
B
C
X =
Y
Z
(you can either leave the \ off the last line, or you can insert a blank line. Some favor having the blank line so that every line in a multiline variable assignment consistently has a backslash at the end, and when MODIFYING makefiles to add something to the end you don't need to also add the backslash to the previous line. This is a matter of preference, but if there's a prevailing style in CircuitPython we'd appreciate if you tried to follow it)
@crude blaze ^
There are other ways it could occur but that's my best guess
looking at my makefile it seems to be all ok regarding multiline statements, both a blank line and no \ at the end of the last line in all cases
given that it is looking for a target named "=" that sounds like something doesn't get passed to that makefile maybe
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
anyway to find out what variable that could be that tells mkrules.mk to build target "="?
my knowledge with cmake is pretty basic unfortunately
like what is the command that is actually calling this makefile, the higher verbosity output is not really giving any clue about that. I'm guessing it must be somewhere in makemoduledefs.py?
all the variables used in the qstr.split target at least not empty, which is somewhat weird
@crude blaze pastebin the full output of make -n -p and I'll look to see what I can see.
oh thats useful, was not aware you could do that ๐
UGH, yes, thank you! ๐
I'll leave all the hard parts to you ๐ you're welcome!
it's a fun project you've taken on
definitely! I hope
I will find enough time to see it through
at the very least I will learn a lot more about the cpy core
now I have the issue that it doesn't seem to link correctly against my cross compile toolchain. Complaining about standard headers like <stdint.h>. In this case being included in ../../py/mpstate.h so can't be an issue with code from the port.
Have I maybe missed something in the toolchain setup? I don't think I ever told it to look there for includes, the only thing being defined is the location of the toolchains bin/ directory set in path and the prefix for the compiler binaries
I don't know.
seems like https://github.com/isometimes/rpi4-osdev never includes a "standard" header file at all
ah yea no, this is from CPY not code related to the bcm2711
Firmware
All CircuitPython versions after :
Adafruit CircuitPython 6.0.1 on 2020-12-28; MakerDiary nRF52840 MDK USB Dongle with nRF52840
are installing and running fine on the nRF52840 Micro Dev Kit USB Dongle.
This is observed by checking boot_out.txt in the root of the CIRCUITPY drive.
However
Starting with version 6.1.0-beta 3 up to version 7.0.0-alpha.3 the comport for the REPL is not working anymore.
Trying to connect ...
I just loaded 6.3.0
uto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.3.0 on 2021-06-01; MakerDiary nRF52840 MDK USB Dongle with nRF52840
>>>
>>>
7,0 alpha.3
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 7.0.0-alpha.3 on 2021-06-03;...
Thank you!
Great that this is not a common problem but most likely a configuration / code problem on my board.
Strange is only that the REPL-COM-PORT stopped working in CircuitPython after 6.0.1.
@jerryneedell How did you get the bootloader version 0.3.2 onto your board?
Did you update it yourself or was the board delivered to you like this?
Can you point me to a download link?
Since your SD is already s140-6.1.1 you may be able to just use the update .uf2 https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/0.5.1/update-mdk_nrf52840_dongle_bootloader-0.5.1_nosd.uf2
I built the bootloader locally -- I cloned the repository https://github.com/adafruit/Adafruit_nRF52_Bootloader
I just updated it to the latest version 0.5.1-2
UF2 Bootloader 0.5.1-2-g881dac1 lib/nrfx (v2.0.0) lib/tinyusb (0.9.0-22-g7cdeed54) lib/uf2 (heads/master)
Model: ...
FYI -- I tried just copying the update...nosd.uf2 file to my board and it still works....
@ThomasAtBBTF I'm curious if you made any progress on this and if I can close this issue?
I should have started by adding a warning that it is good to have a J-Link to rescue things when messing with the bootloader!
I hope you got it working.
Just copying the different UF2 files didnot help and did not change anything.
Trying this:
C:\Users\frieh\AppData\Roaming\Python\Python37\Scripts>adafruit-nrfutil --verbose dfu serial --package mdk_nrf52840_dongle_bootloader-0.5.1_s140_6.1.1.zip -p COM26 -b 115200 --singlebank --touch 1200
Upgrading target on COM26 with DFU package C:\Users\frieh\AppData\Roaming\Python\Python37\Scripts\mdk_nrf52840_dongle_bootloader-0.5.1_s140_6.1.1.zip. Flow control is disabled, Single bank, Tou...
Hi @analog bridge, I hope youโre doing great! I saw your enhancements on the Wi-Fi authmodes, but as per my understanding those also removed the ability to detect if a SSID has WPA-Enterprise or WPA3. Why would it be an enhancement to remove this detection capability?
Ugh! Sorry about that -- So now if you double Tap RESET, it does not mount the Bootloader drive?
I loaded it to mine that way several times this morning. I don't know what else to suggest.
Good luck!
I have something that needs more investigation still but wanted to post what I did find. I got a Saleae and was trying to capture the glitch. I finally managed to get a few instances where an entire line was blank. I noticed that the timing between the column select command and the data was ~36 microseconds.

 but this might help outline how to help do it via micropython: https://forum.micropython.org/viewtopic.php?t=5795
And these: https://learn.adafruit.com/building-circuitpython
https://learn.adafruit.com/debugging-the-samd21-with-gdb
might help extrapolate to circuit python from there
yeah micropython has a minimal port which is a good starting point
pretty sure that was the starting point for the lofive implementation of micropython
Thank you, I looked at the wrong change then. ๐
@scenic jetty there is the porting guide but no template unfortunately https://circuitpython.readthedocs.io/en/latest/docs/porting.html
Leading on from https://github.com/adafruit/circuitpython/pull/4534
pins.c was previously updated, but there was also a reference in mpconfigboard.h that was missed.
SCK = 37
SDI = 36
SDO = 35
?serverinfo
Explains why this was working:
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
but this was not:
spi = board.SPI()
Thanks @crude blaze
@tulip sleet Can Bluetooth 4.0 talk to CircuitPython? There's a thermometer I am thinking of getting that doesn't say BLE, but it says Bluetooth 4.0, which the internet indicates includes BLE, but I don't know how that works.
we don't speak "Classic" Bluetooth. Could you give a link and maybe I could interpret the specs?
Yeah give me a minute and I'll link you.
4.0 includes both, yes, it's not a very useful name
@tulip sleet https://www.thermoworks.com/wand-blue
I have corresponded with Thermoworks about their thermometers. They require exchanging proprietary keys with their Bluetooth-enabled devices. It is BLE but we don't have access to it without signing an NDA.
when I was looking for devices we could talk to they were on the list, but we had to give up because of that
Yeah I sort of remembered that and wasn't sure why you didn't follow through.
Makes sense.
Now I want to go sign an NDA just so I can talk to it ๐
they were more worried about cloning than about their own app. With an NDA they were happy to have you write an app, etc.
Hmm. Wait, cloning what?
that their thermometers would be counterfeited
yeah, they already had a lot of trouble with unauthorized resellers, and maybe some counterfeting, I can't remember. They don't authorize sales through Amazon, for instance.
Yeah I think I knew that. At least their shipping is quite quick though directly.
hmmm -- just stumbled across an issue -- CircuitPythons print function does not recognize the argument flush. This causes some errors in the Fingerprint library example -- easy to fix and I've opened an issue, but should flush be accepted. I ran into this on a CLUE (nRF52840) have not tried other builds. yet...
weird, it looks like it should work (in 7.0 at least) @solar whale
MicroPython 7.0.0-alpha.2-563-g35ee4add6-dirty on 2021-05-13; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> print("hi", flush=True)
hi
mine is on 7.0.0 alpha-2
>>> print("hi",flush=True)
hi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
>>>
I can try latest
hmmmm!
yeah file an issue
I assumed the problem was print() not knowing flush=, but it DOES, only the extra action it tries to perform doesn't work
Just ran across this on CLUE (nrf52840)
using the "flush" argument for print throws an error
Adafruit CircuitPython 7.0.0-alpha.2-527-g47947dc23 on 2021-05-13; Adafruit CLUE nRF52840 Express with nRF52840
>>> print("hi",flush=True)
hi
Traceback (most recent call last):
File "", line 1, in
OSError: [Errno 22] Invalid argument
>>>
hmmm -- may just be on the nRF52840
Adafruit CircuitPython 7.0.0-alpha.3-45-g5f81f9ed1 on 2021-06-13; Adafruit Feather M0 Adalogger with samd21g18
>>> print("hi",flush=True)
hi
>>>
Nope....
Adafruit CircuitPython 7.0.0-alpha.3-45-g5f81f9ed1 on 2021-06-13; Adafruit Feather M4 Express with samd51j19
>>>
>>> print("hi",flush=True)
hi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
>>>
@solar whale yeah by coincidence I had a clue in front of me as well .. so it's only SOME but we don't know the pattern yet. interesting
Is there a weekly meeting today? If so when?
2pm et
Thanks
Hello, all! CircuitPython Weekly meeting is in ~1.5 hours - 11amPT/2pmET. If you'd like to participate, please remember to add your hug reports and status updates to the notes document (linked). Hope to see everyone there! <@&356864093652516868> https://docs.google.com/document/d/10z3OQ1_Pc-cmG-CodmMsbFaebYaV81JSUGb8Tl-ql5o/edit#
Google Docs
CircuitPython Weekly for June 14th, 2021 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to participate,...
I was a minute too late ๐
I believe this is due to:
https://github.com/adafruit/circuitpython/blob/84e1d77664bc7425673f33395a7dd0e53ab0f063/py/stream.c#L494-L496
but I don't know why there is no ioctl support for stdout on those ports. It may just be a typo somewhere.
@onyx hinge Do you have time to test my setup?
sure I can jump in the voice channel @idle owl
Thanks!
Google Docs
CircuitPython Weekly for June 14th, 2021 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to participate,...
Lurking
Lurking as well ๐
Listening - no need to talk
Welcome Bill!
Thanks @turbid radish - will be listening while driving shortly - just want to catch up... Unofficial Hugs to @tulip sleet for all the USB work he's doing!
listening...
Windows makes for a compelling choice for Python developers inย 2021.
#circuitpythonparsec
Here's a quick demo on how fast and easy it is to get CircuitPython up and running on a board with drag-and-drop .UF2 bootloader firmware. Plus, the Project Bundle in the Learn Guide will get you the code, libraries, and assets you need in one single download.
*Please note: "The parsec is a unit of length used to measure th...
๐
The clock traveled the globe as the family moved. The last move it was damaged to the point that only the whistles and gong were salvageable. It's had a difficult 50-year life.
Sounds like a labor of love -- good luck!
Thanks! It's been working for about a year now, but the whistle bellows are beginning to leak.
@idle owl i'm dending the HID consumer codes from this example: https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/main/examples/hid_consumer_control_brightness.py
there are at least 2 or 3 different displays that they ship with the kaluga. there
's no clear way to tell the difference without trying different init code
I've seen intermittent read errors on stm32 with sdioio but pretended I didn't notice it.
Good to know -- they're back....
update-learn and breaking-change sound good to me
will do
Previous topic and the list of PR: "Adafruit_CircuitPython_HID" is there a "standard" way to replace the US Keyboard by something else. I think there are two tentative, one German and one French, but this will never catchup if there is no "infrastructure" or "indication" on the acceptable way to do that.
We need a flag for "unintended consequences" ๐
Thanks everyone! Another meeting in the bag ๐
Looking forward for the video... to find the timestamp of my demo. ๐
@thorny jay we can't add all the world keyboards to the single adafruit_hid package, because it would be too large. I think it would be possible for other keymaps to live in the community bundle, so that they were separately installable according to need. There is sure to have been previous discussion of this, so if I'm contradicting something previously said then I am wrong ๐
Thanks
Thanks
Great!
Then maybe the US keyboard could be optional and out of the HID library. And each and everyone would have to import the layout he need?
@thorny jay I see where you are coming from with that statement, but probably the US keyboard will remain where it is.
Well, the US keyboard take space too, if you are not using it. ๐ except if one can inherit from it to make another mapping more "light". Or I don't know, Adafruit could create the EN_UK keyboard and say: "This is how we believe internationalisation should be done..." and other can just copy cat and adjust the keys in separate library.
the keycode names are chauvinistic in the USB spec and are based on the names of the keys on a US keyboard. that was part of my original motivation for including KeyboardLayoutUS in HID.
(I don't know how many difference there are between US and UK QWERTY keyboard.)
About a pound
Sound like a joke, but I feel it is maybe right. (thinking about it, I wonder if they ever included the โฌ symbole... now it might be too late).
we could factor out KeyboardLayout... and put it in a separate library. That's fine with me, but we need to think then about what to do about having a layout frozen in (or not) on the boards that do freeze an HID library
Well today, I switched to English keyboard for my code to work, because it does : emoji_code :
keyboards are weird, sometimes you want to think of them as reporting the location of the keyswitches that are pressed (for instance, so that those particular 4 keys under your left hand move your character within a game -- americans call those keys WASD after their legends, but what's written on the keys is unimportant) and other times by the effect they should have in "standard programs" (such as inserting the letter written on the keycap itself if the key has "W" written on it)...
there's a related fallacy that maybe there are just a small number of different sets of legends that are ever written on the keys, and you might make a list of all of them as a short-hand
Here is the notes document for Mondayโs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youโll be attending the meeting - itโs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weโll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1YXO2yPKADI2fiEFZTl9ZOgK5pbE890KLIKCZVHq6GIc/edit?usp=sharing
Google Docs
CircuitPython Weekly for Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to participate, add your notes ...
@tulip sleet I don't have time to try to figure this out on my own. Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity. FREEZE ../../frozen/Adafruit_CircuitPython_SimpleMath ../../frozen/Adafruit_CircuitPython_NeoPixel ../../frozen/Adafruit_CircuitPython_HID QSTR updated Traceback (most recent call last): File "/Volumes/circuitpython.git/circuitpython/ports/atmel-samd/../../tools/mpy-tool.py", line 1037, in <module> main() File "/Volumes/circuitpython.git/circuitpython/ports/atmel-samd/../../tools/mpy-tool.py", line 1022, in main raw_codes = [read_mpy(file) for file in args.files] File "/Volumes/circuitpython.git/circuitpython/ports/atmel-samd/../../tools/mpy-tool.py", line 1022, in <listcomp> raw_codes = [read_mpy(file) for file in args.files] File "/Volumes/circuitpython.git/circuitpython/ports/atmel-samd/../../tools/mpy-tool.py", line 776, in read_mpy raise Exception("not a valid CircuitPython .mpy file") Exception: not a valid CircuitPython .mpy file make: *** [build-adafruit_slide_trinkey_m0/frozen_mpy.c] Error 1 make: *** Deleting file `build-adafruit_slide_trinkey_m0/frozen_mpy.c'
Can you please help?
Was I supposed to update make or something?
Or mpy-cross?
rebuild mpy-cross
it doesn't get rebuilt automatically
cd ..../mpy-cross; make clean;make
Oh I didn't do make clean first just now.
make clean may not be necessary, but sounds like it is
@tulip sleet It worked without the clean. ๐คทโโ๏ธ
Per discussion with Limor. Tested successfully.
[adafruit/circuitpython] Pull request review submitted: #4889 Add A0 as alias to potentiometer pin\.
Put blank lines before and after groups of aliased pins.
I will stop the first builds after a new commit is pushed.
@idle owl I can fix up the formatting if you are too busy
@tulip sleet I pushed it already?
i was expecting a message here, for some reason, never mind
yeah, just my fuzzy headedness, np
mind if I ask why you requested newlines between the aliased pins? Style guide adherence?
that style is in my head
Some boards have a bunch of aliases, etc. This board is a simple example, where, yeah there's only 4 things in there, so it's not bad. But to match what we do elsewhere, it should be the same.
it's easier to double-check that aliased pins are truly the same
I completely missed the file the edit was on, that makes a lot of sense now, thank you!
i have made dozens of board pin defs, and have to triple-check them against the schematic. Anything that helps to catch copy/paste errors is good.
You're welcome! Thank you for asking.
Does someone offhand remember the function to sleep a few microseconds? Trying to debug something and want to introduce a delay on purpose
Ah its okay I found it (common_hal_mcu_delay_us(1)) for anyone else ever looking
Hi everyone, I am porting circuitpython to SAML21, but I am problem with clock configuration and USB, apparently the clocks work but I can't get the USB to work, anyone have any experience with this?, thanks
not on SAML21. If you can try a TinyUSB example (without CircuitPython) on SAML21 and get it to work, you may be able to compare what it is doing with what the atmel-samd port is doing.
oh, thank, I trying with tinyusb
Hey @tulip sleet I have an easy one for review: https://github.com/adafruit/circuitpython/pull/4887
The previous PR (that you merged) missed a spot.
(The TinyS2's SDI and SCK were the wrong way around)
Thanks ๐
Funny I just ran into that error too! But didn't have a chance to look into why
Thanks heaps @mcauser and thanks for the quick approval @dhalbert !
This PR fixes a pin name of Wio Terminal, added at #4679. According to the schematics (https://files.seeedstudio.com/wiki/Wio-Terminal/res/Wio-Terminal-SCH-v1.2.pdf), the I2S bit clock pin was named as board.I2S_BLCK, which is corrected as board.I2S_BCLK.
a patch for folks who don't want to wait, latest builds fix bitbangio and you can read/write the SD card with SPI!
import os import busio import digitalio import board import storage import adafruit_sdcard import bitbangio # Connect to the card and mount the filesystem. spi = bitbangio.SPI(board.CLK, board.CMD, board.DAT0) cs = digitalio.DigitalInOut(board.DAT3) sdcard = adafruit_sdcard.SDCard(spi, cs) vfs = storage.VfsFat(sdcard) storag...
wahoo, just got the first capture to work from an OV2640 to a Raspberry Pi Pico running CircuitPython! https://gist.github.com/1ba336028cb718138901f0f72dd302a0
keypad module with Keys, KeyMatrix, and Event classes. The scanning is done in the background. Key transition events (pressed or released) are put on an event queue. Direct query of a key state, bypassing the queue, is also possible. Debouncing is done by scanning once every 20 msecs.
Also added a simple atomic locking mechanism that I needed, in supervisor/shared/lock.{h,c}.
Sample code scanning key-per-pin using a NeoKey FeatherWing and RP2040 Feather (D5 and D6 are the defa...
<div class="section" id="module-keypad">
<span id="keypad"></span><h1><a class="reference internal" href="#module-keypad" title="keypad"><code class="xref py py-mod docutils literal notranslate"><span class="pre">keypad</span></code></a> โ Support for scanning keys and key matrices<a class="headerlink" href="#module-keypad" title="Permalink to this headline">ยถ</a></h1>
<p>The <a class="reference internal" href="#module-keypad" title="keypad"><code class="xref any py py-mod docutils litera...
I wonder if it would make sense to make those classes follow the iterator protocol, instead of having a custom named next_event function. Compare:
while True:
event = matrix.next_event()
...
with
for event in matrix:
...
and
while True:
event = next(matrix)
...
the latter two using the iterator protocol.
Maybe it would also make sense to have a was_pressed method, like the Miro:bit has on its buttons: https://microbit-micropython.readthedocs.io/en/v1.0.1/button.html#Button.was_pressed
I wonder if it would make sense to make those classes follow the iterator protocol
I thought about that, and would be willing to entertain it. But there might be use cases for not using an iterator. I was also thinking about future additions, including things such as:
next_pressed_event()-- skipsreleasedeventswait_for_event()-- does not returnNone;blocks waiting for a real eventnext_pressed_key_num()-- skips creating anEventaltogether, and just returns an...
Maybe it would also make sense to have a
was_pressedmethod, like the Miro:bit has on its buttons: https://microbit-micropython.readthedocs.io/en/v1.0.1/button.html#Button.was_pressed
Or like gamepad, which latches. I think this is subsumed by the events, which are history. And the question is if was_pressed() clears the history, as it does in gamepad, what happens to the corresponding events, and does it clear history just for that key?
@deshipu We would like to subsume gamepad, and eventually gamepadshift`, with this. Of course we can leave the originals in for your boards, but does this provide the functionality you need? I will add shift register support later.
Or like gamepad, which latches. I think this is subsumed by the events, which are history. And the question is if was_pressed() clears the history, as it does in gamepad, what happens to the corresponding events, and does it clear history just for that key?
Right, initially there was only is_pressed, but then people would try to use it in their interactive applications and get annoyed that they missed key presses. The thing is, when the method is there for you to use, it makes it more ...
I thought about that, and would be willing to entertain it. But there might be use cases for not using an iterator. I was also thinking about future additions, including things such as:
next_pressed_event()-- skipsreleasedeventswait_for_event()-- does not returnNone;blocks waiting for a real eventnext_pressed_key_num()-- skips creating anEventaltogether, and just returns an intkey_num. Maybe it's blocking.These could be intermixed with fet...
I've found there are really two major use cases here: one is simple buttons for interaction, and the other is more keyboard support. We also wanted background scanning if possible, which #4877 did not do. It also had a complicated idea of State and union states. This is simpler and smaller. This is about the fourth iteration of the API.
This works on Metro M0 and fails on Metro M4. I believe the difference is whether MICROPY_PY_IO is 0 (M0) or 1 (M4).
Hi, TinyUSB working with SAML21 and examples, I'm going to check the configuration of clocks that tinyusb use
We have https://circuitpython.org, circup, project bundles, and the like now, so closing this as it is mostly done. Please open a new issue if you have further enhancement ideas.
Closing this as mostly obsolete. Please open a new issue if you have further ideas.
Unknown keyword arguments now raise an exception.
Now available via user-defined HID descriptors.
Closing this as not seen now.
@anecdata Does this problem still exist?
@anecdata Does this problem still exist?
@dherrada Is this kind of all done?
We now have a partial port. Closing this. More specific issues can be opened for additional functionality.
Done as part of sleep implementation.
woohoo 3 year old issue :D
While I understand how this solves the problem in theory, is there an example or doc that has the descriptor and hid code to process it?
Digitizer descriptor that worked on at least some systems:
https://github.com/adafruit/circuitpython/blob/6.3.x/tools/hid_report_descriptors.py#L341-L406
I don't know what Python library I was using with this, if any. I may have just seen whether the OS recognized it, as opposed to trying to send a report.
@tulip sleet iirc, there is a standard absolute pointer tablet device that VM stacks have been using for yonks
supported natively by everything
as in KVM, VirtualBox, ESXI, etc have been using forever
I suppose you can also disable gamepad once there is keypad?
MICROPY_PY_IO gets enabled if JSON is enabled.
https://github.com/adafruit/circuitpython/blob/main/py/circuitpy_mpconfig.h#L516
I think JSON is enable for all the "full" builds so that would be consistent with what we are seeing.
Is this likely an upstream issue?
I suppose you can also disable gamepad once there is keypad?
That is the idea, so it would be good to know if the games you have written could be redone with keypad.Keys.
Is the one I posted the standard? If not, could you point to it as a comment in that issue? Thanks.
@solar whale Your MICROPY_PY_IO comment is well taken; I think you deleted it but I'm not sure why. Yes, it is all a micropythonism, which until now I did not bother to figure out. It provides the io module, whose code also seems to provide extra functionality for stdin/stdout (maybe...)
@deshipu I plan this morning to factor out an EventQueue class as proposed above. I will also think about adding an iterator. The only problem with adding an iterator is that I have to implement a whole new class for it. That's not hard but it takes space.
@tulip sleet thanks. I deleted it because I realized I was still confused about the connection to UJSON vs JSON and wanted to understand it better.
I think it's just that the json module depends on the functionality provided. I should have mentioned the reason for io in my own comment. So feel free to put it back.
Will do.
It looks like MICROPY_PY_IO gets enabled if JSON is enabled.
https://github.com/adafruit/circuitpython/blob/main/py/circuitpy_mpconfig.h#L516
I think JSON is enable for all the "full" builds so that would be consistent with what we are seeing.
Is this likely an upstream issue?
For extra compatibility, these are the USB descriptors that QEMU/KVM use, https://github.com/qemu/qemu/blob/master/hw/usb/dev-hid.c#L398-L410
wait, that one was a little too high up
GitHub
Official QEMU mirror. Please see http://wiki.qemu.org/Contribute/SubmitAPatch for how to submit changes to QEMU. Pull Requests are ignored. Please only use release tarballs from the QEMU website. -...
I've also edited the comment
I used cookiecutter to bootstrap my new widget for displayio-layout. Trying to merge an update but the CI fails:
Collecting Adafruit-Blinka
Downloading Adafruit-Blinka-6.10.2.tar.gz (136 kB)
ERROR: Could not find a version that satisfies the requirement adafruit-displayio-layout (from versions: none)
ERROR: No matching distribution found for adafruit-displayio-layout
https://github.com/rsbohn/Dexter_CircuitPython_Slider/pull/1/checks?check_run_id=2839218046
Do I need to change something in the CI configuration?
(Guess I should run pre-commit locally first.)
yes, do pre-commit install in your repo to have it run automatically
Yes, it is all a micropythonism. It provides the io module, whose code also seems to provide extra functionality for stdin/stdout (maybe...), and is also needed by json.
Had an error in my requirements.txt -- fixed it and passed all the CI checks. (Should have been "adafruit-circuitpython-displayio-layout").
Re-tested both code examples above, and the issue is still present in
Adafruit CircuitPython 7.0.0-alpha.3 on 2021-06-03; Adafruit Feather M4 Express with samd51j19
@dhalbert I think so, but @tannewt would know best
Re-tested the code example above, and the issue is still present in
Adafruit CircuitPython 7.0.0-alpha.3 on 2021-06-03; Adafruit Feather M4 Express with samd51j19
Hello makers,
Maybe I missed it but I couldn't find any way to use an ESP32-S2 board as a webserver with CircuiPython.
There is a library for the ESP32 throught SPI (adafruit_esp32spi_wsgiserver), I would very much like to have something comparable for the ESP32-S2, maybe in the wifi module of the ESP32-S2 port or via a dedicated library?
Thanks for your great job on CircuitPython and microcontroller support in general!
There's a port of wsgiserver for the S2, I think I should add it to the community bundle, but it's usable as is.
https://github.com/Neradoc/circuitpython-native-wsgiserver
@tulip sleet Am I understanding how supervisor.reload() works in that there is no chance of it causing filesystem corruption if it's called in your code.py because it's happening at the CircuitPython level, not the microcontroller level?
that should be ok. Interestingly I hadn't thought about this at all as a way to restart code.py -- maybe I forgot it existed.
(I saw the discussion in the other channel)
ah ... pylint gives different results locally than on github, because I have python3.9.
is there any convenient way to get older python versions on debian?
you can use the Ubuntu deadsnakes ppa: https://unix.stackexchange.com/questions/188741/install-newer-older-versions-of-python-on-debian
one person says it's fine, the other says it's not ๐
I think pyenv was simple enough, once setup with the versions you want, you can pyenv local <version> in the directory to setup with that version
Revised API:
EventQueueis factored out fromKeysandKeyMatrix. If other scanners are added, they would use the sameEventQueue.- The queue is not implemented as an iterator, because I anticipate possible future variations on
next(), as mentioned above.next()is convenient enough.
Internally, the latest commits include some bug fixes, and simplify maintaining the list of active scanners.
</div>
<div role="main" class="document" itemscope="itemscope" itemty...
New combined example showing both key-per-pin and a telephone-style matrix:
import keypad
import board
km = keypad.KeyMatrix(
row_pins=(board.A0, board.A1, board.A2, board.A3),
col_pins=(board.D0, board.D1, board.D2))
k = keypad.Keys((board.D8, board.D9), value_when_pressed=False, pull=True)
STOP_EVENT = keypad.Event(1, True)
while True:
km_event = km.events.next()
if km_event:
print(len(km.events), "events queued")
print("matrix", km...
Thank you Neradoc, I'll look at it.
Indeed it would deserve to be in the bundle with an example which displays a web page !
I second pyenv. I use it on MacOS but I'm pretty sure it works on Linux as well. Also, is that why Pylint is returning different results locally? I ran into that on Monday and didn't have the time or energy to look into why. I simply fixed the issues.
I'm also using Python 3.9.
I suppose you can also disable gamepad once there is keypad?
That is the idea, so it would be good to know if the games you have written could be redone with keypad.Keys.
This is not a problem. The ugame.py has this abstracted away, so it's just a question of freezing the right code with the correct version. The only thing that I might worry about is if the code required is substantially bigger, and some game is on the edge of available resources, it might stop working โ but...
@tulip sleet I know this has been asked and answered many times, but I'm asking it again (sorry). How are we referring to I2C parts in CircuitPython? I think one is peripheral, but I'm not remembering the other (can only think of central being associated, but I think that's specific to Bluetooth).
Pylint passed remotely, but locally failed on a bunch of stuff. I thought it might be a difference between my setup and the Learn repo.
If you look in the Learn Guides, you see "I2C Main" and "Secondary", but I like "Peripheral better". Sparkfun uses "Controller" and "Peripheral" e.g. https://learn.sparkfun.com/tutorials/i2c/all
Hmm ok. I'm doing up the I2C template. So I can kinda call it what I want here and it'll end up in all the board guides eventually. I don't know why we didn't go with controller and peripheral. It makes way more sense than main and secondary. I get that main and secondary maintain the first letters, but it's not necessary like it was for MOSI and MISO. No one says "I2CM" and "I2CS" so those letters aren't really crucial.
the guides that have Main and Secondary are older Tony guides and maybe they were changed very early in all this
I like Controller and Peripheral too. Sounds like a 6pm mtg q
Good call. I was going to make an executive decision, but I suppose it's worth discussing.
Looks like Zephyr never came to a conclusion either.
What about the gamepadshift? Are you going to implement that functionality as well eventually?
@idle owl in my particular case, it was time.monotonic_ns being recognized locally but not in CI.
Oh mine was not like that. Mine was ... one was using sys.exit(), one was an else/break issue, and .. something else I'm forgetting. This was on Python code. So maybe the Learn repo isn't setup to deal with Python code so much.
Learn passed it, local did not.
yeah the ways that pylint runs are subtly different --- library, library example, and learn all are a bit different, mostly on purpose
like the way we deal with the duplicate code check in examples .. which I'm a bit surprised hasn't affected learn?
Yeah....
I think we pinned it on Learn.
Or we disabled it.
Pinned Pylint I mean.
And disabled the dupe check.
okay
Not sure though.
But that would make sense.
Because I have personally duplicated a ton of code. So I know other folks have as well.
@onyx hinge pylint==1.9.2. Oi. Yeah we pinned it.
duplicate-code is in the disable in .pylintrc as well though.
Which I can't remember if that ever worked like that. But eh.
we've tried pinning it and not pinning it and they both make us unhappy.
so in libraries we do both !? -- repo: https://github.com/pycqa/pylint is pinned at 2.7.1, while the repo: local one uses whatever you have, or (in CI) what was installed by pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
What about the
gamepadshift? Are you going to implement that functionality as well eventually?
Yes, we definitely need for the boards with shift registers.
@idle owl there's more precedent in the Learn Guides for controller/peripheral and controller/device than main/secondary or main/peripheral: https://www.google.com/search?q=site%3Alearn.adafruit.com+"i2c+controller"
the "I2C main" terminology should probably be cleaned up: https://www.google.com/search?q=site%3Alearn.adafruit.com+"i2c+controller"
Perfect.
Seems so. I'll bring it up.
Yeah mixing packages from another distro or from a newer or older version of debian isn't a good idea.
Its nicknamed frankendebian, https://wiki.debian.org/DontBreakDebian/
its better to use pyenv because you're not modifying the system to do so and everything is available to you as a non-privileged user.
I kinda wish I could get a consistent snapshot of the state of all keys, e.g., as a bytearray. any chance of adding it?
I kinda wish I could get a consistent snapshot of the state of all keys, e.g., as a bytearray. any chance of adding it?
It is stored internally as a vector of bools. I could just copy that out to a supplied MutableSequence. I'd probably ask you to supply it to avoid generating a lot of garbage.
What is the use case? events and pressed() are designed to avoid your having to write Python code to scan a vector.
Maybe my thinking is fuzzy, but imagine I have a keyboard with characters & modifiers. When I see that "B" is pressed down, I need to find out if Shift was pressed at that same time or not, to see whether to transmit "B" or "b".
If I have a snapshot that is consistent from one point in time (or as close as you can get, given that maybe it takes a few ms to scan the matrix), then I can figure out which to do. I like the way that pressed() potentially frees me from tracking the state of Sh...
Adafruit CircuitPython 6.3.0 on 2021-06-01; Adafruit FunHouse with ESP32S2
>>> import time
>>>
>>> s = time.mktime((2021, 06, 16, 20, 0, 0, -1, -1, -1))
>>> s
1623873600
>>>
vs.
Adafruit CircuitPython 7.0.0-alpha.3 on 2021-06-03; Adafruit FunHouse with ESP32S2
>>> import time
>>>
>>> s = time.mktime((2021, 06, 16, 20, 0, 0, -1, -1, -1))
>>> s
677188800
>>>
Events would tell you that the shift key was pressed before or simultaneously with the letter key, which is what you want to know. If it were pressed afterwards, then the letter is not shifted. Yes, you will need to maintain a modifier state.
I see no problem adding another simple way to retrieve state.
The advantage of the events is that you don't have to maintain "is this still down?" information yourself. That use case is more like handling buttons on CPX, etc.
This might be an epoch thing. Does that work out to seconds since 1/1/2000?
The epoch has changed from 1970 to 2000 with the Micropython updates. Technically this is not a bug I guess, since the epoch in python is port dependent. It causes issues with existing libraries, like when they try to update the time from a unix epoch online.
It can be changed back in Circuitpython with MICROPY_EPOCH_IS_1970.
It can be tested in libraries by looking at time.mktime((2000, 1, 1, 0, 0, 0, 0, 0, 0)).
The time difference is NTP_TO_UNIX_EPOCH = 2_208_988_800.
So it's an intended breaking change, and we should tell users and library writers to add 30 years before doing more manipulations to avoid OverflowError: timestamp out of range for platform time_t?
Unix timestamps based on 1/1/1970 need to have 30 years removed from them (the exact number of seconds above, taking leap years and such into accounts). For example this code from a clock demo converting the NTP 1900-based given time into the 1970 epoch representation before calling localtime has to be updated:
def get_ntp_time(pool):
packet = bytearray(48)
packet[0] = 0b00100011
for i in range(1, len(packet)):
packet[i] = 0
with pool.socket(pool.AF_...
After filing issue #4886 where I finally bricked my board. I got two ItsyBitsy NRF52840 Express boards from a vendor in Berlin / Germany.
And to my surprise I can report exactly the same findings as with the nRF52840 Micro Dev Kit USB Dongle !
My INFO_USB.TXT looks like the following:
UF2 Bootloader 0.2.13 lib/nrfx (v1.1.0-1-g096e770) lib/tinyusb (legacy-755-g55874813) s140 6.1.1
Model: Adafruit ItsyBitsy nRF52840 Express
Board-ID: nRF52840-ItsyBitsy-revA
Date: Sep 25 201...
you dont need to update the bootloader, but you should be using the latest releases. did you try 7.0.0 alpha?
Do you know how to do a bisect? That would narrow down what the issue is, if it does not also work with 7.0.0-alpha.3.
New routines added to Keys and KeyMatrix:
<dl class="py attribute">
<dt id="keypad.KeyMatrix.num_keys">
<code class="sig-name descname"><span class="pre">num_keys</span></code><em class="property"> <span class="pre">:int</span></em><a class="headerlink" href="#keypad.KeyMatrix.num_keys" title="Permalink to this definition">ยถ</a></dt>
<dd><p>The number of keys that are being scanned. (read-only)</p>
</dd></dl>
<dl class="py method">
<dt id="keypad.KeyMatrix.store_states">
<code...
@tulip sleet FYI regarding Issue 4894, when it was originally reported as 4886, I was unable to reproduce it. All versions worked for me.
They got hung up trying to update the bootloader bu tI had no issues with any of the version of CP they reported.
thanks, I have not tried it yet
I did have a newer bootloader than the as-shipped boards and I updated mine to the current release. Not that the issue should be related to tthe bootloader anyway...
i don't think so, but ... I will put this on the 7.0.0 list
@ThomasAtBBTF Do you have a Raspberry Pi or some other non-Windows computer to try it on to try to further narrow the problem?
Thanks Dan! (I still haven't done a code-review but since I got my pony I like the API)
@klardotsh Tagging you for interest.
Do you know how to do a bisect? That would narrow down what the issue is, if it does not also work with 7.0.0-alpha.3.
Yes, I do know bisect and the O-Notation effort of O(log N). But with low n-sample count log-n is nearly equivalent to O(n)
Anyways: I started with the current version 6.3 and when I realized that I got the same results as with the other boards.
Then I found that 5.x was working and then I tried 6.0.1 which worked for me before.
@ThomasAtBBTF Do you have a Raspberry Pi or some other non-Windows computer to try it on to try to further narrow the problem?
Sure I have a Raspberry PI but it is running OctoPrint for a 3D-Printer.
But I have s stable of FriendlyArm NanoPi Neo Air's running different Ubuntu versions.
Also I can revive a old MacBook to check if Versions of after CP 6.0,1 are working with for example MiniTerm....
But this does not answer the question what is different between version CP 6.0.1 and...
you dont need to update the bootloader, but you should be using the latest releases. did you try 7.0.0 alpha?
I will try 7.0.0 alpha next. But as I wrote in issue #4886 this version exhibited the same behaviour on the MicroDev board using version 7.0.0 alpha.
I don't want to put unnecessary work on you.
But I think you should investigate what changed after version 6.0.1 for the REPL-Com port.
But this does not answer the question what is different between version CP 6.0.1 and later versions!
Right, I just want to know if it's specific to your Windows box or not.
Could what row and column pins were triggered in keypad.KeyMatrix() be in the key event as an int of the index of the pin?
Sure, I am with you on thatl
I will report back tomorrow morning my time here in Germany.
Could what row and column pins were triggered in
keypad.KeyMatrix()be in the key event as an int of the index of the pin?
Hi, what's your use case for this? You can back-compute them from the key_num. I could add a row-col back-compute, the reverse of key_num(row, col), but you could keep a mapping of key_num to keycode.
keymapping is much easier to use when you're using a matrix to store your mapping of keycodes to keys on the key matrix.
recomputing that x and y co-ord is a waste of time just because of context loss.
you dont need to update the bootloader, but you should be using the latest releases. did you try 7.0.0 alpha?

I copied adafruit-circuitpython-itsybitsy_nrf52840_express-en_US-7.0.0-alpha.3.uf2
to my ItsyBitsy NRF52840 Express and got the same result as with any other version above CP 6.0.1
Sorry for my German "device manager output" but I think you can see what ...
@Red-M I will think about it, but the key numbers are already linearized when I store the states internally and pass them to the EventQueue, so I would have to do the reverse mapping anyway. I am trying to make the EventQueue applicable to any scanner, so it uses linear key numbers, not implementation dependent coordinates. The time to do the arithmetic is very small compared with everything else that is going on.
It's actually pretty easy to do a mapping like this:
MAPPING = [
"q", "w", "e", "r", "t", "y", "u", "i", "o", "p",
"a", "s", "d", "f", "g", "h", "j", "k", "l", "enter",
"z", "x", "c", "v", "b", "n", "m", ",", ".", "/",
]
character = MAPPING[key_num]
@tulip sleet This is an odd shot in the dark, and since it's more likely to be misleading than helpful I figured I'd ask here: Was circuit python 6.1 around the time that the german translation was having a lot of trouble fitting on some boards? Would there be a similar cause here?
well, a build either fits or it doesn't, so I don't think it has to do with that, and todbot probably didn't test the German translation. an overflowing build causes the build to fail, and does not generate bad code
but that is the kind of good thinking that is helpful when debugging: "what is different here?", so I appreciate your thoughts
Good to know, thank you!
this shows you are good at debugging ๐
Haha the compression of the translations and error strings is the way I want to try to contribute to the core code, so it was a forward thought in my mind
@dhalbert If you don't have the indexes of the pins, that's fine then, I thought I would ask as I wasn't sure if you were able to just provide that data as it might be used during scans.
@deshipu
That's purely a human readable only solution and doesn't allow for easily checking if a map makes sense or other errors that might exist (map too short, map too long, missing rows or columns AKA allows injection of bad input data from a user (who might want to change the map, which then creates ...
Nicer than the tuple of tuples I use right now.
https://github.com/Red-M/RedPycoKeeb/blob/master/Firmware/lib/pycokeeb/keymap.py#L10-L18 :/
Actually, I can pre-compute a translation map of this at start up by iterating the entire matrix and assigning ints to my co-ords keymap being the key_num as the index.
Firmware
- Adafruit CircuitPython 7.0.0-alpha.3 on 2021-06-03; Adafruit QT Py M0 Haxpress with samd21e18
- Adafruit CircuitPython 7.0.0-alpha.3 on 2021-06-03; Raspberry Pi Pico with rp2040
Code/REPL
import time, usb_midi, adafruit_midi
from adafruit_midi.note_on import NoteOn
from adafruit_midi.note_off import NoteOff
midi = adafruit_midi.MIDI( midi_in=usb_midi.ports[0], midi_out=usb_midi.ports[1] )
while True:
midi.send(NoteOn("A4",10))
...
And here the content of the boot_out.txt after the update:
Adafruit CircuitPython 7.0.0-alpha.3 on 2021-06-03; Adafruit ItsyBitsy nRF52840 Express with nRF52840
I also tried CP 6.0.1 and CP 7.0.0-alpha.3 on the computer of my wife with a fresh installed PUTTY.
The results were the same as on my "old" Windows machine.
What I noticed between CP 6.0.1 and CP 7.0.0-alpha.3 that the COM port changed on the computer # of my wife.
So there must be a difference after CP 6.0.1 on the i...
@elijahsgh Thanks for sending that! I think I would need to read up more about making a custom build before trying that, so may not be trying that soon.
@tannewt Where do you think that is on the priority list for the team?
@hathach is there anything in recent TinyUSB changes that might have caused this? I will also look at the USB descriptors, which may have changed inadvertently when I did the dynamic USB descriptors in 7.0.0. Thanks.
If you felt we were being annoyed I assure you that was not the case at all. Apologies if you felt that way. We are just trying to divide and conquer the problem.
Added keypad.ShiftRegisterKeys. Tested on a PyBadge.
Still to add:
- argument to specify polarity of diode in
KeyMatrix - argument to specify debounce aka scan interval in all the scanners
To help honing in on the bug, it appears in both 7.x alphas:
Adafruit CircuitPython 7.0.0-alpha.2 on 2021-05-11;...Adafruit CircuitPython 7.0.0-alpha.1 on 2021-04-06;...(requires 6.x style mpys)
If you're on Windows, MIDI-OX is a good MIDI Monitor. It also will show the issue, in potentially more clarity than MIDI Monitor. It prints out:
90 45 0A
90 0A 00
80 45 00
80 00 00
as seen in the screenshot below.
<img width="512" alt="midiox-cp7-midi-issue" src="https://user-images.githubusercontent.com/274093/122510988-6c6f4e80-cfbb-11eb-8dfb-e036632db70d.png">
ACK-ing the notification - I'm heading out for a Puget Sound sailing day trip tomorrow but I should have some time over the weekend to look at this (1) in general (2) from the perspective of seeing whether we could use it to rip out a bunch of basically-never-optimized Python-side code in KMK
Good news under Linux !
The ItsyBitsy NRF52840 Express shows up as /dev/ttyACM0

And works with CP 6.0.1:

And also with CP 7.0.0-alpha.3

...
Additional info:
This is how the ItsyBitsy NRF52840 Express shows up running CP 6.0.1:

And this is running CP 7.0.0-alpha.3:

And this in UF2 BOOTLOADER mode:

hmm, I think it is related to # 4440, it probably got too long and not responding. I am trying to troubleshoot it again to see if I could figure out something. Please be patient
No problem, I will be patient.
hmm, I think it is related to # 4440, it probably got too long and not responding. I am trying to troubleshoot it again to see if I could figure out something. Please be patient
No problem, I will be patient.
Good news, after tons of trying, I seems to found a fix,it is indeed race condition within nRF5x USB DMA. The issue depends on the timing of usb command sequence from host, and it is coincidence that it only happens with windows driver (not Linux). I will need to do a prope...
Wow, this was fast and required very little patience on my side!
The firmware.uf2 in the above zip-file works for fine for me on my windows machine.
Thank you very much for sharing your test-build.
Wow, this was fast and required very little patience on my side!
The firmware.uf2 in the above zip-file works for fine for me on my windows machine.Thank you very much for sharing your test-build.
Great, thanks for testing, please continue to use that for awhile to see if there is any side-effect, I will wrap up the fix with PR. It could take a day or so. It would be great if you could give more feedback after a few days of usage :)
huh we use the sdk libm on nrf, not the micropython libm. not sure it matters, but the micropython libm is probably smaller
that is a mistake, we should probably use the micropython one to consistent results (even if they are less accurate or whatever)
Unix tests pass locally, I'll let CI chew on the rest and see where we're at.
I noticed this, and @dhalbert said
that is a mistake, we should probably use the micropython one to consistent results (even if they are less accurate or whatever)
A typical read-only property object in shared-bindings looks like this:
const mp_obj_property_t keypad_keys_num_keys_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&keypad_keys_get_num_keys_obj, // getter
MP_ROM_NONE, // setter
MP_ROM_NONE}, // deleter
};
There are a lot of these kinds of properties in the native modules, several hundred right now, so about 1200...
Are these tables hand written?
If machine generated - many tweeks could be measured
There is a table for each property in a native module. They are hand-written. I eyeballed the savings just with some grepping and wc.
@hathach is there anything in recent TinyUSB changes that might have caused this? I will also look at the USB descriptors, which may have changed inadvertently when I did the dynamic USB descriptors in 7.0.0. Thanks.
There has been too many changes to tinyusb, I did fix an MIDI buffer overflow recently, maybe there is other buffer issue with MIDI as well. I will test this out
[adafruit/circuitpython] Pull request opened: #4900 update tinyusb to fix nrf control race condition
fix race condition with control since TASKS_EP0RCVOUT also require EsyDMA. Should fix #4894 and #4440 .
@ThomasAtBBTF this is the final uf2 that generated by PR #4900 Please try it out to see if that "still" solve problems.
itsy-pr4900.zip
I was just noticing that the CI builds PDF documentation. Do we use PDF documentation for CircuitPython?
https://circuitpython.readthedocs.io/_/downloads/en/6.3.x/pdf/ I guess readthedocs makes it available, so it's probably good to test it as well
OK, merge 1.16 got through the "test" build this time, yays.
I was mistaken. CircuitPython centralizes the choice, so I misinterpreted what was going on in some merge conflicts in #4897.
I saw #4899 and took a stab at implementing it.
This concentrates on some specific properties that are probably in the most constrained builds. (OK, about half the files were not on trinket m0 builds...) However, it's not enough yet to give a net savings.
Building trinket_m0, here is the change in code size so far:
Baseline: 3760 bytes free in flash
New code: 3516 bytes free in flash (+244 vs baseline)
Using it: 3580 bytes free in flash (+176 vs baseline) (-64 vs new code)
...
Well, it was a hope :slightly_smiling_face: . Thanks for trying this out. I saw something similar in another experiment I did to provide some routines to do typical argument validation. On small builds it saved maybe 50 bytes. (But it does make it easier to do the validation.)
Looks like all the xtensa builds fail,
make: *** No rule to make target 'lib/tinyusb/src/portable/espressif/esp32s2/dcd_esp32s2.c', needed by 'build-adafruit_feather_esp32s2_nopsram/genhdr/qstr.split'. Stop.
are additional changes needed there?
Looks like all the xtensa builds fail,
make: *** No rule to make target 'lib/tinyusb/src/portable/espressif/esp32s2/dcd_esp32s2.c', needed by 'build-adafruit_feather_esp32s2_nopsram/genhdr/qstr.split'. Stop.are additional changes needed there?
Yeah, it is rename dcd_esp32sx.c to also support s3, I have pushed the commit update.
Happy to confirm that it works fine for me,
@hathach: Thank You!
Also tested the usb_cdc.data object which also works fine.
thank for confirmation, glad that works out for you.
I updated the PR with a version that does save 52 net bytes on trinket m0.. but I think we'd also want to measure the speed, because I suspect it also slows property access a bit.
@jepler tried this in #4901, without a net gain on small builds. My original suggestion above was to create new property types corresponding to the contents of the .proxy array. Each type takes about 60 bytes, I think, and then the code has to check for these.
The point of the multiple types is to encode what slots are in the proxy array. I thought of some other ways to do this that might take less code space. These ways do not require creating new property types.Unfortunately there are ...
tested with great success on esp32s2
The latest commits separate out the pypi upload the mpy-cross s3 upload and use setuptools_scm to generate the version string which is the same utility used by circuit python libraries.
I have successfully tested both dev and stable uploads using this branch: https://github.com/FoamyGuy/circuitpython/tree/foamyguy_test_stubs which had a modified package name that included my username.
I think once pypi credentials are added to this repo these actions should begin working to upload the s...
The principle is that the "less frequently used" fields of a type object are placed in a flexible array member; this flexible array either has 0 (hopefully the usual case) or 1 member. The new flag indicates whether the flexible portion of the structure exists.
Fields that reside there (plus 2 that I decided NOT to move after starting) are now hidden behind accessors in most cases; where the verification had already been performed somewhere else (you could tell because there was no NULL-p...
Here's how I estimated which fields were used most. The sed takes the ranges of lines within an mp_obj_type_t definition, and the awk prints the first field of each. sort | uniq -c counts unique instances of each one, then sort -n puts them in numeric order.
Here I've manually removed the lines which are just noise, so your local results will differ.
$ git grep -l 'mp_obj_type_t .*= {' | xargs sed -n '/mp_obj_type_t.* = {/,/;/p' | awk '{print $1}' | sort | uniq -c | sort -n
...
OK, here's one way to work towards compatibility:
- Change the declaration of an extended slot to look like
const mp_obj_type_t mp_type_bytes = { { &mp_type_type }, .flags = MP_TYPE_FLAG_FULL, .name = MP_QSTR_bytes, .print = str_print, .make_new = bytes_make_new, .locals_dict = (mp_obj_dict_t *)&str8_locals_dict, .ext[0].binary_op = mp_obj_str_binary_op, .ext[0].subscr = bytes_subscr, .ext[0].get...
FYI, I've got about half of an i2c library now:
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather nRF52840 Express with nRF52840
>>>
>>> import board
>>> import adafruit_sps30.sps30_i2c
>>> i2c = board.I2C()
>>> spsi2c = adafruit_sps30.sps30_i2c.SPS30_I2C(i2c)
>>> spsi2c.fw_version
(2, 2)
>>> spsi2c.read()
{'particles 40um': 51, 'particles 10um': 49, 'pm10 standard': 6, 'pm100 standard': 9, 'pm25 standard': 8, 'particles 25um': 50, 'particles 100um': 51, 'particles...
Update: I have fixed another issue with MIDI, https://github.com/hathach/tinyusb/pull/906
though I am not sure if this would fix your issue. I couldn't reproduce it at all. It isn't part of circuitpython yet, you need to manually change the tinyusb to my upstream https://github.com/hathach/tinyusb and manually compile it for testing.
@dhalbert think you could take another look at this this week?
Remove commented-out code.
Sorry, I missed this was ready for re-review.
Does not pertain to RP2040.
Does not pertain to RP2040.
Thanks for taking up work on this! Iโm embarrassed about dropping the ball. Iโm busy right now but Iโll try to at least take a look at your changes.
I've brought this up to date with the Main branch and removed the use of goto. Tested on a Feather M4 Express, works as expected. There are a couple of remaining questions I have before it gets merged:
- Are we trying to reduce this API before merging, to avoid having to reduce it later and cut functionality? If so, what elements are in question?
- Related to the above, scanning the discussion, I don't see a clear consensus on why someone would want
RELOAD_ON_ERRORto be true. This ...
My bad, I missed that this block wasn't implemented. I'll put in a NotImplementedError for now, but I'll revisit this in a future PR to probably try and move the whole RP2040 system over to not using the watchdog reset, and implementing "sleep memory" in the heap space somehow.
As used in upcoming additions to the Learn sleep guide.
I'm wondering if it's worth merging this now if it's going to change in the future. What is the current consumption for light and deep sleep now. If they are high maybe we should leave this unimplemented now on RP2040 because it's not worth it.
I am having the same problem on a Metro M4 express with CircuitPython 6.3.0.
import board
import busio
uart = busio.UART(board.D2, board.D3, baudrate=115200)
In the REPL, I also get the Invalid pins ValueError on the uart line.
I know @dhalbert has suggested a change like this, but I couldn't find the issue to tie it to. Credit goes to him for the concept.
@tannewt has been talking for years about shrinking these type objects. I'm not sure I actually ever mentioned the technique you are using. In days of old I saw complicated union-like types when passing arguments with varying parameters, but not the split technique with pointers you have adopted.
@tulip sleet so much for my recollection, maybe it was Scott..
I remember saying something about using flag bits to indicate what follows. But I don't remember either of us suggesting the pointers to separate blocks thing.
I think you may have come up with that yourself, or it seemed obvious to you when we were discussing it
It's still all one block, the "flexible array member" is present in memory right after the initial fields of the object
oh, I thought it was a pointer, due to the double curly-braces. I didn't look closely
it is a pointer?
i need to read the code ๐
struct _mp_obj_type_ext ext[]; The "ext" field is a flexible array. A short type has no items in ext[], while a full type gets 1
i thought there were multiple such things, because,say, parts A,B,C, were all optional, so you might have just A, A and C, B and C, etc. But it is just there or not? In that case, I did suggest that, sort of
Yeah there are just two kinds of type structure with my change, the full and the short; the short becomes the default, because it was a great way to make sure everything that needed to be changed became a compile error.
the stuff I had seen in the past was exactly that. There was a flag of what was optional, and then it was all mashed together, and unpacked sequentially. This was when PDP-10's had 256k words of RAM, so we were always thinking about saving space
ok, then, I claim a little credit ๐
anyway, it works, but I think we (I) need to find the best syntax and one that accomodates implementations that prefer NOT to split the type objects .. and then we should probably at least get upstream to say they're interested in taking something like this before we dive in and do it ourselves.
having two type structs with matching initial fields may be better than the optional fields; it would make the changes for namedtuples (which follow the type object with their own additional fields) a little less unnatural.
i agree, maybe it's just a (slightly horrible) macro
I had fun on a saturday and that's what counts. ๐
i notice you did not try the awful "pointer masquerading as an integer" thing
I'm not sure how it would have applied here
if you're being serious you should tell me more
i was awake at 3am Sat morning thinking about this, so I just write it down, and then the bug gets transferred to your ear from mine
my thing was only about how to encode variable-length proxies, nothing about variable-length type objects
properties?
the .proxy object: getter/setter/deleter
ok yeah we're talking about the same thing then
I'll let you do that one .. hmm .. The property type did end up being a small type, interestingly enough
saving about 32 bytes for each of those two new types
so the +244 or whatever for the original multiple property types was not all code; the new types were a significant chunk of that
yes if I said code I probably meant flash
anyway what i said is way less general that what you did, and is more pervasive and better. you just said firmware size
having just one property/proxy type would be very nice also because it speeds up the "check if it is a property" path which is probably a hot path
yes, I was thinking of that too. I could just try 1. from the comment above and see what savings there are on small builds (which is where it's critical). 2. would be twice that minus some extra code
anyway my reason for all this was to try to get the keypad code back in at least some of the SAMD21 builds
it's like going through the couch hoping to find enough change that you can see a movie
(which is probably a thing that does not occur anymore)
probably you shold introduce a macro for producing these objects, so it is easier to try out alternatives
the raw number of declarations you have to tangle with is pretty small when your "target" is trinket_m0 (say)
I actually did own some crypto but I 100% divested back in April. I'm confident I don't own any now.
it's not how I support my lavish lifestyle ๐คฃ
I just thought that was the equivalent of the couch search these days
sooner or later the samd21 will have to be left behind
yes, limor says that
not that it's not useful, but that it simply cannot have the functionality we would like it to have
I wonder if it would make sense to drop the translations for it at some point
or even use the new no-error-messages build setting
?serverinfo
Ohh getting close to 30k ๐
Hi I'm using an UM feather S2 togehter with a Adafruit RFM95W LoRa Radio Transceiver Breakout - 868 or 915 MHz - RadioFruit for my lora project and deep sleep (with circuitpython) because I'm using lipo batteries. This works fine. My preferred solution would be to use circuitpython/deepsleep with my Adafruit Feather M0 with RFM95 LoRa Radio - 900MHz - RadioFruit feathers. Is there a technical reason, why this feathers doesn't support circuitpython deepsleep? Using C as to my knowledge here deepsleep is supported, but my whole solution GW etc. is bsed on python, so I don't want to change all this stuff to C.
The reason is that this hasn't been finished yet.
So I think in the near future the feathers will support it. This is important for me, because I have a bunch of this feathers and using it, I would be able to reduce the form factor of my sensors. Any ideas when it is supported?
Someone is actively working on sleep on ports other than ESP32S2. But we don't do schedule promises, because too many things can go wrong.
One other important thing is that the SAMD21 ("M0") ports are very space constrained, particularly the non-Express boards like the Feather RFM boards. So it's quite possible sleep will NOT be supported on those boards for space reasons.
The nrf and ESP32S2 board have the best sleep implementations right now
Added interval args to the scanners, so that you can choose the debounce/scanning time you want. Default is 20msecs, as before.
Factored out some generic arg validation routines. I started to do this a while ago in a separate PR that never even got to draft state. This is somewhat improved on that, and can be applied to lots of other things in shared-bindings to save sapace
mmh ok I understand, my thx
doing anything of size on the integrated RFM board is unfortunately a very tight squeeze, as you may have discovered already
ok so I think I will go on with my UM feathersS2 ๐
@ionic elk thanks for that draft sleep power consumption page. We can talk about whether to wait for further work on the RP2040 (changing the reset behavior) before doing sleep. If we release something that doesn't really save power, I think we will get a a lot of support blowback, so my inclination is to wait.
@dhalbert the only effect of the change on the RP2040 would be to enable Sleep Memory. The global change would be to remove "NORETURN" keyword from the API, which I think might be better tracked separately. Using PinAlarm on the Pico improves life on a 1000mAh battery from a day and a half (27mA) to about a month (1.4mA) on a board that isn't optimized for power, so I'm not sure why we'd want to toss the work on this PR.
ah, I see the comment above. I thought it was not really sleeping at all
@tulip sleet it reduces power from 27mA to 1.4
Oh, no, I guess I got that across wrong. Basically the RP2040 is annoying because it enters low power modes but has special RAM that doesn't lose power even when in the uA range
Even when you "power down" the RAM, which I'm not even presently doing, it still doesn't lose data
so what we -really- need is a new board with an external RTC clock, then you could really get it down to uA
I wonder if an RTC featherwing would provide the signal we need
how slow can it be?
1 sec?
1Hz
yeah
I wasn't sure if we wanted to put in a weird API thing to support it though
if we have to, we have to. It could be an optional arg or some chip-specific addition to alarm
Yeah I have a bunch of those laying around. I could try it
When you use TimeAlarm as it's implemented now, it's 5mA
which is real good for light sleep, but pretty mediocre for deep sleep
maybe ExternalTimeAlarm ๐
though that sounds like PinAlarm
i think maybe an extra required pin arg or something
I mean if you're using the DS3231 you might as well just program it with an alarm and use PinAlarm
that's what I do for my alarm clock
Firmware
Adafruit CircuitPython 7.0.0-alpha.3-57-g683304fd3-dirty on 2021-06-19; Adafruit ItsyBitsy nRF52840 Express with nRF52840
Code/REPL
From the ble_keyboard example, I copied this code to my tester and created BRAILLE_HID_DESCRIPTOR based on code that works for OSX over USB.
hid = HIDService(hid_descriptor=BRAILLE_HID_DESCRIPTOR)
Behavior
Traceback (most recent call last):
File "code.py", line 46, in
...
There is already an issue for this: #4868. Would it make sense to move your requirements to there?
<@&356864093652516868> Meeting in ~15 minutes! Please include notes in the notes doc if you plan to participate, or want to include notes if you're not making the meeting. See everyone there! https://docs.google.com/document/d/1YXO2yPKADI2fiEFZTl9ZOgK5pbE890KLIKCZVHq6GIc/edit
Google Docs
CircuitPython Weekly for June 21, 2021 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to participate, ad...
lurking (2nd shot day +1, no major symptoms but didn't get to updating the doc)
Congrats! Hope it continues that way.
Congrats on the shot, the finish line for being fully vaccinated and maxinated is just a short distance away ๐
Lurking.
Lurking and listening in, enjoying the company while trying to get sqrt(-1) things done
Python 3.10 beta 3 is out. Please give it a try with your libraries โ donโt get caught unawares when the final release goes out this fall! https://t.co/EzE9QgMkgQ
Retweets
176
Likes
814
Dan just dropped a new PR with our event-based key switch vector/matrix handling all done in the CircuitPython core https://github.com/adafruit/circuitpython/pull/4891 which will make keyboard projects a lot easier and a TON faster. Matrix/vector scanning is now done in a background interrupt and can handle all the work for you and emit key pres...
@ArmstrongSubero just checking in - are you still working on this PR?
Listening. ๐
Pretty sure that means Kattni's now the Git Rebase de facto expert! ๐
I closed #4905
Here the descriptor which I tried to load:
BRAILLE_HID.zip
Problem with rebase... is that even if you succeed once, you are not sure you will succeed again (at least that is the case for me). ๐
Congrats on the PyOhio talk!
Thanks!
@trim elm Add your name to your In the Weeds topic, if that was you. That way we can turn it over to you when we get to it.
Oh, thanks. Didn't know to do that but that makes sense
@errant grail I'm now picturing you having decade-themed sections in your house.
@slender iron API for your review: sleep_memory_reserve_for_system will grab memory starting from the end of the sleep memory block. It will shrink the size of the memory reported by get_length. If this conflicts with user reserved memory, a runtime error will be reported. If the user later attempts to reserve system memory, a different runtime error will be reported, which notes the system reserved some extra memory. Also would add set, get, and free routines for this "system block".
And thanks to that comment, I can't get the image of a new-wave neon blacklight decorated bathroom out of my head. ๐จ
Yes. We decided to celebrate it rather than make it boringly uniform. Itโs a museum now.
Ooh that's really cool
why not just always reserve a fixed amount? that way the sleep memory size is fixed across runs
CircuitPython Day 8/6/2021!
2021/08/06
@slender iron We could, but that means we have to set an actual limit on the amount of memory to reserve. If it's dynamic, we can support next file strings of any length.
Maybe we can celebrate twice!!!
You're always welcome to celebrate CircuitPython!
How do you send a PR to a calendar?
Not that next file strings are probably going to be that long, so it's not a big deal if we do it statically. But we'd need to decide on how long they should be.
I wonder if you code store a file number instead of name
does FAT have a consistent file number?
I guess that'd be tough to make stable
@slender iron I pitched that, but the issue with indexes is that the sub-programs could be nested
Not sure if I'll be able to organize the latinamerican version of
-day because of the house thing, but I'll try to find someone who can and help as much as I can.
@tulip sleet had comments to the effect that it would be pretty dangerous
kk. I think 64 or 128 characters would be plenty
(Maybe I'll ask @lapis pivot ...)
I'd bias towards over reserving the space in case we want to use it for something else
@slender iron I think that's fine, at least on STM32 the sleep memory is like 4k so 128 of that is not a really big impact
Keep me posted!
Another meeting in the bag! Thanks y'all!
will do.
I may do 512b then
Is the the shortest meeting since a long time?
ya, probably. I think our meetings get shorter during the summer when folks are gone
@slender iron at that point it does feel like it's cutting into user memory quite a bit for a feature that could be kind of rare...
using sleep memory is rare too
Yeah it's hard for me to judge that
Thanks
Thanks!
So far I have used 1 byte of sleep memory...
And there is a guide that does that for the MagTag.
This is the only project I know using this: https://learn.adafruit.com/adafruit-magtag-project-selector
4096 bytes used, 4096 bytes free in 'RTC Slow Memory' out of 8192 bytes (8.0kB).
alarm.sleep_memory[0] = selected # ... so the first byte
"You aren't gonna need it"[1][2] (YAGNI)[3] is a principle of extreme programming (XP) that states a programmer should not add functionality until deemed necessary.[4] XP co-founder Ron Jeffries has written: "Always implement things when you actually need them, never when you just foresee that you need them."[5] Other forms of the phrase include "You aren't going to need it"[6][7] and "You ain't gonna need it".[8]
I'm going to sign off and get the meeting video uploaded & stuff. ๐
Is this "in the weed"?
This is post-meeting
ah a good time of year
last week I saw BEL do very well in a game against RUS, but I haven't followed since then...
was that last week? anyhow, last time I was watching soccer that was the game
@onyx hinge I deleted the transcoding section - we've all been skipping that and it's been fine. Thanks for thinking about the notes.
Finland is playing Belgium right now, it's made good background noise while at home
Here is the notes document for Mondayโs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youโll be attending the meeting - itโs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weโll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/16nG56rv4MQlL4aoAd1B1IGLTNUuWtWuGYIobBSX9Vag/edit?usp=sharing
Google Docs
CircuitPython Weekly for June 28, 2021 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to participate, ad...
@idle owl I also added a step to say to make the old notes document view-only, which I've been trying to do. there was a concern that bots would come by and vandalize them all someday, otherwise ..
Correct, thanks. I typically do it, but good to have it in the instructions.
@silver tapir I disconnected you from the voice channel to avoid any surprises.
Did this go into 6.3.0?
No, what's in 6.3.0 is in the release notes: https://github.com/adafruit/circuitpython/releases/tag/6.3.0. In general 6.3.0 added boards and a limited set of important fixes, not feature additions.
@still zephyr We can find a time this week to discuss PRs if that works for you. I'm considering who else to involve, so I don't want to set an exact time yet, but I wanted to check in.
Yes let me know I will be available @idle owl
I asked because there's some strangeness mentioned in Adafruit Forums: Bluefruit advertisement.complete_name not showing
@tulip sleet @slender iron should I put the new sleep and next file related stuff I'm working on into the existing PRs we have, or make new ones/one big new one? If I put sleep memory API changes into the existing RP2040 alarm PR and next file PR, it'll scatter them around... maybe it'd be better to have all the "next file deep sleep compatibility" stuff in a single, new PR?
And just merge the current RP2040 alarm and next-file PRs as they are, since they both work, they just ignore this particular feature combination.
Or I could append it all to the current next-file PR, and just put off merging the RP2040 until next-file is finished and merged.
The todo list is the sleep memory API changes + integration, STM32 sleep memory, and RP2040 sleep memory.
@ionic elk I think another PR is the better option
I think once pypi credentials are added to this repo these actions should begin working to upload the stubs to PyPi.
I think they are set at the organizational level so they'll already apply.
Thanks for splitting the two! I'm going to merge now and we can see how things go. Thank you for putting this together!
Adding the ber makes this more readable. (Do this everywhere please.)
//| key_number: int
Here's my take on the APIs. I really like the new arg validation and imagine we'll want to upstream it. Thanks!
Do we want to inject an overflow event to mark where the event stream is disjoint? You'd probably want to treat it as if all keys were released.
Internal pulls used then right? Otherwise inputs will float when the key switch isn't pressed.
I pushed f47ebbc because the SNES controller uses a shift register (CD4021 or equivalent) with a latch pin whose sense is opposite from 74HC165, so this needs to be parameterized.
We could have an overflow event, or just a resettable flag. I'm not sure we want to release all the keys because we lose a lot of state that way. For instance, if someone is pounding a controller key with a shift key held down, it's OK to lose some of those clicks, but not the shift key state.
get() is OK. I agree next() sounds like an iterator. It's a stream, so it could be read() as well.
Could be readinto() if next() were read().
Right, I should make this clearer. It uses internal pulls. @ladyada said people rarely put external pulls on matrices: she has not seen that.
Oops, some missing words: "no more often than this interval" or something like that.
Thanks for taking on this merge!
Please delete ports/zephyr, ports/rp2, ports/esp32 and ports/esp8266. We have our own ports and the extra folders confuse folks.
I delete tests/multi_{net,bluetooth} too since we don't use it.
We may want to delete tools/mpremote as well. I don't think it'll work with CircuitPython and I doubt we want to support it.
# SPDX-FileCopyrightText: Copyright (c) 2014-2021 Damien P. George
And delete the chunk below.
I had requests both for events and for raw key state, both as a fast path. A library would not be a fast path. I think both use cases are valid and would like to cater to both.
There are use cases for a fast path with no storage allocation.
I thought about this, but the keypad.EventQueue is quite special-purpose internally, and it just seemed like extra code to have to instantiate it separately.
@dpgeorge @jimmo any thoughts?
looks like we got 403 from PyPi:
Uploading circuitpython-stubs-7.0.0a4.dev82.tar.gz
0%| | 0.00/8.94M [00:00<?, ?B/s]
0%| | 8.00k/8.94M [00:00<03:14, 48.2kB/s]
3%|โ | 264k/8.94M [00:00<00:08, 1.14MB/s]
17%|โโ | 1.55M/8.94M [00:00<00:01, 5.50MB/s]
79%|โโโโโโโโ | 7.06M/8.94M [00:00<00:00, 21.2MB/s]
100%|โโโโโโโโโโ| 8.94M/8.94M [00:00<00:00, 9.60MB/s]
NOTE: Try --verbose to see response content.
HTTPError: 403 Forbidden from https://uploa...
Yeah, nice! I had this idea for a long time as well, and is part of the reason for adding the .flags member to mp_obj_type_t.
I wanted to do a full analysis of how frequently certain slots were used, and then write some code to search for the optimal separation into "standard" and "full" types. I also thought about having multiple flags, or even a count, to say how many extended slots there were. Eg sort the slots on how frequently they are used and then the count says how many are ...
@tannewt OK, got those all I think. Do you want me to try to "squash" this to a single merge commit, or did your recent experiences lead you to think that's not such a good idea?
A side note, I'm a bit surprised that the stubs are nearly 9MB. Do they have extra content they shouldn't have? Are they more than just some ".pyi" files?
I think my preference would be to keep the old behavior by changing MICROPY_EPOCH_IS_1970. Any objections?
Closing. Thanks @Neradoc.
Why does PY_IO disable flush? CPython always has it: https://docs.python.org/3/library/functions.html#print
When it runs it does print a bunch of other unrelated files, many things that are in the circuitpython repo, but not stubs specifically.
If you unfold the stubs step here: https://github.com/adafruit/circuitpython/runs/2879766210?check_suite_focus=true
it seems to take a second to load. For me it's a giant blank section for a while but eventually gets filled in if I scroll around a bit.
It does list many files that are unrelated to stubs:
...
creating circuitpython-stubs-7.0....
Ah yep I think this got doubled up, it's likely I misclicked it while working through changes to merge from main. I'll make a new PR to remove the dupe
Thanks for taking up work on this! Iโm embarrassed about dropping the ball. Iโm busy right now but Iโll try to at least take a look at your changes.
No problem! We know folks don't always have time to contribute. We're happy to pick it up. You got it very far!
1. Are we trying to reduce this API before merging, to avoid having to reduce it later and cut functionality? If so, what elements are in question?
No, I don't think so. It's an advanced API so it can have all of the op...
@FoamyGuy I've added adafruit-travis as a maintainer. @jreese started this project at a Pycon sprint which is why they are an owner.
this removes a duplicate line that was accidentally included in the recent stubs PR.
@tannewt Where do you think that is on the priority list for the team?
It's not currently a priority for Adafruit funded folks. As always, we're happy to review PRs and give guidance.
I think so too. I suspect we'll get issues once more folks use them but we can have separate issues/PRs for those. Thanks @dherrada for going over it all.
@brentru Is this the IO cert issue in the nina FW?
Hey @slender iron I saw you just merged this one: https://github.com/adafruit/Adafruit_CircuitPython_ST7735R/pull/22
I looked into it further and I don't think my proposed (and merged) fix is correct.
The default init seq is in bgr mode, and the bgr argument was previously setting "not bgr mode".
But by me changing it to set bgr mode, as the argument name suggests, now there is no way to unset bgr mode (ie. rgb mode)
I think the proper fix is to rename the arg to rgb, and put the value back as it was.
By default you get bgr, and if you pass in rgb=true, you get rgb mode.
GitHub
Re issue: #21
https://cdn-shop.adafruit.com/datasheets/ST7735R_V0.2.pdf
Page 113 - RGB-BGR ORDER
@fluid moss ah, feel free to make another PR. does anyone use the existing bgr arg?
I think I should. I have a few different TFTs to dust off and test with. Both newer IPS and older active matrix (white plastic shell).
None of the Adafruit branded ones though.
I'll make a PR, and add some more tests and photos
๐ thanks! we can also revert that one if you like
correct, folks can use external pulls in addition to internal - but vast majority of matrices/keys use internal pulls only!
being able to get events and also current key state is really valuable for UI and HID reports
I am pretty sure that this is also fixed by #4900, but I can not confirm as my only nRF52840 Micro Dev Kit USB Dongle is bricked after messing around with the bootloader.
I ordered more in China but it takes a couple of weeks for them to arrive.
We can close this for now and I will reopen in the unlikely case, that #4900 does not also fix this.
Clarified, with default and units mentioned.
But if they release the shift at that moment, you will have it wrongly held forever. Resetting to a known good state is the only way to handle this.
By the way, would you prefer column over col?
@tannewt Yes, I believe this is an issue with Arduino's nina-fw upstream not containing the root cert. for Adafruit IO, since @dedSyn4ps3 's sketch works properly w/insecure port 1883 (non-SSL connection).
I changed the name and added the reverse computation, which returns a tuple.
row_col_to_key_number(row, col) -> key_number
key_number_to_row_col(key_number) -> (row,col)
Leaving, but renamed to get_states_into(), for consistency.
Can we just use
len()for this?
Good idea. It seems unambiguous to me. We still need to provide key_count arg for ShiftRegisterKeys.
looks like the pypi upload of stubs succeeded in an actions run this morning! We can now install the stubs much easier than before ๐
pip install circuitpython-stubs --pre
Once the next release is made the --pre won't be needed unless you want dev builds.
It's working great with PyCharm. If any VSCode users have a chance to give it a try I'm interested to know if it's working in that app as well.
I defer to your experience on the clearing.
I added an overflowed property to Event, and I will clear the EventQueue and post that event if it overflows.
@lone axle that is great news! I may have some refinements, I'll tag you to look at them if I get it ready.
@tannewt I understand that. If someone could, however, just make a solution for the stm32f405 feather to change at boot.py, that would allow for your products (feather gps + feather stm32) to be compatible. I view that as different from working on changing all of the boards' capabilities just for the feature. I realize there's a lot going on and that still may not be a priority though.
I know next to no C, but if I manage to solve anything on my own, I'll submit a PR.
- so that excess files are not included in sdist, perform build down in circuitpython-stubs
- This means we need to
- Remove the need-pypi check
- Copy a setup.py, README, and MANIFEST.in into the stubs build location
- Revamp how the overall
mypy --strictcheck lists its inputs
- Add a new test that actually installing the stubs lets us do type checking (tools/test-stubs.sh)
- Add a missing return type to a
__init__function (why was this not an error under `mypy --str...
@brentru I sent an email to arduino last week in regards to adding the root cert, but have not heard back. I'm not sure if this is because they closed the issue ticket that I originally filed for the https issue...I may have to reopen a new ticket, not sure.
I know that from prior experience using the Seeed Wio Terminal in the Arduino IDE, I would have to manually add the root cert in my sketch for proper HTTPS comms to whatever site I was trying to communicate with. I have not had the...
Successfully installed circuitpython-stubs-7.0.0a4.dev97 Thanks!!
what sent me down this rabbit hole was that the stm32f405 jams gps antennas while running at 168[MHz].
What clock speed does not interfere with GPS? Implementing a general clock-speed change is a big hammer if we could perhaps just tweak the default frequency slightly to avoid some particular harmonics. That would be another issue.
@dhalbert I haven't been able to test other frequencies, but I believe that the next lowest "step" is 144MHz for the STM32 for their default divisors, right? If you have a build with that frequency, I'll be glad to do whatever testing is needed.
Can the Adafruit fork of NINA be flashed onto the Nano (are the U-bloxยฎ pins the same)?
@anecdata I do not believe so, they've done some upstream PRs specifically for the RP2040 Connect.
@lone axle Where do you install the stubs? I run everything through virtual environments, but I'm not sure I want to have to start PyCharm out of a venv every time. Do you simply install them on your system?
Thus far all of my testing has been inside of a virtual environment. But for longer term usuage I will likely install it into my main python instance.
But to use it with a virtualenv you would have to start PyCharm out of that virtualenv, right?
Or how does that even work
Inside of pycharm you can select your python interpreter on a per-project basis. and I believe it saves the selection inside of the .idea folder so that it can load the same way next time.
Ohhhh.
That makes more sense.
Thanks! I'm eager to test this out, but don't want to bork my system etc.
But it sounds like we've got it in a state where I could add it globally and be ok
inside File -> Settings and then select your project on the left. Then into Python Interpreter:
Right, got it.
I do think it should work fine globally. The only possible gotcha that I know of is that circuitpython uses lots of different names (one for each of the modules that exist). I don't know whether there are any conflicts with existing python libraries but if so it may not like having both installed at once.
like if there were a different unrelated library named digitalio or something.
@lone axle @idle owl related to that, we avoid shipping stubs for modules that are also in desktop python (like time) so if you get hints about time.monotonic it is about the "standard" time module rather than the CircuitPython one.
Oh. Nice.
I think users are going to love this, but also will notice places where it is not 100%. For instance, it does not know what board.D1 is...
(because there's just one set of stubs, but whether or not there's a board.D1 is specific to each board)
(I guess we could publish 200 circuitpython-stubs-<boardname> packages on pypi ...
)
I was thinking about the stubs for board a bit as well actually. I wonder if it would be possible / make sense to try to include all possible pin names inside the stubs for board It wouldn't get any data associated with those pins so it wouldn't know anything about them other than that they exist. I think that would be nice though because it would allow the IDE to realize that it does exist.
perhaps other things that get attached to board as well like board.DISPLAY
You may also be able to write an "I know what I'm doing" type annotation in your code, d1 : microcontroller.Pin = board.D1 to guide it
and yeah it's true we could have a "superset of all boards" board/__init__.pyi. Right now it gets SPI(), I2C() and UART()
Awesome! Thanks for getting it going!
@fluid moss looks like the ST7735R was fixed by melissa: https://github.com/adafruit/Adafruit_CircuitPython_ST7735R/pull/24
No need to squash. It's funny with merge commits.
I see a ports/qemu-arm left that I forgot to list. For reference, I used this script to delete other ports: https://github.com/adafruit/circuitpython/blob/main/tools/merge_micropython.py#L13
Yeah, I generally prefer full words because it's easier for non-english speakers to understand/google.
Do you want to repopulate the eventqueue with current presses on overflow? You still know the current state since you maintain it separately.
But what if there are more pressed keys than the queue size?
What are events useful for? I'm trying to counter having multiple ways of doing something. Furthermore, we should consider Seesaw connected matrices because they should have the same API. (See https://github.com/adafruit/Adafruit_CircuitPython_seesaw/pull/76 )
Looks like you have more to push (for more resolved items) so let me know when that is pushed.
I'm going to close this one up -- it's an interesting proof-of-concept, but we don't want to do it right now.

