Last active
September 8, 2021 11:07
-
-
Save robinkrens/6d4cf41976bc1a0f198e08280ecfd0b5 to your computer and use it in GitHub Desktop.
Sensor Pole Code
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(); | |
/* fall-through */ | |
case TIMER_WAKEUP: | |
/* ulp has been collecting recent data */ | |
lora_wakeup(); | |
lora_send(buf); /* note: make sure what kind of send this is */ | |
break; | |
} | |
/* back to sleep, shut down all, except ulp + adc for continious monitoring | |
ulp will wake up processor to periodically send data */ | |
deep_sleep_start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment