File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change
1
+ # Module for advancing tick count and scheduling async event for lvgl on STM32.
2
+ # Import after lvgl module.
3
+ #
4
+ # MIT license; Copyright (c) 2020 Amir Gonnen
5
+
6
+ import lvgl as lv
7
+ import micropython
8
+ import pyb
9
+
10
+ class lvstm32 ():
11
+ def __init__ (self , freq = 25 , timer_id = 4 ):
12
+ self .task_handler_ref = self .task_handler # Allocation occurs here
13
+ self .delay = 1000 // freq
14
+ tim = pyb .Timer (timer_id )
15
+ tim .init (freq = freq )
16
+ tim .callback (self .timer_cb )
17
+
18
+ def task_handler (self , _ ):
19
+ lv .task_handler ()
20
+
21
+ def timer_cb (self , t ):
22
+ lv .tick_inc (self .delay )
23
+ # Passing self.task_handler would cause allocation.
24
+ micropython .schedule (self .task_handler_ref , 0 )
25
+
Original file line number Diff line number Diff line change 9
9
/* clang-format off */
10
10
11
11
#include <stdint.h>
12
+ #define mp_instance_cast_to_native_base mp_obj_cast_to_native_base
12
13
13
14
/*====================
14
15
Graphical settings
15
16
*====================*/
16
17
17
18
/* Maximal horizontal and vertical resolution to support by the library.*/
18
19
#define LV_HOR_RES_MAX (480)
19
- #define LV_VER_RES_MAX (320)
20
+ #define LV_VER_RES_MAX (272) //( 320)
20
21
21
22
/* Color depth:
22
23
* - 1: 1 byte per pixel
55
56
/* Dot Per Inch: used to initialize default sizes.
56
57
* E.g. a button with width = LV_DPI / 2 -> half inch wide
57
58
* (Not so important, you can adjust it to modify default sizes and spaces)*/
58
- #define LV_DPI 100 /*[px]*/
59
+ #define LV_DPI 60 /*[px]*/
59
60
60
61
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
61
62
typedef int16_t lv_coord_t ;
You can’t perform that action at this time.
0 commit comments