from machine import Timer
import TMC2130

FREQUENCY = 100 #kHz

counter = 0
sTim = Timer()

def sTim_callback(t):
    global counter
    counter += 1
    TMC2130.timer_callback(counter)
    
def sTimer_Start():
    sTim.init(freq=FREQUENCY*1000, mode=Timer.PERIODIC, callback=sTim_callback)
    
def sTimer_Stop():
    sTim.deinit()