quadrature encoder: reduce PIO code size from 29 to 24 (#390)
Co-authored-by: Paulo Marques <pm@quant-insight.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2021 pmarques-dev @ github
|
||||
* Copyright (c) 2021-2023 pmarques-dev @ github
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
@@ -44,8 +44,10 @@ int main() {
|
||||
PIO pio = pio0;
|
||||
const uint sm = 0;
|
||||
|
||||
uint offset = pio_add_program(pio, &quadrature_encoder_program);
|
||||
quadrature_encoder_program_init(pio, sm, offset, PIN_AB, 0);
|
||||
// we don't really need to keep the offset, as this program must be loaded
|
||||
// at offset 0
|
||||
pio_add_program(pio, &quadrature_encoder_program);
|
||||
quadrature_encoder_program_init(pio, sm, PIN_AB, 0);
|
||||
|
||||
while (1) {
|
||||
// note: thanks to two's complement arithmetic delta will always
|
||||
|
||||
Reference in New Issue
Block a user