a native solution based on your C code would of course be the best solution, but would a micropython implementation be fast enough to get started?
I've been playing with jupyter notebook + micropython remote ( + vim-binding ) and have started converting your code.
This is way more advanced than the usual stuff I do with micropython but a good opportunity to learn.
I suppose I need to use machine.mem16() and machine.mem8() here, I could be wrong though! Also, I would love to use some kind of loop in TFT_Init() but the addresses being poked alternate randomely between LCD_RAM and LCD_REG, so I couldn't think of one. I'll check some existing code for inspiration!
Cheers,
John
Code: Select all
import stm
import time
import machine
LCD_REG = const(0x60000000)
LCD_RAM = const(0x60020000)
def TFT_Init():
BIT12 = const(1 << 12)
_BIT12 = const(0xFFFF ^ BIT12)
#hardware reset
machine.mem16[stm.GPIO_ODR] &= _BIT12
time.sleep_ms(250)
machine.mem16[stm.GPIO_ODR] |= BIT12
time.sleep_ms(120)
#SOFTWARE RESET
machine.mem8[LCD_REG] = 0x01
time.sleep_ms(1000)
#POWER CONTROL A
machine.mem8[LCD_REG] = 0xCB
machine.mem8[LCD_RAM] = 0x39
machine.mem8[LCD_RAM] = 0x2C
machine.mem8[LCD_RAM] = 0x00
machine.mem8[LCD_RAM] = 0x34
machine.mem8[LCD_RAM] = 0x02
...