WildernessLabs / Meadow_Issues

Public repo for bugs and issues with Meadow
15 stars 0 forks source link

Disconnecting interrupts results in an ioctl failure #310

Closed ctacke closed 1 year ago

ctacke commented 1 year ago

Meadow OS 1.0.0

When an InterruptPort is disposed in managed code, Core attempts to disconnect the interrupt handler. This calls an ioctl to configure the interrupt as disabled (enable == 0) and with no edges. The fact we have 0 for rising and falling leads the ioctl to return EINVAL at this line:

https://github.com/WildernessLabs/Meadow/blob/b89f5b41846239c9112d3b9c4cfefae1d6c81b31/nuttx/configs/stm32f777zit6-meadow/src/meadow_interrupt.c#L917

This check should probably only look at the edge configuration if we're enabling the interrupts.

Peter-Moody commented 1 year ago

Thanks Chris for digging into this. Simple fix. if(cfg->risingEdge == 0 && cfg->fallingEdge == 0) became if(cfg->enable && cfg->risingEdge == 0 && cfg->fallingEdge == 0)