Skip to content

Commit f6fe844

Browse files
committed
Merge remote-tracking branch 'origin/main' into main
2 parents 183fbbf + 775f1b9 commit f6fe844

File tree

16 files changed

+422
-11
lines changed

16 files changed

+422
-11
lines changed

locale/circuitpython.pot

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,10 +1042,6 @@ msgstr ""
10421042
msgid "Group already used"
10431043
msgstr ""
10441044

1045-
#: shared-module/displayio/Group.c
1046-
msgid "Group full"
1047-
msgstr ""
1048-
10491045
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c
10501046
#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c
10511047
#: ports/stm/common-hal/sdioio/SDCard.c
@@ -1787,6 +1783,10 @@ msgid ""
17871783
"constructor"
17881784
msgstr ""
17891785

1786+
#: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c
1787+
msgid "Pins must be sequential"
1788+
msgstr ""
1789+
17901790
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
17911791
msgid "Pins must share PWM slice"
17921792
msgstr ""
@@ -3743,6 +3743,10 @@ msgstr ""
37433743
msgid "pressing both buttons at start up.\n"
37443744
msgstr ""
37453745

3746+
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
3747+
msgid "pull masks conflict with direction masks"
3748+
msgstr ""
3749+
37463750
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
37473751
msgid "pull_threshold must be between 1 and 32"
37483752
msgstr ""

ports/raspberrypi/bindings/rp2pio/StateMachine.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
//| initial_out_pin_direction: int = 0xffffffff,
7070
//| first_in_pin: Optional[microcontroller.Pin] = None,
7171
//| in_pin_count: int = 1,
72+
//| pull_in_pin_up: int = 0,
73+
//| pull_in_pin_down: int = 0,
7274
//| first_set_pin: Optional[microcontroller.Pin] = None,
7375
//| set_pin_count: int = 1,
7476
//| initial_set_pin_state: int = 0,
@@ -99,6 +101,8 @@
99101
//| :param int initial_out_pin_direction: the initial output direction for out pins starting at first_out_pin
100102
//| :param ~microcontroller.Pin first_in_pin: the first pin to use with the IN instruction
101103
//| :param int in_pin_count: the count of consecutive pins to use with IN starting at first_in_pin
104+
//| :param int pull_in_pin_up: a 1-bit in this mask sets pull up on the corresponding in pin
105+
//| :param int pull_in_pin_down: a 1-bit in this mask sets pull up on the corresponding in pin. Setting both pulls enables a "bus keep" function, i.e. a weak pull to whatever is current high/low state of GPIO.
102106
//| :param ~microcontroller.Pin first_set_pin: the first pin to use with the SET instruction
103107
//| :param int set_pin_count: the count of consecutive pins to use with SET starting at first_set_pin
104108
//| :param int initial_set_pin_state: the initial output value for set pins starting at first_set_pin
@@ -133,6 +137,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n
133137
enum { ARG_program, ARG_frequency, ARG_init,
134138
ARG_first_out_pin, ARG_out_pin_count, ARG_initial_out_pin_state, ARG_initial_out_pin_direction,
135139
ARG_first_in_pin, ARG_in_pin_count,
140+
ARG_pull_in_pin_up, ARG_pull_in_pin_down,
136141
ARG_first_set_pin, ARG_set_pin_count, ARG_initial_set_pin_state, ARG_initial_set_pin_direction,
137142
ARG_first_sideset_pin, ARG_sideset_pin_count, ARG_initial_sideset_pin_state, ARG_initial_sideset_pin_direction,
138143
ARG_exclusive_pin_use,
@@ -151,6 +156,8 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n
151156

152157
{ MP_QSTR_first_in_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
153158
{ MP_QSTR_in_pin_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
159+
{ MP_QSTR_pull_in_pin_up, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
160+
{ MP_QSTR_pull_in_pin_down, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
154161

155162
{ MP_QSTR_first_set_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
156163
{ MP_QSTR_set_pin_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
@@ -233,7 +240,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n
233240
args[ARG_frequency].u_int,
234241
init_bufinfo.buf, init_bufinfo.len / 2,
235242
first_out_pin, args[ARG_out_pin_count].u_int, args[ARG_initial_out_pin_state].u_int, args[ARG_initial_out_pin_direction].u_int,
236-
first_in_pin, args[ARG_in_pin_count].u_int,
243+
first_in_pin, args[ARG_in_pin_count].u_int, args[ARG_pull_in_pin_up].u_int, args[ARG_pull_in_pin_down].u_int,
237244
first_set_pin, args[ARG_set_pin_count].u_int, args[ARG_initial_set_pin_state].u_int, args[ARG_initial_set_pin_direction].u_int,
238245
first_sideset_pin, args[ARG_sideset_pin_count].u_int, args[ARG_initial_sideset_pin_state].u_int, args[ARG_initial_sideset_pin_direction].u_int,
239246
args[ARG_exclusive_pin_use].u_bool,
@@ -548,6 +555,24 @@ const mp_obj_property_t rp2pio_statemachine_rxstall_obj = {
548555
(mp_obj_t)&mp_const_none_obj},
549556
};
550557

558+
//| in_waiting: int
559+
//| """The number of words available to readinto"""
560+
//|
561+
562+
STATIC mp_obj_t rp2pio_statemachine_obj_get_in_waiting(mp_obj_t self_in) {
563+
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in);
564+
check_for_deinit(self);
565+
return MP_OBJ_NEW_SMALL_INT(common_hal_rp2pio_statemachine_get_in_waiting(self));
566+
}
567+
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_get_in_waiting_obj, rp2pio_statemachine_obj_get_in_waiting);
568+
569+
const mp_obj_property_t rp2pio_statemachine_in_waiting_obj = {
570+
.base.type = &mp_type_property,
571+
.proxy = {(mp_obj_t)&rp2pio_statemachine_get_in_waiting_obj,
572+
(mp_obj_t)&mp_const_none_obj,
573+
(mp_obj_t)&mp_const_none_obj},
574+
};
575+
551576
STATIC const mp_rom_map_elem_t rp2pio_statemachine_locals_dict_table[] = {
552577
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&rp2pio_statemachine_deinit_obj) },
553578
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
@@ -563,7 +588,8 @@ STATIC const mp_rom_map_elem_t rp2pio_statemachine_locals_dict_table[] = {
563588
{ MP_ROM_QSTR(MP_QSTR_write_readinto), MP_ROM_PTR(&rp2pio_statemachine_write_readinto_obj) },
564589

565590
{ MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&rp2pio_statemachine_frequency_obj) },
566-
{ MP_ROM_QSTR(MP_QSTR_rxstall), MP_ROM_PTR(&rp2pio_statemachine_rxstall_obj) }
591+
{ MP_ROM_QSTR(MP_QSTR_rxstall), MP_ROM_PTR(&rp2pio_statemachine_rxstall_obj) },
592+
{ MP_ROM_QSTR(MP_QSTR_in_waiting), MP_ROM_PTR(&rp2pio_statemachine_in_waiting_obj) },
567593
};
568594
STATIC MP_DEFINE_CONST_DICT(rp2pio_statemachine_locals_dict, rp2pio_statemachine_locals_dict_table);
569595

ports/raspberrypi/bindings/rp2pio/StateMachine.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self,
4141
size_t frequency,
4242
const uint16_t* init, size_t init_len,
4343
const mcu_pin_obj_t * first_out_pin, uint8_t out_pin_count, uint32_t initial_out_pin_state, uint32_t initial_out_pin_direction,
44-
const mcu_pin_obj_t * first_in_pin, uint8_t in_pin_count,
44+
const mcu_pin_obj_t * first_in_pin, uint8_t in_pin_count, uint32_t pull_pin_up, uint32_t pull_pin_down,
4545
const mcu_pin_obj_t * first_set_pin, uint8_t set_pin_count, uint32_t initial_set_pin_state, uint32_t initial_set_pin_direction,
4646
const mcu_pin_obj_t * first_sideset_pin, uint8_t sideset_pin_count, uint32_t initial_sideset_pin_state, uint32_t initial_sideset_pin_direction,
4747
bool exclusive_pin_use,
@@ -69,5 +69,8 @@ void common_hal_rp2pio_statemachine_set_frequency(rp2pio_statemachine_obj_t* sel
6969

7070
bool common_hal_rp2pio_statemachine_get_rxstall(rp2pio_statemachine_obj_t* self);
7171
void common_hal_rp2pio_statemachine_clear_rxfifo(rp2pio_statemachine_obj_t *self);
72+
size_t common_hal_rp2pio_statemachine_get_in_waiting(rp2pio_statemachine_obj_t *self);
73+
74+
void common_hal_rp2pio_statemachine_set_interrupt_handler(rp2pio_statemachine_obj_t *self, void(*handler)(void*), void *arg, int mask);
7275

7376
#endif // MICROPY_INCLUDED_RASPBERRYPI_BINDINGS_RP2PIO_STATEMACHINE_H

ports/raspberrypi/bindings/rp2pio/__init__.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,28 @@
2828
#include "py/runtime.h"
2929

3030
#include "bindings/rp2pio/StateMachine.h"
31+
#include "bindings/rp2pio/__init__.h"
3132

3233
//| """Hardware interface to RP2 series' programmable IO (PIO) peripheral."""
3334
//|
3435

36+
//| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool:
37+
//| """Return True if the pins have sequential GPIO numbers, False otherwise"""
38+
//| ...
39+
//|
40+
STATIC mp_obj_t rp2pio_pins_are_sequential(const mp_obj_t pins) {
41+
size_t len;
42+
mp_obj_t *items;
43+
mp_obj_get_array(pins, &len, &items);
44+
return mp_obj_new_bool(common_hal_rp2pio_pins_are_sequential(len, items));
45+
}
46+
47+
STATIC MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_pins_are_sequential_obj, rp2pio_pins_are_sequential);
48+
3549
STATIC const mp_rom_map_elem_t rp2pio_module_globals_table[] = {
3650
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_rp2pio) },
3751
{ MP_ROM_QSTR(MP_QSTR_StateMachine), MP_ROM_PTR(&rp2pio_statemachine_type) },
52+
{ MP_ROM_QSTR(MP_QSTR_pins_are_sequential), MP_ROM_PTR(&rp2pio_pins_are_sequential_obj) },
3853
};
3954

