Skip to content

Instantly share code, notes, and snippets.

@amirgon
amirgon / socat_usb-uart.sh
Created March 18, 2022 20:44
socat usb-uart
socat $(tty),raw,echo=0,escape=0x1D /dev/ttyUSB0,b115200,raw; stty sane
@amirgon
amirgon / .tmux.conf
Last active January 26, 2022 08:14
dotfiles
#
# https://gist.github.com/spicycode/1229612
#
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
@amirgon
amirgon / lv_example_anim_timeline_1.py
Created June 27, 2021 22:40
anim timeline example with callback setters
#!/opt/bin/lv_micropython -i
import sys
sys.path.append('') # See: https://github.com/micropython/micropython/issues/6419
import time
import lvgl as lv
import display_driver_utils
lv.init()
@amirgon
amirgon / mp_trace.py
Created April 16, 2021 20:23
Tracing Micropython code
import sys
# See: https://pymotw.com/2/sys/tracing.html
def mp_trace(frame, event, arg):
co = frame.f_code
func_name = co.co_name
func_line_no = frame.f_lineno
func_filename = co.co_filename
print('[%s] [%s] %s:%s' % (event, func_name, func_filename, func_line_no))
@amirgon
amirgon / lodepng_test.py
Last active June 27, 2021 20:41
lodepng problem on the simulator
# Initialize
import imp, usys as sys
sys.path.append('https://raw.githubusercontent.com/littlevgl/lv_binding_micropython/dev-8.0/lib')
import display_driver
import lvgl as lv
import ustruct as struct
@amirgon
amirgon / lv_micropython_esp32_flash_rodata_size_analysis.txt
Last active October 9, 2020 22:14
python3 elf-size-analyze.py --no-color -H -S 12 -o -t "/opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-" ports/esp32/build-GENERIC_SPIRAM/application.elf
==================================== SECTIONS: 12 ====================================
Symbol Size %
======================================================================================
/ 230.1 KiB 78.34
home 230.0 KiB 78.33
amirgon/esp 228.1 KiB 77.68
projects/lv_mpy 206.6 KiB 70.37
ports 121.5 KiB 41.39
esp32 120.8 KiB 41.13
build-GENERIC_SPIRAM 114.1 KiB 38.84
@amirgon
amirgon / lv_micropython_esp32_flash_text_size_analysis.txt
Created October 9, 2020 21:50
python3 elf-size-analyze.py --no-color -H -S 13 -o -t "/opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-" ports/esp32/build-GENERIC_SPIRAM/application.elf
==================================== SECTIONS: 13 ====================================
Symbol Size %
======================================================================================
/ 1.0 MiB 76.63
home 1.0 MiB 76.20
amirgon/esp 957.4 KiB 68.37
projects/lv_mpy 530.1 KiB 37.85
lib 266.4 KiB 19.02
lv_bindings 227.7 KiB 16.26
lvgl/src 225.5 KiB 16.10
@amirgon
amirgon / lvgl7_micropython_api_tree.txt
Created May 13, 2020 22:56
lvgl dev-7 micropython API tree printed with inspect.py
lvgl
| list
| | remove
| | PART
| | | ALL
| | | MAIN
| | add_btn
| | add_protect
| | add_state
| | add_style
@amirgon
amirgon / inspect.py
Created May 13, 2020 22:54
Micropython module inspection
from types import ModuleType
def inspect(t, name=None, nesting=0):
if not (name or hasattr(t, "__name__")): return
print("| "*nesting + (name if name else t.__name__))
if isinstance(t, int) or isinstance(t, str): return
if t is type or isinstance(lv, ModuleType):
for x in dir(t):
if not x.startswith("__"):
inspect(getattr(t,x), name=x, nesting = nesting + 1)
@amirgon
amirgon / lv_sim_init.py
Created February 16, 2020 22:25
initialization script for micropython lvgl simulator. Loads display driver.
import imp, sys
sys.path.append('https://raw.githubusercontent.com/littlevgl/lv_binding_micropython/master/lib')
import display_driver
import lvgl as lv