ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_nrf5_sdk15_communication.c
Go to the documentation of this file.
1 
10 #if RUUVI_NRF5_SDK15_COMMUNICATION_ENABLED
11 
12 #include "ruuvi_driver_error.h"
13 
14 #include <stdbool.h>
15 #include <stdint.h>
16 #include "nrf_soc.h"
17 #include "nrf_sdh.h"
18 #include "nrf_sdh_ble.h"
19 
20 rd_status_t ri_comm_id_get (uint64_t * const _id)
21 {
22  uint64_t id = 0;
23  id |= (uint64_t) ( (NRF_FICR->DEVICEID[0] >> 24) & 0xFF) << 56;
24  id |= (uint64_t) ( (NRF_FICR->DEVICEID[0] >> 16) & 0xFF) << 48;
25  id |= (uint64_t) ( (NRF_FICR->DEVICEID[0] >> 8) & 0xFF) << 40;
26  id |= (uint64_t) ( (NRF_FICR->DEVICEID[0] >> 0) & 0xFF) << 32;
27  id |= (uint64_t) ( (NRF_FICR->DEVICEID[1] >> 24) & 0xFF) << 24;
28  id |= (uint64_t) ( (NRF_FICR->DEVICEID[1] >> 16) & 0xFF) << 16;
29  id |= (uint64_t) ( (NRF_FICR->DEVICEID[1] >> 8) & 0xFF) << 8;
30  id |= (uint64_t) ( (NRF_FICR->DEVICEID[1] >> 0) & 0xFF) << 0;
31  *_id = id;
32  return RD_SUCCESS;
33 }
34 #endif
uint32_t rd_status_t
bitfield for representing errors
#define RD_SUCCESS
Internal Error.
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
rd_status_t ri_comm_id_get(uint64_t *const id)