This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(void) | |
{ | |
switch(wakeup_cause()) { | |
case SHELF_MODE_WAKEUP: | |
init_peripherals(); /* enable all needed power domains */ | |
set_tilt_trigger_intr(); /* (re)set tilt trigger again, kills ulp power domain */ | |
ulp_load_program(&program); /* load program that periodically checks sensors */ | |
ulp_set_wakeup_period(x); | |
ulp_run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Make pdf by running `dot -Tpng file.dot -o out.png` | |
* or check online at one of the many tools like webgraphviz.com */ | |
digraph G { | |
A [label="Initializing"] | |
B [label="Communicating"] | |
C [label="Monitoring\n (ULP mode)"] | |
D [label="Sleeping\n (Shelf mode)"] | |
D -> A [label="Tilt trigger"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void read_force(void) | |
{ | |
int count; | |
/* Offset and gain need to be calculated for each load cell */ | |
int offset = 1234; /* calibration offset */ | |
float gain = 1.818e-5; /* gain: convert output data to grams */ | |
while(1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# by mr_woggle - 2024 (c) | |
# free for all :D | |
import os | |
POLY = 0x8005 | |
START_VAL = 0xFFFF | |
IN_FILE = "test.bin" | |
OUT_FILE = "test_encrypted.bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example on how to use hid to write STC chip series: STC8H8K64U,STC32G12K128,STC32F12K54 | |
# Opens USB HID device and programs flash. No error check. Use at own risk | |
# Only tested on STC32F12K54 | |
import hid | |
import time | |
import struct | |
from intelhex import IntelHex | |
from tqdm import tqdm |