#circuitpython-dev

1 messages Β· Page 173 of 1

tidal kiln
#

and i just kind of got in a habit of doing that

#

meh. it pretty much works.

#

maybe put both? you can say "just program it. if that doesn't seem to work, then double reset to bootloader and try that."

idle owl
#

That works

ruby atlas
#

Hmm, anyone able to give me advice on the appropriate way to temporarily allocate the initializer bytes for mp_obj_new_bytearray()? is it m_new or m_alloc or..?

errant grail
#

@marble hornet Sure. My approach is verbatim from TonyD's excellent learning guides. I tried the OLED FeatherWing and the TFT FeatherWing. The OLED was much faster than the TFT, but was still too slow and memory hungry for the real-time MIDI sniffer project. Here's the TFT code. Note that the learning guide links are included in the header. ```# 2018-05-30 DSP MIDI sniffer v05 TFTwing.py

https://learn.adafruit.com/micropython-hardware-ili9341-tft-and-featherwing?view=all#circuitpython

https://learn.adafruit.com/micropython-displays-drawing-text

### Setup

import board
import busio
import bitmapfont

uart = busio.UART(board.TX, board.RX, baudrate=31250)

spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = digitalio.DigitalInOut(board.A3)
dc = digitalio.DigitalInOut(board.D10)

from adafruit_rgb_display import ili9341, color565
tft = ili9341.ILI9341(spi, cs=cs, dc=dc)
tft.fill(0)
tft.scroll(0)

bf = bitmapfont.BitmapFont(120, 320, tft.pixel)
bf.init()

bf.text('2018-05-30 DSP MIDI sniffer v05 TFTwing.py', 0, i, color565(255, 255, 255))```

#

@marble hornet ... and the OLED code. ```# 2018-05-29 DSP MIDI sniffer v05 OLED.py

https://learn.adafruit.com/micropython-hardware-ssd1306-oled-display?view=all

### Setup

import board
import busio
import adafruit_ssd1306

uart = busio.UART(board.TX, board.RX, baudrate=31250)

i2c = busio.I2C(board.SCL, board.SDA)

oled = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
oled.fill(0)
oled.show()

oled.text('DSP MIDI sniffer',0,0)
oled.show()```

#

(the UART setup is for the MIDI serial connection and has nothing to do with the display)

#

To overcome the display blocking, scrolling, and text display speed issues, I'm planning to implement a VT-100 -like emulator in Arduino code and driving a TFT display of some sort. I'll send the VT-100 emulator characters serially from the CircuitPython MIDI sniffer code running on a Trinket M0 or Feather M0 Express.

ruby lake
errant grail
#

@ruby lake Thank you for the link! I'm sure I'll learn a lot from your approach. Your MIDI CC state and note buffer methods are getting me to rethink a few things already...

marble hornet
#

@errant grail cool. i altered the rgb tft display to open a file i made. the file contains a text dict named text_dict. example of contents: ```text_dict = {
'Height' : 7,
'Width' : 5,
"A" :(0b10111111,
0b11000100,
0b11000100,
0b11000100,
0b10111111),

"B" :(0b11111111,
      0b11000001,
      0b11001001,
      0b11001001,
      0b10110110),

"C" :(0b10111110,
      0b11000001,
      0b11000001,
      0b11000001,
      0b10100010),
#

then in the rgb display library the added 'text' method goes through the inputed string and stripes the text. I also added support for special characters like' battery symbol's, and an 'unknown' character.

stuck elbow
marble hornet
#

Can it be written in blocks instead of pixel by pixel ?

#

@stuck elbow

stuck elbow
#

sure, I was just hinting at a more efficient way of storing the font data

#

you can make a buffer, draw the pixels in that, and send it as a block

marble hornet
#

Could I ask for your help with sending blocks of data later ? I looked at the core. It seems like raw data but the formatting... Do you have experience with that ?

#

@stuck elbow are you Radomir Dopieralski? If you don't mind my asking

stuck elbow
#

yes

marble hornet
#

to both ?

stuck elbow
#

yes

manic glacierBOT
tulip sleet
#

@ruby atlas m_new is just a convenience macro:

#define m_new(type, num) ((type*)(m_malloc(sizeof(type) * (num), false)))

But do you need to allocate it on the heap? Could you just allocate an array on the stack, fill it, and then call mp_obj_new_bytearray()?

ruby atlas
#

@tulip sleet the stack would be fine... though i don't know the size of it in advance, which is why i thought i have to allocate it on the heap? I may have a hole in my C/embedded knowledge here - is there a way to dynamically allocate stack?

#

though i'm tempted to just manually do the bytearray initialization and use memset() instead of using mp_obj_new_bytearray()

#

(or add a new mp_obj_new_bytearray_zeroed() or mp_obj_new_bytearray_filled())

errant grail
#

@marble hornet Clever approach. Does it improve character rendering speed on the TFT?

#

@stuck elbow Excellent algorithm. I'm going to add it to my experimental/learning tests. Do you use this on your gaming platform?

stuck elbow
#

@errant grail yes

manic glacierBOT
tulip sleet
ruby atlas
#

Thanks dan!

slender iron
manic glacierBOT
#

I tried essentially the same program on a Trinket M0 to rule SPI flash presence in or out. Had to hack things up a bit to provide I2S on a Trinket, but I get same kinds of hangs (not examined in gdb). Not clear if coincident with filesystem operations: sometimes seems synchronized, and sometimes operation does not provoke a hang. Often hangs by itself (more quickly than on Metro M0).

slender iron
#

they should always include instructions on usage and link to docs

tulip sleet
#

sure - can you point to a good example?

slender iron
#

yup, lemme look

slender iron
#

yup, matrix looks good too

#

usually I start with the previous release's notes but some repos don't have the format

#

new headshot looks good btw!

tulip sleet
#

tnx!

slender iron
#

@tulip sleet I feel like I'm seeing a similar hang with the pulsein stuff

tulip sleet
#

is it also DMA?

slender iron
#

I was experimenting with detection yesterday and theres a spot between the symptom and the detection

#

no, its interrupts

tulip sleet
#

does it have a MICROPY_VM_HOOK?

slender iron
#

no, they happen in the background

#

will keep looking πŸ˜ƒ

tulip sleet
#

it is weird. only solid clue I have is smashed MSC ASF4 device descriptor when I add I2S->DATA[0].reg = I2S->DATA[0].reg;. Maybe I'll try to set a watchpoint on the MSC struct

slender iron
#

yeah, that could be good if its consistent

tulip sleet
#

do you remember why you added that I2S write to itself and then why you took it out?

#

it seems to work fine without

#

with, it might trigger an early write into the DMA with premature data

slender iron
#

I think it had to do with a note in the datasheet

#

but it might have been to trigger the dma

tulip sleet
#

yes, I saw that, that doing the write would trigger the peripheral

#

k, i will keep looking too

slender iron
#

watchpoint soudns like a good idea to me

marble hornet
#

@errant grail it does over the built in buf of cir-py. and i am able to add special character. plus it is only buffering 1s and 0s not whole numbers for color. so a little. what kind of tft are you using ?

wraith tiger
marble hornet
#

amg8833 libraries. is there still a difference between 3.0 and the 2.2.1 ? or is the code now cross compatible?

#

i though i heard tell of 2.x code running on 3.0

errant grail
#

@marble hornet The 2.4-inch TFT FeatherWing.

slender iron
#

@wraith tiger yup, aivar is the thonny dev (based in europe so timezones can be tricky)

wraith tiger
#

Yeah, I have the world clock set up in Gnome with Florence, Nairobi, Bangalore, Jakarta & Manila across the top of my screen.

solar whale
#

@marble hornet the .mpy files are formatted differently for 2.x vs 3.x so you have to use the correct versions. the underlying code in the .py files are "usually" the same

marble hornet
#

ah, so i'm looking for the source file. thanks!

solar whale
#

there should only be one source file.

marble hornet
#

there are, .zip and tar.zip

solar whale
#

if you want to convert to .mpy later just use the correct version of mpy-cross for 3.x or 2.x

slender iron
#

😬 #0 0x0001d43c in EIC_Handler () at peripherals/samd21/external_interrupts.c:82 #1 <signal handler called> #2 __get_PRIMASK () at asf4/samd21/CMSIS/Include/cmsis_gcc.h:313 #3 common_hal_mcu_disable_interrupts () at common-hal/microcontroller/__init__.c:51 #4 0x0001d5b6 in SysTick_Handler () at tick.c:42

tulip sleet
#

handler in a handler

slender iron
#

yup, as the handler is trying to disable interrupts

tulip sleet
#

i think i need to read about the interrupt system and whether an interrupt can be set to mask other interrupts when handler is called

tidal kiln
prime flower
#

blink_rate is more descriptive

tulip sleet
#

yah, blink is more likely to be just True or False

tidal kiln
#

works for me. thanks.

tulip sleet
#

@slender iron I think there needs to be some kind of "test and set" operation for nesting_count, cause right now there's a race condition to increment it.

slender iron
#

yup, looking at that right now

#

asf4 handles it by storing interrupt state every disable and resetting it on enable

#

I think we can just always disable

#

since its idempotent

#

disable first and then decide if we can re-enable

idle owl
#

@tulip sleet I search Discord for "library releases" and Scott pasted a raw markdown example previously that you can change the URLs and library name in and then it's an easier paste into new release notes. That's how I've been doing it.

tulip sleet
#

how does asf3 do it?

#

@idle owl - thanks yes, I pretended to edit another release and got the markdown from that and changed the url. (I suggested to github a while ago they add wysiwyg to the release message text editor, but nothing happened yet...)

slender iron
#

looking in asf3 now

tulip sleet
#

looking in yiu

idle owl
#

@tulip sleet Searching Discord might be easier than editing another release, but I figured I'd let you know how I was doing it in case it was simpler for you.

wraith tiger
#

@tidal kiln Maybe even blinks_per_sec or similar to be even more explicit.

tidal kiln
#

@wraith tiger maybe. it's not continuously settable. there are four options: off, 0.5Hz, 1Hz, 2Hz

slender iron
#

@tulip sleet asf3 grabs flags and then disables

tulip sleet
#

@slender iron does it keep a count?

slender iron
#

nope, seems like it should suffer from the same bug actually

tulip sleet
#

that file has a volatile cpu_irq_critical_section_counter but it's not mentioned elsewhere in the file, and it's static (?!)

tidal kiln
#

i was thinking of maybe adding some consts to make it a little more readable:

BLINK_RATE_OFF = 0
BLINK_RATE_0_5HZ = 1
BLINK_RATE_1HZ = 2
BLINK_RATE_2HZ = 3

or some such...

slender iron
#

I think we'll be fine if we always disable first

#

and then do the count math

#
volatile uint32_t nesting_count = 0;
void common_hal_mcu_disable_interrupts(void) {
    __disable_irq();
    __DMB();
    nesting_count++;
}

void common_hal_mcu_enable_interrupts(void) {
    if (nesting_count == 0) {
        // This is very very bad because it means there was mismatched disable/enables so we
        // "HardFault".
        HardFault_Handler();
    }
    nesting_count--;
    if (nesting_count > 0) {
        return;
    }
    __DMB();
    __enable_irq();
}
tulip sleet
#

yes. it's not necessarily a problem that common_hal_mcu_disable_interrupts gets interrupted. it's a problem only if the two interrupt handlers access shared storage before disabling interrupts

slender iron
#

right

#

is __udivsi3 slow?

#

we use it in the pulsein handler

tulip sleet
#

i think m0 has no hardware divide

slender iron
#

ya

tulip sleet
#

prob not THAT slow

slender iron
#

but removing it doesn't actually help this case becaues you could just input a faster signal

#

we could have the vm track the last time it ran "background" tasks and give a mechanic for interrupt to check its happening from time to time

#

a non-hardware watch dog

tulip sleet
#

you mean have systick check that? i thought it ran background tasks always as part of MICROPY_VM_HOOK_LOOP

slender iron
#

nah, the pulsein interrupt

#

I need to know when to shut it down

tulip sleet
#

to prevent it from starving the background tasks

#

like if the background tasks haven't run for a second and pulsein is active then pulsein is starving them, and it should give up

slender iron
#

yup yup

#

though it may be able to starve the systick as well

tulip sleet
#

the pulsein handler does not block other interrupts, but the systick handler does. do we use interrupt priorities at all or are they all the same priority

slender iron
#

we don't use any priorities but the systick is special because its in the core

#

looks like tracking the last run of the background is a pretty good metric

#

I'll try bumping systick to top priority

tulip sleet
#

I'm thinking that systick can't get starved by pulsein even if they're the same level because the pulsein handler doesn't disable interrupts but the systick handler does. so if the systick handler is at the same level, it will interrupt pulsein and then is guaranteed to finish its work

slender iron
#

current_tick does turn off interrupts

tulip sleet
#

actually, not true, according to Yiu:

#

_"An interrupt request can be accepted by the processor if:

  • The pending status is set,
  • The interrupt is enabled, and
  • The priority of the interrupt is higher than the current level (including interrupt masking register configuration)."_
slender iron
#

right, so equal priorities wait

tulip sleet
#

yes, so systick should be higher, as you say

slender iron
#

the cmsis SysTick_Config function sets it lowest by default

#

so it was lower than everything else πŸ™„

#
$9 = 11725
(gdb) p last_finished_tick
$10 = 61```
tulip sleet
#

those should be equal?

slender iron
#

yeah

tulip sleet
#

ooh bad

slender iron
#

but pipe in a 50khz signal to pulsein and it falls over

#

I think its useful to track

tulip sleet
#

good idea

#

interesting that right now with all interrupts at the same prio (except for faults that are fixed at higher prio), the "interrupt disable/enable" stuff isn't actually protecting against anything ... not that we should take it out

slender iron
#

its not protecting when an interrupt is active

#

and systick in master is lowest priority

tulip sleet
#

right, not counting systick.

stuck elbow
#

In the Adafruit Daily you are asking for links to PyGame games.

slender iron
#

yay!

stuck elbow
#

by the way, I think it's a very bad idea to base the library on pygame

slender iron
#

have you used pygame on micropython at all?

#

why?

stuck elbow
#

no, it's not possible

#

pygame is based on SDL, which is really designed with large PCs with large memory in mind

slender iron
#

right but we could use the same api right? someone has done it for pokkito

stuck elbow
#

I would rather look at the consoles like NES, GameBoy, etc.

#

you probably could, but it would be very wasteful

slender iron
#

sure

stuck elbow
#

plus, pygame doesn't make it easy to make games

slender iron
#

thats why I like the approach of good C helpers with a python/pygame layer

#

pygame has a lot of docs and tutorials already

stuck elbow
#

not really

#

nothing good quality anyways

#

it has a lot of very basic stuff

#

but that doesn't let you make an actual game

#

I've been writing games using PyGame for the last 10 years :)

slender iron
#

well, I'm all for another api too but I think we'll want pygame support somehow

stuck elbow
#

I made Β΅Game precisely because PyGame sucks

slender iron
#

πŸ˜„

#

I won't argue with you since I don't have experience with it

stuck elbow
#

in any case, most games on that page I linked are in pygame

#

and they are all open source, so you can take a look

slender iron
#

awesome

#

I'm hoping to have some dedicated cycles for it after 3.0.0 is in release candidate and soaking

stuck elbow
#

there are some libraries with better api: lΓΆve2d, haxe, pyglet

slender iron
#

and definitely want to think about portability to modern handhelds and retro ones

stuck elbow
#

oh, there is also the pico8, which is a fantasy console

#

as in, an emulator for a non-existing console

slender iron
#

neat!

stuck elbow
#

there is an awesome community making games for that

#

if you could tap into that, it would be great

slender iron
#

I need to make an issue for it

manic glacierBOT
slender iron
#

@stuck elbow lets brainstorm there so ladyada gets emails about it πŸ˜ƒ

manic glacierBOT
stuck elbow
#

Added some links

slender iron
#

thanks!

#

@tulip sleet I bumped the usb priority and it doesn't freeze as hard either

manic glacierBOT
tulip sleet
#

if you push that stuff I could try the PDMIn tests again, though I'm not sure it's releated

slender iron
#

sure

tulip sleet
#

i can just try your repo

manic glacierBOT
slender iron
#

goes to eat lunch

idle owl
#

oh man I need to eat too.

tulip sleet
#

i had lunch but that was a while ago, need a snack

#

@slender iron PDMIn hangs as usual, unfortunately. Also NeoPixel is blindingly bright, not pulsing as it should.

idle owl
#

That was an easter egg.

raven canopy
#

With the previous PulseIn/SysTick issue, and FrequencyIn, I was wondering if the NVIC priorities could be looked at. Didn't think they were causing any issues, though. While catching up, I was going to mention something along the lines of setting "secondary" interrupts (EIC) to a lower priority. But, setting SysTick from lowest to highest seems more logical.

slender iron
#

@tulip sleet on what board? I only tested it on metro m0

tulip sleet
#

metro m0 πŸ˜ƒ

tidal kiln
tulip sleet
#

@tidal kiln how bout if not (0 <= x <= 3):

tidal kiln
#

that was my guess for most pythonic, just not a check for being in range

#

and it works

slender iron
#

@tulip sleet is your bright neopixel yellow?

tulip sleet
#

white

slender iron
#

hrm

#

mines blindingly yellow every so often

tulip sleet
#

a op b op c in python is short for a op b and b op c

#

it is just stuck white, even if i mon reset

#

are you using jlink?

tidal kiln
#

there's also if x not in range(0,4) but that would waste some memory creating the range, right?

tulip sleet
#

yeah, that would be really slow, since it will check all the elements, I think

raven canopy
#

@tidal kiln hmm. I'll have to look at that later, since the same conditional is used elsewhere (in other libraries as well). Thanks for the heads up.

tidal kiln
#

@raven canopy yep. it's used elsewhere in that same lib too. i'm going to use what dan suggested for now.

tulip sleet
#

it's if 0 < rate > 3 which would be 0 < rate and rate > 3 which is only true if rate > 3

tidal kiln
#

i was wondering what that expand out to. so it's basically an implicit and ?

tulip sleet
#

yeah

tidal kiln
#

any pythonic way to make it an or?

tulip sleet
#

see "chained". nope it's always and

#

I think the not is pretty clear in that case

stuck elbow
#

@tidal kiln if not 0 >= rate >= 3:

idle owl
#

@raven canopy @cunning crypt @slender iron I've pushed an update to the CoC, if you could give it a look when you get a chance. Thank you.

tulip sleet
#

so parens not needed?

tidal kiln
#

@stuck elbow if not 0 <= rate <= 3:

stuck elbow
#

right, sorry

tidal kiln
#

that's what i switched to and works. dan suggests same.

#

and yep, i had no parens

slender iron
#

@idle owl pinned in my inbox. thanks!

tidal kiln
#

@raven canopy created an issue in the trellis repo for that. too bad it doesn't work. the syntax looks cool.

raven canopy
#

I was just about to do that! Haha. Thanks! @tidal kiln

tulip sleet
#

@slender iron neopixel_write calls wait_until(next_start_tick_ms, next_start_tick_us)' and then disables interrupts.

#

I forgot, it didn't used to work either with the jlink, except it was just dark, not bright. some issue about pin assignments, if i remember right

slender iron
#

it works ok on the m4

#

I was getting a weird bright yellow pixel when off jlink on the m0

tulip sleet
#

looking at the schematic, now I remember. problem is that noepixel is run off pa30, which is also SWCLK. pa31 is rxled and SWDIO. Due to not enough pins, had to share

slender iron
#

right

surreal saffron
#

