Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. /// Define the listener function to be called after polling the temperature sensor.
  2. static mut LISTENER: SensorListener = SensorListener { // Must be static so it won't go out of scope.
  3. sl_sensor_type: TEMP_SENSOR_TYPE, // Type of sensor: ambient temperature. Either computed (floating-point) or raw (integer)
  4. sl_func : read_temperature, // Listener function to be called with the sensor data
  5. sl_arg : LISTENER_CB, // Indicate to the listener function that this is a listener callback
  6. sl_next : 0, // Must be 0
  7. };
  8.  
  9. /// Listen To Local Sensor
  10. pub fn start_sensor_listener() -> i32 {
  11. ...
  12. // Set the Listener Function to be called every 10 seconds, with the polled sensor data.
  13. let rc = unsafe { sensor_register_listener(listen_sensor, &mut LISTENER) };
  14. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement