Pin in select case hidden by too short pulse? Is one solution a buffered port?
Posted: Mon Mar 19, 2018 11:44 am
I have a case like this, in a select. I wait for a pin change on a 1-bit port called p_spi_irq:
However, it was never taken. I think the reason was that all pin changes happened while the task was not in the select.
When I moved this to a separate task which listened for that pin (same code) then it it was picked up. It then signalled on a channel that then replaced the code line above. It was of course also only taken when the code evaluated the select.
Could I have used a buffered input port for this and kept the original code (and saved a thread and a two chanends)? I can't find the exact code pattern in 6.9 Using a buffered port in XMOS-Programming-Guide-_documentation_F. If yes, how would the code be?-)
Code: Select all
case p_spi_irq when pinsneq(spi_irq_current_val) :> spi_irq_current_val:
When I moved this to a separate task which listened for that pin (same code) then it it was picked up. It then signalled on a channel that then replaced the code line above. It was of course also only taken when the code evaluated the select.
Could I have used a buffered input port for this and kept the original code (and saved a thread and a two chanends)? I can't find the exact code pattern in 6.9 Using a buffered port in XMOS-Programming-Guide-_documentation_F. If yes, how would the code be?-)