EVB on supports one GPIO Input, one GPIO Output and one GPIO Interrupt ... And names them sequentially: "/dev/gpio0", "/dev/gpio1", "/dev/gpio2" ... Which gets super confusing because "/dev/gpio0" doesn't map to BL602 GPIO Pin 0 🤔

github.com/lupyuen/bl602_expan

All 23 GPIOs are fully wired up on Stack ! 😲 Let's simplify and rename the GPIOs as "/dev/gpio0" to "/dev/gpio22" ... Easier for devs to create NuttX Drivers 👍

github.com/lupyuen/bl602_expan

Apache RTOS lets us create I/O Expander Drivers that will handle many GPIOs (Input / Output / Interrupt) ... Perfect for Stack !

github.com/lupyuen/bl602_expan

Handling GPIO Interrupts gets tricky on Stack ... All GPIO Interrupts are multiplexed into a single IRQ! Our GPIO Expander can help

github.com/lupyuen/bl602_expan

As noted (eloquently) by Robert Lipe, attaching a GPIO Interrupt Handler is hard (because our stars are misaligned) ... Let's fix this with our GPIO Expander for Apache RTOS

github.com/lupyuen/bl602_expan

Tracking all 23 GPIOs used by Stack can get challenging ... We might reuse GPIOs by mistake! 😱 Our GPIO Expander shall validate the GPIOs at startup

github.com/lupyuen/bl602_expan

Someday our GPIO Expander for shall validate that the SPI / I2C / UART Pin Functions are correctly assigned to the GPIO Pin Numbers ... So SPI MISO must be either GPIO 0, 4, 8, 12, 16 or 20

github.com/lupyuen/bl602_expan

@lupyuen

Can we static assert to avoid overheads in nuttx?
(Ie prevent builds with bad allocations)

@Ralim Hmmm maybe. But we still need a runtime check to be sure that the GPIOs are not reused

@lupyuen hmm true. I just like having configurations checked at compile time where possible to save iterations of testing :)

@lupyuen
Hmm…
If each pin can only be used once, could we flip the arrignment matrix and instead have it always have an entry for each pin, which is either a selected value or hi-z by default; then use kconfig rules to prevent collisions ?

(Not sure, haven't used this much tbqh)

@Ralim Hmmm major Kconfig Conflict between BL602 and ESP32 ... Wonder how the NuttX folks feel about this 🤔

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.