Either that's wrong or there's something real magical happening here, heh

slender iron
#

@surreal saffron looks suspect

#

probably needs to be passed in by the caller

surreal saffron
#

I think it just needs to be "true", tbh

#

os.listdir should return strings, not bytes.

slender iron
#

is that what os does in cpython?

surreal saffron
#

Hm, no, you're right - os.listdir(b'.') gives bytes, os.listdir('.') gives strings

#

TIL...

cunning crypt
#

@idle owl Had a quick glance. Seems solid.

idle owl
#

@cunning crypt Thank you, if you could note that on the PR that would be great

manic glacierBOT
cunning crypt
#

A bit busy right now. Fixing brother's website (I accidentally deleted his database. Good thing I backed it up), and then heading out to D&D

idle owl
#

Ok

cunning crypt
#

I'll give it a proper review/read tomorrow

river quest
#

hi hi @slender iron

slender iron
#

hi!

river quest
#

should i ... POST a LEEK ... HERE or in general ... game thingie PCBs

#

DEALERS CHOICE

#

(calling it ArcADA for now)

slender iron
#

general I think

cunning crypt
#

I like ArcADA

#

It's a fine name.

river quest
slender iron
#

it is related to circuitpython but it'll blow out our other conversations πŸ˜ƒ

cunning crypt
#

And also a nice play on words.

manic glacierBOT
#

I'm unable to reproduce the problem in #894, but I was able to get another one.

I order to get the tests running at all I first had to do a:

storage.erase_filesystem()

Otherwise I got the same hung error mentioned further down.

I've run the tests 3 times in a row, no problem.

.../tests $ CPBOARD_EXEC_MODE=disk python3 run-tests --device=metro_m4_express --target=pyboard -d basics circuitpython
<snip>

413 tests performed (12423 individual testcases)
401 test...
idle owl
#

@tulip sleet When you get a minute, I need your help with adding a piece of information to the CP Expectations page about ints and limits. You explained it in the issue, but you explained it super technically and I'm not sure that's the best way to put it into the guide page, so I wanted to discuss it with you.

#

@slender iron I'm also not sure what to add regarding heap memory usage. That's all that was added to the list and I don't know where to go with expanding that into useful information.

slender iron
#

whats the note actually say?

manic glacierBOT
idle owl
#

"Heap memory usage"

#

with a check box.

#

I assume you said it verbally and I added it.

slender iron
#

hrm

#

a section about memory usage is probably enough

idle owl
#

I'm trying to write that now and struggling. I'll finish writing it up and have you look at it. I don't think it's right.

slender iron
#

just think about the common issues people hit around it and tips to help

#

mpy-cross is one

manic glacierBOT
ruby atlas
#

@tulip sleet finally read the wiki link. Apparently I need to read up on C99 and C11. I appear to have failed to learn the new features of C and am stuck in the mid 90s.

tulip sleet
#

@slender iron small builds are running out of space again. try setting -finline-limit=50 That worked for me when trying to fit rotaryio in (no PR for that yet).

tidal kiln
#

i'm adding __setitem__ access to the ht16k33 driver, so you can do things like this:

matrix[3,6] = 1

but this doesn't make sense for non-matrix displays like seven seg and alphanumeric.

#

i'm thinking of overriding and throwing a RuntimeError for those displays

#

make sense? so if someone tried:

seven_seg[3,6] = 1

it would throw an exception.

tulip sleet
#

@tidal kiln - it could make sense: on the 3rd digit/alpha display turn on/off the 6th segment

#

kinda convenient maybe actually

idle owl
#

But how are the segments numbered in that case?

tidal kiln
#

hmmm

#

there's a cheat sheet...

tulip sleet
#

there is a numbering

idle owl
#

Ah

#

Thought maybe it was arbitrary.

#

@tulip sleet Did you see my message earlier about int and float limits for the CP Expectations page?

tulip sleet
#

noo...

#

did you write anything yet? we could chat a bit on this

#

now saw it

idle owl
#

I have not written anything for that one yet

#

I can show you what I have so far

#

I guess it's already said in there rather concisely under "Things to watch out for!"

tulip sleet
#

non-Express boards only have 31-bit integers (you could give the range: -2^31 to 2^31-1). As of 3.0 Express boards have arbitrary long integers like CPython.

tidal kiln
idle owl
#

If I want to add that to the FAQ section, how would I word the question that your info answers?

#

What integers are supported in CircuitPython? ?

#

Seems weird.

tulip sleet
#

floating point numbers are single precision (not double precision like CPython), They have 8 bits of exponent and 22 bits of mantissa (not 24 like regular single precision floating point)

idle owl
#

"What are the int and float limitations of CircuitPython?" ?

tulip sleet
#

"How large can integers be in CircuitPython?" "How large can floating point numbers be?" "How many digits of precision for floats?"

idle owl
#

Ok

tidal kiln
#

unfortunately, they use a letter based labeling

#

and then there's those DP's

tulip sleet
#

a=1, b=2, for decimal points, 0 could be the decimal point light

#

what's the current API for arbitrary segment access?

tidal kiln
#

they don't have it, for the segmenets

tulip sleet
#

@idle owl largest FP number is about 3.4e38 (most neg is about -3.4e38) smallest is about 5.6e-45 (pos or neg)

#

@tidal kiln I thought I saw something about arbitrary access in the arduino libs

#

will look

tidal kiln
#

yah, and i should know. it's come up in the forums a few times...

tulip sleet
#

`class Adafruit_AlphaNum4 : public Adafruit_LEDBackpack {
public:
Adafruit_AlphaNum4(void);

void writeDigitRaw(uint8_t n, uint16_t bitmask);`

tidal kiln
#

^^ yep. that.

idle owl
#

I added it to the list at the bottom. Can you read through it quickly and make sure it sounds ok?

tulip sleet
#

same for 7-segment, plus drawColon(bool)

tidal kiln
#

not really beginner friendly. i've had to walk people through creating bitmask before.

tulip sleet
#

may not be worth implementing if you want to save space, but people might want to do it. People like to do animations, etc.

tidal kiln
tulip sleet
#

@idle owl I don't think these are really FAQ's. I think there might be a section like "Differences between regular Python and CircuitPython"

#

some of that is in "Things to watch out for !" now

#

@tidal kiln yah, so bitmask is a pain, and if there was an array syntax, it might be easier, which is why it appealed to me. You'd have to have a picture showing the mapping. And the 0 digit or the 4 digit could be the colon

tidal kiln
#

i could get fancy, what's passed in is just an arbitrary key. so, in theory, could support:

seven_seg[3,'D'] = 1
slender iron
#

@tulip sleet will look now. just got back from climbing

tulip sleet
#

@tidal kiln - it's kinda wordy, i guess, when you want to set multiple ones. does arduino have bit constants for the different segmeents you can "or" together?

#

maybe I am revising my idea of that it's a good idea. so right now seven_seg[3] = 2 would display a "2" on the third (or fourth?) digit?

#

or is seven_seg[3] = "2"

tidal kiln
#

yes. there will be something like that.

tulip sleet
#

seven_seg[3] = "ACD." turns on those segments

tidal kiln
#

with the general idea of just being able to throw text and numbers at the segment displays

tulip sleet
#

right, at the whole display, not a subscripted digit

#

"seven_seg[3] = "ACD." turns on those segments" is lousy for the alphnumeric ones, so that's not good

tidal kiln
#

current lib is already like that

#

it only allows the seven seg to accept numbers (but does have hex support)

tulip sleet
#

yeah, and I want it to be able to say "uhoh"

#

πŸ˜ƒ

#

or at least turn on the segments to say that

tidal kiln
#

01134 is supported πŸ˜€

#

oh wait. not enough digits. 😦

tulip sleet
#

so, back to your original question, what should it throw? Are you using subclasses or just separate classes?

#

for the different displays on ht16k33, or is it all one class

tidal kiln
#

sub, ht16k33 is my base.

#

and it has the __setitem__ support

tulip sleet
#

so __setitem__ would be implemented differently in the different subclasses. You could just not handle the multiple subscripts on the 7seg and alpha, or do you want to check for that and fail gracefully?

wraith tiger
tulip sleet
#

I think ValueError is the correct exception. RuntimeError implies a failure of some kind in the code, not that it was called wrong

ruby atlas
tidal kiln
#

right. that's what i was doing. and then for the seven_seg / alpha_num, basically turn it off (override, throw expection), since it doesn't seem to make sense.

#

i could just leave it there. it's benign. user would just be turning on/off random non-obvious segments.

tulip sleet
#

the class hierarchy could be:

HTK1633
    pixeldisplays
           8x16, etc.
    segmentdisplays
           7seg
           alpha

and only implement [a,b] for pixeldisplays

stuck elbow
#

they don't have to be random, a could be the digit and b could be the segment in that digit

tidal kiln
#

@wraith tiger such sweet sounds... now just need a Vogon to join in

tulip sleet
#

@stuck elbow scroll back πŸ˜ƒ

#

@wraith tiger I wrote a poetry program in FORTRAN in 1971.

#

it did not talk

tidal kiln
#

^^ and elsewhere in that thread

stuck elbow
#

I generally don't like the idea of forcing the segment displays and the pixel displays to have a common base class β€” there is almost nothing to share

tidal kiln
#

i think it's kind of working out ok doing that

stuck elbow
#

by the way, instead of doing meaningless api changes, we could change the way the font is stored in the segment displays, to save ram

ruby atlas
tulip sleet
#

you could have an ht16k33 helper class that does the low-level i/o, and have the other classes just call it as necessary

stuck elbow
#

what low-level io?

#

the i2cdevice already does the low-level io

tulip sleet
#

abstract the register writes?

#

i am talking out of my hat

stuck elbow
#

done in the i2c_register lib

wraith tiger
#

@tidal kiln I actually watched that Hitchhiker's episode the other day. It's free to watch with Amazon Prime.

tulip sleet
#

