Skip to content

Instantly share code, notes, and snippets.

@lupyuen
Last active August 10, 2018 04:20
Show Gist options
  • Save lupyuen/0322594fb494bd9aa5c91770d71eb021 to your computer and use it in GitHub Desktop.
Save lupyuen/0322594fb494bd9aa5c91770d71eb021 to your computer and use it in GitHub Desktop.
static void sensor_setup(uint8_t display_task_id) {
// Start the sensor tasks for each sensor to read and process sensor data.
// Edit this function to add your own sensors.
// Set up the sensors and get their sensor contexts.
const int pollInterval = 500; // Poll the sensor every 500 milliseconds.
SensorContext *tempContext = setup_temp_sensor(pollInterval, display_task_id);
SensorContext *humidContext = setup_humid_sensor(pollInterval, display_task_id);
// For each sensor, create sensor tasks using the same task function, but with unique sensor context.
// "0, 0, 0" means that the tasks may not receive any message queue data.
//// debug(F("task_create")); ////
task_create(sensor_task, tempContext, 10, // Priority 10 = highest priority
0, 0, 0); // Will not receive message queue data.
task_create(sensor_task, humidContext, 20, // Priority 20
0, 0, 0); // Will not receive message queue data.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment