Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_Uicr.h File Reference
#include <protocol/cs_Typedefs.h>
#include <protocol/cs_UicrPacket.h>
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for cs_Uicr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint32_t getHardwareBoard ()
 Get the hardware board from UICR, or the default board if none is set in UICR. More...
 
cs_ret_code_t writeHardwareBoard ()
 Write the default hardware board to UICR if none is written yet. More...
 
cs_ret_code_t enableNfcPinsAsGpio ()
 Enable NFC pins to be used as GPIO. More...
 
bool canUseNfcPinsAsGpio ()
 Returns true when the NFC pins can be used as GPIO. More...
 
cs_ret_code_t getUicr (cs_uicr_data_t *uicrData)
 Read the UICR data from UICR. More...
 
cs_ret_code_t setUicr (const cs_uicr_data_t *uicrData, bool overwrite)
 Write the UICR data to UICR. More...
 

Function Documentation

◆ canUseNfcPinsAsGpio()

bool canUseNfcPinsAsGpio ( )

Returns true when the NFC pins can be used as GPIO.

◆ enableNfcPinsAsGpio()

cs_ret_code_t enableNfcPinsAsGpio ( )

Enable NFC pins to be used as GPIO.

This is stored in UICR, so it's persistent. NFC pins leak a bit of current when not at same voltage level.

Returns
ERR_SUCCESS On success.
ERR_WRONG_STATE When the UICR is not writable (the softdevice locked the UICR)

◆ getHardwareBoard()

uint32_t getHardwareBoard ( )

Get the hardware board from UICR, or the default board if none is set in UICR.

◆ getUicr()

cs_ret_code_t getUicr ( cs_uicr_data_t uicrData)

Read the UICR data from UICR.

Parameters
[out]uicrDataThe struct to read to.
Returns
ERR_SUCCESS On success.

◆ setUicr()

cs_ret_code_t setUicr ( const cs_uicr_data_t uicrData,
bool  overwrite 
)

Write the UICR data to UICR.

Parameters
[in]uicrDataThe data to write to UICR.
[in]overwriteWhether to overwrite existing data in UICR. This is a risky operation, as it erases the whole UICR for a short while.
Returns
ERR_SUCCESS On success.
ERR_ALREADY_EXISTS When something is written already. You will have to overwrite.
ERR_WRONG_STATE When the UICR is not writable (the softdevice locked the UICR)..

◆ writeHardwareBoard()

cs_ret_code_t writeHardwareBoard ( )

Write the default hardware board to UICR if none is written yet.

In the past, the hardware board was not written to UICR. Instead, the board was compiled into the firmware, and each product had their own different firmware. This function is made to transition from that solution to a single firmware with board in UICR. We only have to make sure that each product once runs a firmware that writes the correct hardware board to UICR.

Returns
ERR_SUCCESS On success.
ERR_WRONG_STATE When the UICR is not writable (the softdevice locked the UICR)