like _write_cmd() in the current lib

stuck elbow
#

besides, there are only two registers

#

brightness and blinking

tidal kiln
#

i'm adding things like size and auto_write also

#

can add the keyscan stuff later

stuck elbow
#

but those are not registers on the device

#

this is just pure overhead

#

and every class is going to have a different size anyways

#

@tidal kiln in that wip, why are you not using framebuf?

tidal kiln
#

they call the base class and pass in their size

stuck elbow
#

can't they just set the size in their own class?

#

I know that building complex hierarchies is exciting, but do we gain anything here from it?

tidal kiln
#

there would be redundant size code in all the classes, let the base take care of it

stuck elbow
#

size code?

tidal kiln
#

size checking, for example

stuck elbow
#

it's literally:

class Foo:
   size = x, y
#

no need to make it a property

#

you never modify it

#

(also, separate width and height attributes would make more sense)

tidal kiln
#

but each class would have that

stuck elbow
#

yes, because each has it different

#

you don't save anything by putting it also in the base class

tidal kiln
#

it's only in the base class

#

the sub classes pass in their size when they are created. it's not meant to change.

stuck elbow
#

so the base class has all this code for passing and setting the attribute, and the subclasses in addition have the code to pass the size to the base class

#

instead of just setting it in the subclasses

#

without any extra code, only the thing that changes

crude fossil
#

G'day all! Nick Moore here ... looking forward to doing some CircuitPython development πŸ˜ƒ

slender iron
#

hi hi @crude fossil !

stuck elbow
#

@tidal kiln compare:

class Matrix8x8(HT16K33):
    """Class for using a 8x8 LED matrix."""

    def __init__(self, i2c, address=0x70):
        super(Matrix8x8, self).__init__(i2c, address, size=(8, 8))

and

#
class Matrix8x8:
    width = 8
    height = 8
tidal kiln
#

and then what? what would the rest of the Matrix8x8 code look like?

stuck elbow
#

you also save memory, because the size is per class, not per instance, and you don't need extra memory for the tuple

#

@tidal kiln it would have code for creating the correct framebuf, and a 1-line show() function for sending that to the display

tulip sleet
#

@crude fossil hi!

tidal kiln
#

@crude fossil hey hey. you're in the right place for that.

stuck elbow
#

and two register defintions for brightness and blinking

tulip sleet
#

i bow to deshipu for further discussion: he is expert on minimal python for this kidn of thing

slender iron
#

the core work on that issue was simply splitting the classes into separate files afaict

stuck elbow
#

but that doesn't save you anything if you still import all those files

tidal kiln
#

and getting away from get/set style methods

slender iron
#

@stuck elbow who would import all of the different displays at once?

stuck elbow
#

exactly

slender iron
#

@tidal kiln may be better served in two steps

tidal kiln
#

you would only import the files for your display

stuck elbow
#

and those would import the files for their base classes

tidal kiln
#

one file - ht16k33

#

but the others wouldn't get imported

slender iron
#

sounds good to me

#

please start with that and propose API changes separately

#

definitely good to brainstorm how to evolve it

tidal kiln
stuck elbow
#
from adafruit_bus_device import i2c_device
from adafruit_register import i2c_bits
import framebuf


class Matrix8x8:
    width = 8
    height = 8
    brightness = i2c_bits.RWBits(4, 0xe0, 0)
    blink_rate = i2c_bits.RWBits(2, 0x81, 1)

    def __init__(self, i2c, address=0x70):
        self.i2c_device = i2c_device.I2CDevice(i2c, address)
        self._bufffer = bytearray(self.width * self.height // 8)
        self.framebuf = framebuf.FrameBuffer(self._buffer,
            self.width, self.height, framebuf.MONO_HLSB)

    def show(self):
        self.i2c_device.write_to_mem(0x00, self._buffer)
#

this is how I think this class should look like, roughly

#

Matrix16x8 would be the same, only with width=16

#

and possibly it would need to do some post-processing in show()

#

the .framebuf already has all the methods for drawing pixels, lines, text and whatever else is needed

idle owl
#

@crude fossil Hello and welcome!

tidal kiln
#

yah, that drawing stuff would be useful for the matrix ones. then for the segmented ones, would there even be a framebuf?

manic glacierBOT
stuck elbow
#

@tidal kiln no, the segmented ones would have completely different code, except for the the registers

idle owl
#

@tulip sleet Ok thank you, I'll move the page around.

stuck elbow
#

that's why I don't see sense in having a common superclass

tidal kiln
#

i can see that for the matrix vs. segment displays

#

but there's enough matrix displays, i was thinking / hoping they could share stuff with a common superclass

stuck elbow
#

well, it's 5 lines of common code

#

not sure it's worth creating a class for that

#

especially since you are going to import only one of them at once usually

#

so you don't save any memory by sharing that code

#

show() is going to be custom for every one of them, __init__ is going to be pretty much identical each time

#

except for the bi-color one, where the framebuf type is going to be different

tidal kiln
#

this parameter? framebuf.MONO_HLSB

stuck elbow
#

yes

#

not sure if we have 2-bit color mode implemented already, there was a pull request for MicroPython, but I don't know if it's merged

#

we can use 4-bit color in the worst case, and do post-processing in show()

idle owl
stuck elbow
#

so the show() would be more like:

def show(self):
    buffer = bytearray(17)
    buffer[0] = 0x00 # pixel register
    for y in range(8):
        b = self._buffer[y]
        buffer[1 + 2 * y] = (b >> 1) | (b << 7)
    self.i2c_device.write(buffer)
#

because the 8x8 backpack has arbitrarily arranged the pixels: shifted by one column and using every other row

#

probably was easier to route the pcb that way

tidal kiln
#

how'd the current CP version end up without framebuf in it?

stuck elbow
#

it was added after Tony forked it

tidal kiln
#

ah

stuck elbow
#

we will be probably overhauling the framebuf module in the near future anyways

#

for the arcade wing

tidal kiln
#

looking through that MP version helps with understanding it. thanks for that link.

stuck elbow
#

sorry, I forget that people don't have all the context I have in my head

tulip sleet
#

@idle owl doing a bit of editing, but looks great!

ruby atlas
#

i'm slowly learning the necessary incantations to make the pixelbuf class exist πŸ˜ƒ

stuck elbow
#

@ruby atlas is it similar to framebuf?

ruby atlas
#

maybe. it's purpose is to handle the bytearray for neopixels and dotstars in a speedy manner.

#

specifically the tuple to bytes conversions

stuck elbow
#

I see

ruby atlas
#

we should get a 5-10x speedup.

stuck elbow
#

yeah, using the right data types can help a lot

idle owl
#

@tulip sleet Thank you on both counts

tulip sleet
#

@idle owl k, check out the "Differences" section again

idle owl
#

@tulip sleet That's wonderful, thank you so much!

tulip sleet
#

np

idle owl
#

I'm calling it good to go.

ruby atlas
#

I'm guessing it's not safe to return a mp_obj_new_bytearray_by_ref to a bytearray held on the object instance from within a property getter?

#

(and that there really is no safe zero-copy way to do that)

#

though it'd be nice to allow access to the underlying bytearray directly.

tulip sleet
#

@ruby atlas, not a bytearray, but maybe a bytes? does it neeed to be changable?

#

ok, i missed the context, never mind, I read back

ruby atlas
#

ideally, yes it should be changeable

tulip sleet
#

i would think you would create the bytearray in python and then pass it into the c library

ruby atlas
#

hmmmmm.... that's probably the best way.

tulip sleet
#

instead of creating it in the c code

ruby atlas
#

and have the c code check that the bytearray is of the appropriate size.

tulip sleet
#

sure, or use the length of the bytearray as the defined size

stuck elbow
#

this way you can keep reusing the same buffer

ruby atlas
#

yeah, exactly.

#

it's not like this class is supposed to be used directly. it's okay for it to be a little low level.

#

i keep trying to make it's interfaces pythonic πŸ˜ƒ

#

bad me.

tulip sleet
#

deshipu has a good point, maybe separate the length, just make sure it's at least as long as needed

ruby atlas
#

right.

#

i'm not quite sure how reference counting is handled yet in the code. if I pass a bytearray during construction, is it going to exist until destruction of the instance?

tulip sleet
#

MicroPython/CircuitPython uses garbage collection, not reference counting.

#

so as long as the object holds it, it will be safe

ruby atlas
#

ok cool.

manic glacierBOT
#

I found that on my metro m4 I could reproduce a weird hang with the following interactively, freeing me from repeatedly reinitializing the SPI flash or other long debugging cycles:

>>> exec("def f(): yield from f()\ntry: list(f())\nexcept: raise")

When I run this, serial terminal hangs but I can break in gdb:

Program received signal SIGINT, Interrupt.
HardFault_Handler () at supervisor/port.c:295
295         asm("");
(gdb) where
#0  HardFault_Handler () at supervisor/p...
onyx hinge
#

whee I think I cracked what's going on .. waiting for my fork's CI build to complete before popping the champagne and actually opening a PR though.

#

also, for anyone wondering, I got openocd to work on metro m4 express. My commandline is $ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/at91samg5x.cfg -c 'gdb_memory_map disable' and my openocd version is Open On-Chip Debugger 0.10.0. It was mentioned that the support status of the metro m4 with openocd was unknown.

#

hmmm as dhalbert already noticed, travis is going slow today...

manic glacierBOT
#

.. setting it based on the ad-hoc stack pointer calculation of mp_stack_ctrl_init() meant that the stack used above main() counts against the 1KiB safety factor that the mp_stack_set_limit call tries to establish. It turns out, at least on M4, that over half of the safety factor is used up by stack-above-main()!

In the case of the basics/gen_stack_overflow.py test, which blows the stack on purpose, it turns out that gc would be called while handling the "maximum recursion depth ex...

manic glacierBOT
solar whale
#

@idle owl Congratulations on the release of the CPX guide -- Well done! blinka

stuck elbow
#

the crict just arrived, but I have a question about it

#

when I connected my circuit playground express to it, I noticed that the pin labels don't match

#

the VBATT is connected to VOUT, the A8 to A0 and A9 to A1

#

is this correct? will it blow up when I power it?

solar whale
stuck elbow
#

yeah, that's why I'm asking

#

I couldn't find any information about it

#

or schematics

solar whale
stuck elbow
#

no idea

#

it says "Developer Edition" on it

#

no version numbers or anything

solar whale
#

I can't check mine now - at work - hopefully someone else can look at one.

onyx hinge
#

if in your rev VBATT means that the connector never sees USB +5V then it will not power the CRICKIT

#

.. from USB

#

I'm just guessing here

solar whale
#

The crickit is not powere by VUSB is it -- it has to be powered on its connectors

onyx hinge
#

you're right, the guide is quite clear about that

solar whale
#

still - siince so many pads are differents, I wonder if the correct signals are going to the CriCkit -- like A0. SDA/SCL/GND look OK so the seesaw will probalbly work but I would not try it!

#

without some clarifcation or a schematic of your version.

onyx hinge
#

OK now I'm more worried about the VOUT vs VBAT connector, once I start thinking about the direction power is flowing in -- the CRICKIT might drive +5V right into the battery charger circuitry of the CPX and that can't be good.

#

you could leave that post off and independently power the CPX, .. maybe

agile plover
#

Can I have your input on this: I have been into Arduino, Pi, and Micro:bit for the past 2+ years, now I have seen this massive CircuitPython community, so my question is, should I get into CircuitPython?

tulip sleet
#

@stuck elbow I have the old board files and think I can come up with a schematic for you. hold one

onyx hinge
#

@agile plover In general the answer is "yes", but it depends a lot on your projects and on your level of expertise. You shouldn't be afraid to pick up a CircuitPython compatible board like the feather m0 express, since you can take it right over to Arduino if CP isn't the right choice for your project..

#

@agile plover For a simple project, I think CircuitPython will let you develop much more quickly than Arduino, but if you are doing sophisticated stuff or large projects then you may find that CP is not the best match.

stuck elbow
#

@tulip sleet thanks!

#

I noticed that when I flashed recent firmware on it and tried to use the audio, the transistor next to the speaker started smoking, so now I'm careful...

agile plover
#

@onyx hinge CP is a whole new world of software and hardware. And if I get into CP: an Arduino Uno is a beginner level board, what board is the one I can get for CP as a beginner?

onyx hinge
agile plover
#

Thank you! I will consider this!

solar whale
#

@agile plover It is a great community and a very nice way to be able to "poke around" with sensors. It is rapidly evolving and you have to be comfortable with that. Also be aware that for the M0 (SAMD21) boards, the limited RAM will make it harder to implmentd some projects taht work under Arduino. That said, jump in and have fun!

onyx hinge
agile plover
#

Thank you!

onyx hinge
#

and both of those can be re-flashed between Arduino and CircuitPython at any time

solar whale
#

@agile plover as @onyx hinge points out, you can easily go back and forth between Arduino and CP so there is no downside to trying it out.

agile plover
#

Ohh, ok, I will be sure to try it out now!

stuck elbow
#

so close

manic glacierBOT
#

hmmmm.. I am not a pro at reading ARM assembly yet but it looks like main is allocating quite a bit of stack:

(gdb) disas main
Dump of assembler code for function main:
   0x0000fb9c <+0>:	stmdb	sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
...
   0x0000fbda <+62>:	sub.w	sp, sp, #612	; 0x264

somewhat confirmed by looking at the stack pointer on arrival in main:

Breakpoint 2, main () at ../../main.c:236
236	int __attribute__((used)) main(void) {
1: $sp = (void *) 0x2002ff...
sick creek
#

@umbral dagger are the biscuit supportive with crict board?

umbral dagger
#

@sick creek Not for direct breadboard use,the pins won’t reach past the Crikit. But you could connect a cable to the pins. You would have to sandwich it between the CPX and Crikit, for the 6 Crikit pads anyway. The others could would just connect as normal to the CPX.

#

@sick creek Oh wait. It does fit fine!

#

Once I actually tried it πŸ˜‰

manic glacierBOT
#

I initially diagnosed #900 as being due to the stack above main being hundreds of bytes on Metro M4. However, on further investigation, it is actually the stack of main itself being over 600 bytes. This is primarily due to f486ead84a44846996c66d117de391fab048b01b which added a 512-byte on stack buffer for checking whether the contents of the boot_out.txt file matched what was already written to flash.

I think this could be greatly improved if the code which allocates the char[512] ...

#

main() reads the first 512 bytes of boot_out.txt to see whether the version information in the file is the same as what would be written to boot_out.txt. This could be reduced to, say, 160 bytes, without harm. But I thought C semantics is that the lifetime of file_contents[] would be just inside the if { } block. This could be checked by looking at the stack pointer for a call inside the if { } block vs just after it.

umbral dagger
#

@sick creek photo or it didn’t happen

#

The only thing that’s blocked is the seesaw programming port.

sick creek
#

so you could make otherside for like that arduino photo above

manic glacierBOT
umbral dagger
#

@sick creek I'm having trouble parsing that.

sick creek
#

where Crickr board is in the middle

umbral dagger
#

You could... but you wouldn't have access to the other connections.

#

And the seesaw port is only needed to reflash the seesaw chip.

#

I'll blame not thinking of trying this on my cold. This solves a problem for me in a clean/nonintrusive way (tapping into the I2C signals).

manic glacierBOT
#

I agree that under the semantics of C, the storage duration of file_contents is limited to the body of the if() block. But I think gcc is doing something clever to minimize the number of operations on the stack pointer, by finding the largest amount of storage that is ever required, and adjusting the stack pointer just once based on that value. This is probably controlled by this optimizer flag, which is turned on at any optimization level:

'-fcombine-stack-adjustments'
     Trac...
onyx hinge
#

thanks @slender iron and @tulip sleet for the attention to my recent PRs!

idle owl
#

@slender iron @tulip sleet I'll be out until ~2pm.

tulip sleet
#

roger

manic glacierBOT
manic glacierBOT
ruby atlas
slender iron
#

@stuck elbow make sure and pick up a new CPX or few the next free order you make. the one you have looks like a pre-production version

stuck elbow
#

roger

slender iron
#

@onyx hinge I'll poke rosie to do a test run today and see how it goes

#

thanks for the fixes!

#

@stuck elbow thank you for the fantasy console links. I dove more into them last night. they look very cool

stuck elbow
#

awesome

prime flower
slender iron
#

@prime flower I don't think so. Its not the workflow I want to promote for circuitpython

prime flower
#

ok

manic glacierBOT
#

In addition to removing the MICROPY_VM_HOOK_LOOP, as described in the previous comment. I wrapped the entire insides of common_hal_audiobusio_pdmin_record_to_buffer() in disable/enable interrupts, so it would be completely synchronous, and it still hangs the same way. When a hang happens, the first word of first_buffer contains good data, but the rest has not been filled in. So only one word was transferred.

Also checked settings of I2S peripheral. The settings are the same when a g...

slender iron
prime flower
#

yep, trying that out with some of the Adafruit IO Arduino examples

lone sandalBOT
tulip sleet
idle owl
#

@tulip sleet I can do it if you like

tulip sleet
#

sure, thanks!

manic glacierBOT
lone sandalBOT
manic glacierBOT
slender iron
#

Should I cut Beta.1 today or wait?

idle owl
#

I don't see a reason to wait. There's some really solid fixes in already that I think would be good to get out.

slender iron
#

yeah, I've got another fix but I don't think its critical

manic glacierBOT
slender iron
#

eh, I think I should get my stuff in first

#

I have interrupt changes that should help things

idle owl
#

That does sound like a good thing to have

slender iron
#

we can always release tomorrow πŸ˜ƒ

idle owl
#

That statement is probably almost always valid.

stuck elbow
#

Friday is the traditional day for deploying to production

slender iron
#

πŸ˜„

wraith tiger
#

Friday at 4:59 pm, to be exact...

idle owl
#

Monday over lunch. Best time.

prime flower
#

props to @cerulean pine for the MQTT library, just got it pushing to my IO + made a lil' dash for it

tulip sleet
#

i have eliminated a lot of possibilities but still haven't fixed PDMIn. I need a break and will go to the crafts store to buy cardboard and popsicle sticks.

idle owl
#

Yes!

slender iron
#

@tulip sleet you'll figure it out while deciding which popsicle sticks to get. πŸ˜ƒ enjoy the break!

ruby atlas
#

@wraith tiger I got a shirt from one of the vendors at PyCon that says "I deploy on Fridays" on it.

wraith tiger
#

...and on the weekends, I run with scissors...

#

Bummer, I can't fit all the interesting /amusing microbit demos into one file without a memory error.

idle owl
#

@slender iron I responded to your comment and also pushed updates to the CoC for whenever you get to it

manic glacierBOT
ivory fossil
#

Can I add WiFi functionality to a Circuit Playground board (the ATSAMD21 version) running Circuit Python by hooking up a generic ESP8266? I know I could do this with regular Arduino & I appreciate that the ESP8266 is a capable microcontroller by itself, but the Circuit Playground is such a convenient board with all of the sensors & outputs built in... if it also had WiFi!

stuck elbow
#

yes, but you will have to write the library to support it yourself

ivory fossil
#

ah okay, so Circuit Python doesn't have the same out-of-the-box library support for it that an older atmega32u4 Circuit Playground running Arduino code would?

stuck elbow
#

precisely

#

you have the UART to send the commands, but you have to construct the commands yourself

ivory fossil
#

Okay, thanks πŸ˜ƒ

#

I've used Arduino for years, but have only very recently discovered Circuit Python so I'm not as aware of the library ecosystem as with Arduino

prime flower
#

welcome to blinka_cooking

stuck elbow
#

you can also program the esp8266 with circuitpython to implement the processing of the network data, and just send the results to your circuit playground

#

the esp8266 has more memory for this stuff

ivory fossil
#

Good point - I always find it entertaining when people use an ESP8266 to add wifi functionality to something like an Arduino Uno that then runs their actual project code... at a quarter the clockspeed & with substantially less memory :3

prime flower
#

hey @stuck elbow , I have a ampy-weirdness question for you when you're free

stuck elbow
#

shoot

prime flower
#

I'm banging against the age-old "could not enter raw repl"

#

I changed ampy's timeout as well, and keep hitting it whenever I do an ampy command

solar whale
#

@prime flower just to check, you don't have a terminal session connected to i somewhere do you? Is this an esp8266?

#

or if it is running a "main.py" try opening a REPL and renaming the main.py to something else. I though this was fixed, but maybe not.

stuck elbow
#

@prime flower make sure you are using a recent version of ampy too

#

it was fixed fairly recently

prime flower
#

yeah, using latest

#

@solar whale I might,, it is running a main.py

solar whale
#

If you have a teminal session open, ampy will just fail to connect so that is probably not it. Try renaming main.py. import os os.rename("main.py","notmain.py") and see if ampy is happier

slender iron
#

@tulip sleet this is why I think we could compress type structs: ```00029304 <mp_type_fun_bc>:
29304: 0002f3d0 ldrdeq pc, [r2], -r0
29308: 00000120 andeq r0, r0, r0, lsr #2
29304: 0002f3d0 ldrdeq pc, [r2], -r0
29308: 00000120 andeq r0, r0, r0, lsr #2
2930c: 00000000 andeq r0, r0, r0
29310: 00000000 andeq r0, r0, r0
29314: 0001d515 andeq sp, r1, r5, lsl r5
29318: 0001c73d andeq ip, r1, sp, lsr r7
2931c: 00000000 andeq r0, r0, r0
29320: 00000000 andeq r0, r0, r0
29324: 00000000 andeq r0, r0, r0
29328: 00000000 andeq r0, r0, r0
2932c: 00000000 andeq r0, r0, r0
29330: 00000000 andeq r0, r0, r0
29334: 00000000 andeq r0, r0, r0
29338: 00000000 andeq r0, r0, r0
2933c: 00000000 andeq r0, r0, r0

00029340 <mp_type_gen_wrap>:
29340: 0002f3d0 ldrdeq pc, [r2], -r0
29344: 00000123 andeq r0, r0, r3, lsr #2
29348: 00000000 andeq r0, r0, r0
2934c: 00000000 andeq r0, r0, r0
29350: 0001d4b1 ; <UNDEFINED> instruction: 0x0001d4b1
29354: 0001c73d andeq ip, r1, sp, lsr r7
29358: 00000000 andeq r0, r0, r0
2935c: 00000000 andeq r0, r0, r0
29360: 00000000 andeq r0, r0, r0
29364: 00000000 andeq r0, r0, r0
29368: 00000000 andeq r0, r0, r0
2936c: 00000000 andeq r0, r0, r0
29370: 00000000 andeq r0, r0, r0
29374: 00000000 andeq r0, r0, r0
29378: 00000000 andeq r0, r0, r0```

idle owl
#

@tulip sleet Ping me when you get back, question about the Crickit 3.0 build.

rigid path
#

Is there an easy way to go back and forth from using circuit python to Arduino code on a Feather M0 RFM69 Packet Radio? I have CP loaded and want to go back to using Arduino.

stuck elbow
#

yes, press reset twice to get to the bootloader and then just flash your arduino program

prime flower
#

@solar whale worked briefly, then failed grr

solar whale
#

@prime flower hmm -- did you reload a new main.py? Is it failing if there is no main.py?

rigid path
#

@stuck elbow - Thank you.

prime flower
#

Yeah, reloaded one (using Screen to connect to the serial repl) and whenever I detatch screen, ampy's unable to access...am I using screen wrong?

solar whale
#

Ive just been testing the mqtt stuff - but not using main.py and ampy has been working OK for me - no delay set.

#

I always exit screen (Control-a \ on linust) Ithink it is (control-a crontol \ ) on mac

idle owl
#

(ctrl-a, ctrl-k, y) also kills screen on a Mac.

stuck elbow
#

or ctrl+a K

#

it doesn't ask for confirmation then

#

(capital K)

idle owl
#

Oh nice

#

Thanks for that

solar whale
#

hmm contol-a K does not work on my mac, control-a control-k does - with prompt

#

or control-a k also works - with prompt

idle owl
#

Mmm... same, actually.

#

ctrl+a, ctrl+\ offers to "really quit and kill all your windows?" So there's still a prompt there too. ctrl+a, \ does nothing.

prime flower
#

yep, two control presses did it

solar whale
#

on linux control-a \ is the same as control-a control-\ on mac.

#

@prime flower @stuck elbow It looks like the
main.py" issue is still present -- @prime flower are you using ampy 1.0.4?

prime flower
#

1.0.3 from pip

solar whale
#

ah -- I have 1.0.4

prime flower
#

hmm, why isn't 1.04 installing as latest

solar whale
#

not sure. trying to recall how I got it...

prime flower
onyx hinge
solar whale
#

I think I installed it from the github source

#

first remove the old version from pip then install

prime flower
#

ok, i'll try that

idle owl
#

@slender iron Noticed that the RTD page for rotaryio is formatted wrong. I think I know what's wrong with it, but I'm kind of guessing. //| :param ~microcontroller.Pin pin_b: Second pin to read pulses from. //| //| For example:: //| //| import rotaryio //| import time //| from board import * //| //| enc = rotaryio.IncrementalEncoder(D1, D2) //| last_position = None //| while True; //| position = enc.position //| if last_position == None or position != last_position: //| print(position) //| last_position = position
I think "For Example" and everything under it in that section should be 3 more spaces indented. At the moment, everything after that is included in the code example (deinit etc).

I can submit a PR, but I wanted to see if I was on the right track with the problem.

slender iron
#

@idle owl I'm not sure what the problem is. Testing it locally should help

idle owl
#

I apparently don't know how to build sphinx on the CP repo.

#

I don't know where the conf.py for Sphinx is stored, which I thought was needed to run it locally.

tulip sleet
#

@idle owl back after multpile stores

idle owl
#

@tulip sleet Did you find all of the things?

tulip sleet
#

of course not, but i have enough and i bought food too

idle owl
#

Good on all counts then.

#

Ok so Brent was trying to use the cpx lib with the crickit build and ran into Module not found: ucollections. Is LIS3DH not updated in that build?

tulip sleet
#

it should be, but there multiple builds, depends on which .uf2 he was using

#

i built one for Limor a while ago that had old libs

idle owl
#

Is cpx frozen into those builds?

tulip sleet
#

yes!

idle owl
#

Ok.

#

@prime flower So a couple of things: first of all, make sure you're using the most recent Crickit build. Second of all, you don't need to have the cpx lib on the board in the /lib folder, it's frozen into the build.

tulip sleet
#

@prime flower what's the version in boot_out.txt?

idle owl
#

@tulip sleet Thanks for the info.

tulip sleet
#

no guarantees. I can double-check the latest version.

idle owl
#

True, but it's a start.

tulip sleet
#

also you can find out the version of the library by importing it and doing whatever.__version__

idle owl
#

oh right. You had me do that the other day.

#

Maybe I'll remember it now that it's come up twice. πŸ˜„

#

Any idea how to run Sphinx on the CP repo?

stuck elbow
#

research shows that at least 15 repetitions are needed before humans assimilate a pattern ;-)

idle owl
#

Aw well I guess it's going to be a while then.

stuck elbow
#

there should be a makefile

#

just cd into the repo and type 'make html'

idle owl
#

Oh. Hmm. Ok.

#

whaaaat.

tulip sleet
#

oh, wow, I didn't even know that was there

#

thanks!

idle owl
#

@stuck elbow Thank you!!

stuck elbow
#

if you didn't know, then who put it there?

idle owl
#

Only leaves one person.

#

Also, I only partially fixed the issue I was trying to fix.

#

Fixed!

prime flower
#

@tulip sleet Adafruit CircuitPython 3.0.0-alpha.6-91-g54293397c-dirty on 2018-05-20; Adafruit CircuitPlayground Express with samd21g18

tulip sleet
prime flower
#

Hrm thats the one on the guide @tulip sleet

tulip sleet
#

we should update it

prime flower
#

ill add it to my todo tomorrow

simple pulsar
#

hello

#

I've got some Pimoroni bearables and I was thinking of using CircuitPython to talk to their i2c port, are you aware of any prior work in this space? There's a Raspberry Pi module already for it

prime flower
#

@tulip sleet ok updated verson on learn

tulip sleet
#

@simple pulsar it's not hard to adapt RPi Python code that uses I2C to CircuitPython. If you search on GitHub for Adafruit_CircuitPython_ you 'll find a lot of libraries (like dozens) that use I2C.

simple pulsar
#

Thanks, I'm not sure whether to enhance their library to allow the i2c object to be passed or to write a new one that's more in the style of existing CircuitPython libs. I'll have a look over next week and ponder this. Just thought I'd check in case you knew of any work going on in this area.

prime flower
#

none that I know of - but please ask any question you have in here πŸ˜ƒ

simple pulsar
#

@idle owl On a different subject, re: the page we were discussing the other day about internal RGB LED updates, there's a forum post saying a rather simple code snippet does not work on the ItsyBitsy, have a look at https://forums.adafruit.com/viewtopic.php?f=60&t=136420 if you have not seen it

#

@idle owl ah, actually it wasn't using the library code it was using abbreviated code based on the same approach - still odd it doesn't work though

idle owl
#

@simple pulsar It looks like the issue was resolved.

simple pulsar
#

@idle owl there was an alternate solution which was a good one but there was never an explanation of why the other code didn't work

#

@idle owl so nothing critical just a bit of a mystery

idle owl
#

It's possible that it was trying to use the pins incorrectly. That was some lower level code.

tulip sleet
#

@simple pulsar turns out there was a typo in the pins file; fixing; thanks for raising this

meager fog
#

@ruby lake take a look if you're bored :

simple pulsar
#

NP

meager fog
#

i cna export to 7 if those wont open for ya

simple pulsar
#

Time for bed for me, goodnight

meager fog
ruby atlas
#

I appear to be either a) corrupting memory b) running into GC freeing things in use or c) all of the above πŸ˜ƒ I wonder if it's time to use a VM with Atmel studio or try to keep going with gdb.

