Skip to content

Instantly share code, notes, and snippets.

View hathach's full-sized avatar
🏠
Working from home

Ha Thach hathach

🏠
Working from home
View GitHub Profile
@hathach
hathach / cm4_netboot.md
Last active October 22, 2021 15:35
CM4 netboot
Internal Stress Test Example
Formatting ... Done
Task high writing ...
Task n1 writing ...
Task high writing ...
[IFLASH] Blocked parallel write attempt ... waiting for mutex
Task high writing ...
[IFLASH] Blocked parallel write attempt ... waiting for mutex
Task n2 writing ...
Task high writing ...
/*********************************************************************
This is an example for our nRF52 based Bluefruit LE modules
Pick one up today in the adafruit shop!
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
MIT license, check LICENSE for more information
@hathach
hathach / fill_stack.c
Created June 29, 2017 05:43
asm inline to fill stack with pattern
/* Fill stack with pattern to allow checking of stack usage
* __StackLimit : lower address of stack region
*/
__asm__(
"ldr r0, =__StackLimit\n"
"ldr r1, =__STACKSIZE__\n"
"ldr r2, =0xADADADAD\n"
".Fill:\n"
"STR R2, [R0]\n"
"ADDS R0, 4\n"
@hathach
hathach / stack_fill.asm
Last active November 8, 2017 06:16
asm to fill stack with pattern
/* Fill stack with pattern to allow checking of stack usage
* __StackLimit : lower address of stack region
*/
ldr r0, =__StackLimit
ldr r1, =__StackSize
ldr r2, =0xADADADAD
.L_fill:
str r2, [r0]
adds r0, 4
@hathach
hathach / button_debounce.c
Created April 17, 2017 07:43
Button Debounce
/**
* Check if button A,B,C state are pressed, include some software
* debouncing.
*
* Note: Only set bit when Button is state change from
* idle -> pressed. Press and hold only report 1 time, release
* won't report as well
*
* @return Bitmask of pressed buttons e.g If BUTTON_A is pressed
* bit 31 will be set.