<s> import pyb <EOL> import stm <EOL> out_idx = <NUM_LIT:0> <EOL> out_seq = [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:2> ] <EOL> pin_a2 = pyb . Pin ( '<STR_LIT>' , pyb . Pin . OUT_PP ) <EOL> pin_b2 = pyb . Pin ( '<STR_LIT>' , pyb . Pin . OUT_PP ) <EOL> def set_out ( ) : <EOL> print ( "<STR_LIT>" . format ( ( out_seq [ out_idx ] & <NUM_LIT> ) != <NUM_LIT:0> , ( out_seq [ out_idx ] & <NUM_LIT> ) != <NUM_LIT:0> ) ) <EOL> pin_a2 . value ( ( out_seq [ out_idx ] & <NUM_LIT> ) != <NUM_LIT:0> ) <EOL> pin_b2 . value ( ( out_seq [ out_idx ] & <NUM_LIT> ) != <NUM_LIT:0> ) <EOL> def incr ( ) : <EOL> global out_idx <EOL> out_idx = ( out_idx + <NUM_LIT:1> ) % <NUM_LIT:4> <EOL> set_out ( ) <EOL> def decr ( ) : <EOL> global out_idx <EOL> out_idx = ( out_idx - <NUM_LIT:1> ) % <NUM_LIT:4> <EOL> set_out ( ) <EOL> set_out ( ) <EOL> pin_a = pyb . Pin ( '<STR_LIT>' , pyb . Pin . AF_PP , pull = pyb . Pin . PULL_NONE , af = pyb . Pin . AF1_TIM2 ) <EOL> pin_b = pyb . Pin ( '<STR_LIT>' , pyb . Pin . AF_PP , pull = pyb . Pin . PULL_NONE , af = pyb . Pin . AF1_TIM2 ) <EOL> enc_timer = pyb . Timer ( <NUM_LIT:2> , prescaler = <NUM_LIT:1> , period = <NUM_LIT> ) <EOL> enc_channel = enc_timer . channel ( <NUM_LIT:1> , pyb . Timer . ENC_AB ) <EOL> for i in range ( <NUM_LIT:12> ) : <EOL> print ( "<STR_LIT>" , enc_timer . counter ( ) ) ; <EOL> incr ( ) <EOL> for i in range ( <NUM_LIT> ) : <EOL> print ( "<STR_LIT>" , enc_timer . counter ( ) ) ; <EOL> decr ( ) <EOL> for i in range ( <NUM_LIT:12> ) : <EOL> print ( "<STR_LIT>" , enc_timer . counter ( ) ) ; <EOL> incr ( ) <EOL> print ( "<STR_LIT>" , enc_timer . counter ( ) ) ; </s>
