I am trying to write an app to record raw data from the green HRM (heart rate monitor) sensor on the Samsung Gear S3, using the following code extract:
unsigned int sensor_interval_ms = 25; sensor_type_e type = SENSOR_HRM_LED_GREEN; sensor_h sensor; sensor_listener_h listener; sensor_get_default_sensor(type, &sensor); sensor_create_listener(sensor, &listener); sensor_listener_set_option(listener, SENSOR_OPTION_ALWAYS_ON); // set sensor interval to 10 ms sensor_listener_set_interval(listener, 10); sensor_listener_set_event_cb(listener, sensor_interval_ms, &on_sensor_event_cb, NULL); sensor_listener_start(listener);
on_sensor_event_cb() is a function to write the sensor values to a text file, using:
sensor_event_s event; sensor_listener_read_data(listener, &event); int sensor_value = event.values[0];
The app writes a value to the file every 25 ms (or whatever I change sensor_interval_ms to). However, sensor_value only changes every 50 ms.
Does anyone know if there is a way to sample more often than once every 50 ms, or is 20 Hz (1/50 ms) the maximum sample rate of this sensor?