/* Initialize lock code from flash. If it does not exist, copy from APP_CONFIG_LOCK_CODE.  */
static void lock_code_init(uint8_t *p_lock_buff)
/* Initialize lock code from flash. If it does not exist, copy from APP_CONFIG_LOCK_CODE.  */
static void lock_code_init(uint8_t *p_lock_buff)
{
    ret_code_t err_code;
    err_code = es_flash_access_lock_key(p_lock_buff, ES_FLASH_ACCESS_READ);
    FLASH_ACCES_ERROR_CHECK_ALLOW_NOT_FOUND(err_code);
    if (err_code == FDS_ERR_NOT_FOUND)
    {
        uint8_t lock_code[16] = APP_CONFIG_LOCK_CODE;
        memcpy(p_lock_buff, lock_code, sizeof(lock_code));
        err_code = es_flash_access_lock_key(p_lock_buff, ES_FLASH_ACCESS_WRITE);
        APP_ERROR_CHECK(err_code);
    }
}