Can micropython write to GPIO port in parallel as a group ?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
picopie
Posts: 1
Joined: Sat Aug 04, 2018 9:13 pm

Can micropython write to GPIO port in parallel as a group ?

Post by picopie » Sat Aug 04, 2018 9:19 pm

Hello,
I had been using class Pin to write to pyboard GPIO but I was wondering if I can write to a GPIO port in parallel so all pins in a port will transition at once. I searched documentation but could not find a reference. Also, is there facility like "bus out" object in mbed that you can use as direct in/out variable ?
Eg: busout data = 0x12, will write 8 bits to bus.
int check = (data == 0x0F) will check lower 4 bit nibble.

Thanks !

User avatar
dhylands
Posts: 2848
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Can micropython write to GPIO port in parallel as a group ?

Post by dhylands » Sun Aug 05, 2018 1:11 am

There isn't a direct API to do this, but you can write directly to the stm registers by using the stm module.
Here's an example from the documentation: http://docs.micropython.org/en/latest/p ... e-directly

There is also a forum post here: viewtopic.php?f=2&t=134&p=498 This uses the BSRR registers which is a slightly different way of setting. The forum post explains the difference between the 2 methods.

Post Reply