本文整理汇总了C++中VERIFY_MODULE_INITIALIZED函数的典型用法代码示例。如果您正苦于以下问题:C++ VERIFY_MODULE_INITIALIZED函数的具体用法?C++ VERIFY_MODULE_INITIALIZED怎么用?C++ VERIFY_MODULE_INITIALIZED使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VERIFY_MODULE_INITIALIZED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: app_gpiote_user_register
uint32_t app_gpiote_user_register(app_gpiote_user_id_t * p_user_id,
uint32_t pins_low_to_high_mask,
uint32_t pins_high_to_low_mask,
app_gpiote_event_handler_t event_handler)
{
//Check state and parameters.
VERIFY_MODULE_INITIALIZED();
if (event_handler == NULL)
{
return NRF_ERROR_INVALID_PARAM;
}
if (m_user_count >= m_user_array_size)
{
return NRF_ERROR_NO_MEM;
}
//Allocate new user.
mp_users[m_user_count].pins_mask = pins_low_to_high_mask | pins_high_to_low_mask;
mp_users[m_user_count].pins_low_to_high_mask = pins_low_to_high_mask;
mp_users[m_user_count].pins_high_to_low_mask = pins_high_to_low_mask;
mp_users[m_user_count].event_handler = event_handler;
*p_user_id = m_user_count++;
//Make sure SENSE is disabled for all pins.
pins_sense_disable(*p_user_id);
return NRF_SUCCESS;
}
示例2: ble_db_discovery_evt_register
uint32_t ble_db_discovery_evt_register(const ble_uuid_t * const p_uuid)
{
VERIFY_PARAM_NOT_NULL(p_uuid);
VERIFY_MODULE_INITIALIZED();
return registered_handler_set(p_uuid, m_evt_handler);
}
示例3: pstorage_store
uint32_t pstorage_store(pstorage_handle_t * p_dest,
uint8_t * p_src,
pstorage_size_t size,
pstorage_size_t offset)
{
VERIFY_MODULE_INITIALIZED();
NULL_PARAM_CHECK(p_src);
NULL_PARAM_CHECK(p_dest);
MODULE_ID_RANGE_CHECK(p_dest);
BLOCK_ID_RANGE_CHECK(p_dest);
SIZE_CHECK(p_dest, size);
OFFSET_CHECK(p_dest, offset, size);
// Verify word alignment.
if ((!is_word_aligned(p_src)) || (!is_word_aligned((void *)(uint32_t)offset)))
{
return NRF_ERROR_INVALID_ADDR;
}
uint32_t storage_addr = p_dest->block_id + offset;
uint32_t retval = ble_flash_block_write((uint32_t *)storage_addr,
(uint32_t *)p_src,
(size /sizeof(uint32_t)));
app_notify(p_dest, p_src, PSTORAGE_STORE_OP_CODE, size, retval);
return retval;
}
示例4: ble_bondmngr_master_ids_get
uint32_t ble_bondmngr_master_ids_get(uint16_t * p_master_ids, uint16_t * p_length)
{
VERIFY_MODULE_INITIALIZED();
if (p_length == NULL)
{
return NRF_ERROR_NULL;
}
if (*p_length < m_masters_in_db_count)
{
// Length of the input array is not enough to fit all known master identifiers.
return NRF_ERROR_DATA_SIZE;
}
*p_length = m_masters_in_db_count;
if (p_master_ids == NULL)
{
// Only the length field was required to be filled.
return NRF_SUCCESS;
}
int i = 0;
for (i = 0; i < m_masters_in_db_count; i++)
{
p_master_ids[i] = m_masters_db[i].bond.master_id_info.div;
}
return NRF_SUCCESS;
}
示例5: pstorage_load
uint32_t pstorage_load(uint8_t * p_dest,
pstorage_handle_t * p_src,
pstorage_size_t size,
pstorage_size_t offset)
{
VERIFY_MODULE_INITIALIZED();
NULL_PARAM_CHECK(p_src);
NULL_PARAM_CHECK(p_dest);
MODULE_ID_RANGE_CHECK (p_src);
BLOCK_ID_RANGE_CHECK(p_src);
SIZE_CHECK(p_src,size);
OFFSET_CHECK(p_src,offset,size);
// Verify word alignment.
if ((!is_word_aligned(p_dest)) || (!is_word_aligned((void *)(uint32_t)offset)))
{
return NRF_ERROR_INVALID_ADDR;
}
memcpy(p_dest, (((uint8_t *)p_src->block_id) + offset), size);
app_notify(p_src, p_dest, PSTORAGE_LOAD_OP_CODE, size, NRF_SUCCESS);
return NRF_SUCCESS;
}
示例6: pstorage_clear
uint32_t pstorage_clear(pstorage_handle_t * p_dest, pstorage_size_t size)
{
uint32_t page_addr;
uint32_t retval;
uint16_t page_count;
VERIFY_MODULE_INITIALIZED();
NULL_PARAM_CHECK(p_dest);
MODULE_ID_RANGE_CHECK(p_dest);
page_addr = p_dest->block_id / BLE_FLASH_PAGE_SIZE;
retval = NRF_SUCCESS;
for (page_count = 0; page_count < m_app_table[p_dest->module_id].no_of_pages; page_count++)
{
retval = ble_flash_page_erase(page_addr);
page_addr++;
if (retval != NRF_SUCCESS)
{
break;
}
}
app_notify(p_dest, NULL, PSTORAGE_CLEAR_OP_CODE, size, retval);
return retval;
}
示例7: pstorage_store
uint32_t pstorage_store(pstorage_handle_t * p_dest,
uint8_t * p_src,
pstorage_size_t size,
pstorage_size_t offset)
{
VERIFY_MODULE_INITIALIZED();
NULL_PARAM_CHECK(p_src);
NULL_PARAM_CHECK(p_dest);
MODULE_ID_RANGE_CHECK(p_dest);
BLOCK_ID_RANGE_CHECK(p_dest);
SIZE_CHECK(p_dest, size);
OFFSET_CHECK(p_dest, offset,size);
// Verify word alignment.
if ((!is_word_aligned(p_src)) || (!is_word_aligned((void *)(uint32_t)offset)))
{
return NRF_ERROR_INVALID_ADDR;
}
if ((!is_word_aligned((uint32_t *)p_dest->block_id)))
{
return NRF_ERROR_INVALID_ADDR;
}
return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset);
}
示例8: pm_peer_id_get
ret_code_t pm_peer_id_get(uint16_t conn_handle, pm_peer_id_t * p_peer_id)
{
VERIFY_MODULE_INITIALIZED();
VERIFY_PARAM_NOT_NULL(p_peer_id);
*p_peer_id = im_peer_id_get_by_conn_handle(conn_handle);
return NRF_SUCCESS;
}
示例9: pm_peers_delete
ret_code_t pm_peers_delete(void)
{
VERIFY_MODULE_INITIALIZED();
m_deleting_all = true;
pm_peer_id_t current_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID);
if (current_peer_id == PM_PEER_ID_INVALID)
{
// No peers bonded.
m_deleting_all = false;
pm_evt_t pm_delete_all_evt;
memset(&pm_delete_all_evt, 0, sizeof(pm_evt_t));
pm_delete_all_evt.evt_id = PM_EVT_PEERS_DELETE_SUCCEEDED;
pm_delete_all_evt.peer_id = PM_PEER_ID_INVALID;
pm_delete_all_evt.conn_handle = BLE_CONN_HANDLE_INVALID;
evt_send(&pm_delete_all_evt);
}
while (current_peer_id != PM_PEER_ID_INVALID)
{
ret_code_t err_code = pm_peer_delete(current_peer_id);
if (err_code != NRF_SUCCESS)
{
return NRF_ERROR_INTERNAL;
}
current_peer_id = pdb_next_peer_id_get(current_peer_id);
}
return NRF_SUCCESS;
}
示例10: pm_peer_data_load
ret_code_t pm_peer_data_load(pm_peer_id_t peer_id,
pm_peer_data_id_t data_id,
void * p_data,
uint16_t * p_length)
{
VERIFY_MODULE_INITIALIZED();
VERIFY_PARAM_NOT_NULL(p_data);
VERIFY_PARAM_NOT_NULL(p_length);
if (ALIGN_NUM(4, *p_length) != *p_length)
{
return NRF_ERROR_INVALID_PARAM;
}
pm_peer_data_t peer_data;
memset(&peer_data, 0, sizeof(peer_data));
peer_data.length_words = BYTES_TO_WORDS(*p_length);
peer_data.data_id = data_id;
peer_data.p_all_data = p_data;
ret_code_t err_code = pdb_peer_data_load(peer_id, data_id, &peer_data);
*p_length = peer_data.length_words * BYTES_PER_WORD;
return err_code;
}
示例11: pds_peer_data_write_prepare
ret_code_t pds_peer_data_write_prepare(pm_peer_data_const_t const * p_peer_data,
pm_prepare_token_t * p_prepare_token)
{
ret_code_t retval;
VERIFY_MODULE_INITIALIZED();
VERIFY_PARAM_NOT_NULL(p_peer_data);
VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id);
//VERIFY_PARAM_NOT_NULL(p_prepare_token); redundant, see fds_reserve().
retval = fds_reserve((fds_reserve_token_t*)p_prepare_token, p_peer_data->length_words);
switch (retval)
{
case FDS_SUCCESS:
return NRF_SUCCESS;
case FDS_ERR_NULL_ARG:
return NRF_ERROR_NULL;
case FDS_ERR_RECORD_TOO_LARGE:
return NRF_ERROR_INVALID_LENGTH;
case FDS_ERR_NO_SPACE_IN_FLASH:
return NRF_ERROR_NO_MEM;
default:
return NRF_ERROR_INTERNAL;
}
}
示例12: app_timer_stop_all
uint32_t app_timer_stop_all(void)
{
// Check state
VERIFY_MODULE_INITIALIZED();
return timer_stop_op_schedule(NULL, TIMER_USER_OP_TYPE_STOP_ALL);
}
示例13: app_timer_create
uint32_t app_timer_create(app_timer_id_t const * p_timer_id,
app_timer_mode_t mode,
app_timer_timeout_handler_t timeout_handler)
{
// Check state and parameters
VERIFY_MODULE_INITIALIZED();
if (timeout_handler == NULL)
{
return NRF_ERROR_INVALID_PARAM;
}
if (p_timer_id == NULL)
{
return NRF_ERROR_INVALID_PARAM;
}
if (((timer_node_t*)*p_timer_id)->is_running)
{
return NRF_ERROR_INVALID_STATE;
}
timer_node_t * p_node = (timer_node_t *)*p_timer_id;
p_node->is_running = false;
p_node->mode = mode;
p_node->p_timeout_handler = timeout_handler;
return NRF_SUCCESS;
}
示例14: app_timer_start
uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context)
{
uint32_t timeout_periodic;
timer_node_t * p_node = (timer_node_t*)timer_id;
// Check state and parameters
VERIFY_MODULE_INITIALIZED();
if (timer_id == 0)
{
return NRF_ERROR_INVALID_STATE;
}
if (timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS)
{
return NRF_ERROR_INVALID_PARAM;
}
if (p_node->p_timeout_handler == NULL)
{
return NRF_ERROR_INVALID_STATE;
}
// Schedule timer start operation
timeout_periodic = (p_node->mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0;
return timer_start_op_schedule(p_node,
timeout_ticks,
timeout_periodic,
p_context);
}
示例15: pdb_write_buf_store_prepare
ret_code_t pdb_write_buf_store_prepare(pm_peer_id_t peer_id, pm_peer_data_id_t data_id)
{
VERIFY_MODULE_INITIALIZED();
ret_code_t err_code = NRF_SUCCESS;
pdb_buffer_record_t * p_write_buffer_record;
p_write_buffer_record = write_buffer_record_find(peer_id, data_id);
if (p_write_buffer_record == NULL)
{
return NRF_ERROR_NOT_FOUND;
}
if (p_write_buffer_record->prepare_token == PDS_PREPARE_TOKEN_INVALID)
{
uint8_t * p_buffer_memory = pm_buffer_ptr_get(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id);
pm_peer_data_const_t peer_data = {.data_type = data_id};
if (p_buffer_memory == NULL)
{
return NRF_ERROR_INTERNAL;
}
peer_data_const_point_to_buffer(&peer_data, data_id, p_buffer_memory, p_write_buffer_record->n_bufs);
err_code = pds_peer_data_write_prepare(&peer_data, &p_write_buffer_record->prepare_token);
if (err_code == NRF_ERROR_INVALID_LENGTH)
{
return NRF_ERROR_INTERNAL;
}
}