Skip to content

Instantly share code, notes, and snippets.

@kzyapkov
Created December 3, 2017 14:26
Show Gist options
  • Save kzyapkov/4b8f6d6479f9d9cdd7e238caaafd9012 to your computer and use it in GitHub Desktop.
Save kzyapkov/4b8f6d6479f9d9cdd7e238caaafd9012 to your computer and use it in GitHub Desktop.
#include "mgos.h"
void sayit(void *arg) {
LOG(LL_INFO, ("TICK!"));
}
IRAM void _timer_cb(void *arg) {
static uint32_t count = 0;
if (((++count) % 1000) == 0) {
mgos_invoke_cb(sayit, NULL, true);
}
(void) arg;
}
enum mgos_app_init_result mgos_app_init(void) {
mgos_set_hw_timer(1000, 1, _timer_cb, NULL);
return MGOS_APP_INIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment