#circuitpython-dev

1 messages Β· Page 107 of 1

tulip sleet
#

@timber lion I used to use those machines!

timber lion
#

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

sick creek
#

the circuitVest

#

the small parts could have dotstars

timber lion
#

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

idle owl
#
        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))```
timber lion
#

hey sorry was in and out

#

what was the issue?

idle owl
#
        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)```
timber lion
#

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?

slender iron
#
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
timber lion
#

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!

slender iron
#

thanks @timber lion

#

int(TONE_VOLUME * math.sin(2*math.pi*(i / length)) + shift - 1)

idle owl
#
        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)
quick oyster
#

Maybe I can help with that as well

manic glacierBOT
slender iron
#

so I managed to mute my mic duirng the cat seizure but it recorded it together πŸ˜•

idle owl
#

Odd.

slender iron
#

yeah, I think I have it setup correctly now so it'll record to two different tracks

tulip sleet
#

the recording is done before it goes into discord? the muting is in discord?

slender iron
#

its just hissing and growling but I'll cut a chunk out

#

yeah, I muted in discord but it was recording my mic directly

idle owl
#

Ah that makes sense.

slender iron
#

@idle owl I'm gonna cut a bit of you out

idle owl
#

Fair enough. We covered most of it afterwards anyway.

slender iron
#

yeah, we'll get it all squared away

#

ok, got it edited and will upload shortly

idle owl
#

Nice!

#

I'm going through the Gemma quickstart.

slender iron
#

thanks @idle owl!

#

I'm gona grab lunch after I get it uploading then we should chat

idle owl
#

Excellent. Let me know when you're back.

slender iron
#

kk

manic glacierBOT
umbral dagger
#

@stuck elbow Nice.

manic glacierBOT
idle owl
#

that moment when you remember you forgot to check if Sphinx builds before pushing to Github, but it turns out it does

manic glacierBOT
#

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.

slender iron
#

@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

slender iron
hollow tartan
#

@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 adabot .

pastel panther
#

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)?

manic glacierBOT
manic glacierBOT
#

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...

opal elk
#

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

solar whale
#

@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.

How to use MicroPython with boards like the Feather M0 & Arduino Zero!

idle owl
#

@opal elk I implemented sound for the Circuit Playground Express specific library, but the library uses audioio. What board are you using?

opal elk
#

probably metro

idle owl
#

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.

opal elk
#

right! maybe I'll play around.

solar whale
#

@idle owl doesnt the CPX have an I2Cspeaker on it. CAn you drive it with jsut ones like a simple speaker?

#

meant speaker

idle owl
#

@solar whale I'm not sure. My suggestion wasn't that level of informed, I was going based on logical assumptions.

solar whale
#

I was plaing with some examples last week - did tey come from you @opal elk for creating tones for a speaker on otehr boards.

idle owl
#

I didn't have to use any I2C code to make it work.

solar whale
#

@idle owl never-mind - my error - it jsut has an amp - the sound sensor is i2C

idle owl
#

@solar whale That makes more sense.

tidal kiln
#

CPX sound sensor is I2S (not to be confused with I2C)

solar whale
#

@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 πŸ˜‰

neat rose
#

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.

solar whale
#

@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.

idle owl
#

@solar whale No problem, I hadn't known it was I2S, so I learned something. πŸ˜ƒ

neat rose
#

I cant find any info on how to edit the pil font, so I dunno how to fix it myself.

solar whale
#

@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?

neat rose
#

@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.

tidal kiln
#

@neat rose probably better to ask that in the forums

solar whale
#

@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.

slender iron
#

@pastel panther I can help with a native mac setup. Thats what I use

#

most important is brew cask install gcc-arm-embedded

neat rose
#

Posted an issue on the github page :3

solar whale
#

@neat rose - nevermind - now I see you have been there already. Good luck with it.

slender iron
tawny creek
#

@slender iron yay! about time ☺

slender iron
#

making progress πŸ˜ƒ

neat rose
#

@solar whale Thank you~~

manic glacierBOT
manic glacierBOT
slender iron
#

ok, I think I'm caught up on review

manic glacierBOT
#

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,
...

manic glacierBOT
manic glacierBOT
idle owl
#

LOL: You are running in safe mode which means something really bad happened. Looks like our core CircuitPython code crashed hard. Whoops!

slender iron
#

oh no!

#

can you repro it @idle owl ?

idle owl
#

@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!

solar whale
#

@slender iron I still think we need an equivalent to the "sparky" pin for software - looks like @idle owl earned one!

idle owl
#

πŸ’ͺ

tulip sleet
#