4055
STATIC MP_DEFINE_CONST_DICT(rp2pio_module_globals, rp2pio_module_globals_table);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2021 Jeff Epler for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#pragma once
28+
29+
bool common_hal_rp2pio_pins_are_sequential(size_t len, mp_obj_t *items);

ports/raspberrypi/common-hal/audiobusio/I2SOut.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
122122
NULL, 0,
123123
data, 1, 0, 0xffffffff, // out pin
124124
NULL, 0, // in pins
125+
0, 0, // in pulls
125126
NULL, 0, 0, 0x1f, // set pins
126127
bit_clock, 2, 0, 0x1f, // sideset pins
127128
true, // exclusive pin use

ports/raspberrypi/common-hal/audiobusio/PDMIn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
6868
NULL, 0,
6969
NULL, 1, 0, 0xffffffff, // out pin
7070
data_pin, 1, // in pins
71+
0, 0, // in pulls
7172
NULL, 0, 0, 0x1f, // set pins
7273
clock_pin, 1, 0, 0x1f, // sideset pins
7374
true, // exclusive pin use
@@ -92,6 +93,7 @@ void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) {
9293
if (common_hal_audiobusio_pdmin_deinited(self)) {
9394
return;
9495
}
96+
return common_hal_rp2pio_statemachine_deinit(&self->state_machine);
9597
}
9698

9799
uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t* self) {

ports/raspberrypi/common-hal/neopixel_write/__init__.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
6767
NULL, 0, // init program
6868
NULL, 1, // out
6969
NULL, 1, // in
70+
0, 0, // in pulls
7071
NULL, 1, // set
7172
digitalinout->pin, 1, // sideset
7273
0, pins_we_use, // initial pin state
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "py/runtime.h"
28+
29+
#include <hardware/regs/pio.h>
30+
#include "common-hal/rotaryio/IncrementalEncoder.h"
31+
#include "bindings/rp2pio/__init__.h"
32+
#include "bindings/rp2pio/StateMachine.h"
33+
34+
STATIC const uint16_t encoder[] = {
35+
// again:
36+
// in pins, 2
37+
0x4002,
38+
// mov x, isr
39+
0xa026,
40+
// jmp x!=y, push_data
41+
0x00a5,
42+
// mov isr, null
43+
0xa0c3,
44+
// jmp again
45+
0x0000,
46+
// push_data:
47+
// push
48+
0x8020,
49+
// mov y, x
50+
0xa041,
51+
};
52+
53+
STATIC const uint16_t encoder_init[] = {
54+
// set y, 31
55+
0xe05f,
56+
};
57+
58+
STATIC void incrementalencoder_interrupt_handler(void *self_in);
59+
60+
void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t* self,
61+
const mcu_pin_obj_t* pin_a, const mcu_pin_obj_t* pin_b) {
62+
mp_obj_t pins[] = {MP_OBJ_FROM_PTR(pin_a), MP_OBJ_FROM_PTR(pin_b)};
63+
if (!common_hal_rp2pio_pins_are_sequential(2, pins)) {
64+
mp_raise_RuntimeError(translate("Pins must be sequential"));
65+
}
66+
67+
self->position = 0;
68+
self->quarter_count = 0;
69+
70+
common_hal_rp2pio_statemachine_construct(&self->state_machine,
71+
encoder, MP_ARRAY_SIZE(encoder),
72+
1000000,
73+
encoder_init, MP_ARRAY_SIZE(encoder_init), // init
74+
NULL, 1, 0, 0xffffffff, // out pin
75+
pin_a, 2, // in pins
76+
3, 0, // in pulls
77+
NULL, 0, 0, 0x1f, // set pins
78+
NULL, 0, 0, 0x1f, // sideset pins
79+
true, // exclusive pin use
80+
false, 32, false, // out settings
81+
false, // Wait for txstall
82+
false, 32, false); // in settings
83+
84+
common_hal_rp2pio_statemachine_run(&self->state_machine, encoder_init, MP_ARRAY_SIZE(encoder_init));
85+
86+
// We're guaranteed by the init code that some output will be available promptly
87+
uint8_t state;
88+
common_hal_rp2pio_statemachine_readinto(&self->state_machine, &state, 1, 1);
89+
// Top two bits of self->last_state don't matter, because they'll be gone as soon as
90+
// interrupt handler is called.
91+
self->last_state = state & 3;
92+
93+
common_hal_rp2pio_statemachine_set_interrupt_handler(&self->state_machine, incrementalencoder_interrupt_handler, self, PIO_IRQ0_INTF_SM0_RXNEMPTY_BITS);
94+
}
95+
96+
bool common_hal_rotaryio_incrementalencoder_deinited(rotaryio_incrementalencoder_obj_t* self) {
97+
return common_hal_rp2pio_statemachine_deinited(&self->state_machine);
98+
}
99+
100+
void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_obj_t* self) {
101+
if (common_hal_rotaryio_incrementalencoder_deinited(self)) {
102+
return;
103+
}
104+
common_hal_rp2pio_statemachine_deinit(&self->state_machine);
105+
}
106+
107+
mp_int_t common_hal_rotaryio_incrementalencoder_get_position(rotaryio_incrementalencoder_obj_t* self) {
108+
return self->position;
109+
}
110+
111+
void common_hal_rotaryio_incrementalencoder_set_position(rotaryio_incrementalencoder_obj_t* self,
112+
mp_int_t new_position) {
113+
self->position = new_position;
114+
}
115+
116+
STATIC void incrementalencoder_interrupt_handler(void *self_in) {
117+
rotaryio_incrementalencoder_obj_t* self = self_in;
118+
// This table also works for detent both at 11 and 00
119+
// For 11 at detent:
120+
// Turning cw: 11->01->00->10->11
121+
// Turning ccw: 11->10->00->01->11
122+
// For 00 at detent:
123+
// Turning cw: 00->10->11->10->00
124+
// Turning ccw: 00->01->11->10->00
125+
126+
// index table by state <oldA><oldB><newA><newB>
127+
#define BAD 7
128+
static const int8_t transitions[16] = {
129+
0, // 00 -> 00 no movement
130+
-1, // 00 -> 01 3/4 ccw (11 detent) or 1/4 ccw (00 at detent)
131+
+1, // 00 -> 10 3/4 cw or 1/4 cw
132+
BAD, // 00 -> 11 non-Gray-code transition
133+
+1, // 01 -> 00 2/4 or 4/4 cw
134+
0, // 01 -> 01 no movement
135+
BAD, // 01 -> 10 non-Gray-code transition
136+
-1, // 01 -> 11 4/4 or 2/4 ccw
137+
-1, // 10 -> 00 2/4 or 4/4 ccw
138+
BAD, // 10 -> 01 non-Gray-code transition
139+
0, // 10 -> 10 no movement
140+
+1, // 10 -> 11 4/4 or 2/4 cw
141+
BAD, // 11 -> 00 non-Gray-code transition
142+
+1, // 11 -> 01 1/4 or 3/4 cw
143+
-1, // 11 -> 10 1/4 or 3/4 ccw
144+
0, // 11 -> 11 no movement
145+
};
146+
147+
while (common_hal_rp2pio_statemachine_get_in_waiting(&self->state_machine)) {
148+
// Bypass all the logic of StateMachine.c:_transfer, we need something
149+
// very simple and fast for an interrupt!
150+
uint8_t new = self->state_machine.pio->rxf[self->state_machine.state_machine];
151+
152+
// Shift the old AB bits to the "old" position, and set the new AB bits.
153+
self->last_state = (self->last_state & 0x3) << 2 | (new & 0x3);
154+
155+
int8_t quarter_incr = transitions[self->last_state];
156+
if (quarter_incr == BAD) {
157+
// Missed a transition. We don't know which way we're going, so do nothing.
158+
return;
159+
}
160+
161+
self->quarter_count += quarter_incr;
162+
if (self->quarter_count >= 4) {
163+
self->position += 1;
164+
self->quarter_count = 0;
165+
} else if (self->quarter_count <= -4) {
166+
self->position -= 1;
167+
self->quarter_count = 0;
168+
}
169+
}
170+
}

0 commit comments

Comments
 (0)