Skip to content

Instantly share code, notes, and snippets.

@jasonbu
jasonbu / all_winner_makefile
Created May 27, 2023 14:36
all_winner_makefile
VERSION = 4
PATCHLEVEL = 0
SUBLEVEL = 0
EXTRAVERSION =
NAME = MELIS SDK
# *DOCUMENTATION*
# To see a list of typical targets execute "make help"
# More info can be located in ./README
# Comments in this file are targeted only to the developer, do not
@jasonbu
jasonbu / resize_png_argb_alpha.py
Created September 16, 2019 04:30
format png file alpha set max to 255
from PIL import Image
img = Image.open("src.png")
raw = img.load()
(w,h) = img.size
alpha_buffer = []
alpha_max = 0
@jasonbu
jasonbu / raw_hex_to_wav.py
Created March 21, 2019 11:17
print %02X and python convert from hex string to wav file
import numpy as np
import scipy.io.wavfile
f = open('test.raw')
ls = f.readlines()
arrays = ""
for l in ls:
from PyCRC.CRCCCITT import CRCCCITT
from PyCRC.CRC32 import CRC32
from PyCRC.CRC16 import CRC16
from PyCRC.CRC16DNP import CRC16DNP
from PyCRC.CRC16Kermit import CRC16Kermit
from PyCRC.CRC16SICK import CRC16SICK
src = [
# 'surface_galaxy.bmp',
@jasonbu
jasonbu / decode_keil_stack_htm.py
Created August 11, 2018 09:25
use this python to decode keil htm file and know stack usage
import re
re_str = '''<STRONG>.*</a>([0-9a-zA-Z_]{1,})</STRONG>.*[\r\n]{0,2}.*<LI>Max Depth = ([0-9]{1,})<LI>'''
re_find_func_max_depth = re.compile(re_str)
target_func_max_deep = [
"main",
]
@jasonbu
jasonbu / struct.c
Last active August 29, 2015 14:27
struct.c
////.h file
#include <stdint.h>
#include <stdbool.h>
#include "module_pedometer.h"
typedef struct rt_upload_ctrl_demands_struct_t rt_upload_ctrl_demands_t;
/**
*
*/
typedef enum {
fsm_evt_boot_direct = 0,
fsm_evt_boot_fail,
fsm_evt_boot_seq_start,
fsm_evt_timeout,
fsm_evt_button_push,
fsm_evt_button_release,
fsm_evt_batt_low,
fsm_evt_shutdown_ok,