@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

idle owl
#

@tulip sleet Thank you so much! I'll start testing it now. I'm working on acceleration so it's perfect.

tulip sleet
#

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

idle owl
#

@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.

slender iron
#

thanks @idle owl !

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.

tulip sleet
#

@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?

idle owl
#

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.

slender iron
#

@tulip sleet the circuitplayground library could change the sys path

idle owl
#

Also that πŸ˜ƒ

tulip sleet
#

that's a great idea, and very specific to the library

slender iron
#

πŸ‘

idle owl
#

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.

slender iron
#

oen way is print(x, ",", y , ",", z)

idle owl
#

Hmm, I tried something close to that, I must have been off with something.

tulip sleet
#

print(x,y,z, sep=", ") is in regular python; let's test in CPy

idle owl
#

Testing

#

Works perfectly!

#

@tulip sleet @slender iron Thank you πŸ˜ƒ

tulip sleet
#

also you can say print(1, 2, end='') to suppress the ending newline, or sep='' to suppress the space

idle owl
#

I'm not sure what the ending newline refers to.

#

This is streaming axis data if that changes what I might be seeing

tulip sleet
#

try print(1,2); print(1,2) vs print(1,2,end=''); print(1,2)

idle owl
#

Oh so it would all be on the same line if you did theend='' ?

tulip sleet
#

yes

idle owl
#

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 πŸ˜ƒ

manic glacierBOT
tidal kiln
#

print("{0},{1},{2}".format(x,y,z))

#

i like sep= better though for the simple case

idle owl
#

@tidal kiln Yeah it worked exactly as I wanted it to.

tidal kiln
#

the .format approach will let you get fancier (if needed)

idle owl
#

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.

tidal kiln
#

you're good then. just throwing out another option fwiw.

idle owl
#

I really appreciate it. I had no idea how to do anything else with print. I know I'll need it eventually.

tidal kiln
#

you can do all kinds of stuff like set width, zero padding, setting it hex, etc. in {}

idle owl
#

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!

tidal kiln
#

kind of like printf

idle owl
#

I remember that from a different language. Where do I remember that from?

tidal kiln
#

a, b, ...

idle owl
#

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.

tidal kiln
#

print("{0:02x}".format(12))

#

fancy things like that

idle owl
#

I'm not sure I follow what that ends up looking like.

tidal kiln
#

try it.
0 before : is place holder. after :, 0 sets zero padding, 2 set width, x set hex format

idle owl
#

Ohhh

#

That is getting fancy indeed

tidal kiln
#

and in case this is ever useful:
print("{0} and {1} and again {0}".format(1,2))

idle owl
#

Oh neat

tidal kiln
#

as an example of how the place holder numbers work

idle owl
#

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.

tidal kiln
#

or a more cute example:
print("{0} in hex is {0:x}".format(12))

idle owl
#

Oh nice.

#

Ahhhh I get the relation now...

#

Made more sense seeing it in two different lines of code

umbral dagger
#

My Trinket M0 is complaining that the file system is read-only. I've seen this before but never make note of the fix.

idle owl
#

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.

#

And follow the instructions from the first link.

carmine basin
#

Hey guys. the link to the learn guide 'MicroPython Hardware: PCA9685 PWM & Servo Driver' url link is broken again.

umbral dagger
#

@idle owl I never work directly on the flash fs, so there's nothing irreplacable on it

carmine basin
umbral dagger
#

@idle owl The SPI flash eraser will do it for the Trinket?

carmine basin
#

If you get rid of '/software?view=all' the link works.

#

Just an FYI.

umbral dagger
#

@idle owl That was my first thought, but then I saw The SPI part πŸ˜ƒ

slender iron
#

@carmine basin I don't see a software page anymore. where did you get the link?

carmine basin
#

from my webpage when I clicked on it.

#

but if the last part of the url is removed, it works

tidal kiln
carmine basin
#

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

tidal kiln
#

ok. yeah. i'm getting same stale link.

carmine basin
#

now get rid of the last part of the url '/software?view=all' and it will work.

tidal kiln
#

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.

carmine basin
#

ok. no problem, I'll just use the workaround. I just wanted you to know if case someone else ran into the same problem.

slender iron
#

there is a separate search service

#

its probably not updated immediately

carmine basin
#

thank you.

slender iron
#

@dusty fog would know

#

I miss the microtrace buffer. I have a bug corrupting the stack

tidal kiln
#

thanks @carmine basin for pointing this out. will let learn system peeps know about it.

carmine basin
#

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.

slender iron
#

no worries @carmine basin. we're happy to redirect

tidal kiln
#

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?

slender iron
#

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

idle owl
#

@umbral dagger Sorry, I had to step away. Did you get it sorted?

tidal kiln
#

@slender iron if a repo was started elsewhere, can you pull it in later?

slender iron
#

we can fork it or have you push to it later

tidal kiln
#

i mean if you didn't start a repo in the adafruit account originally

umbral dagger
#

@idle owl Not yet.. I need to erase the internal flash for the Trinkey, right? There's no SPI flash.

slender iron
#

@tidal kiln yeah, the local repo is actually independent of the remote ones

tulip sleet
#

@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

umbral dagger
#

@tulip sleet Ah.. That's easy enough.

idle owl
#

@umbral dagger I realised after you asked that, the flash eraser is only for the Express boards. Good call.

#

@tulip sleet Thank you!

tulip sleet
#

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.

tidal kiln
#

@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

slender iron
#

no worries @tidal kiln

tulip sleet
#

@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.

slender iron
#

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

umbral dagger
#

@idle owl @tulip sleet Thanks. That fixed it.

idle owl
#

@umbral dagger Great!

tulip sleet
#

@slender iron ugh. sorry to hear that. could be alignment

slender iron
#

time to take a break πŸ˜ƒ

tulip sleet
#

@slender iron think I will work on the brownout bug next (tomorrow)

tidal kiln
#

@tulip sleet theres a max_usb_current=1 setting in config.txt, fwiw

tulip sleet
#

@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

tidal kiln
#

yah, no guarantees. just something to try. i think it only changes 600mA max to 1.2A or some other not circuitpython related value. 😁

tulip sleet
#

😁

#

@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

idle owl
#

@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.

tulip sleet
#

Did you do git fetch and then git merge upstream/master?

idle owl
#

I did git fetch upstream and then the second one.

#

Already up to date.

tulip sleet
#

what branch were you in when you did the merge: your work branch or master?

idle owl
#

Should be work branch, I was taught not to do things from master.

#

I've learned all of this fairly recently...

tulip sleet
#

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.

idle owl
#

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.

tulip sleet
#

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.

idle owl
#

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.

tulip sleet
#

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.

idle owl
#

I think I've been working with clean histories so far, but Scott never mentioned it being necessary.

tulip sleet
#

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.

idle owl
#

As did I! lol. Now I know. πŸ˜ƒ

tulip sleet
#

Scott likes clean histories, which is fine with me.

idle owl
#

Good to know, I'll keep up with what I have been doing then.

#

Thank you so much!

tulip sleet
#

yw

idle owl
#

It was such a minor change, I think I'll just trash the branch and start again.

tulip sleet
#

😁 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"

idle owl
#

Good to know that's not just me.

tidal kiln
#

is the only way to create a travis account via github?

slender iron
#

think so @tidal kiln

idle owl
#

@slender iron Sorry about the extra pull request, I realised I hadn't made speaker_enable private like we had talked about.

slender iron
#

no problem!

#

not sure when I'll get to it though. I'm in open hardware summit mode now

#

gotta pack

idle owl
#

I figured, exactly why I apologised. πŸ˜ƒ

slender iron
#

np

tidal kiln
#

just looks a little dodgy...
"Travis CI wants permissions to (insert list of everything on github)"

slender iron
#

adafruit org already oks it

#

and its not a small project

#

lots of people use it

tidal kiln
#

yep. just wanted to check.

slender iron
#

πŸ˜ƒ

manic glacierBOT
manic glacierBOT
tidal kiln
#

running cookiecutter for first time. any guidance on how to decide on answering y/n to depends on bus_device and register?

fading solstice
#

@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

tidal kiln
#

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.

solar whale
#

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.

hollow tartan
#

@solar whale would not you say that seems to be a memory overflow (overwrite) problem?

solar whale
#

@hollow tartan why?

tulip sleet
#

@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).

solar whale
#

@tulip sleet so far only in REPL - I'll try main.py

manic glacierBOT
solar whale
#

@tulip sleet no- go in main.py - hangs

#
a=sys.stdin.readlines()
print(a)

#

control-c gets out of it πŸ˜ƒ

tulip sleet
#

@solar whale go ahead and file an issue

hollow tartan
#

@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?

solar whale
#

@hollow tartan Do you have CircuitPython running on a board? If so which board?

#

@tulip sleet Will do.

hollow tartan
#

@solar whale Sorry, no. but I have some esp 8266 and a RPi Zero.

tulip sleet
#

@solar whale it works fine reading from a file so it's something odd about stdin EOF checking.

solar whale
#

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.

tulip sleet
#