idle owl
#

Have to go deeper!

ruby atlas
#

breakpoints time!

slender iron
#

@ruby atlas I use gdb so I can help navigate if needed

ruby atlas
#

i seem to mostly just need n, s, c, start, break File.c:99, print, and bt, so far πŸ˜ƒ

slender iron
#

watchpoints can be handy too

#

I have a script that can chart all the memory too but thats not simple

#

the svd stuff is worth it to look at register values

tulip sleet
#

@simple pulsar pins were not reversed; they are different on the board; bitbangio will work

ruby atlas
#

the script to chart memory would likely be handy at some point.

#

does GC only run when an allocation failure happens, or is it more often?

manic glacierBOT
slender iron
#

@ruby atlas on failure or if gc.collect() is called from python

ruby atlas
#

thanks, and is there a specific function i should breakpoint to catch if gc is running? (I'm sure I can find it, if you know it off the top of your head that'll save me time)

slender iron
#

its in py/gc.c

#

I think its gc_collect but not exactly sure

ruby atlas
#

i'll spam breakpoints πŸ˜ƒ

slender iron
#

πŸ˜ƒ

ruby atlas
#

also it got cold outside again, i think i'll go back inside to my desktop. πŸ˜ƒ

idle owl
#

Blankets and heat from the laptop!

ruby lake
#

@meager fog ah the serial and i2s on differnt sercpms, easy then

meager fog
#

@ruby lake well, you cant use the RX and TX pins but you can use other pins. something had to get shared

ruby atlas
#

aww i wish i'd checked new before my order today, the black magic looks awesome.

onyx hinge
#

total crashes : 11.5k (208 unique)

#

hm I thought I'd found all the trivial crashes in micropython. For some reason, ubsan is finding a lot more than previously

#

(that's just a run a few minutes long!)

#

must have slightly varied the ubsan flags from the last long running test I did...?

idle owl
#

ubsan is a script or something?

onyx hinge
#

The Undefined Behavior Sanitizer, a feature of the clang C compiler

#

in the C language standard, a lot of things are defined as being undefined. For instance, using the "<<" shift operator on a negative number.

#

when you "build with ubsan", there are lots of runtime checks added for things like this

idle owl
#

oh nice

ruby atlas
#

nifty. now if only i could figure out why i'm crashing in my own code πŸ˜ƒ

#

@slender iron is there a way to find out what python instruction was executing and/or to get serial console output over gdb (or another way). I can't keep the metro m0 connected to USB and debug or my usb goes haywire πŸ˜ƒ

#

(checking for serial pins on the metro m0 express docs)

slender iron
#

@ruby atlas I can usually tell through the call stack

#

thats why I like separate power to the metro, to keep it running off usb

ruby atlas
#

it's during a subscr i'm not expecting.

#
#3  0x0000e10a in mp_obj_subscr (base=0x20001c60 <heap+5216>, index=0x1,
    value=0x200026b0 <heap+7856>) at ../../py/obj.c:470```
#
0x0001b71c supervisor/port.c 295 256 times```
slender iron
#

is that the full call stack?

ruby atlas
#

nope

#
Program received signal SIGTRAP, Trace/breakpoint trap.
HardFault_Handler () at supervisor/port.c:295
295             asm("");
(gdb) bt
#0  HardFault_Handler () at supervisor/port.c:295
#1  <signal handler called>
#2  0x20666f20 in ?? ()
#3  0x0000e10a in mp_obj_subscr (base=0x20001c60 <heap+5216>, index=0x1,
    value=0x200026b0 <heap+7856>) at ../../py/obj.c:470
#4  0x000184c8 in mp_execute_bytecode (
    code_state=code_state@entry=0x20000b80 <heap+896>,
    inject_exc=<optimized out>, inject_exc@entry=0x0) at ../../py/vm.c:475
#5  0x00010362 in fun_bc_call (self_in=0x20000ae0 <heap+736>, n_args=0,
    n_kw=536873696, args=0xc4ed <mp_call_function_n_kw+44>)
    at ../../py/objfun.c:267
#6  0x0000c4ec in mp_call_function_n_kw (
    fun_in=fun_in@entry=0x20000ae0 <heap+736>, n_args=n_args@entry=0,
    n_kw=n_kw@entry=0, args=args@entry=0x0) at ../../py/runtime.c:658
#7  0x0000c500 in mp_call_function_0 (fun=fun@entry=0x20000ae0 <heap+736>)
    at ../../py/runtime.c:632
#8  0x00020c12 in parse_compile_execute (source=source@entry=0x39abd,
    input_kind=input_kind@entry=MP_PARSE_FILE_INPUT,
    exec_flags=exec_flags@entry=32, result=result@entry=0x20007d44)
    at ../../lib/utils/pyexec.c:103
#9  0x00020f14 in pyexec_file (filename=filename@entry=0x39abd "main.py",
    result=result@entry=0x20007d44) at ../../lib/utils/pyexec.c:516
#10 0x0001b1dc in maybe_run_list (filenames=filenames@entry=0x20007d50,
    exec_result=exec_result@entry=0x20007d44) at ../../main.c:122
#11 0x0001b318 in start_mp (safe_mode=safe_mode@entry=NO_SAFE_MODE)
    at ../../main.c:158
