@micropython.viper
def shiftOut(data: int):
GPIO_OUT = ptr32(0x60000300)
GPIO_OUT[2] = 0x10
for i in range(8):
value = data & 1<<i
reg = 2-(value >>i)
GPIO_OUT[reg] = 0x8000
GPIO_OUT[1] = 0x20
GPIO_OUT[2] = 0x20
instead of
def shiftOut(byte):
latch.off()
for i in range(8):
value = byte & 1<<i
data.value(value)
clock.on()
clock.off()
Is it going to be faster? IDK, I
asked about it on MicroPython forums to figure out - and also to make sure there are more Google-able examples of toggling GPIOs from Viper code. New example is here:
https://github.com/CRImier/IMTAIDKW/blob/master/software/test_viper.py
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.