# [−][src]Module app::app_sensor

Poll the temperature sensor every 10 seconds. Transmit the sensor data to the CoAP server after polling. This is the Rust version of https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/rust-nbiot/apps/my_sensor_app/OLDsrc/sensor.c

## Constants

SENSOR_POLL_TIME | Poll sensor every 10,000 milliseconds (10 seconds)
TEMP_SENSOR_KEY | Use key (field name) `t` to transmit raw temperature to CoAP Server
TEMP_SENSOR_TYPE | Type of sensor: Raw temperature sensor (integer sensor values 0 to 4095)

## Statics

SENSOR_DEVICE | Sensor to be polled: `temp_stm32_0` is Blue Pill's internal temperature sensor

## Functions

convert_sensor_data | Convert the raw temperature value received from Mynewt into a `SensorValue` for transmission, which includes the sensor data key `t`. `sensor_type` indicates the type of data in `sensor_data`.
handle_sensor_data | This listener function is called every 10 seconds by Mynewt to handle the polled sensor data. Return 0 if we have handled the sensor data successfully.
start_sensor_listener | Ask Mynewt to poll the temperature sensor every 10 seconds and call `handle_sensor_data()`. Return `Ok()` if successful, else return `Err()` with `MynewtError` error code inside.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)