Update pyb.Switch() to support multiple buttons?

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
User avatar
mcauser
Posts: 404
Joined: Mon Jun 15, 2015 8:03 am

Update pyb.Switch() to support multiple buttons?

Post by mcauser » Thu Oct 10, 2019 2:22 am

On boards such as the MCUDev Black STM32F407VET6, there are 2x user buttons.

In the board definition I've defined KEY0 as the main switch.

Is it worth updating pyb.Switch() to support multiple switches? eg.
pyb.Switch() == KEY0
pyb.Switch(1) == KEY0
pyb.Switch(2) == KEY1

Or is pyb.Switch deprecated in favour of just using machine.Pin and pin.irq()?

shaoziyang
Posts: 275
Joined: Sun Apr 17, 2016 1:55 pm

Re: Update pyb.Switch() to support multiple buttons?

Post by shaoziyang » Thu Oct 10, 2019 4:46 am

That's a good idea.

Post Reply