How to use TEMP sensor on nRF5x boards ? #nrf52840 #sensor

Yorick Brunet
 

Hello,

I have recently started to use Zephyr. Up to now, I have been able to set up some tasks and ESS (with Temperature characteristic (dummy value for the moment)) and BAS Bluetooth profiles. The BAS profile comes from the samples. I have been able to compile and flash my nRF52840 DK (or pca10056) board. It works well.

I'd like now to get the processor temperature using the TEMP sensor. I have seen that Zephyr provides it:
  • https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_TEMP_NRF5.html
  • https://github.com/zephyrproject-rtos/zephyr/tree/master/drivers/sensor/nrf5
I added
      CONFIG_TEMP_NRF5=y
to my prf.conf and the driver seems to have been compiled.

However, I haven't found any doc to use this sensor except https://docs.zephyrproject.org/latest/reference/drivers/index.html.

Do you know I how should use the sensor in my application ?

I haven't found any function in temp_nrf5.c that I can call. All functions are static and takes a "struct device* " as parameter that I don't have. I don't think that my question is only related to this sensor, it must be a generic question valid also for other sensors.

Thanks.

Best regards,
Yorick

Join users@lists.zephyrproject.org to automatically receive all group messages.