#12 0x0001b4b0 in main () at ../../main.c:368
(gdb) mtb
0x0001b71c supervisor/port.c 295 256 times```
slender iron
#

I think there is an extra loop in the hardfault handler

#

thats why the mtb is garbage

ruby atlas
#

is Serial1 on pins 0 and 1 the same serial that's avail on usb?

#

if yes, time for my FTDI

slender iron
#

no, usb doesn't go through a serial port

onyx hinge
#
469     if (type->subscr != NULL) {
470         mp_obj_t ret = type->subscr(base, index, value);
#

looks like type is not a very good type

#

or type->subscr actually

#

if you break at HardFault_Handler maybe the mtb won't be trashed yet?

#

... cpy2 has this block in HardFault_Handler, but its equivalent isn't in the current version (not right code for samd51?)

#
{
#ifdef ENABLE_MICRO_TRACE_BUFFER
    // Turn off the micro trace buffer so we don't fill it up in the infinite
    // loop below.
    REG_MTB_MASTER = 0x00000000 + 6;
#endif
ruby lake
#

@meager fog EAgle 7.3 complained about something but the brd/sch loaded ok

ruby atlas
#

@onyx hinge likely the case. that's where i've been focussing on the code.

#

@slender iron doesn't look like there's an easy way in the code to make it either πŸ˜ƒ

#

ooh, gdbgui

ruby atlas
#

ugh, my index = 0x2 rather than a legit pointer just before the crash.

tulip sleet
#

@slender iron I was reading through the SAMD21 errata, and found this, which is still true on the latest chip rev (D). Not sure if you are using the event system for TC's in this way.

ruby lake
#

hm, will have to try one of these M5stack things

slender iron
#

@onyx hinge you want to break after it turns it off. Otherwise it fills with jumps from the infinite loop

#

@tulip sleet yup, I use the TC events to clock audio out

#
  • to the dac
drowsy snow
#

Any idea when the Feather M4 Express will be available?

marble hornet
#

does anyone know what kind of inductor is used on m4 boards? it looks like a capacitor but the schematic says there is a inductor there. thanks for all the help either way.

stuck elbow
#

it's just a coil

#

10Β΅H if I remember correctly

#

any 10Β΅H inductor should be fine

#

also, if I remember correctly, it's not currenly enabled by the firmware

#

so it's not used, you can skip it

manic glacierBOT
#

Hi,

I finally received my J-link and programmed three different NRF52 boards, but on the one I want to use it most (Ruuvi tag), I am not sure how to load the code. It does not have a serial connection that is enabled(and I have no idea how to get it running), nor a USB port. The WebREPL via webBluetooth is working, but none of the REPL file transfer programs (or Ampy) supports that. I do have a Bluefruit LE Friend (UART) but for that I first need the NRF52 to connect etc.

Is it possible...

manic glacierBOT
idle owl
#

rotaryio time!

manic glacierBOT
#

It's been awhile since I played with this, but there is an example here:
https://github.com/adafruit/circuitpython/tree/master/ports/nrf/freeze
This is compiled into your build. I think any .py file in the "freeze" folder will also get compiled in. You can then invoke it from the REPL. I don't recall if it gets stored as "freeze/test" or as test.
If you look at '''
help('modules') '''
should should see it. I'll try to provide an example tonight or tomorrow if you have not gotten it wor...

lone sandalBOT
idle owl
#

@tulip sleet I thought rotaryio was built in?

onyx hinge
#

@slender iron just curious if you found the time to try rosie

idle owl
#

Is it only in master and not the current beta.0 release?

prime flower
#

@tulip sleet just tested the CPX code I was messing with last night for dano, works on latest seesaw firmware build so that's good

#

also wow. the seesaw takes up some srs space on the cpx when you start adding in cpx specific things on top of it like neopixels, audioio, etc.

idle owl
#

@prime flower All of that is beefy. We've been trimming from everywhere to get any of it to fit into the builds in the first place.

#

Ok I just built from master and it still says ImportError: no module named 'rotaryio'

#

Still says I'm running 3.0.0-beta.0 though...

#

Not sure if that should be different.

#

🀦

#

Somehow it copied the firmware.uf2 to CIRCUITPY. That does not install it.

idle owl
#

@tulip sleet When you're around, I need some help with HID multimedia.

tulip sleet
#

just got back from the Y, go ahead

idle owl
#

I don't understand it. The only example is in the doc string and it doesn't work as is. I would like to control volume.

tulip sleet
#

rotaryio is only in Express builds right now

idle owl
#

This is an Itsy

#

it wasn't in the beta0 release.

#

I built a new build for it and it works.

tulip sleet
#

ah ok, good. lemme look at the docstring

#

hmm, it's not in rtd, I'll look at teh source

idle owl
#

I can't find it now in the code

#

I found it in the PR.

#

which is the only way I found this at all.

#

It's not documented anywhere.

tulip sleet
#
    from adafruit_hid.consumer_control import ConsumerControl
    from adafruit_hid.consumer_control_code import ConsumerControlCode

    cc = ConsumerControl()

    # Raise volume.
    cc.send(ConsumerControlCode.VOLUME_INCREMENT)

    # Pause or resume playback.
    cc.send(ConsumerControlCode.PLAY_PAUSE)

from the README

idle owl
#

Ok the version I found was wrong then

#

that's different than what I have pasted

#

let me try the change

#

There it is!

tulip sleet
#

yeah, you don't talk to Keyboard at all - it's a different device

#

but I don't understand why rtd is out of date

idle owl
#

The initial version had cc.send(ConsumerCode.VOLUME_INCREMENT)

#

Which failed

tulip sleet
#

that was a typo that somebody pointed out that I fixed a while ago, so there's some version skew going on here

idle owl
#

Ok, I couldn't find anything else about it so I was going with what I found

#

Works now.

#

I now have a rotary encoder volume knob that plays/pauses on press.

tulip sleet
idle owl
#

@tulip sleet You added the ones that make the most sense anyway

tulip sleet
#

@idle owl ok, I forgot to add the new files to api.rst in HID, so they weren't included. So I'll fix that. I thought they were included automatically - I forgot I had to do that.

idle owl
#

@tulip sleet Ah ok

idle owl
#

@tulip sleet In all the CP build stuff, other than the board name in /ports/atmel-samd/boards, ItsyBitsy is two words, Itsy Bitsy. Should we fix that?

#

Adafruit Itsy Bitsy M0 Express with samd21g18

#

It's that way in the REPL too.

tulip sleet
idle owl
#

Looks like one word to me.

#

There's no space there.... It's an Adafruit ItsyBitsy M0 Express!

#

We could ask. πŸ˜„

tulip sleet
#

who you gonna trust, me or your lying eyes πŸ˜ƒ Seriously, it's kinda inconsistent. From Learn:

idle owl
#

Hah!

tulip sleet
#

but the text says "ItsyBitsy" a lot

#

so yeah, we could change it. Maybe ask Limor in that other chat place

idle owl
#

Will do.

tidal kiln
#

no space on silk

stuck elbow
#

you have to pick the names carefully, if you name the smallest board "Gabelstaplerfahrer" it might not fit...

idle owl
#

I bet Phil B makes it fit. Somehow.

#

Silk screen wizard.

stuck elbow
#

Chinese characters might be easier

slender iron
#

I always omit the space.

#

@idle owl it wasn't checked in for beta.0. Its another reason we should release Beta.1

idle owl
#

@slender iron This guide can't be published until it is. I'm going to write it as though the latest release includes it. I'm thinking it'll take longer for the guide than the Beta.1 release.

slender iron
#

@idle owl makes sense. I'm hoping it'll be today or tomorrow. I just need to go heads down and work through this code size exploration πŸ˜ƒ

idle owl
#

@slender iron Like I said, I'm sure the guide will take longer. No pressure from me.

slender iron
#

you never know πŸ˜ƒ

idle owl
#

Ok that's fair.

#

Either way I'll have things to move onto if I finish it before beta.1 is released. So it's all good.

slender iron
#

totally!

manic glacierBOT
idle owl
#

@tulip sleet One word.

tulip sleet
#

k - I can fix that in a future PR for adafruit/circuitpython or you can now if you want.

idle owl
#

I can try. I have no idea where it is.

#

In the boards/itsybitsy_m0_express directory somewhere is my guess.

tulip sleet
#

ports/atmel-samd/boards/itsybitsy_m{0,4}_express/mpconfigboard.{mk,h}

idle owl
#

ooh I was right

tulip sleet
#

there's an itsy m4 dir as well. there are strings in both files

idle owl
#

Ok

tulip sleet
#
grep Itsy */*
itsybitsy_m0_express/mpconfigboard.h:#define MICROPY_HW_BOARD_NAME "Adafruit Itsy Bitsy M0 Express"
itsybitsy_m0_express/mpconfigboard.mk:USB_PRODUCT = "Itsy Bitsy M0 Express"
itsybitsy_m4_express/mpconfigboard.h:#define MICROPY_HW_BOARD_NAME "ItsyBitsy M4 Express"
itsybitsy_m4_express/mpconfigboard.mk:USB_PRODUCT = "ItsyBitsy M4 Express"
idle owl
#

M4 is correct

#

@tulip sleet Do we want Adafruit on the front of them for consistency? As long as I'm in here.

#

I assume the .h file string is what shows up in the REPL and maybe boot_out.txt

tulip sleet
#

@idle owl Yes, that's right. You can check all the boards. I think they should say "Adafruit"

idle owl
#

Ok. That's what I thought.

#

M4 does not.

#

I'll add that too

manic glacierBOT
tulip sleet
#

@idle owl can you add "Adafruit" to the other boards that are missing it:

$ grep BOARD_NAME */mpconfigboard.h
...
***feather_m4_express/mpconfigboard.h:#define MICROPY_HW_BOARD_NAME "Feather M4 Express"
***itsybitsy_m4_express/mpconfigboard.h:#define MICROPY_HW_BOARD_NAME "ItsyBitsy M4 Express"
***metro_m4_express/mpconfigboard.h:#define MICROPY_HW_BOARD_NAME "Metro M4 Express"
...

Just push another commit - it will update automatically.

idle owl
#

Yes.

#

@tulip sleet Added.

tulip sleet
#

k thanks I'll wait for travis and then merge

idle owl
#

keen

reef seal
slender iron
#

@reef seal looks like you tagged 7149579 but the pr is for c24f56

reef seal
#

How do I change that?

#

I'm new at this submodule stuff

slender iron
#

in your repo change into the submodule directory and git pull

#

then change out and it should show in git status

reef seal
#

Got it, done

slender iron
#

πŸ‘

#

will merge once travis gives the thumbs up

reef seal
slender iron
#

I don't think so. adabot should update automatically

#

but keep an eye on it to make sure

reef seal
#

Cool πŸ‘πŸΌ

slender iron
#

πŸ˜ƒ thanks!

manic glacierBOT
manic glacierBOT
#

better example- I copied thhese files to the freeze folder"

erryneedell@Ubuntu-Macmini:~/projects/adafruit_github/circuitpython_master/ports/nrf$ cat freeze/blinky.py 
import board
import digitalio
import time

led = digitalio.DigitalInOut(board.LED2)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)
jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/circuitpython_maste...
manic glacierBOT
#

We've added travisci to the Learn guide repo which changed the workflow needed to submit code to the repo. I am going to build on the current GitHub/git guide to outline an example workflow for CircuitPython and Learn.

I think this may work better as a standalone guide that lists the current guide as required reading, and then links to it when needed instead of explaining the concepts. The workflow I'm going to include should be included in full which means some duplication of the info in ...

idle owl
#

Is the rotary encoder we sell mechanical?

slender iron
#

yes

tulip sleet
#

@slender iron are you available for a video chat about the PDMIn problem?

slender iron
#

sure

idle owl
#

@tulip sleet Can I sit in?

#

I need to brain something else.

tulip sleet
#

sure

stuck elbow
#

how many pwm channels can I have on the samd21?

#

with CP

#

I guess I have to try and see

stuck elbow
#

hmm, test inconclusive

turbid radish
stuck elbow
#

looks like I can only have 3

#

then I get RuntimeError: All timers in use

idle owl
#

Hmm. I feel like that was discussed in a guide somewhere. But it's fuzzy.

stuck elbow
#

in any case, I doubt I can get 12

slender iron
#

@stuck elbow for what? all of the same base frequency?

onyx hinge
#

@stuck elbow did you get geektrapped by the "top octave oscillator" problem, or is it just coincidence that you're looking for 12 independent timers?

stuck elbow
#

@slender iron all 50Hz, for servos

onyx hinge
#

ah nevermind then

stuck elbow
#

@onyx hinge nope, I want to get back to making robots

manic glacierBOT
slender iron
#

@stuck elbow you should be able to do more with TCC sharing

stuck elbow
#

how do I do that?

idle owl
#

@tulip sleet I was wondering about that, seemed like it took forever for travis to run.

tulip sleet
#

it's been terrible. There was another PR that I hard to restart three jobs on.

slender iron
#

@stuck elbow it should do it automatically. what code and board are you using?

stuck elbow
#

I tested with Fether M0 Express, with this code:

import board, pulseio
pins = [board.D1, board.D5, board.D6, board.D9, board.D10, board.D11, board.D12, board.D13, board.SDA, board.SCL, board.RX, board.TX, board.D0, board.MOSI, board.MISO, board.SCK]
pwms = []
for pin in pins:
    print(pin)
    pwms.append(pulseio.PWMOut(pin, frequency=50))

and it errors out after 3rd pin

#
board.D1
board.D5
board.D6
Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
RuntimeError: All timers in use
#

so only creates 2 pwms

slender iron
#

hrm, I think thats a bug

tulip sleet
#

@stuck elbow could also be influenced by the order of the pins, since you can't map all tc's to all pins

slender iron
#

I checked the multiplexing of the first four pins and it seems ok