Hi,
try this, I hope it will work
#define TEMP_SENSOR_NAME "TEMP_0"
int valid = 0;
const struct device *tempSensor
device_get_binding(TEMP_SENSOR_NAME);
sensor_value sensor_val;
int rc =
sensor_sample_fetch(tempSensor);
if (rc == 0) {
rc = sensor_channel_get(tempSensor,
SENSOR_CHAN_DIE_TEMP,&sensor_val);
}else{
valid=0;
}
if (rc == 0) {
double temp = sensor_val.val1 +
sensor_val.val2/1000000.0;
//printk("Temp: %d.%d\n", sensor_val.val1,
sensor_val.val2/10000);
valid=1;
}else{
valid=0;
}
you also need to enable
CONFIG_SENSOR=y
CONFIG_TEMP_NRF5=y
in prj.conf
Martin
Dne 30.10.2020 v 9:16 Mohamed
Belaroussi napsal(a):
toggle quoted messageShow quoted text
Hi Martin.
If you have some code that you are willing to share then
please share it to save time.
Thank you.
Kind regards
Mohamed
On Thu, Oct 29, 2020 at 9:15
PM Martin Kozusky < news@...> wrote:
Hi,
I would recommend looking at
samples\bluetooth\peripheral_ht\src
I managed to create my code for nrf52832 based on
that sample. If you have problems with that sample, I
can paste some code here.
Martin
Hello,
I
am looking for some some nRF5340 example code
that reads the nRF5340 die temperature using zephyr
APIs.
I've
looked at previous posts but I could only find this
one https://devzone.nordicsemi.com/f/nordic-q-a/56171/how-to-get-die-temperature-on-nrf52832-using-zephyr from
10 months ago that stated none existed.
I am hoping someone, somewhere musty have done
something similar.
Thank
you.
Kind
regards
Please consider the environment
before printing this email.
*********************************************************************
This communication may contain information which is
confidential, personal and/or privileged. It is for the
exclusive use of the intended recipient(s).
If you are not the intended recipient(s), please note that any
distribution, forwarding, copying or use of this communication
or the information in it is strictly prohibited. If you have
received it in error please contact the sender immediately by
return e-mail. Please then delete the e-mail and any copies of
it and do not use or disclose its contents to any person.
Any personal views expressed in this e-mail are those of the
individual sender and the company does not endorse or accept
responsibility for them. Prior to taking any action based upon
this e-mail message, you should seek appropriate confirmation
of its authenticity.
This message has been checked for viruses on behalf of the
company.
*********************************************************************
G4S Regional Management (UK&I) Limited, Registered Office: Southside, 105 Victoria Street, London, SW1E 6QT. Registered in England No. 3189802.
G4S Care and Justice Services (UK) Limited, trading as G4S Central Government Services, Registered in England No. 390328.
G4S Health Services (UK) Limited, Registered in England No. 5121608.
G4S Government and Outsourcing Services (UK) Limited, trading as G4S Outsourcing Services, Registered in England No.3175173.
G4S Facilities Management (UK) Limited, Registered in England No. 3333860.
G4S Investigation Solutions (UK) Limited, Registered in England No. 3749819.
G4S Monitoring Technologies Limited, Registered in England No. 2626613.
G4S Ordnance Management Limited, Registered in England No. 7068855.
G4S Risk Management Limited, Registered in England No. 1540857.
G4S Secure Solutions (Iraq) Limited, Registered in England No.5128617.
G4S Risk Consulting Limited, Registered in England No. 4047630.
The Registered office of all the above companies is Southside, 105 Victoria Street, London, SW1E 6QT.
G4S Aviation Services (UK) Limited, Registered in England No. 2837136.
G4S Secure Solutions (UK) Limited, Registered in England No. 1046019.
G4S Security Services (UK) Limited, Registered in England No.2380900.
G4S Gurkha Services (UK) Limited, Registered in England No.6304482.
G4S Cash Solutions (UK) Limited, Registered in England No.354883.
G4S Cash Centres (UK) Limited, Registered in England No.1485104.
G4S Bullion Solutions (UK) Limited, Registered in England No.7860383.
The Registered office of all the above companies is Sutton Park House, 15 Carshalton Road, Sutton, Surrey SM1 4LD.
|