@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.

opal elk
#

@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

solar whale
#

@opal elk ^C kills it but I don't get the input lines....

tulip sleet
#

@solar whale Ha! there's no EOF char checking on stdin. The ctrl-D just goes through as input.

manic glacierBOT
solar whale
#

@tulip sleet is that a bug or a feature ?

tulip sleet
#

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).

sick creek
#

bug is a feature

tulip sleet
#

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

solar whale
#

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....

manic glacierBOT
tulip sleet
#

@solar whale the handling of ctrl-C and ctrl-D from USB input is fairly hacky. I already fixed one bug about that.

solar whale
#

@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...

tulip sleet
#

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

hollow tartan
#

@solar whale ok thanks. .

solar whale
#

@tulip sleet Thanks - excellent clarification Control-D is not EOF... good point.

tulip sleet
#

@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.

solar whale
#

@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.

The Gemma M0 will super-charge your wearables! Small, light, and it's easy to use, so you can do more.

tulip sleet
#

@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]

solar whale
#

@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 !

tulip sleet
#

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.

solar whale
#

sounds like a good approach.

#

obviously it is not a common usage - since it has not turned up before !

idle owl
#

HAH!

#

I'm getting good:

#
Looks like our core CircuitPython code crashed hard. Whoops!```
#

And I can reproduce it!

manic glacierBOT
#

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.

idle owl
#

@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.

tulip sleet
#

@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.

idle owl
#

@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.

tulip sleet
#

@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.

idle owl
#

I can't tell if it's just the library or if it's the code.py as well.

tulip sleet
#

just include both

idle owl
#

@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.

tulip sleet
#

yes, just the code that actually runs

idle owl
#

I thought as much, thank you

manic glacierBOT
manic glacierBOT
opal elk
#

sanity check: is there no input_pullup in CP?

#

wait, reading the docs

#

ignore meeee

slender iron
#

DigitalInOut.pull = digitalio.Pull.UP

opal elk
#
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

idle owl
#

@opal elk Nice!

umbral dagger
#

Hmmm.... In CP, how do I keep a literal list/array of byte values in flash rather than ram?

slender iron
#

@umbral dagger THe express boards have an nvm module that can do up to 256 bytes

slender iron
formal plover
#

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

manic glacierBOT
opal elk
#

@slender iron that's cool! I might be interested...

manic glacierBOT
umbral dagger
#

@slender iron I need 600 bytes. It's a static, literal, lookup table of byte values.

tidal kiln
#

@slender iron neat idea with hacktoberfest. assume you're thinking of targeting cp repos?

tulip sleet
#

@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?

umbral dagger
#

@tulip sleet Ah.. simulated EEPROM. Clever. The table is immutable. Constants that get looked up based on a computed index.

tidal kiln
#

simulated eeprom is all there is on the M0, right? it's a hardware thing.

tulip sleet
#

@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

umbral dagger
#

@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.

tulip sleet
#

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?

umbral dagger
#

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

tulip sleet
#

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

tidal kiln
#

no way to access the simulated eeprom in circuitpython?

tulip sleet
#

@tidal kiln oh yes, using the nvm module. I meant no way of storing a 600-byte array in flash.

umbral dagger
#

Given the data I have isn't in hex... Porting to C is the easiest IMo.

tulip sleet
#

@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

umbral dagger
#

@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

tulip sleet
#

πŸ‘Yes!

idle owl
#

@slender iron I definitely want to try to do Hacktoberfest! I wish I'd known three days ago though... lol.

umbral dagger
#

@tulip sleet Converted to C, AMG8833 -> 8x8 dotstar πŸ˜ƒ

idle owl
#

So many memory errors. Oi.

manic glacierBOT
idle owl
#

@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?

tulip sleet
#

@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?

idle owl
#

@tulip sleet Yeah.

tulip sleet
#

@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?

idle owl
#

@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.

tulip sleet
#

what os are you running on?

idle owl
#

MacOS. I have a Windows machine as well, with bash installed, but nothing running Linux right now.

tulip sleet
#

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.

idle owl
#

That was my thought as well.

tulip sleet
#

i should learn to use homebrew on the mac anyway. I'll get back to you when i have something, probably half hour - hour.

idle owl
#

Excellent, thank you so much!

tidal kiln
#

Scott's guide mentions having travis create the mpy files

#

but i actually haven't tried setting that up

idle owl
#

I think mpy-cross is local. Not sure though.

#

I haven't touched travis yet

tidal kiln
#

you could be right. i may be mis-reading/understanding that part of the guide

idle owl
#

I'm reading it, I'm thinking maybe travis also does what mpy-cross does?

tulip sleet
#

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
#

@tulip sleet That was quick!

tulip sleet
#

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.

idle owl
#

Excellent!

tulip sleet
#

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.

idle owl
#

Checking

#

Where am I supposed to store mpy-cross?

tulip sleet
#

anywhere you want. if you have a ~/bin in your PATH, you could put it there so it gets found automatically

idle owl
#

It's saying "not found" is why I asked. I'm in the same directory as it

tulip sleet
#

say ./mpy-cross not mpy-cross

idle owl
#

Permission denied. And then sudo it, and it says command not found.

tulip sleet
#

also chmod +x mpy-cross

idle owl
#

ok

#

Worked!

#

And it worked on the CPX!

tulip sleet
#

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!

idle owl
#

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.

tulip sleet
#

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.

idle owl
#

I enjoy the frills. For now though, I'm really enjoying my library working.

solar whale
#

@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....

idle owl
#

@solar whale Don't be sorry! Always good to have more information, even if it's the same written a different way.

tulip sleet
#

@solar whale no problem!

#

... I have to go food shopping, so good luck and I'm sure others can help.

idle owl
#

@tulip sleet Thank you so much! Greatly appreciated.

tulip sleet
#

yw

tidal kiln
#

ln -s can be your friend too (stash file whereever, add sym link to bin dir found in $PATH)

idle owl
#

If I use a property decorator and write the following: @property def touch(): return Is it doing anything? Am I using memory for it?

fading solstice
#

@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.

idle owl
#

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.

fading solstice
#

i wouldn't add a new method for doc purposes

idle owl
#

Ok. Thanks @fading solstice πŸ˜ƒ

tulip sleet
#

@idle owl we shold be able to get sphinx to do the right thing without having to alter the code

idle owl
#

@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.

tulip sleet
#

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

idle owl
#

@tulip sleet Are you asking me what command I run when I build it?

tulip sleet
#

yes

idle owl
#

This sphinx-build -b html . _build/html

#

Is what Scott told me to use

tulip sleet
#

got it - I think it defaults to html but that may depend on the sphinx version

idle owl
#

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.

tulip sleet
#

ok, I'll see what I can get it to do.

idle owl
#

Excellent, thank you!

#

I have to run for a bit, I'll be back in about 30 minutes.

idle owl
#

Back.

tulip sleet
#

@idle owl here's a revised version with several changes:

  • each .touch_Ax is 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.
    -.pixels is now a property. This makes it unsettable, which is good practice, and now the documentation doesn't have a spurious = None after it.
idle owl
#

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.

tulip sleet
#

bleah - not just to save memory, unless you really need dynamic attribute names.

idle owl
#

If you don't think it's a problem, I'll defer to you, obviously.

tulip sleet
#

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.

idle owl
#

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.

tulip sleet
#

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.

idle owl
#

Ah

tulip sleet
#

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.

idle owl
#

Ah ok

#

Looks like 4kb if I make the one you sent me into .mpy

tulip sleet
#

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')

idle owl
#

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

tulip sleet
#

gotta finish dinner; I'll be back in 45 mins or so, I think.

idle owl
#

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

tulip sleet
#

salmon cooking 5 more mins ... how big is the .mpy for your original?

idle owl
#

Checking

tulip sleet
#

how about .touchA[3] .touchA[5]

idle owl
#

4041 for my express.py vs 4641 for yours. Finder says both are 4 so I checked command line.

tulip sleet
#

.touch_A[3]

idle owl
#

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.

tulip sleet
#

it'll work, the doc is a little tricker. You can always put in manual doc sections, I think.

idle owl
#

I'll look into it. I need to understand Sphinx better anyway.

tulip sleet
#

you can do a lot but it's not well documented (or, rather, there aren't many good examples)

idle owl
#

Good to know

#

On both counts. I won't waste time looking for examples if that's the case.

tulip sleet
#

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.

idle owl
#

@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.

tulip sleet
idle owl
#

Reading.

tulip sleet
#

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)

idle owl
#

It looks right in Sphinx

tulip sleet
#

you tried it? Great! That may solve a lot of problems about documenting things that you can't describe in the actual Python syntax.

idle owl
#

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.

tulip sleet
#

You could use it for the touch names, which don't exist statically. data:: touch_A1, etc.

idle owl
#

Ohhh.... I think I get it. I'll give it a try now.

slender iron
#

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.

hollow tartan
#

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.

formal plover
#

@hollow tartan That'll be a cool/fun project. There is a I2c learn guide you can use for some guidance if needed.

hollow tartan
#

@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.

formal plover
#

@hollow tartan you're welcome!

tacit glade
hollow tartan
#

@tacit glade I messaged you.

tacit glade
#

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

solar whale
#

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.

hollow tartan
#

@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.

#

Do you have code that is generating an error?

hollow tartan
tacit glade
#

@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

hollow tartan
#

Sorry. I tried.

#

Do you agree the machine is the substitute for pyb on ESP8266?

tacit glade
#

There is no machine in CircuitPython, only MicroPython.

hollow tartan
#

That is curious. Because, I just did >>>import machine and >>>tim = machine.Timer(1)

#

No problem on CP 2.0.

obsidian compass
#

Hi! Do circuitpython comes with APDS9960 library ?

#

The gesture and RGB sensor

floral dagger
#

@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.

solar whale
#

@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.

obsidian compass
#

@jerryn Thats cool! Is there any PR or something I can look at?

solar whale
obsidian compass
#

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 ... :-)

solar whale
#

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.

hollow tartan
#

@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?

slender iron
#

@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.

solar whale
#

@slender iron welcome back. Hope you feel better soon.

hollow tartan
#

@slender iron I might offer the observation that it is not within the perview of an educational & introduction to programming platform in any case.

slender iron
#

thanks @solar whale

#

@hollow tartan yeah, I agree. I figure we'll address it when we need it for networking

solar whale
#

@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

slender iron
#

@solar whale not that I can think of. do you have a logic analyzer you could use?

solar whale
#

no - just an o'scope

slender iron
#

may be orth checking each line is changing

formal plover
#

@slender iron welcome back. My brain has been missing for about a week. All this baby prep stuff is brutal.

solar whale
#

ok - I'll keep poking. ran out of memory on M0 with SD, rtc and temp sesnor 😦 thought I't try the esp8266.

formal plover
#

@solar whale how are you using your esp8266 with an SD card? Do you have a breakout board for it?

solar whale
#

@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!

formal plover
#

@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

solar whale
#

@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?

formal plover
#

@solar whale Nice! No, I don't have a breakout for it or the adaloger

solar whale
#

the adalogger is nice because it also has an RTC - teh RTC and Si7021 work fine (they are i2C) but not the SD - yet.

formal plover
#

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.

solar whale
#

@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.

formal plover
#

@solar whale you could use Adafruit IO for now for fun.

solar whale
#

I have that running under arduino code - have not tried CP for it yet.

formal plover
#

Ah, gotcha.

solar whale
#

I meant adafruit IO

#

did you get it working in your esp8266?

formal plover
#

It's pretty easy to use with CircuitPython, you just use API calls. Yeah, I got it working blinka adabot

#

Doesn't require libraries or anything

#

Other than urequests

solar whale
#

great - do you have a simple example you can post?

idle owl
#

@slender iron Glad to have you back! Hope you manage to shake the bug quickly.

slender iron
#

@idle owl thanks! Will just lay low this weekend. Should be up for work on monday

formal plover
#

@solar whale Yup! Let me see if I can grab an example

solar whale
#

@formal plover thanks - no rush

formal plover
#

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

solar whale
#

@formal plover wow - that looks great - I'll give it a try.

formal plover
#

@solar whale awesome! Good deal

solar whale
#

@formal plover where do I find urequests?

formal plover
solar whale
#

@formal plover very nice! it worked! with test value - now to add to si7021 test.

formal plover
#

@solar whale Awesome! Woot woot! blinka

solar whale
#

@formal plover cool!- now sending temp data from si7021 to my AIO feed - taht was easy!

formal plover
#

@solar whale Very cool! I was surprised how easy it was too.

solar whale
#

@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

solar whale
#

@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)

formal plover
#

@solar whale well on the free tier I think you can only send a certain amount of updates

cunning trail
#

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.

formal plover
#

AIO probably stops taking data

solar whale
#

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.

formal plover
#

@solar whale you're welcome! Glad you're all set up now. Yeah, good luck with that!

manic glacierBOT
manic glacierBOT
weary spindle
#

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 ?

solar whale
#

@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.

slender iron
#

@weary spindle it should be doable. I'd be happy to help fix any bugs you find

weary spindle
#

@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 ...

slender iron
#

@weary spindle I can't think of any actual docs. Its mostly the define you need to change

#

are you building master?

weary spindle
slender iron
#

what branch of circuitpython? master is very new

weary spindle
#

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.

slender iron
#

I bet it does. There is a 2.x branch that will be more featureful for now

weary spindle
#

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)

slender iron
#

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.

weary spindle
#

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.

slender iron
#

no problem @weary spindle !

formal plover
#

@solar whale glad to hear that. So it does recover after the error? Just errors that once a ten min the continues on?

solar whale
#

@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.

formal plover
#

@solar whale interesting. Hopefully you can figure out an error free solution.

solar whale
#

@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!

solar whale
#

@formal plover cool! just triggered my first case where the 10 second retry worked - no need to reset. Looks like a keeper!

formal plover
#

@solar whale Nice! Awesome job

solar whale
#

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...

formal plover
#

Yeah, it's crazy. Great tool indeed.

tulip sleet
#

@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

idle owl
#

@tulip sleet Tomorrow would work better for me. Potentially later tonight but I'm not sure when I'll be available.

tulip sleet
#

@idle owl tomw during or after checkin meeting is fine

idle owl
#

@tulip sleet Ok I'll ping you when I'm around tomorrow and we can sort the specifics.

slender iron
#

tomorrow is better for me too @tulip sleet

manic glacierBOT
idle owl
#

@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.

slender iron
#

@idle owl only if the changes are included in the branch you do the pull request from

idle owl
#

@slender iron Ok that's where I'm making the changes. Thank you!

slender iron
#

np πŸ˜ƒ

manic glacierBOT
solar whale
#

@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.

slender iron
#

@solar whale Its weird that the chip select isn't low on the esp8266

solar whale
#

@slender iron is CS actilve low? I was triggering on rising edge

slender iron
#

yeah, I believe so

solar whale
#

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.

slender iron
#

its really hard to tell

#

it looks like everything is active as I'd expect

solar whale
#

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.

slender iron
#

@solar whale ok thanks! sorry it doesn't just work πŸ˜ƒ

solar whale
#

That wouldn't be any fun πŸ˜‰

solar whale
#

@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!

manic glacierBOT
manic glacierBOT
slender iron
#

@tulip sleet <@&356864093652516868> hows 11am PT/ 2pm ET for the weekly tomorrow everyone?

idle owl
#

@slender iron Sounds good.

tulip sleet
#

@slender iron that's good!

solar whale
#

@slender iron should be ok for me.

slender iron
#

great!

manic glacierBOT
formal plover
#

@slender iron I'll listen in on it. Might be able to chime in real quick since I'm working from home.

slender iron
#

<@&356864093652516868> The CircuitPython Weekly will be tomorrow (Monday) at its normal time 11am PT / 2pm ET.

idle owl
#

@slender iron Thanks!

slender iron
#

no problem @idle owl

manic glacierBOT
solar whale
#

@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.

formal plover
#

@solar whale way to go! When Adafruit makes a express or M0 version of the ESP8266, that's one less thing to worry about.

manic glacierBOT
slender iron
#

@solar whale the card works with the driver on an M0?

solar whale
#

@slender iron yes - no problems on an M0

slender iron
#

free trinket m0s and gemma m0s

idle owl
#

@slender iron That's really exciting!

slender iron
#

@idle owl if you are around, please hop in the circuitpython voice channel so I can test the recording setup

idle owl
#

@delicate pike It sounds like it's your connection. You keep cutting out.

formal plover
#

I'm listening, not sure if I will be chiming in. I don't really have anything to add this week :(

delicate pike
#

Hi @idle owl yes it must be mine lol

formal plover
#

Might just need to ping me verbally loudly if you have questions directed at me Haha.

idle owl
#

@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.

timber lion
#

hey i'm around now, on chat

delicate pike
#

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 πŸ˜ƒ

formal plover
#

No hug reports other than just to @idle owl and the other CircuitPython helpers for doing great work helping others! Plus Adafruit employees ❀

#

Yassss!

tidal kiln
#

"hug report" = just saying thanks to anyone for anything

timber lion
#

hey just on chat, no hug reports right now

#

thanks!

idle owl
#

Thank you, everyone! I'm really glad I am able to help so much!

sick creek
#

how did the jacket hold on the event?

timber lion
#

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

delicate pike
#

Revenez souvent lol

#

Come back often

timber lion
#

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

#

hrm i don't hear dan

#

discord messed up?

slender iron
#

yeah, I hear him

timber lion
#

wow weird

tidal kiln
#

i can't

timber lion
#

no audio here 😦

idle owl
#

I can

timber lion
#

ok refreshed and working now

#

wow weird

tidal kiln
#

yep

timber lion
#

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

#

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

solar whale
#

@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.

tidal kiln
#

jp has a light painter guide with cp - could add a page to that?

formal plover
#

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!

delicate pike
#

Well I still working on this motor

slender iron
#

using circuitpython?

timber lion
#

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

delicate pike
timber lion
#

that's all for me

idle owl
#

Wolf couldn't make it today, I wanted to give an update for him.

timber lion
#

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

slender iron
#

dan is talking

timber lion
#

ok back

tidal kiln
#

yeah. i keep loosing dan. have to refresh.

timber lion
#

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

solar whale
#

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.

timber lion
#

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

tidal kiln
#

make main.py a one liner that runs whatever?

timber lion
#

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 πŸ˜ƒ

tidal kiln
timber lion
#

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

tulip sleet
#

bye tony

slender iron
#

thanks @timber lion !

delicate pike
#

Nice chat all of you thanks for this moment πŸ˜ƒ

slender iron
#

thanks @delicate pike

tulip sleet
#

goodnight @delicate pike thanks for joining us

solar whale
#

@delicate pike goodnight!

delicate pike
#

Thanks πŸ˜‰

solar whale
#

I have to run - dentist 😦 -- thanks all!

delicate pike
#

Lol good luck @solar whale

tidal kiln
#

later!

delicate pike
#

@tidal kiln See ya πŸ‘

manic glacierBOT
slender iron
delicate pike
#

Thanks @slender iron

slender iron
#

no problem! I just realized my audio isn't as good as it could be because I was recording the wrong microphone.

delicate pike
#

Lol @slender iron it happends πŸ˜‹

slender iron
#

yup yup. it was leftover from our in person recording at adafruit

manic glacierBOT
#

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 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 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.

manic glacierBOT
manic glacierBOT
tidal kiln
#

so....trying to figure out all the bits and pieces for documentation.
how / where does the api documentation get integrated?

slender iron
#

I gotta run @tidal kiln but you might describe what you mean by integrated

tidal kiln
#

where = what file(s) do you actually put the text in
how = how does it finally show up on readthedocs

idle owl
#

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.

tidal kiln
#

Sphinx is what parses out the documentation, right?

idle owl
#

Yeah

tidal kiln
#

And Read The Docs is basically just a hosting site so it can be viewed in the cloud?

idle owl
#

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.

tidal kiln
#

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

idle owl
#

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.

tidal kiln
#

yep. that's what i'm after.

idle owl
#

This is the file:

tidal kiln
#

yep. looking at it right now...

#

so it built it from the doc strings there?

idle owl
#

Yes

tidal kiln
#

cool. let me use that as a ref and see if i can get something to work through the system.

idle owl
#

Excellent. I'm glad I was able to help. Surprised in fact πŸ˜ƒ

formal plover
#

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.

tidal kiln
#

the same cookie cutter Scott mentions in his guide? i did that to start.

formal plover
#

@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

manic glacierBOT
#

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.

slender iron
#

@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

tidal kiln
#

@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

formal plover
#

Glad to hear that's sorted out @tidal kiln

tidal kiln
#

thanks @formal plover one. small. step. at. a. time.

slender iron
#

good to hear @tidal kiln

#

@fading solstice we can work together on the struct stuff today if you are around

bronze geyser
#

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

slender iron
#

@bronze geyser I'm looking at it now

#

@tulip sleet I'm around if you want to chat

bronze geyser
#

wow! Thank you.

tulip sleet
#

@slender iron I was just going to ask you

slender iron
#

@bronze geyser I'm not porting it. Which version are you using? SPI or UART?

bronze geyser
#

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.

slender iron
#

no worries!

bronze geyser
#

Thank you.

tulip sleet
#

ok now? will include nrf52 discussion - where should I meet you

slender iron
#

@tulip sleet I'm in the circuitpython voicce channel

bronze geyser
#

I'll take a look. Thanks.

slender iron
bronze geyser
#

the register library looks like what i was looking for. having the SPI version out would be helpful indeed.

solar whale
#

@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.

slender iron
#

@solar whale jump in the voice chat!

solar whale
#

@slender iron the upcomming nrf52 stuff will work with this dev kit?

slender iron
#

@solar whale yeah, until we have custom hardware for it

solar whale
#

great thanks.

slender iron
#

no problem!

manic glacierBOT
#

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...

#

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 *)(...
slender iron
#

@tulip sleet want me to merge my PR or will you?

tulip sleet
#

@slender iron - I can do it. Just waiting for travis to finish.

slender iron
#

its needed for eink devices

tulip sleet
#

@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.

slender iron
#

I didn't but that'd be good

manic glacierBOT
manic glacierBOT
#

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...

split ocean
#

@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!

pulsar bronze
#

Who Pinged xd

slender iron
#

I don't think @split ocean realized the power of @everyone