#circuitpython-dev
1 messages Β· Page 107 of 1
that's from the cold room with DEC, vaxes, CDC, etc π
yeah worth experimenting to see if they lib can work if it's compiled into firmware
er the lib
wow that's wacky
i wonder what sphinx is doing
i would ignore it, sounds like sphinx is trying to process code it shouldn't
or trying to outsmart our stuff
shift = 2 ** 15
for i in range(length):
yield int(TONE_VOLUME * math.sin(2*math.pi*(i / length)) + shift)
length = 79 # Amount of samples in the sine wave.
sine_wave = array.array("H", sine_sample(length))```
TONE_VOLUME = 2 ** 15
shift = 2 ** 15
for i in range(length):
yield int(TONE_VOLUME * math.sin(2*math.pi*(i / length)) + shift)
length = 79 # Amount of samples in the sine wave.
sine_wave = array.array("H", sine_sample(length))
# Initialize the audio output to play the generated sine wave.
sample = audioio.AudioOut(board.SPEAKER, sine_wave)```
one question too, is there a reason sphinx is processing this file?
it's not part of a library or doc though
so maybe needs to be put on an ignore list?
tannewt@shallan:~/repos/circuitpython/atmel-samd (internal_fs *) $ python3
Python 3.6.1 (default, Apr 4 2017, 09:40:21)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> def sine_sample(length):
... TONE_VOLUME = 2 ** 15
... shift = 2 ** 15
... for i in range(length):
... yield int(TONE_VOLUME * math.sin(2*math.pi*(i / length)) + shift)
...
>>> import array
>>> sine_wave = array.array("H", sine_sample(length))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'length' is not defined
>>> length = 79
>>> sine_wave = array.array("H", sine_sample(length))
>>> sine_wave
array('H', [32768, 35371, 37958, 40512, 43017, 45458, 47818, 50083, 52238, 54271, 56167, 57916, 59505, 60926, 62168, 63225, 64089, 64755, 65219, 65477, 65529, 65374, 65012, 64447, 63681, 62720, 61570, 60237, 58731, 57061, 55237, 53271, 51175, 48963, 46649, 44246, 41772, 39240, 36667, 34070, 31465, 28868, 26295, 23763, 21289, 18886, 16572, 14360, 12264, 10298, 8474, 6804, 5298, 3965, 2815, 1854, 1088, 523, 161, 6, 58, 316, 780, 1446, 2310, 3367, 4609, 6030, 7619, 9368, 11264, 13297, 15452, 17717, 20077, 22518, 25023, 27577, 30164])
>>> length = 100
>>> sine_wave = array.array("H", sine_sample(length))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: unsigned short is greater than maximum
oh you're hitting sine = 1 i bet and that's getting to 2 ** 15
python's array module is probably stricter about overflow
ah yeah the addition of shift at sine = 1 would overflow
yeah easy change could be to just bump volume down a bit, like 2 ** 14
i was using 2 ** 12
yeah with 79 it's probably not hitting exactly an input of sine giving a 1.0 result
sine goes from -1 to 1 smoothly
alright i gotta run, thanks all!
thanks @timber lion
int(TONE_VOLUME * math.sin(2*math.pi*(i / length)) + shift - 1)
TONE_VOLUME = 2 ** 15 - 1
shift = 2 ** 15
for i in range(length):
yield int(TONE_VOLUME * math.sin(2*math.pi*(i / length)) + shift)
Maybe I can help with that as well
This is my attempt at moving micropython ustruct into shared_bindings and shared_module for both atmel and esp8266
so I managed to mute my mic duirng the cat seizure but it recorded it together π
Odd.
yeah, I think I have it setup correctly now so it'll record to two different tracks
the recording is done before it goes into discord? the muting is in discord?
its just hissing and growling but I'll cut a chunk out
yeah, I muted in discord but it was recording my mic directly
Ah that makes sense.
@idle owl I'm gonna cut a bit of you out
Fair enough. We covered most of it afterwards anyway.
Excellent. Let me know when you're back.
kk
Cool! Ping me when you want me to look at it. Once its ready I'll fork it into adafruit's repos.
I just added a column to both sheets to hold tracking issues that are used to note who is working on what.
Board definition for a hacked Trinket M0 with added flash chip.
Based on https://daveastels.com/2017/09/01/trinket-m0-express-hack/
Details at https://hackaday.io/project/21578-pewpew-featherwing/log/68146-replicating-the-trinket-m0-express-hack
Add yourself here @mrmcwethy
No need for the _internal suffix. Its implicit with shared_modules.
We should probably not pass this test because its checking that MicroPython doesn't match CPython.
I'm not sure if this is actually useful, but since I got it working, I thought I would make the pull request anyways.
Thanks for this! I'm not exactly sure how we want to handle the branding for this since its a hacked up Trinket. I think it'd be ok to have it pulled in. We just likely want to caveat it.
I don't know of any extensions other than some slight behavior differences that i already have pointed out. I took the text from the original code, so i will remove the words ,'with some extensions'
I looked at the micro python documentation. They do not document these extensions. We won't either. There is some code that is looking for 'S'. I don't yet see any for 'O'. I can delete the 'S' code.
@stuck elbow Nice.
I totally agree that the .h file should be with the .c file. I followed the changes for urandom to random. shared-bindings\random is like what i did, but i will make shared-bindings\struct case as you like.
I made the requested changes, built and tested on a metro board.
that moment when you remember you forgot to check if Sphinx builds before pushing to Github, but it turns out it does
Reword this here to explain why gamepad is super useful for making games.
"The basic feature required here is the ability to poll the keys at regular intervals (so that de-bouncing is consistent) and fast enough (so that we don't miss short button presses) while at the same time letting the user code run normally, call blocking functions and wait on delays."
Please move the GamePad object and header to a separate file to match TouchIn and others. https://github.com/adafruit/circuitpython/blob/master/shared-bindings/touchio/TouchIn.c#L54
Move this below the class, then indent it and it'll be included in the class automatically. Here is an example: https://github.com/adafruit/circuitpython/blob/master/shared-bindings/touchio/TouchIn.c#L54
I also think pressed should be a property rather than a method because its state.
Disabling this by calling it again with no arguments seems weird to me. Could you add deinit to match other classes instead? Thanks!
Fixes #278, #277, #276, #275.
Had to reduce -ifinline-limit to almost the minimum to get this to fit on non-Express boards.
Enhanced Makefile so that -finline-limit is not used on Express boards.
Tested by hand in a straightfoward way for the various *io modules on both atmel-samd and esp8266. analogio and digitalio were tested electrically as well (with a voltmeter). Speaker output and mic input on CPX also checked.
@fading solstice you around?
nvm, I think I got it sorted. I'm trying to find a way to list all of the github pulls I need to get back on
Ok, here is the recording from the weekly today. I couldn't manage to get it edited so you'll hear Spook hissing and growling while @idle owl talks. https://www.youtube.com/watch?v=Aj_sh56biNA
Join here for the chat all week: http://adafru.it/discord The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel for noti...
@everyone This is a strange path I am on. First, after getting turned on to ESP8266 microPython, Arrow Electronics awarded me a participation prize of a free RPi Zero in their 2017 Back To School Backpack of Components Giveaway. Then I bought a RPi Zero and two zero cases at Micro Center.
One is the Pibow Zero Case for Raspberry Pi Zero version 1.3 and the other is a Nucleus Zero Case Black and Lime with a heat sink from C4Labs. It is installed and looks really great.
Then on Sunday; a very generous person π , who is a member of Marietta's The Maker Station, gifted me with a COMPLETE Pocket Chip set from Next Thing Company's Kickstarter: https://docs.getchip.com/pocketchip.html. Unreal! Now I have 4 tiny devices that run Debian Linux and Python and 8 tiny devices that run microPython with a fair possibility of running CircuitPython
.
so, after trying unsuccessfully to get the 2.x branch to build with what pieces of the atmel arm SDK I could extract from my Arduino install, and failing to convince Atmel's website of my humanity to download the ARM gcc toolchain, I'm ready to ask for help.
Does anyone have tips for getting a functioning CP dev environment (on a mac)?
Done. I hope I didn't miss any. I also changed one "micropython" to "circuitpython" β you might want to do that in other boards too.
I also think pressed should be a property rather than a method because its state.
I would make it a property, if not for the side effect, which is clearing the current state. The way this works, it accumulates button presses, until you call "get_pressed", which gives you what has been pressed since the last call, and clears the buffer. Making it a property would lead to surprising, unexpected behaviors where the status is cleared more than once, etc.
I made the status clearing functio...
Also note, that it is important that the status is retrieved and cleared in one atomic operation, and not first retrieved, and then cleared separately β the latter risks missing some button presses.
Thank you for your guidance, I'm still not very well oriented in how it all is organized, your comments are certainly most helpful.
I'm still not sure what to do with the conflicts. I originally wrote this for the 2.x version, and it seems that in 3.x there has been some changes β to which version do we want to merge this?
I read through some backscroll: @idle owl you're working on CP sound production, right? I'm debating whether I can get away with generating tones for my halloween costume or if I should attach a sd card and play sound samples
@pastel panther One way to build CP on a nac is ti set um a Virtual Machine as described here: https://learn.adafruit.com/micropython-for-samd21/build-firmware?view=all#build-firmware I did this for a lon gtim before switched to a linux system. Alterenatively, I think it can be installed directly o the Mac is you instalI Homebrew. https://brew.sh -- Good luck.
@opal elk I implemented sound for the Circuit Playground Express specific library, but the library uses audioio. What board are you using?
probably metro
I haven't tried it using the Metro. The onboard speaker on the CPX is just a soldered on version of a wired on speaker, obviously, so I don't see why it wouldn't work as is with the Metro.
right! maybe I'll play around.
@idle owl doesnt the CPX have an I2Cspeaker on it. CAn you drive it with jsut ones like a simple speaker?
meant speaker
@solar whale I'm not sure. My suggestion wasn't that level of informed, I was going based on logical assumptions.
I was plaing with some examples last week - did tey come from you @opal elk for creating tones for a speaker on otehr boards.
I didn't have to use any I2C code to make it work.
@idle owl never-mind - my error - it jsut has an amp - the sound sensor is i2C
@solar whale That makes more sense.
CPX sound sensor is I2S (not to be confused with I2C)
@tidal kiln thanks for the correction. I'm still trying to figure out why I got so confused about these. It certatinly is I2S. There was some componet "I thought that became I2C on the CPX ) bu perhaps it was just in a dream π
I just wanted to drop it here, a couple of characters in the helvR08.pil/helvR08.pbm is erroreus. [ and / does not render properly, only 1 of 2 pixel columns is rendered. Secondly, \ and / should be three pixels wide, 2 pixels look awful. The lower case letter r is also printed without an empty column after, so it becomes quite hard to read.
NextBus project.
@tidal kiln @idle owl I just looked at the schematics for teh CP and CPX and I have no idea waht my concern was .... I think I have not had enogh coffee today. Sorry for the confusion.
@solar whale No problem, I hadn't known it was I2S, so I learned something. π
I cant find any info on how to edit the pil font, so I dunno how to fix it myself.
@neat rose I'm not familiar with what you are tryin to do. Where did you fet the fonts and haow are you tryin to use them?
@solar whale Its part of the Adafruit NextBus project/example.
Its not really part of circuitpython, but since it was python related, I thought I'd drop it here.
@neat rose probably better to ask that in the forums
@neat rose Interesting project and I agree with @tidal kiln - I have not seen any mention on these discussions. You may want to try in #help-with-projects as well.
@pastel panther I can help with a native mac setup. Thats what I use
most important is brew cask install gcc-arm-embedded
Posted an issue on the github page :3
@neat rose Good luck! you can also post to https://forums.adafruit.com/viewforum.php?f=47 and a search for nextbus showed severel other users have been asking questions, but I did not see your issue addressed specifically
@neat rose - nevermind - now I see you have been there already. Good luck with it.
CircuitPython now has a category in the store! https://www.adafruit.com/category/956
@slender iron yay! about time βΊ
making progress π
Thanks @deshipu !
Which MicroPython did you change?
c2bb9e2 Add board file for the hacked Trinket M0 Haxpre... - deshipu
@solar whale Thank you~~
Have you tested this with sphinx or readthedocs? I think this chunk and below needs to be indented.
(RST was created by python people I think so its white space sensitive too.)
This should be in the express board portion right? Currently this will call ticks but the singleton will always be null.
35-41 can go in init.c and do .. currentmodule:: gamepad here.
Example touchio docs: https://github.com/adafruit/circuitpython/blob/master/shared-bindings/touchio/__init__.c
Ok! Looks good.
Another critical point in my mind is that it includes past presses. The state module works better when there are no side effects and it only is actively pressed buttons. Thanks for the push back!
That said, you should be able to test this in master with the REPL if you want to try and merge to master. The filesystem stuff isn't working yet though.
Is this ready for another look?
Yes, it is ready. Please review
c478c10 Do not allow a *io object to be used after dein... - dhalbert
I haven't, I will fix it and test, sorry.
Not sure what you mean. This defines how often the buttons are scanned, and also lets you disable the scanning completely. I put it here, because it's configuration. The gamepad_singleton is not related to it, but it won't be always NULL β it's being assigned to in the gamead_make_new function.
I will try that, thanks.
Lets raise an error here just like CPython
Lets raise a typecode error here if the fmt is 'O' or 'S' because they are non-standard.
Official ones are here: https://docs.python.org/3/library/struct.html#format-characters
ok, I think I'm caught up on review
Ah ok. Thanks!
On Tue, Oct 3, 2017 at 12:17 PM Radomir Dopieralski <
notifications@github.com> wrote:
e6be16f#diff-c0809c6aa2f2d9455e27475a2bfe59fbL79
https://github.com/adafruit/circuitpython/commit/e6be16fdeb8919938aba96dce0e531c8124091b8#diff-c0809c6aa2f2d9455e27475a2bfe59fbL79β
You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/pull/303#issuecomment-333949056,
...
Right, the scanning should be disabled on non-express builds. With this here, non-express boards will still include https://github.com/adafruit/circuitpython/pull/295/files#diff-ae7239759d3115ddffbb5b5fd105f23aR21 and gamepad_ticks().
Ah, I see what you mean.
Thank you for the review, I incorporated your suggestions, and also added a short usage example.
I tested it with 2.x, so I think it would make sense to merge it there. Should I make a second pull request for that branch, or can you choose it while merging?
f498167 Add a gamepad module for handling buttons in ... - deshipu
Hey, @mrmcwethy I just realized this should be based on master. The rename is a big enough change that we should hold off on it until 3.x.
LOL: You are running in safe mode which means something really bad happened. Looks like our core CircuitPython code crashed hard. Whoops!
@slender iron I just dropped the CircuitPython uf2 onto it in bootloader mode and it came right back up, code and all.
I'm guessing it's not always so simple, but it happened to be this time!
@slender iron I still think we need an equivalent to the "sparky" pin for software - looks like @idle owl earned one!
πͺ
@idle owl here is a .uf2 with the libraries you requested embedded in the firmware. I was able to do from adafruit_circuitplayground.express import circuit using express.py without blowing out RAM. I tested a coupla things and it seems to work. I have no lib/ on this CPX so it's running just with the builtin libs.
if this works for you I'll put this in 2.x
@tulip sleet Thank you so much! I'll start testing it now. I'm working on acceleration so it's perfect.
if you have those libraries in your lib/ I think it will try loading that first, so you may want to rename the .mpy's in lib/ so they won't be imported. If you import sys; print(sys.path) you'll see the search order`
or just rename the whole lib folder to libx temporarily
@slender iron I'll file an issue if it happens again, but I don't think I can reproduce it.
@tulip sleet I'll rename the entire thing.
thanks @idle owl !
@tulip sleet Nicely done! Turns out I only had the libs I asked you to add on the board anyway. I renamed them and then deleted them. My accelerometer code works perfectly.
@idle owl OK! We'll need to think about whether to have a special bundle for CPX that doesn't have those libs, or else change the sys.path order. @slender iron do you have an opinion?
It seems like board specific bundles might be helpful, considering the limited space on Gemma and Trinket, but those aren't the same use case, as you copy what you need, not that you necessarily don't need particular ones.
Although if we start including frozen modules for each board, it might end up being handy to have board-specific bundles.
@tulip sleet the circuitplayground library could change the sys path
Also that π
that's a great idea, and very specific to the library
π
This is printing the values of x, y and z. print(x, y, z) Is there a way to get it to print commas between the numbers? I tried putting them in quotes between the letters with their own commas, but it gave me a syntax error.
oen way is print(x, ",", y , ",", z)
Hmm, I tried something close to that, I must have been off with something.
print(x,y,z, sep=", ") is in regular python; let's test in CPy
also you can say print(1, 2, end='') to suppress the ending newline, or sep='' to suppress the space
I'm not sure what the ending newline refers to.
This is streaming axis data if that changes what I might be seeing
try print(1,2); print(1,2) vs print(1,2,end=''); print(1,2)
Oh so it would all be on the same line if you did theend='' ?
yes
Ahh ok
Good to know. That wouldn't help here, but now I know the next time I'm confused as to why it's not doing what I want π
This saves a lot of RAM. Fixes #287.
Also fixed compilation of frozen_mpy.c to use supplied make rule rather than builtin rule (supplied rule suppresses printing out the gcc command line).
I agree, the changes to circuitpython should not be part of 2.x series, should be in 3.0 beta or later. i was told to make changes on the 2.x branch. Is it easy to switch branches?
Sorry about being so thick on this. I think i get it now.
Not sure what python exception you want to raise: ValueError?
@tidal kiln Yeah it worked exactly as I wanted it to.
the .format approach will let you get fancier (if needed)
Thanks! π
Oh I get it. lol. Took me until you said that to realise what was happening in that line.
Comma separation looks fine in this case. If it was still blending together I'd use .format, but reads well with commas.
you're good then. just throwing out another option fwiw.
I really appreciate it. I had no idea how to do anything else with print. I know I'll need it eventually.
you can do all kinds of stuff like set width, zero padding, setting it hex, etc. in {}
Seems like every time I learn something that isn't needed right then, the next day something comes up where I wouldn't have understood the code I was working on if I hadn't learned the odd thing the day before. At least it's been that way for the last couple of weeks.
Nice!
kind of like printf
I remember that from a different language. Where do I remember that from?
a, b, ...
Fair enough. I think I had one class on it at uni, and I attended maybe 2 sessions. Makes sense though, since that was probably in the first two meetings.
I'm not sure I follow what that ends up looking like.
try it.
0 before : is place holder. after :, 0 sets zero padding, 2 set width, x set hex format
and in case this is ever useful:
print("{0} and {1} and again {0}".format(1,2))
Oh neat
as an example of how the place holder numbers work
That's really good to know because I'd bank on me doing that accidentally and not knowing what was wrong. Now I know what it looks like to do it on purpose, and know what to look for if it happens unintentionally.
or a more cute example:
print("{0} in hex is {0:x}".format(12))
Oh nice.
Ahhhh I get the relation now...
Made more sense seeing it in two different lines of code
My Trinket M0 is complaining that the file system is read-only. I've seen this before but never make note of the fix.
Do you have everything on it saved elsewhere? My suggestion is always the flash eraser, but it will mean wiping it and starting again. Read-only sounds like a bad flash, or like it rebooted in the middle of writing at some point.
Download the file from here: https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/flash_erase_express
And follow the instructions from the first link.
Hey guys. the link to the learn guide 'MicroPython Hardware: PCA9685 PWM & Servo Driver' url link is broken again.
@idle owl I never work directly on the flash fs, so there's nothing irreplacable on it
The current link url is: https://learn.adafruit.com/micropython-hardware-pca9685-pwm-and-servo-driver/software?view=all
@idle owl The SPI flash eraser will do it for the Trinket?
@idle owl That was my first thought, but then I saw The SPI part π
@carmine basin I don't see a software page anymore. where did you get the link?
from my webpage when I clicked on it.
but if the last part of the url is removed, it works
@carmine basin you're accessing via the main learn.adafruit.com front page?
I went to learn.adafruit.com, then I search on micropython and servo. It brought me to the search results page. and I selected the MicroPython Hardware learn guide: PCA9685 PWM & Servo Driver guide
ok. yeah. i'm getting same stale link.
now get rid of the last part of the url '/software?view=all' and it will work.
yep
that page was probably was in the guide at some point
and then got removed / renamed or some such
as to why the learn search still points to old page...dunno.
ok. no problem, I'll just use the workaround. I just wanted you to know if case someone else ran into the same problem.
thank you.
@dusty fog would know
I miss the microtrace buffer. I have a bug corrupting the stack
thanks @carmine basin for pointing this out. will let learn system peeps know about it.
No, thank you. I apologize for the disruption, It was a Micropython learn guide so I figure the Circuitpython guys was the right group. Thanks again.
no worries @carmine basin. we're happy to redirect
so i'm going to try working on a cp lib pretty soon. currently reading through scott's guide.
question for those that are already working on these - what was your starting point in terms of initial repo location?
I usually start driver repos under adafruit
if they will take a few days to get going then I'll have them private until they are ready
@umbral dagger Sorry, I had to step away. Did you get it sorted?
@slender iron if a repo was started elsewhere, can you pull it in later?
we can fork it or have you push to it later
i mean if you didn't start a repo in the adafruit account originally
@idle owl Not yet.. I need to erase the internal flash for the Trinkey, right? There's no SPI flash.
@tidal kiln yeah, the local repo is actually independent of the remote ones
@umbral dagger easiest way to erase flash is to use Arduino to upload any program, like blink. Then copy the circuitpython .uf2 to TRINKETBOOT again.
this is true only for non-SPI flash boards
@tulip sleet Ah.. That's easy enough.
@umbral dagger I realised after you asked that, the flash eraser is only for the Express boards. Good call.
@tulip sleet Thank you!
If you know how to use bossac, you can use the -e flag, and erase it that way. That's basically part of what Arduino is doing.
If you want to restore the original files on the board, you can get them here: https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino/overview?view=all#downloads
@slender iron just wanting to make sure it doesn't create headaches later or something if a bunch of work was done without you having created an initial repo
no worries @tidal kiln
@slender iron ok, I have an RPi 3 that boots from a 500GB USB HDD. That's enough on that for tonight. I had to power it with its own AC adapter.
nice work @tulip sleet ! I spent all day doing reviews and banging my head against a hard fault
I think its related to -Os instead of -O1
@idle owl @tulip sleet Thanks. That fixed it.
@umbral dagger Great!
@slender iron ugh. sorry to hear that. could be alignment
time to take a break π
@slender iron think I will work on the brownout bug next (tomorrow)
@tulip sleet theres a max_usb_current=1 setting in config.txt, fwiw
@tidal kiln oh really? thanks! I couldn't even get the drive to spin up on my regular Dell desktop, so I thought I'd have no luck with the RPi. I have that little USB current monitor that AF sells; I should try that.
@tidal kiln it's an older 7200RPM drive, so it may be relatively power hungry
2.5" though, from an old laptop
yah, no guarantees. just something to try. i think it only changes 600mA max to 1.2A or some other not circuitpython related value. π
π
@tidal kiln found a newer drive, also 500GB, that's much less power hungry. Works directly from USB. didn't need to change config.txt (I think) ... reimaging
@tulip sleet I made a small change to a branch of the CPX library, but when I try to make another pull request, it says it can't automatically merge. What step did I miss? I tried to merge upstream/master, but it says up to date. It's a change to something that was approved and merged earlier today.
Research is showing that, while I can still make the pull request, it means that the conflicts will have to be resolved by whomever approves the request, so I didn't want to leave it hanging like that.
Did you do git fetch and then git merge upstream/master?
what branch were you in when you did the merge: your work branch or master?
Should be work branch, I was taught not to do things from master.
I've learned all of this fairly recently...
if you do git checkout master; git fetch; git merge upstream/master does that just fast-forward? Then you can check out the work branch and merge from your own master. But before you do that, assuming you have not committed yet, you can do git stash to save all your work, then merge (which should fast-forward), then git stash pop to put your changes on top of the updated code.
I did commit, and pushed. Maybe I needed to do the fetch and merge from in the working branch?
That was it. Now it's giving me the conflict locally.
I have always updated from upstream in master (or the appropriate upsream branch), and then brought the working branch up to date. That may not be necessary, but it keeps my forked repo in sync with upstream more easily.
It is apparently necessary. It's telling me that it can't automatically merge because of conflicts. So I'll need to research a bit but at least I know where the issue is.
I didn't realise I had to update the branch as well. I thought because the pull request came from it, it didn't need to be updated. I understand why that's not the case, but I didn't before doing this.
then you can maybe rebase locally, or just fix the merge conflicts and then rebase if you want a clean history. Clean histories are a matter of taste: where I worked previously we didn't mind merge commits.
I think I've been working with clean histories so far, but Scott never mentioned it being necessary.
I almost always discard the work branch after the pull request is accepted, kind of for that reason. Whenever I tried to reuse a branch I got confused.
As did I! lol. Now I know. π
Scott likes clean histories, which is fine with me.
yw
It was such a minor change, I think I'll just trash the branch and start again.
π it took me a week or so to get the workflow right! I did the same thing -- "this branch is all messed up; I'll just copy the files over"
Good to know that's not just me.
is the only way to create a travis account via github?
think so @tidal kiln
@slender iron Sorry about the extra pull request, I realised I hadn't made speaker_enable private like we had talked about.
no problem!
not sure when I'll get to it though. I'm in open hardware summit mode now
gotta pack
I figured, exactly why I apologised. π
np
just looks a little dodgy...
"Travis CI wants permissions to (insert list of everything on github)"
yep. just wanted to check.
π
I added an internal method to exclude 'S' and 'O'
And more importantly, I couldn't find a vector version of the CircuitPython logo or mascot, to make a PCB out of it.
running cookiecutter for first time. any guidance on how to decide on answering y/n to depends on bus_device and register?
@tidal kiln when i ran cookie cutter, i knew that th eptoject did not depend on bus_device and register. i answered no. i think you are pretty safe either.
way
i think i will be using both - a driver for an i2c board.
wondering about trade offs in size in case it matters.
they both look like convenience modules which would be great to use. but does it add too much?
meh. ill just include / use them and see what happens.
I am playing with some input options (Metro M0 Express - CP 2.0.0 - connected via linux screen session). When I try:```
import sys
sys.stdin.readlines()
Should this work - that is shouldn't controlD terninate the readlines()?
Is there some special way to sen controlD via screen -- seems to go OK at the REPL
It works as expected in a python3 session on my desktop.
@solar whale would not you say that seems to be a memory overflow (overwrite) problem?
@hollow tartan why?
@solar whale surprised it doesn't work; did you try it not in the REPL (e.g. in a main.py)? It's possible there's an interaction with the REPL. Though if I do input() and then type ctrl-D, I get an EOFError (as I'd expect).
@tulip sleet no- go in main.py - hangs
a=sys.stdin.readlines()
print(a)
control-c gets out of it π
@solar whale go ahead and file an issue
@jerryln I don't have much experience in the developement methods you folks are using so it was just a guess. I would like to learn how to do what you are doing. Where do I start?
@hollow tartan Do you have CircuitPython running on a board? If so which board?
@tulip sleet Will do.
@solar whale Sorry, no. but I have some esp 8266 and a RPi Zero.
@solar whale it works fine reading from a file so it's something odd about stdin EOF checking.
You can install CircuitPython on an ESP8266 if you want to try it. Just a second - I'll post a link.
@tulip sleet Good to know - I think π sounds like a real bug. I thought it was jsut a problem tranmitting the control d via screen.
@solar whale since you can type ctrl-d at the repl, probably not a screen issue. I tried picocom as well - same thing. I am looking at the i/o now.
@solar whale I remember ^D not working but ^C did for me
I think
I chalked it up to different environments
wait no different thing ignore me
also you said that
goes away
@opal elk ^C kills it but I don't get the input lines....
@solar whale Ha! there's no EOF char checking on stdin. The ctrl-D just goes through as input.
entering the following:
import sys
sys.stdin.readlines()
then typing some input and a Control-D does not terminate the input. It just hangs .
Control-C terminates it, but the input is lost.
also tried as main.py with same result.
The same sequence works as expected in a pythpn3 session on my desktop.
@tulip sleet is that a bug or a feature ?
input() looks for ctrl-D at the beginning of a line and throws EOFError it if sees it. Just adding ctrl-D handling to readlines() is dangerous because there might be a ctrl-D in a file and that shouldn't be treated as EOF (I would think).
bug is a feature
It's a bug; this is from micropython; surprised it hasn't been mentioned before, but I can't find anything. I'll look in the micropython issues.
@solar whale ok thanks!
this is exactly the kidn of testing we need
Glad to help. Always fun to break something π
@tulip sleet I started playing with it after rading your recent forum post. - input and readline worked great - then I pushed a bit to far....
mp_hal_stdin_rx_chr() just passes ctrl-D through. input() handles it specially and throws EOFError if it encounters a ctrl-D at the beginning of a line. readlines() does not do anything with it, which makes sense, since there might be a ctrl-D in the middle of a line of a file.
@solar whale the handling of ctrl-C and ctrl-D from USB input is fairly hacky. I already fixed one bug about that.
@chilly trail a good place to start with an esp8266 is http://circuitpython.readthedocs.io/en/stable/docs/esp8266/quickref.html but when you got to get the image to load get it from https://github.com/adafruit/circuitpython/releases.
@tulip sleet I can imagine. Is readlines supposed to handle "binary" stream as well as "ascii" streams. I alwasy assumed the "line" part assumed a text based stream. I also tried sys.stdin.read(-1) -- same result. I thought maybe they would be different.
@tulip sleet I tended to think read() was for more genereal input and readline() better suited to text, but I guess not...
readlines() just knows where newlines are, otherwise it doesn't care what the characters are. I'm testing to make sure, but I'd assume it works that way. ctrl-D as EOF is a tty-ism, not a general EOF marker in files, whether text or (obviously) binary.
and in general ctrl-D must be at the beginning of a line to be treated as an EOF on tty input
@solar whale ok thanks. .
@tulip sleet Thanks - excellent clarification Control-D is not EOF... good point.
@solar whale tested in both python3 and CircuitPython. open('eofs.txt', 'r').readlines() is happy to read embedded ctrl-D's in text, where eofs.txt is a file containing some \x04 characters.
@tulip sleet just for fun - on the desktop - I tried using readlines() and enterd control - d after some other characters - and it did not terminate the input - only terminated if control-d started a line - as you said. Good to know.
@hollow tartan Much of the development focus for CircuitPython is for the SAMD series of microprocessors. If you want to learn more about that, this guide has a lot of great information. https://learn.adafruit.com/adafruit-gemma-m0#circuitpython. Many of the examples also work on the ESP8266 but the main difference is that the ESP8266 does not support the .UF2 bootloader or the USB file system.
@solar whale yah, since there's no out-of-band way to indicate various things on a tty, we resort to weirdo control characters at certain times: ctrl-D at beginning of line, ctrl-C, ctrl-backslash, etc. On RS232, etc. we can do something electrically, like "serial break" (holding TX line low) [I am speaking about tty input in general, not python-specific]
@tulip sleet It all makes sense and the python documentation was pretty clear what to expect. AS long as the "rules" are there, we can all learn to live with them. In this case it seemed like it was a bug. That's the problem with trying to be true to cpyhton! It's great you were able to isolate the problem so quickly.
Micropython can just list is as a deviation !
I think I can fix it. I just need to have readlines() check that it's reading from stdin and then return when it reads a ctrl-D at the beginning of the line.
sounds like a good approach.
obviously it is not a common usage - since it has not turned up before !
HAH!
I'm getting good:
Looks like our core CircuitPython code crashed hard. Whoops!```
And I can reproduce it!
I have a simple fix that won't reset the filesystem if it reboots into safe mode. I did try to reproduce this with a bench supply, and only managed to make it happen a couple of times, erratically. I also wrote a high-duty-cycle blinky program on CPX that lit all the Neopixels, and ran a LiPo down, but could not get it to erase.@tdicola when you're back I could pass you a .uf2 with the fix and you can test it with the arc reactor project.
@tulip sleet This is me fumbling around trying to get acceleration into the CPX library. Should I really be filing an issue when it's definitely something I'm doing wrong? It happened yesterday too, and Scott asked if I could repro it, and at the time I had no idea what happened so I couldn't. But this time I paid attention and I can get it to happen again. However, like I said, it's me not understanding what I'm doing that's causing it to fail.
@idle owl getting into safe mode means there was a bug we need to fix, even if your code is in error. If you have a test case that reliably reproduces it, that's great.
@tulip sleet I managed twice, I'll repeat it one more time to be certain.
I had to save it one more time than last time to reload it, but it failed into safemode again. How do I file an issue like this?
There's so much involved.
@idle owl Is it just a snapshot of the CPX library? Just attach that code as a file to the issue, and then write the recipe steps to make it fail. You can also spend the time to get a minimal test case, but the code is not that big in this case, so it's probably not necessary.
just include both
@tulip sleet Ok. Is it safe to assume the rest of the files on the CPX aren't involved? They're .py files but they're just random names from different code attempts.
yes, just the code that actually runs
I thought as much, thank you
Making specific changes to the express class (attached express.txt) in the Circuit Playground Express library causes the CPX to reboot into safe mode.
As is, the code.py (attached code.txt) picks up the current reading of x, y, z orientation and lights up the LEDs the corresponding color, and prints and repeats that reading indefinitely in the serial...
I haven't looked at everything yet. Here are instructions for changing the branch. https://github.com/blog/2224-change-the-base-branch-of-a-pull-request
DigitalInOut.pull = digitalio.Pull.UP
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.UP```
is how I did it. ie how it's put right in the guide I was looking at
facepalms
I'm making a neopixel based "mini gun" for part of my costume... every 4 pixels in a 24 pixel ring. press an arcade button and the lights spin 12 places
@opal elk Nice!
Hmmm.... In CP, how do I keep a literal list/array of byte values in flash rather than ram?
@umbral dagger THe express boards have an nvm module that can do up to 256 bytes
let me know if folks want to do this: https://hacktoberfest.digitalocean.com/
I'd be down @slender iron. Haha I gotta get cranking on something though. I'll work on something after the readthdocs project and once my boards finally arrive lol
@slender iron that's cool! I might be interested...
I changed the base to master and it looks like there is only one conflict! In the atmel-samd/mpconfigport.h you had removed most of the shared-binding. In the case of struct_module, there are no processor dependencies and as a result, i think we allow the struct_module to be included.
@slender iron I need 600 bytes. It's a static, literal, lookup table of byte values.
@slender iron neat idea with hacktoberfest. assume you're thinking of targeting cp repos?
@umbral dagger it's possible to rebuild and increase the size of the simulated eeprom area. are you saying you need to change this table at runtime, or that it always has the same values?
@tulip sleet Ah.. simulated EEPROM. Clever. The table is immutable. Constants that get looked up based on a computed index.
simulated eeprom is all there is on the M0, right? it's a hardware thing.
@umbral dagger well, you could just put it in the code: `consts = bytearray(1,2,7,6,...) (EDIT: WRONG); are you running out of ram? @tidal kiln - right, no real eeprom
@tulip sleet I'm using CP because of the convienence. It's a simple experiment. I can port to C and use PROGMEM.
Oh... bytearray will keep it in flash? That'd be perfect.
no, it'll be loaded into RAM when the .py or .mpy is loaded, but you have 20k of heap RAM and 12k of stack RAM. Are you running out of RAM?
It's to visualize the output of the AMG88xx on the 8x8 dotstar
@tulip sleet "MemoryError: memory allocation failed, allocating 2400 bytes"
It's likely treating it as an array of ints
sorry, my code is wrong, you can't initialize a bytearray that way. You are proobably starting with a list and sticking it in a bytearray. You could just do b'\x34\x22...', which would avoid the intermediate step of having a long list. Also you could keep the bytes in a file and use seek to read the value at a particular offset.
there is no way of having it in flash except by using a file or making it a frozen module in the firmware
no way to access the simulated eeprom in circuitpython?
@tidal kiln oh yes, using the nvm module. I meant no way of storing a 600-byte array in flash.
Given the data I have isn't in hex... Porting to C is the easiest IMo.
@umbral dagger sure - choose what works for you. We are quite RAM-constrained now. The M4 boards will help a lot with that. 292k or 256k
192k
@tulip sleet A) this is a throw away experiment, b) the eventual project will be in C.
@tulip sleet Yes, my eventual project will likely be SAMD51 based. Bidirectional voice and possibly image input will be involved, so the more computing power in the edge nodes, the better.
The 1m/256k SAMD51 looks nice
πYes!
@slender iron I definitely want to try to do Hacktoberfest! I wish I'd known three days ago though... lol.
@tulip sleet Converted to C, AMG8833 -> 8x8 dotstar π
So many memory errors. Oi.
I was able to reproduce this. But I think it's due to delayed writes, and not some particular issue with this code. I was in a "safe mode" state which recurs again and again if I type ctrl-D. But once I did a hard reset, everything was fine.
@tulip sleet Are the frozen modules in a different place than the memory used when I'm writing things into the express class on the CPX?
@idle owl yes, they are in flash with the C code that is CircuitPython. You're using RAM. Are you getting allocation errors on loading now that it's longer?
@tulip sleet Yeah.
@idle owl eventually we'll supply that library as a .mpy, or freeze it like the other modules. A lot of memory gets used when it gets read in to compile it into Python bytecodes. If you precompile to .mpy, you might be able to continue debugging. Do you have a copy of mpy-cross?
@tulip sleet I do not. We talked about that at some point. You guys were wondering if you could include it somewhere. I looked into it at one point and it seemed a bit complicated, if I remember correctly. Yeah, it's coming back to me. We had this exact conversation, heh.
My solution was to delete everything out of the current express.py that wasn't being used and continue using that.
what os are you running on?
MacOS. I have a Windows machine as well, with bash installed, but nothing running Linux right now.
i have a Mac I could probably build mpy-cross on (haven't tried doing an dev on it yet). I'll try to build it and upload to you. If anyone else here has mpy-cross for v2.0.0 already compiled for Mac, could you speak up? Normally Scott could supply it immediately, but he's watching presentations at the Open Hardware Summit.
That was my thought as well.
i should learn to use homebrew on the mac anyway. I'll get back to you when i have something, probably half hour - hour.
Excellent, thank you so much!
Scott's guide mentions having travis create the mpy files
but i actually haven't tried setting that up
you could be right. i may be mis-reading/understanding that part of the guide
I'm reading it, I'm thinking maybe travis also does what mpy-cross does?
we use travis to automatically build .mpy's for libraries (it runs mpy-cross remotely). But for local stuff an mpy-cross is what you need.
@idle owl freshly built
@tulip sleet That was quick!
to use:, just ./mpy-cross express.py will generate express.mpy. Copy that to adafruit_cricuitplayground/. Remove the express.py there because I think the .py may take precedence over the .mpy.
Excellent!
I actually didn't have to do much. I installed brew and it came with git and stuff. So I just had to compile it.
see if you can run it! there might be library issues.
anywhere you want. if you have a ~/bin in your PATH, you could put it there so it gets found automatically
It's saying "not found" is why I asked. I'm in the same directory as it
say ./mpy-cross not mpy-cross
Permission denied. And then sudo it, and it says command not found.
also chmod +x mpy-cross
great! if you can write into /usr/local/bin you could put it there, otherwise just leave it where it's handy. I looked on the Mac I am using (borrowed from someone), and it doesn't have a ~/bin as default. GREAT!
I definitely have a usr/local/bin
Just move it to there and then ./mpy-cross works from anywhere?
Or I need to create the ~/bin as well at that point
I'll leave it where it is for now.
just leave it where it is now. if you do echo $PATH and you see /usr/local/bin, you could put it there, and then you don't need ./. That's just to tell the shell it's in the current directory. But really, just leave it in your dev dir for now and you'll be fine. The rest is frills.
I enjoy the frills. For now though, I'm really enjoying my library working.
@idle owl @tulip sleet just a note - If you move it to /usr/local/bin then you would execute it as mpy-cross not ./mpy-cross.
nevermind - you said that - sorry for butting in....
@solar whale Don't be sorry! Always good to have more information, even if it's the same written a different way.
@solar whale no problem!
... I have to go food shopping, so good luck and I'm sure others can help.
@tulip sleet Thank you so much! Greatly appreciated.
yw
ln -s can be your friend too (stash file whereever, add sym link to bin dir found in $PATH)
If I use a property decorator and write the following: @property def touch(): return Is it doing anything? Am I using memory for it?
@idle owl the property decorator turns a method with 0 parameter into a attribute/property. cls.touch() (method) vs cls.touch (property)
just guessing, memory usage would be same.
The issue i actually with Sphinx - it's not recognising the doc info for touch in __init__ where the rest of the touch bits are in the library, so I wanted to put them in that property, because they show up in the Sphinx doc when placed there. But we're already so tight on memory, I don't want to be wasting more if that's what it's doing.
If it's using memory, then I'll have to figure out a better way to do it.
i wouldn't add a new method for doc purposes
Ok. Thanks @fading solstice π
@idle owl we shold be able to get sphinx to do the right thing without having to alter the code
@tulip sleet I added a touch = None above the init of all the touchpads, and it worked. That was the only thing I could figure out. I think Sphinx doesn't pay attention to private bits so since all of the touch pad inits are _A1 etc, it ignores it if it's under any of them.
are you just running sphinx-build adafruit_circuitpython?
there's a way to tell sphinx which ones you want it to document - will look it up
@tulip sleet Are you asking me what command I run when I build it?
yes
got it - I think it defaults to html but that may depend on the sphinx version
could you drop the latest express.py here?
It includes my touch = None part with the doc bit under it.
So that self.touch = None on line 71 is there solely for the docs, it is not needed for the code.
ok, I'll see what I can get it to do.
Back.
@idle owl here's a revised version with several changes:
- each
.touch_Axis a property, with its own doc. I took out the__get_attr__hack. and just repeated them. It shouldn't really be much more memory. ight be the same or less.
-.pixelsis now a property. This makes it unsettable, which is good practice, and now the documentation doesn't have a spurious= Noneafter it.
I originally had them repeated, but that failed memory allocation faster than the rest of it had.
In fact I was going to try to do a __getattr__ for a couple of other things. Should I not go that route?
Scott said it was really inefficient with them all repeated and suggested I try to come up wtih something more efficient, when we last talked.
bleah - not just to save memory, unless you really need dynamic attribute names.
If you don't think it's a problem, I'll defer to you, obviously.
Well, I think we should measure how much it is, if we think it's important. If there were 20 of them, maybe yes, but ther are only 7.
Wanted to make sure you knew why I had done it that way.
Yeah this is basically how I had it to begin with. Minus the docs because we didn't think we'd leave it that way. I have no idea how to measure what it uses though.
Scott and I should reach consensus on it. That's the only repeated one, and the code in each property is really small (just a .value call) so I think it's not much. It probably has more to do with the names being a lot of strings than the actual code size.
Ah
The size of the .mpy file is very close to what it will use up in RAM, so that's an easy way to tell.
instead of .touch_A2, _A3, etc., you could make it like pixels: a sequence-like object that's read-only: touch[1] through touch[7]. Then it's easier to loop through and stuff like that also. And then you can put the TouchIn objects in a list instead of having a separate attribute for each one.
self._touch = [touchio.TouchIn(pin) for pin in (board.A1, board.A2, board.A3)]
etc.
if touch[3]: print('touched A3')
I think that's where I tried to start and I couldn't figure out how to make it work like that. And we decided we wanted it to be touch_A1 since that's how it's labeled on the board
gotta finish dinner; I'll be back in 45 mins or so, I think.
I don't know if that changes how it has to be done in the class or not, since I think it was that the way pixels is done it just uses numbers and not alphanumeric.
Ok
salmon cooking 5 more mins ... how big is the .mpy for your original?
Checking
how about .touchA[3] .touchA[5]
4041 for my express.py vs 4641 for yours. Finder says both are 4 so I checked command line.
.touch_A[3]
I really wanted them to be touch_A1, it made sense in my head based on the board. But if it won't work well code-wise, I obviously need to change up my thinking.
it'll work, the doc is a little tricker. You can always put in manual doc sections, I think.
I'll look into it. I need to understand Sphinx better anyway.
you can do a lot but it's not well documented (or, rather, there aren't many good examples)
Good to know
On both counts. I won't waste time looking for examples if that's the case.
I myself have an application with buttons where it's much more convenient to have the buttons indexed by integers. But I agree the literal names are more obvious. I just am thinking of lots of elif statements.
@tulip sleet I have project code, and it is, indeed, a lot of elif statements. But my frame of thought is based on teaching, and how best to make the code make sense if you don't know what you're doing. And while it means more code, it also means it's all clearer. At least to me. I'm still new to all of this really, though the code I'm writing might give the illusion that I'm not so much anymore.
But it could be beneficial to be able to use more than one at once for the same thing, so I'll look at what I have and see how it can be tweaked.
Actually, my project code does that too, but I use and.
FInished eating: see the 9-point answer here about using data:: to document arbitrary stuff. https://stackoverflow.com/questions/20227051/how-to-document-a-module-constant-in-python
I have a module, errors.py in which several global constants are defined (note: I understand that Python doesn't have constants, but I've defined them by convention using UPPERCASE).
"""Indicates ...
Reading.
I'll certainly defer to you and Scott about what you think is best for beginning users. You've spent a lot more time discussing this. So maybe .pixel as a property is the only thing from my revision that you might use.
I don't know how that looks in sphinx. Hopefully it looks the same (gray background name)
It looks right in Sphinx
you tried it? Great! That may solve a lot of problems about documenting things that you can't describe in the actual Python syntax.
I'm not sure I follow what problems it solves. I can't figure out how to extrapolate from what we solved with pixels.
Pixels was rendering in Sphinx as it was, but it said Pixels = None in the Sphinx build before. It doesn't do that now, it says Pixels. Which is obviously better. But I don't understand what else would use the same concept.
You could use it for the touch names, which don't exist statically. data:: touch_A1, etc.
Ohhh.... I think I get it. I'll give it a try now.
great work @idle owl and @tulip sleet sorry I was MIA. I'll be around all next week. (And I'm excited to get back to hacking.)
@idle owl @opal elk @formal plover @tidal kiln I'll look more into it in the next few days. Sounds like any 4 legitimate pull requests are enough for the shirt so we should be able to manage that across all of our repos.
Hello, Pythoneers! My current status is as follows: AdaFruit Circuit Python Loaded.
PYB: soft reboot
#5 ets_task(40100164, 3, 3fff8390, 4)
boot.py output:
Press any key to enter the REPL. Use CTRL-D to soft reset.
Adafruit CircuitPython 2.0.0 on 2017-09-12; ESP module with ESP8266
HW used: NodeMCU ESP 8266 , Windows 7 w/ TeraTerm @ 115200
Curr. Project: Use I2C on esp 8266 to drivie 8x8 led matrix via a MCP 23017 .
Oui, je sais que les rΓ©sistances doivent Γͺtre utilisΓ©es pour limiter le flux d'Γ©lectrons.
@hollow tartan That'll be a cool/fun project. There is a I2c learn guide you can use for some guidance if needed.
@formal plover Thanks for pointing the valuable study materials. The CP '66 has been running the Servo Sweep example for a few hours now. Time to get some sleep.
@hollow tartan you're welcome!
I've got a question I'm hoping someone can answer. MicroPython has the Timer class (http://docs.micropython.org/en/latest/pyboard/pyboard/tutorial/timer.html) that allows you to run a callback at a certain frequency. Does CircuitPython have something comparable yet? I haven't been able to find anything in the docs, but I'm still hoping I just couldn't find it...
@tacit glade I messaged you.
I saw, thanks. But I'm very familiar with the MicroPython docs, and just searching for the term "timer" in the CircuitPython docs turns up almost exclusively results for MicroPython. This is the reason I asked my question here
I've been trying to use an adalogger featherwing on an esp8266 with CP 2.0.0 but It seems that any pin I use as CS gives me an error that it is already in use. Iv'e tried GPIO15, GPIO0, GPIO2 but I get the same error. Has anyone used an SDcard with an ESP8266?? Am I missing something simple?
I gave up on the M0 boards because I there is not enough memory for SDCard, RTC and a sensor (SI7021). Frustrating.
Also note, Each part worked fine on a feather_m0_express, just not all together. all work fine on ESP8266 except SDCard.
@tacit glade The CP docs state:
Core Modules
These core modules are intended on being consistent across ports. Currently they are only implemented in the SAMD21 and ESP8266 ports. A module may not exist in a port if no underlying hardware support is present or if flash space is limited. This time module is included as a Core Module according to the table.
And
The time module is a strict subset of the CPython time module. So, code written in MicroPython will work in CPython but not necessarily the other way around. << ?? is this statement true ?? I don't know but I am kinda thinking the CPs and MPs got transposed.
Callback is documented here: https://circuitpython.readthedocs.io/en/1.x/docs/library/pyb.Timer.html?highlight=callback#pyb.Timer.callback
Do you have code that is generating an error?
@tacit glade I hope this link will provide the answer you seek: https://circuitpython.readthedocs.io/en/1.x/docs/pyboard/tutorial/switch.html?highlight=callback
@hollow tartan no, unfortunately that statement isn't true because CircuitPython isn't a port of MicroPython, it's a fork. And not all ports have the same API either. And the link you just sent me for the pyboard which isn't supported by CircuitPython
There is no machine in CircuitPython, only MicroPython.
That is curious. Because, I just did >>>import machine and >>>tim = machine.Timer(1)
No problem on CP 2.0.
@tacit glade CP does have machine. As far as timing, Circuit Python uses time.monotonic(). I could be mistaken, but I believe a lot of the other time related stuff has been removed from micropython as well.
replace reference to non-existent time.sleep_ms()
@hollow tartan @tacit glade machine is only present for the esp8266. Not for the SAMD boards.
@obsidian compass I think someone is working on a driver for the gesture sensor but there is not one avaialble yet.
@jerryn Thats cool! Is there any PR or something I can look at?
@obsidian compass I don't have any additional information.I only saw a post from @dglaude that it was a work in progress https://github.com/dglaude/adps9960-circuit-python
Sure! Thanks :)
Hey one more thing ! I'll be speaking about Using Python in electronics with MicroPython & CircuitPython at PyCon India 2017
If anyone want to suggest something to add while discussing circuitpython and short demos which can be given during a 40 min talk would be helpful ... :-)
Some progress with the SDCard on ESP8266 - looks like the Pin In Use was not a real problem . Now I just get "No SD Card" when I try to connect to it. Just curious if anyone has tried mounting an SDCard using adfruit_sdcard.mpy on an ESP8266. If so, could you please post the working sequence. I'll be back at this this afternoon. Note, it works fine on a feather M0 express so I think the problem is realted to the ESP8266.
@everyone I will be in San Francisco for the weekend. I have a free day on Sunday. Any votes for Computer History Muesum or the Intel Muesum? What other Geeky stuff is there?
@tacit glade @hollow tartan there is no way in circuitpython do do callbacks. I've been avoiding multithreading because its complicated.
<@&356864093652516868> I'm back from travelling but came down with a cold yesterday so my brain is still missing.
@slender iron welcome back. Hope you feel better soon.
@slender iron I might offer the observation that it is not within the perview of an educational & introduction to programming platform in any case.
thanks @solar whale
@hollow tartan yeah, I agree. I figure we'll address it when we need it for networking
@slender iron IS there any reason why the adafruit_sdcard should not work with an esp8266. I keep getting "no SD card". It owrks on my feather M0 express
@solar whale not that I can think of. do you have a logic analyzer you could use?
no - just an o'scope
may be orth checking each line is changing
@slender iron welcome back. My brain has been missing for about a week. All this baby prep stuff is brutal.
ok - I'll keep poking. ran out of memory on M0 with SD, rtc and temp sesnor π¦ thought I't try the esp8266.
@solar whale how are you using your esp8266 with an SD card? Do you have a breakout board for it?
@slender iron baby?? exciting times!!
@formal plover - I have tried with sd breakout and adalogerr with RTC - same results
@formal plover your baby! Congratualtons and good luck!
@solar whale thanks. We're about a month out. So we've been setting up the room, going to classes, hospital tour, paperwork for my work/insurance. Etc. Lol
@formal plover Lots of fun ahead!! My youngest is now 32 so it's been awhile, but I now get to watch them with our grandchild - great fun!
@formal plover have you ever used an SDCard with your esp8266?
@solar whale Nice! No, I don't have a breakout for it or the adaloger
the adalogger is nice because it also has an RTC - teh RTC and Si7021 work fine (they are i2C) but not the SD - yet.
I have a RTC though. I think UPS is refunding me for my lost Adafruit order (that was gifted to me from @slender iron / Adafruit). So I'm placing a new order with the gift card UPS is going to send and add an SD card breakout, then give it a whirl.
@formal plover I was just hoping to make a simple temp logger with time stamp. The RTC library takes a lot of memory and I have not been able to use all 3 on the M0 - I suppose I could just log to the flash on the M0 -express, but since I had the adalogger, I thought it would be fun to try using it.
@solar whale you could use Adafruit IO for now for fun.
I have that running under arduino code - have not tried CP for it yet.
Ah, gotcha.
It's pretty easy to use with CircuitPython, you just use API calls. Yeah, I got it working

Doesn't require libraries or anything
Other than urequests
great - do you have a simple example you can post?
@slender iron Glad to have you back! Hope you manage to shake the bug quickly.
@idle owl thanks! Will just lay low this weekend. Should be up for work on monday
@solar whale Yup! Let me see if I can grab an example
@formal plover thanks - no rush
urequests.post("https://io.adafruit.com/api/groups/weather/send.json?x-aio-key=insert key here&temperature=74")
That would create a group weather and feed temperature
Of course you'd have to pull the temp valve from the sensor. This just posts a fake value of 74 degrees
If the groups and feeds exist, don't worry it won't create them over and over again.
If they don't, they are then created
@formal plover wow - that looks great - I'll give it a try.
@solar whale awesome! Good deal
@formal plover where do I find urequests?
@formal plover very nice! it worked! with test value - now to add to si7021 test.
@solar whale Awesome! Woot woot! 
@formal plover cool!- now sending temp data from si7021 to my AIO feed - taht was easy!
@solar whale Very cool! I was surprised how easy it was too.
@formal plover its working pretty well - sending temp/humidity. Occasionaly it fails with an OS error: -2. Have you seen this. Any idea what causes it?
here is an example - sending data every minute: ```>>> import si7021_aio
22.8739 63.5457
22.8524 63.4466
22.8417 63.3626
22.8202 63.4542
22.8417 63.4084
22.8417 63.3169
22.8846 63.1643
22.8739 63.2101
22.8202 63.355
22.8309 63.5152
22.8309 63.5229
22.8739 63.4466
22.8309 63.5
22.8309 63.5763
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "si7021_aio.py", line 14, in <module>
File "urequests.py", line 111, in post
File "urequests.py", line 53, in request
OSError: -2
here is the code : ```from board import SCL,SDA
from busio import I2C
import adafruit_si7021
import time
import urequests
i2c=I2C(SCL,SDA)
sensor=adafruit_si7021.SI7021(i2c)
while True:
temp=sensor.temperature
rh=sensor.relative_humidity
print(temp,rh)
urequests.post("https://io.adafruit.com/api/groups/weather/send.json?x-aio-key=mykey&temperature="+str(temp))
urequests.post("https://io.adafruit.com/api/groups/weather/send.json?x-aio-key=mykey&humidity="+str(rh))
time.sleep(60)
@formal plover Made a few changes - I still get occaional OSErrors, but this just skips the reading adn trys again in a minute - seems to be working ok ```from board import SCL,SDA
from busio import I2C
import adafruit_si7021
import time
import urequests
i2c=I2C(SCL,SDA)
sensor=adafruit_si7021.SI7021(i2c)
while True:
temp=sensor.temperature
rh=sensor.relative_humidity
print(temp,rh)
try:
urequests.post("https://io.adafruit.com/api/groups/weather/send.json?x-aio-key=mykey&temperature="+str(temp)+"&humidity="+str(rh))
except OSError:
print("error accessing AIO")
time.sleep(60)
@solar whale well on the free tier I think you can only send a certain amount of updates
I know with temp/humidity sensors like DHT11/22 in Arduino are relatively slow devices. You try to request a reading from them too fast and they choke.
AIO probably stops taking data
Is the non-free system available yet? I ahve not seen a way to access it.
@cunning trail thanks - I have had similar issues with the dht22 - these errors occur when sending the dat to AIO - not when reading the sensor.
@formal plover I thin once a minute is OK - but I forgot, that I have some other systems feeding data as well, so there could be collissions. Good point. I don't mind occasional missed values. Just wanted to make sure I was not doing something wrong.
@formal plover I'll be happy to sign up for the "paid" tier when they open the gates.
@formal plover thanks for the hlp getting going with AIO from CP. That is great to have working - now back to the SDCard - grrrr.
@solar whale you're welcome! Glad you're all set up now. Yeah, good luck with that!
Hi has anyone tried to port/configure circuitpython to run on a SAMD21J18A ? note! J18 versus G18 switching from G18 to J18 in board specific files causes many build errors related to samd21_pins.h and other areas. I understand that Adafruit does not have a board where the J18 is used but i have two boards that use that larger package device and wanted to use circuitpython. If i just load a G18 image like for Adafruit m0 adalogger the REPL works and anything that has a defined IO that is the same on G18 and J18 works just fine. the issue is switching device type and mapping the extra IO. Has anyone had any success with doing that ?
@formal plover FYI - I tracked down the errors I was having sending data to Adafriut IO and it turns out it is due to failures in the call to usocket.getaddrinfo from urequests and appears to be a DNS lookup failure. http://circuitpython.readthedocs.io/en/latest/docs/library/usocket.html?highlight=usocket#usocket.getaddrinfo The transmission never gets to Adafuit IO so it is not related to any limits there. One cahge I made that seems to have reduced, but not eliminated, the errors was to enable WEBREPL. I have no idea why this woulld make aany dofference and it may well just be a coincidence. In any case, I have had it running for a few hours sending data once/minute and I get an error every 10 minutes or so. Definately tolerable.
@weary spindle it should be doable. I'd be happy to help fix any bugs you find
@slender iron Are are any guidelines on what needs to be modified to build for a different SAMD21 variant ? maybe i am not doing this properly. I am using vagrant and the method described by Tony D in the learn guides to first copy an existing board build directory with the files like pins.c and board.c and mpconfigboard.h etc to one named for my board. then i looked for the reference to samd21g18.h and switched them to samd21j18.h and just modified one of the pin mapping pin names in pins.c. but when i try to build, first i got an error about Endian, and then lots of issues in samd21_pins ...
@weary spindle I can't think of any actual docs. Its mostly the define you need to change
are you building master?
I think this matters most: https://github.com/adafruit/circuitpython/blob/master/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk#L7
@slender iron i was following the learn guide and use the instructions provided there with :git clone https://github.com/adafruit/atmel-samd-micropython-vagrant.git to get the required source files.
what branch of circuitpython? master is very new
I will have to go back and check on this ... for this initial attempt i was just following the instructions in the learn guide exactly. Maybe that does not bring in the latest master branch.
I bet it does. There is a 2.x branch that will be more featureful for now
I looked at the link you provided above for mpconfigboard.mk and the other related files in that branch and they look like what i have. also can you explain what the following lines are actually doing : #define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
Ok, the master branch only has basics working now. (Help on it is appreciated)
Those defines define pins that shouldn't be reset between python VM runs.
PORT_PA24 and PORT_PA25 are usb pins for example.
Thanks ... that explanation really helps ... i was not able to figure out what they were for but they would be the same for my boards . I will experiment with this more, later .. i have to run now ... have a great day and thanks for the guidance.
no problem @weary spindle !
@solar whale glad to hear that. So it does recover after the error? Just errors that once a ten min the continues on?
@formal plover It varies - usually recovers on the next read - but it has completly crashed occasionlly. I added a new check - I now read evey 5 minutes but if ti AIO lookup fails, I try again after 10 sec. If it fais twice, I toggle the boards RESET. I'll try taht for awhile.
@solar whale interesting. Hopefully you can figure out an error free solution.
@formal plover looking back at the logs from my Raspberry Pi taht has been sending data for several months, I see taht this is not a new problem! It also happens there on occasion. The RPi seems to be a bit better at handling the errors. It's been a learning experience!
@formal plover cool! just triggered my first case where the 10 second retry worked - no need to reset. Looks like a keeper!
@solar whale Nice! Awesome job
It is amazing to me that the code to execute it ia about 30 lines total - python is really a great tool!
with a bit of effort the line count could even be cut way down - I tend to sprawl out when I'm playing...
Yeah, it's crazy. Great tool indeed.
@idle owl I had coupla more thoughts about the Express touch support. Do you have time maybe for a voice chat? Could also be text. @slender iron you could also join in
tomw during regular time is fine too
@tulip sleet Tomorrow would work better for me. Potentially later tonight but I'm not sure when I'll be available.
@idle owl tomw during or after checkin meeting is fine
@tulip sleet Ok I'll ping you when I'm around tomorrow and we can sort the specifics.
tomorrow is better for me too @tulip sleet
The way this works is inherited from MicroPython. I opened an issue in their repo to see if they are aware of this and what their position would be.
@slender iron If I update the Readme.rst file in my local copy of the Adafruit_CircuitPlayground repo, will that cause it to update in the actual repo when I do my pull request? Or is there something special I have to do to update the Readme.
@idle owl only if the changes are included in the branch you do the pull request from
@slender iron Ok that's where I'm making the changes. Thank you!
np π
@slender iron when you have a chance would you look at these scope shots and tell me if it tells you anything: yellow=CS, cyan = SCK, Magenta = MOSI, BLUE = MISO - the first is the M0 mounting the SDCard normally, the second is the ESP8266 failing.
ESP8266
@solar whale Its weird that the chip select isn't low on the esp8266
@slender iron is CS actilve low? I was triggering on rising edge
yeah, I believe so
I should redo these then - on the M0 there is activity during both states of CS.
there is a lot more activity on ESP8266 with CS low later on - I'll take more shots.
ok now with a longer time sclale. and falling edge trigger - corrected M0 added below
ESP8266
The M0 picture is not great - I have new - better ones, bit since it works, I'd ratehr focus onthe ESP8266. THe timing is very different. The driver uses the same buad ates for both so I'm alittle puzzled by that
I'll keep digging - don't spen any more time on it - just wanted to know if anything jumped out at you. - thanks.
@solar whale ok thanks! sorry it doesn't just work π
That wouldn't be any fun π
Just for completeness - this is the shot for the M0 when working correctly.
@slender iron Looing back at things I have done, My previous usage of the SPI on the ESP8266 was with an OLED, but that used the "machine" module. I have never used SPI on the ESP8266 with CP. I'll try ressurecting the OLED on the ESP8266 but without "machine". Hopefully that will help identify if there is a problem with SPI on the ESP8266 for CP. Do you know of anyone who has used the SPI on an ESP8266 with CP? I tried using "machine" to define the SPI interface, but that is not compatible with the adafruit_sdcard - fails try_lock - not an attribute it understands.
@slender iron aha! I did use CP's SPI on an ESP8266 - with a TFT display, so that will be the case to reproduce. Digging through my parts boxes ....and the FTF works jsut as before, so SPI is OK - I tried the SDCARD on the TFT disply and it fails as before so now I have a good test platform!
Hello,
I would like to work on this. I'll need some time to get up to speed on CircuitPython though. I should also have a Feather M0 Express to test on soon.
Great! That would be awesome @process1183. We chat regularly on our discord at http://adafru.it/discord where you can get help. We also have a weekly dev meeting you can join on discord Mondays at 11am PT/ 2pm ET.
@tulip sleet <@&356864093652516868> hows 11am PT/ 2pm ET for the weekly tomorrow everyone?
@slender iron Sounds good.
@slender iron that's good!
@slender iron should be ok for me.
great!
@slender iron I'll listen in on it. Might be able to chime in real quick since I'm working from home.
<@&356864093652516868> The CircuitPython Weekly will be tomorrow (Monday) at its normal time 11am PT / 2pm ET.
@slender iron Thanks!
no problem @idle owl
This was done with the introduction of gamepad in f4981677b0b73d286f3af098a4111f8ba6d286bc.
@slender iron I was able to get the micropython sdcard driver to work under CP 2.0 on the ESP8266 so it would appear there is a problem with the adafruit_sdcard driver - I opened an issue on it and will keep working on it.
@solar whale way to go! When Adafruit makes a express or M0 version of the ESP8266, that's one less thing to worry about.
@tdicola Patch is in branch 2.x_issue_280_brownout in my repo https://github.com/dhalbert/circuitpython/. I have been fiddling with the voltage on a CPX but have only gotten it to wipe the flash once, and I can't replicate reliably.
@solar whale the card works with the driver on an M0?
@slender iron yes - no problems on an M0
@slender iron That's really exciting!
@idle owl if you are around, please hop in the circuitpython voice channel so I can test the recording setup
@delicate pike It sounds like it's your connection. You keep cutting out.
I'm listening, not sure if I will be chiming in. I don't really have anything to add this week :(
Hi @idle owl yes it must be mine lol
Might just need to ping me verbally loudly if you have questions directed at me Haha.
@delicate pike There are others who don't speak but still participate here in the chat. We check this throughout and answer questions or comments as we go.
hey i'm around now, on chat
Great @idle owl in fact I came to have the pleasure to hear your voices, and frankly there's not a lot of participations in chtrooms those few days , so it makes a little ambiance actually it's great π
No hug reports other than just to @idle owl and the other CircuitPython helpers for doing great work helping others! Plus Adafruit employees β€
Yassss!
"hug report" = just saying thanks to anyone for anything
Thank you, everyone! I'm really glad I am able to help so much!
how did the jacket hold on the event?
oh worked well π
and it made it through the airport twice.. in checked bags
i wasn't going to try to explain to a TSA officer why my jacket took batteries
yeah memory usage is tricky, you might need to switch to compiling to .mpy first
past about 200-300 lines in a single file pretty much kills memory π
even comments, etc. count against memory in raw .py
yep if the import fails then likely switch to .mpy will get you going again fast
this will help you get a vagrant machine setup to compile mpy-cross if you need: https://learn.adafruit.com/micropython-for-samd21/build-firmware and https://learn.adafruit.com/micropython-for-samd21/frozen-modules#external-frozen-modules
hrm i don't hear dan
discord messed up?
yeah, I hear him
wow weird
i can't
no audio here π¦
I can
yep
oh weird! huh yeah it's happened to me 3 times
basically ran my arc reactor and circuit walkers on lipo until they stopped π
IMHO i wouldn't diverge much from python.. it could get tricky if there's a library called 'main_lib.mpy' etc π
i'd wonder if comments at the top of the file are enough
hrm check this guide for SD card: https://learn.adafruit.com/micropython-hardware-sd-cards
i was just using the driver and code a couple weeks ago and it worked great with a couple cards (adata 8gb card, 32gb sandisk ultra)
oh M0 with our adafruit drivere
ahh weird!
yeah local errors are common with long lived network stuff
best way to deal with it is be as resilient as possible.. if something fails even just reset and start over
your router, your internet provider's router, etc. can all cause trouble
@timber lion yes - I try twice then reset - seems t o work well
@timber lion taht guide was great for SDCard. thats where i found the reference to the micropython driver and decided to try it.
jp has a light painter guide with cp - could add a page to that?
My only updates are that the search for my box of CircuitPython boards continues via UPS... Going to get back to working on readthdocs stuff, hopefully soon. Been tied up with baby prep, haha.
Thanks!
Well I still working on this motor
using circuitpython?
hey yeah
i was at open hardware summit and denver last week so not much of an update
the ili9341 tft guide is updated though
and this week i'm going to go through the couple asf4 bugs on me, neopixel and some sd card stuff
i'll grab master and start looking at them there
This one
that's all for me
Wolf couldn't make it today, I wanted to give an update for him.
i would start with, is it a problem that needs to be fixed
IMHO if it's a problem that only affects people doing odd stuff like juggling many main files, might not be worth adding more complexity and confusion
i think comments at the top of your file would work
also i lost whoever is talking again
dan is talking
ok back
yeah. i keep loosing dan. have to refresh.
yeah IMHO it's a case not worth adding more engineering complexity to fix π
right
i'm not a fan of run anything starting with main since it's a circuitpython only convention, could cause trouble as drivers port over
'main_humidity_driver.py' etc
I'm not a big fan of all the variants that run automatically. I 'm not sure this needs to be added. using main.py is ok when you are really ready.
i wouldn't go down read the file way.. you'll have to scan every single file on the FS on boot
that could be really troublesome
and slow
i'm finding with complex projects your main.py is a one liner to import a .mpy anyways
like with mega demo, to fit in memory it had to be a .mpy that main imports
yeah IMHO not worth talking fixes if we think it's not a problem to fix π
nope not inefficient
perosnally i'd like support for main.mpy too π
it's only jp that ran into in an edge case though?
yeah same here
yeah.. i dunno, is it worth adding more engineering complexity to maintain, diverge from standard python, etc.
if a process change could fix it
the board port startup
ctrl-d reset and import again would work
but yeah we had though about maybe adding a run python file API
i'd be careful changing or adding more names.. backwards compat issues then since you'll still want to support the current behavior
it's the python module name IIRC
for drivers
for your main.py i think it was doing standard python's main behavior
i gotta run, sorry have to be on a different chat in 2 mins
bye tony
thanks @timber lion !
Nice chat all of you thanks for this moment π
thanks @delicate pike
goodnight @delicate pike thanks for joining us
@delicate pike goodnight!
Thanks π
I have to run - dentist π¦ -- thanks all!
Lol good luck @solar whale
later!
@tidal kiln See ya π
We need a way to do a full duplex SPI transfer. It would read and write at the same time
would likely go something like:
c = None with self.spi_device as spi: c = spi.transfer(bytearray([0x0A, 0x04]))
c would be a bytearray of the data read during the transfer
<@&356864093652516868> @delicate pike here is the recording from the weekly meeting today: https://youtu.be/2ZyAqi8-fOE
Join here for the chat all week: http://adafru.it/discord The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel for noti...
Thanks @slender iron
no problem! I just realized my audio isn't as good as it could be because I was recording the wrong microphone.
Lol @slender iron it happends π
yup yup. it was leftover from our in person recording at adafruit
It looks like its a singleton object on struct.error as well. So its weird. Its ok to skip for now if you like.
Ideally struct.error like CPython.
>>> import struct
>>> b = bytearray(8)
>>> struct.error
<class 'struct.error'>
>>> struct.pack_into("<H", b, 0, 10, 10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: pack_into expected 1 items for packing (got 2)
You may need to add it similar to: https://github.com/adafruit/circuitpython/blob/master/py/objexcept.c#L200
How many bytes at a time do you want to do? Are you going to turn around
and send the previously received byte? Doing that through python will be
very slow.
~Scott
On Mon, Oct 9, 2017 at 7:33 PM deanm1278 notifications@github.com wrote:
We need a way to do a full duplex SPI transfer. It would read and write at
the same timewould likely go something like:
c = None with self.spi_device as spi: c = spi.transfer(bytearray([0x0A,
0x04]))c would be a bytearray of the data re...
for this specific application yea I'm doing one byte at a time and sending the previously received byte so it would be something like:
with self.spi_device as spi:
c = bytearray( [0x0A] )
for i in range(n):
c = spi.transfer( c )
it will be slow, but this e-paper display takes around 10 sec to update anyway so it's acceptable. In general though we probably want to be able to transfer as many bytes as is allowed by available RAM.
This allows us to re-enable os. random is also enabled because
it solely depends on os.
Fixes #266. Its also a pre-requisite for #260.
Looks like enabling a LONGINT impl will break our mpys. Maybe we can change this so they are compatible?
so....trying to figure out all the bits and pieces for documentation.
how / where does the api documentation get integrated?
I gotta run @tidal kiln but you might describe what you mean by integrated
where = what file(s) do you actually put the text in
how = how does it finally show up on readthedocs
Sphinx. Is I think what you're asking.
And it goes in different places in the text. Unfortunately my experience with it is limited to being able to copy and paste from previous bits. @formal plover might have a little more experience with it in other files.
Sphinx is what parses out the documentation, right?
Yeah
And Read The Docs is basically just a hosting site so it can be viewed in the cloud?
I think? ReadTheDocs is the output of Sphinx. My "I think" is based on me not being sure if I'm answer the question correctly, not that you're incorrect.
I can see it as:
Read The Docs pulls your repo in, processes it with Sphinx, then hosts the results.
I modified my README.rst file, pushed the commit, and a few minutes later the update was up on Read The Docs
but I'm not seeing how it goes through and builds the API part of the doc
i think it has to do with api.rst, but not fully understanding that bit
There's a certain format of comments that it picks up out of the API library file. That's the part I've been able to basically copy and paste so far, which means I don't have any detailed answers for you regarding how it does what it does.
yep. that's what i'm after.
This is the file:
Yes
cool. let me use that as a ref and see if i can get something to work through the system.
Excellent. I'm glad I was able to help. Surprised in fact π
Sphinx, oh man. Let me tell you. SO MUCH FUN. Haha
If a document doesn't exist on readthdocs, you have to use a tool called cookie cutter to make it look like the rest of the readthedocs.
the same cookie cutter Scott mentions in his guide? i did that to start.
hmmmm. i actually already had some doc strings. for ex:
https://github.com/caternuson/CircuitPython_ADS1x15/blob/master/adafruit_CircuitPython_ADS1x15.py#L241
but nothing gets generated:
http://circuitpython-ads1x15.readthedocs.io/en/latest/#api-reference
@tidal kiln yeah you use cookie cutter in the beginning to clone whatever you are trying to get from GitHub and format it properly for readthedocs
I'm mid project right now. I haven't published to readthdocs yet. However it appears to be very deliberate, like you would know you're on a step publishing to readthedocs
Looks like enabling a LONGINT impl will break our mpys. Maybe we can change this so they are compatible?
After looking at this, I think this is not going to be an issue. mpy-cross is already set to use MICROPY_LONGINT_IMPL_MPZ for all the .mpy's it produces, so that will not change by turning on longints in our port. tools/mpy-tool.py cares about whether the implementation supports longints or not, but it's used to build internal frozen modules, not .mpy files.
Did you want to turn on maxstack use checking permanently, or just for now while debugging? I see you moved it out of the #ifdef MICROPY_DEBUG_MODULES .
Should something have been declared COMPILER_WORD_ALIGNED or something like that to avoid the -Wcast-align warning suppression here and elsewhre? I'm just trying to understand why you need them.
@tidal kiln readthedocs should have output you can check
I have a feeling your problem is a combination of the module name in api.rst not matching the filename of the module
and perhaps if the module imports other modules native to circuitpython
its sphinx's autodoc that pulls the python documentation strings out: http://www.sphinx-doc.org/en/stable/ext/autodoc.html
@slender iron name not matching in api.rst fixed it. thanks.
it was just a case issue, but it was what was created with cookie cutter
Glad to hear that's sorted out @tidal kiln
thanks @formal plover one. small. step. at. a. time.
good to hear @tidal kiln
@fading solstice we can work together on the struct stuff today if you are around
I'm thinking of porting an Arduino library to python. The library is basically a wrapper around reading/writing to the registers of the ATM90E26 chip. Is there an example of a similar port I can use for reference? Here's the library I'd like to port: https://github.com/whatnick/ATM90E26_Arduino
wow! Thank you.
@slender iron I was just going to ask you
@bronze geyser I'm not porting it. Which version are you using? SPI or UART?
Oh. I know you're not porting it. I'm horrified that you thought that is what I meant. My apologies. Ultimately the SPI version.
no worries!
Thank you.
ok now? will include nrf52 discussion - where should I meet you
I'll take a look. Thanks.
@bronze geyser ideally we'd have SPI versions of this too but we don't yet: https://circuitpython.readthedocs.io/projects/register/en/latest/
the register library looks like what i was looking for. having the SPI version out would be helpful indeed.
@slender iron with regards to nrf52 support - are you targeting the exiting feather boards - just curious. I'd be intersted in helping if I can be useful.
@solar whale jump in the voice chat!
@tulip sleet https://blog.adafruit.com/2017/02/08/bypass-atsamd21-cortex-m0-bootloader-with-j-link-commander/
Hereβs a simple and interesting hack from Alexander Sparkowsky at roamingthings.de for using βJ-Link to change the boot loader protection of a SAM D21.β BOOTPROT defines the size β¦
@slender iron the upcomming nrf52 stuff will work with this dev kit?
@solar whale yeah, until we have custom hardware for it
great thanks.
no problem!
If you aren't worried about speed is it required to simultaneously transfer
in both directions? Can you just do a read and then a write?
On Mon, Oct 9, 2017 at 1:23 PM deanm1278 notifications@github.com wrote:
for this specific application yea I'm doing one byte at a time and sending
the previously received byte so it would be something like:with self.spi_device as spi:
c = bytearray( [0x0A] )
for i in range(n):
c = spi.transfer( c )it will be slow, but th...
OK perfect! That should make it easy.
On Mon, Oct 9, 2017 at 6:42 PM Dan Halbert notifications@github.com wrote:
Looks like enabling a LONGINT impl will break our mpys. Maybe we can
change this so they are compatible?After looking at this, I think this is not going to be an issue. mpy-cross
is already set to use MICROPY_LONGINT_IMPL_MPZ for all the .mpy's it
produces, so that will not change by turning on longints in our port.
tools/mpy-tool.py cares about whether the imple...
Looks like the merge conflict is that in master I've disabled a bunch on the modules. You should be able to add struct to the short list of enabled ones and it'll work.
I did it while debugging the HardFault. I've moved it back.
yea unfortunately it needs to transfer simultaneously in both directions in this application.
although full-duplex communication isn't used all that often it is kinda just part of SPI spec and will need to be implemented eventually :/
for this application though, the reason it needs to be done full-duplex is because the EPD driver expects all data to be written in one transaction. Since we don't have enough on-chip RAM available to store the entire buffer, we need to store it on an external SRAM chip and "read to" the EPD from there.
Both the EPD driver and the SRAM slave devices are active on the bus at one time
I think this is an artifact of the ASF code for CONTAINER_OF. Their Makefile doesn't use -Wcast-align but ours does and I'd rather whitelist places than turn it off. Here is the error:
In file included from asf4/samd51/hal/src/hal_flash.c:46:0:
asf4/samd51/hal/src/hal_flash.c: In function 'flash_ready':
asf4/samd51/hal/utils/include/utils.h:60:46: error: cast increases required alignment of target type [-Werror=cast-align]
#define CONTAINER_OF(ptr, type, field_name) ((type *)(...
Oh, bleah, OK, I'd guess it's the uint8_t in CONTAINER_OF.
@tulip sleet want me to merge my PR or will you?
@slender iron - I can do it. Just waiting for travis to finish.
this might be good for 2.x: https://github.com/adafruit/circuitpython/issues/310
its needed for eink devices
@slender iron did you want to assign #310 to me? Dean could test it if code it up, or I should buy some breakout (like e-ink) that needs it.
I didn't but that'd be good
We don't need transfer to use DMA for now. We can add that in 3.x.
@deanm1278 I can probably take this on, but I want to order something that needs this, is https://www.adafruit.com/product/3502 (Sharp e-ink breakout) suitable? I'll ask you for your driver code when I'm ready to test.
8065477 atmel-samd: Add support for internal filesystem... - tannewt
I'd love it if ADC drivers exposed a number of sub-objects for each input that can be used in place of an AnalogIn. To do that, it'd need the same properties.
You shouldn't actually need any hardware. It should be enough to tie MISO high or low and then use the saleae to verify MOSI output.
thanks @dhalbert!
you can do what @tannewt says or you can use this code on an Atmega 328 based board (metro, UNO)
void setup (void)
{
pinMode(MISO, OUTPUT);
// turn on SPI in slave mode
SPCR |= bit(SPE);
// turn on interrupts
SPCR |= bit(SPIE);
}
volatile int pos;
// SPI isr
ISR (SPI_STC_vect)
{
//byte c = SPDR;
//incrememnt every time a byte has been received
SPDR = pos;
pos++;
}
void loop (void)
{
//do nothing
}
wire...
@everyone I just want to thank you so much for all you do in developing CircuitPython -- it's wonderful to use and is really a big help in my coding and iteration time on projects!
Who Pinged xd
I don't think @split ocean realized the power of @everyone