Skip to content

Commit

Permalink
[update] maixpy_twatch
Browse files Browse the repository at this point in the history
  • Loading branch information
junhuanchen committed Mar 20, 2021
1 parent 319d2e2 commit 328eb79
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 54 deletions.
27 changes: 1 addition & 26 deletions components/drivers/lcd/src/lcd_mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,31 +288,6 @@ static void mcu_lcd_set_direction(lcd_dir_t dir)
//dir |= 0x08; //excahnge RGB
lcd_ctl.dir = ((lcd_ctl.dir & DIR_RGB2BRG) == DIR_RGB2BRG) ? (dir | DIR_RGB2BRG) : dir;

#if defined(CONFIG_BOARD_TWATCH)
lcd_ctl.width = g_lcd_w - 1;
lcd_ctl.height = g_lcd_h - 1;
switch (dir)
{
case DIR_XY_RLUD:
lcd_ctl.start_offset_w = 0;
lcd_ctl.start_offset_h = 0;
break;
case DIR_YX_LRUD:
lcd_ctl.start_offset_w = 0;
lcd_ctl.start_offset_h = 0;
break;
case DIR_YX_RLDU:
lcd_ctl.start_offset_w = 80;
lcd_ctl.start_offset_h = 0;
break;
case DIR_XY_LRDU:
lcd_ctl.start_offset_w = 0;
lcd_ctl.start_offset_h = 80;
break;
default:
break;
}
#else
if (lcd_ctl.dir & DIR_XY_MASK)
{
lcd_ctl.width = g_lcd_w - 1;
Expand All @@ -327,7 +302,7 @@ static void mcu_lcd_set_direction(lcd_dir_t dir)
lcd_ctl.start_offset_w = lcd_ctl.start_offset_w0;
lcd_ctl.start_offset_h = lcd_ctl.start_offset_h0;
}
#endif
tft_write_command(MEMORY_ACCESS_CTL);
tft_write_byte((uint8_t *)&lcd_ctl.dir, 1);
}
Expand Down
49 changes: 21 additions & 28 deletions projects/maixpy_twatch/builtin_py/_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,34 +83,27 @@

# detect boot.py
boot_py = '''
from fpioa_manager import *
import os, Maix, lcd, image
from Maix import FPIOA, GPIO
test_pin=16
fpioa = FPIOA()
fpioa.set_function(test_pin,FPIOA.GPIO7)
test_gpio=GPIO(GPIO.GPIO7,GPIO.IN)
lcd.init(freq=15000000,color=(255,0,0))
fm.register(board_info.PIN17,fm.fpioa.GPIO0)
led=GPIO(GPIO.GPIO0,GPIO.OUT)
led.value(1)
lcd.rotation(1)
lcd.clear((255,0,0))
lcd.draw_string(lcd.width()//2-68,lcd.height()//2-4, "Welcome to MaixPy", lcd.WHITE, lcd.RED)
if test_gpio.value() == 0:
lcd.rotation(2)
print('PIN 16 pulled down, enter test mode')
import sensor
import image
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
lcd.freq(16000000)
while True:
img=sensor.snapshot()
lcd.display(img)
try:
import os, Maix, gc, lcd, image
from Maix import FPIOA, GPIO
gc.collect()
lcd.init(invert=True, freq=15000000,color=(255,0,0))
lcd.rotation(1)
fm.register(board_info.PIN17,fm.fpioa.GPIO0)
led=GPIO(GPIO.GPIO0,GPIO.OUT)
led.value(1)
loading = image.Image(size=(lcd.width(), lcd.height()))
loading.draw_rectangle((0, 0, lcd.width(), lcd.height()), fill=True, color=(255, 0, 0))
info = "Welcome to MaixPy"
loading.draw_string(int(lcd.width()//2 - len(info) * 5), (lcd.height())//4, info, color=(255, 255, 255), scale=2, mono_space=0)
v = sys.implementation.version
vers = 'V{}.{}.{} : maixpy.sipeed.com'.format(v[0],v[1],v[2])
loading.draw_string(int(lcd.width()//2 - len(info) * 6), (lcd.height())//3 + 20, vers, color=(255, 255, 255), scale=1, mono_space=1)
lcd.display(loading)
del loading, v, info, vers
gc.collect()
finally:
gc.collect()
'''

f = open("/flash/boot.py", "wb")
Expand Down

0 comments on commit 328eb79

Please sign in to comment.