Created
January 22, 2015 21:19
-
-
Save DCRichards/d3bc4f3b610074f0db5f to your computer and use it in GitHub Desktop.
Data logging in a Pebble Background Worker
This file contains hidden or 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
#include <pebble_worker.h> | |
DataLoggingSessionRef data_logger; | |
int num_samples = 1; | |
static void data_handler(AccelData *data, uint32_t samples) { | |
data_logging_log(data_logger, data, samples); | |
} | |
static void worker_init() { | |
accel_data_service_subscribe(num_samples, data_handler); | |
accel_service_set_sampling_rate(ACCEL_SAMPLING_10HZ); | |
data_logger = data_logging_create(1, DATA_LOGGING_BYTE_ARRAY, sizeof(AccelData), true); | |
} | |
static void worker_deinit() { | |
data_logging_finish(data_logger); | |
accel_data_service_unsubscribe(); | |
} | |
int main(void) { | |
worker_init(); | |
worker_event_loop(); | |
worker_deinit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment