Initialize the LCD
screen to display
type
: type ofLCD
(reserved for future use):0
: None1
: lcd shield (default)
type is a key-value parameter that must be explicitly called by writing type= in the function call
-
freq
: frequency of lcd ( actually maybe SPI ) -
color
:LCD
initialized color, 16 bitsRGB565
color, e.g.0xFFFF
; orRGB888
tuple, e.g.(236, 36, 36)
, defaultlcd.BLACK
Unregister the LCD
driver to release the I/O pins
Returns the width of the LCD
(horizontal resolution)
Returns the height of the LCD
(vertical resolution).
Returns the type of LCD
(reserved for future use):
0: None 1: lcd Shield
Set or get frequency of LCD (SPI)
freq
: frequency of LCD (SPI)
frequency of LCD
Setting the backlight status of LCD
, turning off the backlight will greatly reduce the energy consumption of the LCD expansion board.
//TODO: Not implemented
state
: backlight brightness, value [0,100]
Return to backlight status
Backlight brightness, value [0,100]
Display a image
(GRAYSCALE or RGB565) on the LCD.
Roi is a rectangular tuple (x, y, w, h) of a region of interest. If not specified, it is an image rectangle
If the roi width is less than the lcd width, the vertical black border is used to make roi at the center of the screen (that is, fill the unoccupied area with black).
If the roi width is greater than the lcd width, roi is at the center of the screen, and the unmatched pixels are not displayed (ie, the LCD displays the center of roi in window form).
If the roi height is less than the lcd height, use a vertical black border to center roi in the center of the screen (ie fill the unoccupied area with black).
If the roi height is greater than the lcd height, roi is at the center of the screen, and the unmatched pixels are not displayed (ie, the LCD displays the center of roi in window form).
roi is a key-value parameter that must be explicitly called by writing roi= in a function call.
Empty the LCD screen to black or other color.
color
:LCD
initialized color, 16 bitsRGB565
color, e.g.0xFFFF
; orRGB888
tuple, e.g.(236, 36, 36)
Set LCD direction and mirror
parameters maybe change in the future
dir
: nomallylcd.YX_LRUD
orlcd.YX_RLDU
, other values just exchangeXY
orLR
orDU
import lcd
lcd.init()
lcd.draw_string(100, 100, "hello maixpy", lcd.RED, lcd.BLACK)
import lcd
import image
img = image.Image("/sd/pic.bmp")
lcd.display(img)
import lcd
import image
img = image.Image()
img.draw_string(60, 100, "hello maixpy", scale=2)
lcd.display(img)
import sensor, lcd
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
sensor.skip_frames()
lcd.init()
while(True):
lcd.display(sensor.snapshot())