raspberrypi: Fix state machine allocation
.. for duplicate programs, like two IncrementalEncoder instances. Closes: #10024
This commit is contained in:
parent
fe23bd7cf8
commit
455d856bcb
1 changed files with 6 additions and 4 deletions
|
|
@ -247,10 +247,12 @@ static bool use_existing_program(PIO *pio_out, uint *sm_out, int *offset_inout,
|
|||
if (_current_program_id[i][j] == program_id &&
|
||||
_current_program_len[i][j] == program_len &&
|
||||
(*offset_inout == -1 || *offset_inout == _current_program_offset[i][j])) {
|
||||
*pio_out = pio;
|
||||
*sm_out = j;
|
||||
*offset_inout = _current_program_offset[i][j];
|
||||
return true;
|
||||
*sm_out = pio_claim_unused_sm(pio, false);
|
||||
if (*sm_out >= 0) {
|
||||
*pio_out = pio;
|
||||
*offset_inout = _current_program_offset[i][j];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue