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