Commit 7d62acf 1 parent 7ce33ca commit 7d62acf Copy full SHA for 7d62acf
File tree 2 files changed +7
-14
lines changed
2 files changed +7
-14
lines changed Original file line number Diff line number Diff line change 54
54
55
55
#include "nrfx.h"
56
56
#include "nrfx_power.h"
57
+ #include "nrf_ficr.h"
57
58
/*---------------------------------------------------------------------------*/
58
59
extern void tusb_hal_nrf_power_event (uint32_t event );
59
60
/*---------------------------------------------------------------------------*/
@@ -76,8 +77,8 @@ power_event_handler(nrfx_power_usb_evt_t event)
76
77
void
77
78
usb_arch_init (void )
78
79
{
79
- const uint16_t serial_num_high_bytes = ( uint16_t ) NRF_FICR -> DEVICEADDR [ 1 ] | 0xC000 ; // The masking makes the address match the Random Static BLE address.
80
- const uint32_t serial_num_low_bytes = NRF_FICR -> DEVICEADDR [ 0 ] ;
80
+ const uint16_t serial_num_high_bytes = nrf_ficr_deviceid_get ( NRF_FICR , 1 ) | 0xC000 ;
81
+ const uint32_t serial_num_low_bytes = nrf_ficr_deviceid_get ( NRF_FICR , 0 ) ;
81
82
const nrfx_power_config_t power_config = { 0 };
82
83
const nrfx_power_usbevt_config_t power_usbevt_config = {
83
84
.handler = power_event_handler
Original file line number Diff line number Diff line change 48
48
#include "linkaddr.h"
49
49
50
50
#include "nrf.h"
51
+ #include "nrf_ficr.h"
51
52
52
53
#include "linkaddr-arch.h"
53
54
@@ -72,18 +73,9 @@ populate_link_address(void)
72
73
device_address [0 ] = (NORDIC_SEMI_VENDOR_OUI ) >> 16 & 0xFF ;
73
74
device_address [1 ] = (NORDIC_SEMI_VENDOR_OUI ) >> 8 & 0xFF ;
74
75
device_address [2 ] = NORDIC_SEMI_VENDOR_OUI & 0xFF ;
75
- #if defined(NRF_FICR )
76
- device_address [3 ] = NRF_FICR -> DEVICEADDR [1 ] & 0xFF ;
77
- device_address_low = NRF_FICR -> DEVICEADDR [0 ];
78
- #elif defined(NRF_FICR_NS )
79
- device_address [3 ] = NRF_FICR_NS -> DEVICEADDR [1 ] & 0xFF ;
80
- device_address_low = NRF_FICR_NS -> DEVICEADDR [0 ];
81
- #elif defined(NRF_FICR_S )
82
- device_address [3 ] = 0 ;
83
- device_address_low = 0 ;
84
- #else
85
- #error "NRF_FICR not supported?"
86
- #endif
76
+ device_address [3 ] = nrf_ficr_deviceid_get (NRF_FICR , 1 ) & 0xFF ;
77
+ device_address_low = nrf_ficr_deviceid_get (NRF_FICR , 0 );
78
+
87
79
memcpy (& device_address [4 ], & device_address_low , sizeof (device_address_low ));
88
80
89
81
memcpy (& linkaddr_node_addr , & device_address [8 - LINKADDR_SIZE ],
You can’t perform that action at this time.
0 commit comments