# Interpolate
from time import sleep
INTERP0_ACCUM0 = const(0x080)
INTERP0_ACCUM1 = const(0x084)
INTERP0_BASE0 = const(0x088)
INTERP0_BASE1 = const(0x08c)
INTERP0_BASE2 = const(0x090)
INTERP0_POP_LANE0 = const(0x094)
INTERP0_POP_LANE1 = const(0x098)
INTERP0_POP_FULL = const(0x09c)
INTERP0_CTRL_LANE0 = const(0x0ac)
INTERP0_CTRL_LANE1 = const(0x0b0)
INTERP0_ACCUM1_ADD = const(0x0b8)
@micropython.viper
def interpolate():
source=ptr16(display_buffer)
dest=ptr16(screen)
sio=ptr32(0xd000_0000)
sio[INTERP0_CTRL_LANE0//4] = 16 | 0<<16 | 1<<18 | 16<<10 | 0<<5
sio[INTERP0_CTRL_LANE1//4] = 16 | 0<<16 | 1<<18 | 16<<10 | 0<<5
sio[INTERP0_ACCUM0//4] = 0
sio[INTERP0_ACCUM1//4] = 0 # start offset
sio[INTERP0_BASE0//4] = (1<<16)*0 # x step
sio[INTERP0_BASE1//4] = (1<<16)*160//2# y-step
sio[INTERP0_BASE2//4] = 0 #
for y in range(20):
print(sio[INTERP0_POP_FULL//4],' ',end='')
sleep(0.001)
print()
display_buffer=bytearray(100)
screen = bytearray(100)
interpolate()
print('.')