|
109 | 109 | //| :param int sideset_pin_count: the count of consecutive pins to use with a side set starting at first_sideset_pin |
110 | 110 | //| :param int initial_sideset_pin_state: the initial output value for sideset pins starting at first_sideset_pin |
111 | 111 | //| :param int initial_sideset_pin_direction: the initial output direction for sideset pins starting at first_sideset_pin |
| 112 | +//| :param ~microcontroller.Pin jmp_pin: the pin which determines the branch taken by JMP PIN instructions |
112 | 113 | //| :param bool exclusive_pin_use: When True, do not share any pins with other state machines. Pins are never shared with other peripherals |
113 | 114 | //| :param bool auto_pull: When True, automatically load data from the tx FIFO into the |
114 | 115 | //| output shift register (OSR) when an OUT instruction shifts more than pull_threshold bits |
@@ -138,6 +139,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n |
138 | 139 | ARG_pull_in_pin_up, ARG_pull_in_pin_down, |
139 | 140 | ARG_first_set_pin, ARG_set_pin_count, ARG_initial_set_pin_state, ARG_initial_set_pin_direction, |
140 | 141 | ARG_first_sideset_pin, ARG_sideset_pin_count, ARG_initial_sideset_pin_state, ARG_initial_sideset_pin_direction, |
| 142 | + ARG_jmp_pin, |
141 | 143 | ARG_exclusive_pin_use, |
142 | 144 | ARG_auto_pull, ARG_pull_threshold, ARG_out_shift_right, |
143 | 145 | ARG_wait_for_txstall, |
@@ -167,6 +169,8 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n |
167 | 169 | { MP_QSTR_initial_sideset_pin_state, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, |
168 | 170 | { MP_QSTR_initial_sideset_pin_direction, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0x1f} }, |
169 | 171 |
|
| 172 | + { MP_QSTR_jmp_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, |
| 173 | + |
170 | 174 | { MP_QSTR_exclusive_pin_use, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, |
171 | 175 | { MP_QSTR_auto_pull, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, |
172 | 176 | { MP_QSTR_pull_threshold, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 32} }, |
@@ -210,6 +214,8 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n |
210 | 214 | mp_raise_ValueError(translate("Side set pin count must be between 1 and 5")); |
211 | 215 | } |
212 | 216 |
|
| 217 | + const mcu_pin_obj_t *jmp_pin = validate_obj_is_pin_or_none(args[ARG_jmp_pin].u_obj); |
| 218 | + |
213 | 219 | mp_int_t pull_threshold = args[ARG_pull_threshold].u_int; |
214 | 220 | mp_int_t push_threshold = args[ARG_push_threshold].u_int; |
215 | 221 | if (pull_threshold < 1 || pull_threshold > 32) { |
@@ -241,6 +247,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n |
241 | 247 | 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, |
242 | 248 | 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, |
243 | 249 | 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, |
| 250 | + jmp_pin, |
244 | 251 | 0, |
245 | 252 | args[ARG_exclusive_pin_use].u_bool, |
246 | 253 | args[ARG_auto_pull].u_bool, pull_threshold, args[ARG_out_shift_right].u_bool, |
|
0 commit comments