dwm_cfg_anchor_set
Configures node as an anchor with given options. The BLE option cannot be enabled with encryption. Otherwise, the configuration is considered invalid and will not be used. Encryption cannot be enabled if encryption key is not set. This call requires a reset for the new configuration to take effect (dwm_reset). Enabling encryption on the initiator will automatically enable encryption of all nodes with the same encryption key set (). This enables encryption for the whole network with the same pan ID (network ID) and encryption key remotely from one place.
Normally, this call writes to internal flash when setting a new value. Hence, it should not be used frequently and can take hundreds of milliseconds in the worst case.!
-
int dwm_cfg_anchor_set(dwm_cfg_anchor_t *cfg_anchor);
- Parameters
input – cfg_anchor
cfg_anchor – initiator, bridge, led_en, ble_en, uwb_mode, fw_update_en, enc_en
initiator – ‘0’ | ‘1’ (Initiator role enable)
bridge – ‘0’ | ‘1’ (Bridge role enable)
enc_en – ‘0’ | ‘1’ (encryption enable)
led_en – ‘0’ | ‘1’ (general purpose LEDs enable)
ble_en – ‘0’ | ‘1’ (BLE enable)
uwb_mode – ‘0’ | ‘1’ | ‘2’ (0-off, 1-passive, 2-active)
fw_update_en – ‘0’ | ‘1’ (Firmware update enable)
output – Status code
Note
C code example
dwm_cfg_anchor_t cfg;
int rv;
cfg.initiator = 1;
cfg.bridge = 0;
/* [Available only when the firmware is compiled with UWB routing backhaul: cfg.uwb_bh_routing: DWM_UWB_BH_ROUTING_AUTO;] */
cfg.common.enc_en = 1;
cfg.common.led_en = 1;
cfg.common.ble_en = 1;
cfg.common.fw_update_en = 1;
cfg.common.uwb_mode = DWM_UWB_MODE_OFF;
rv = dwm_cfg_anchor_set(&cfg);
if (rv == DWM_ERR_PERM)
{
printf(“Error: either encryption or BLE can be enabled, encryption can be enabled only if encryption key is set\n”);
}
dwm_reset();
SPI/UART example
TLV Request |
||
---|---|---|
0x07 |
0x02 |
(bit 5) enc_en (bit 4) led_en (bit 3) ble_en (bit 2) fw_update_en (bits 0-#. uwb_mode |
0x9C 0x02 |
Type 0x07 means command dwm_cfg_anchor_set
TLV Response |
||
---|---|---|
Type |
Length |
Value (see error codes) |
0x40 |
0x01 |
0x00 |