当前位置: 首页>>代码示例>>C++>>正文


C++ NRF_LOG_DEBUG函数代码示例

本文整理汇总了C++中NRF_LOG_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ NRF_LOG_DEBUG函数的具体用法?C++ NRF_LOG_DEBUG怎么用?C++ NRF_LOG_DEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NRF_LOG_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ser_sd_transport_rx_packet_handler

/**@brief Function for handling the rx packets comming from hal_transport.
 *
 * @details
 *  This function is called in serial peripheral interrupt context. Response packets are handled in
 *  this context. Events are passed to the application and it is up to application in which context
 *  they are handled.
 *
 * @param[in]   p_data   Pointer to received data.
 * @param[in]   length   Size of data.
 */
static void ser_sd_transport_rx_packet_handler(uint8_t * p_data, uint16_t length)
{
    if (p_data && (length >= SER_PKT_TYPE_SIZE))
    {
        const uint8_t packet_type = p_data[SER_PKT_TYPE_POS];
        p_data += SER_PKT_TYPE_SIZE;
        length -= SER_PKT_TYPE_SIZE;

        switch (packet_type)
        {
            case SER_PKT_TYPE_RESP:
            case SER_PKT_TYPE_DTM_RESP:
#ifdef ANT_STACK_SUPPORT_REQD
            case SER_PKT_TYPE_ANT_RESP:
#endif // ANT_STACK_SUPPORT_REQD
                if (m_rsp_wait)
                {
                    m_return_value = m_rsp_dec_handler(p_data, length);
                    (void)ser_sd_transport_rx_free(p_data);

                    /* Reset response flag - cmd_write function is pending on it.*/
                    m_rsp_wait = false;

                    /* If os handler is set, signal os that response has arrived.*/
                    if (m_os_rsp_set_handler)
                    {
                        m_os_rsp_set_handler();
                    }
                }
                else
                {
                    /* Unexpected packet. */
                    (void)ser_sd_transport_rx_free(p_data);
                    APP_ERROR_HANDLER(packet_type);
                }
                break;

#ifdef BLE_STACK_SUPPORT_REQD
            case SER_PKT_TYPE_EVT:
                /* It is ensured during opening that handler is not NULL. No check needed. */
                NRF_LOG_DEBUG("[EVT]: %s ", (uint32_t)ser_dbg_sd_evt_str_get(uint16_decode(&p_data[SER_EVT_ID_POS]))); // p_data points to EVT_ID
                m_ble_evt_handler(p_data, length);
                break;
#endif // BLE_STACK_SUPPORT_REQD

#ifdef ANT_STACK_SUPPORT_REQD
            case SER_PKT_TYPE_ANT_EVT:
                /* It is ensured during opening that handler is not NULL. No check needed. */
                NRF_LOG_DEBUG("[ANT_EVT_ID]: %s ", (uint32_t)ser_dbg_sd_evt_str_get(uint16_decode(&p_data[SER_EVT_ID_POS]))); // p_data points to EVT_ID
                m_ant_evt_handler(p_data, length);
                break;
#endif // ANT_STACK_SUPPORT_REQD

            default:
                (void)ser_sd_transport_rx_free(p_data);
                APP_ERROR_HANDLER(packet_type);
                break;
        }
    }
}
开发者ID:kiibohd,项目名称:controller,代码行数:70,代码来源:ser_sd_transport.c

示例2: nrf_free

void nrf_free(void * p_mem)
{
    VERIFY_MODULE_INITIALIZED_VOID();
    NULL_PARAM_CHECK_VOID(p_mem);

    NRF_LOG_DEBUG("[MM]: >> nrf_free %p.\r\n", (uint32_t)p_mem);

    MM_MUTEX_LOCK();

    uint32_t index;
    uint32_t memory_index = 0;

    for (index = 0; index < TOTAL_BLOCK_COUNT; index++)
    {
        if (&m_memory[memory_index] == p_mem)
        {
            // Found a free block of memory, assign.
            NRF_LOG_DEBUG("[MM]: << Freeing block %d.\r\n", index);
            block_init(index);
            break;
        }
        memory_index += get_block_size(index);
    }

    MM_MUTEX_UNLOCK();

    NRF_LOG_DEBUG("[MM]: << nrf_free.\r\n");
    return;
}
开发者ID:nkolban,项目名称:Espruino,代码行数:29,代码来源:mem_manager.c

示例3: nrf_mem_init

uint32_t nrf_mem_init(void)
{
    NRF_LOG_DEBUG("[MM]: >> nrf_mem_init.\r\n");

    SDK_MUTEX_INIT(m_mm_mutex);

    MM_MUTEX_LOCK();

    uint32_t block_index = 0;

    for (block_index = 0; block_index < TOTAL_BLOCK_COUNT; block_index++)
    {
        block_init(block_index);
    }

#if (MEM_MANAGER_DISABLE_API_PARAM_CHECK == 0)
    m_module_initialized = true;
#endif // MEM_MANAGER_DISABLE_API_PARAM_CHECK

#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
    nrf_mem_diagnose();
#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS

    MM_MUTEX_UNLOCK();

    NRF_LOG_DEBUG("[MM]: << nrf_mem_init.\r\n");

    return NRF_SUCCESS;
}
开发者ID:nkolban,项目名称:Espruino,代码行数:29,代码来源:mem_manager.c

示例4: nrf_dfu_settings_write

ret_code_t nrf_dfu_settings_write(dfu_flash_callback_t callback)
{
    ret_code_t err_code;
    NRF_LOG_DEBUG("Writing settings...");
    NRF_LOG_DEBUG("Erasing old settings at: 0x%08x", (uint32_t)m_dfu_settings_buffer);

    // Not setting the callback function because ERASE is required before STORE
    // Only report completion on successful STORE.
    err_code = nrf_dfu_flash_erase((uint32_t)m_dfu_settings_buffer, 1, NULL);

    if (err_code != NRF_SUCCESS)
    {
        NRF_LOG_ERROR("Could not erase the settings page!");
        return NRF_ERROR_INTERNAL;
    }

    s_dfu_settings.crc = nrf_dfu_settings_crc_get();

    static nrf_dfu_settings_t temp_dfu_settings;
    memcpy(&temp_dfu_settings, &s_dfu_settings, sizeof(nrf_dfu_settings_t));

    err_code = nrf_dfu_flash_store((uint32_t)m_dfu_settings_buffer,
                                   &temp_dfu_settings,
                                   sizeof(nrf_dfu_settings_t),
                                   callback);

    if (err_code != NRF_SUCCESS)
    {
        NRF_LOG_ERROR("Could not write the DFU settings page!");
        return NRF_ERROR_INTERNAL;
    }

    return NRF_SUCCESS;
}
开发者ID:petersonev,项目名称:keyboard,代码行数:34,代码来源:nrf_dfu_settings.c

示例5: nrf_bootloader_app_start

void nrf_bootloader_app_start(void)
{
    uint32_t start_addr = MBR_SIZE; // Always boot from end of MBR. If a SoftDevice is present, it will boot the app.
    NRF_LOG_DEBUG("Running nrf_bootloader_app_start with address: 0x%08x", start_addr);
    uint32_t err_code;

    // Disable and clear interrupts
    // Notice that this disables only 'external' interrupts (positive IRQn).
    NRF_LOG_DEBUG("Disabling interrupts. NVIC->ICER[0]: 0x%x", NVIC->ICER[0]);

    NVIC->ICER[0]=0xFFFFFFFF;
    NVIC->ICPR[0]=0xFFFFFFFF;
#if defined(__NRF_NVIC_ISER_COUNT) && __NRF_NVIC_ISER_COUNT == 2
    NVIC->ICER[1]=0xFFFFFFFF;
    NVIC->ICPR[1]=0xFFFFFFFF;
#endif

    err_code = nrf_dfu_mbr_irq_forward_address_set();
    if (err_code != NRF_SUCCESS)
    {
        NRF_LOG_ERROR("Failed running nrf_dfu_mbr_irq_forward_address_set()");
    }

    NRF_LOG_FLUSH();
    nrf_bootloader_app_start_final(start_addr);
}
开发者ID:kiibohd,项目名称:controller,代码行数:26,代码来源:nrf_bootloader_app_start.c

示例6: on_write

/**@brief Function for handling the Write event.
 *
 * @param[in] p_si7021  si7021 Service structure.
 * @param[in] p_ble_evt  Event received from the BLE stack.
 */
static void on_write(ble_si7021_t * p_si7021, ble_evt_t * p_ble_evt) {
    ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;

	NRF_LOG_DEBUG("on_write %x\n\r",p_evt_write->handle);
    if (p_evt_write->handle == p_si7021->value_char_handles.cccd_handle) {
        if (p_evt_write->len == 2 && p_si7021->evt_handler != NULL) {
        	ble_si7021_evt_t evt;

            if (ble_srv_is_notification_enabled(p_evt_write->data)) {
                evt.evt_type = BLE_si7021_EVT_NOTIFICATION_ENABLED;
            	NRF_LOG_DEBUG("BLE_si7021_EVT_NOTIFICATION_ENABLED\n\r");
            } else {
                evt.evt_type = BLE_si7021_EVT_NOTIFICATION_DISABLED;
            	NRF_LOG_DEBUG("BLE_si7021_EVT_NOTIFICATION_DISABLED\n\r");
            }
            p_si7021->evt_handler(p_si7021, &evt);
        }
    } else if (p_evt_write->handle == p_si7021->com_char_handles.value_handle) {
    	p_si7021->interval = uint16_decode(&p_evt_write->data[0]);
    	if (p_si7021->interval<100) {
    		p_si7021->interval=100; // min 100ms
    	}
    	ble_si7021_evt_t evt;
    	evt.evt_type = BLE_si7021_EVT_INTERVAL_CHANGE;
    	NRF_LOG_DEBUG("BLE_si7021_EVT_INTERVAL_CHANGE %d\n\r",p_si7021->interval);
        p_si7021->evt_handler(p_si7021, &evt);
	} else {
			// No implementation needed.
	}
}
开发者ID:pcbreflux,项目名称:nordic,代码行数:35,代码来源:ble_si7021.c

示例7: nrf_bootloader_app_start

void nrf_bootloader_app_start(uint32_t start_addr)
{
    NRF_LOG_DEBUG("Running nrf_bootloader_app_start with address: 0x%08x", start_addr);
    uint32_t err_code;

    //NRF_LOG_INFO("Initializing SD in mbr");
    err_code = nrf_dfu_mbr_init_sd();
    if (err_code != NRF_SUCCESS)
    {
        NRF_LOG_ERROR("Failed running nrf_dfu_mbr_init_sd");
        return;
    }

    // Disable and clear interrupts
    NRF_LOG_DEBUG("Disabling interrupts");

    NVIC->ICER[0]=0xFFFFFFFF;
    NVIC->ICPR[0]=0xFFFFFFFF;
#if defined(__NRF_NVIC_ISER_COUNT) && __NRF_NVIC_ISER_COUNT == 2
    NVIC->ICER[1]=0xFFFFFFFF;
    NVIC->ICPR[1]=0xFFFFFFFF;
#endif

    // Set the sd softdevice vector table base address
    NRF_LOG_DEBUG("Setting SD vector table base: 0x%08x", start_addr);
    err_code = sd_softdevice_vector_table_base_set(start_addr);
    if (err_code != NRF_SUCCESS)
    {
        NRF_LOG_ERROR("Failed running sd_softdevice_vector_table_base_set");
        return;
    }

    // Run application
    nrf_bootloader_app_start_impl(start_addr);
}
开发者ID:petersonev,项目名称:keyboard,代码行数:35,代码来源:nrf_bootloader_app_start.c

示例8: mpulib_orient_cb

static void mpulib_orient_cb(unsigned char orientation)
{
	BleSrvcCharNotify(GetImuSrvcInstance(), 2, &orientation, 1);

/*    if (m_motion.features & DRV_MOTION_FEATURE_MASK_ORIENTATION)
    {
        drv_motion_evt_t evt     = DRV_MOTION_EVT_ORIENTATION;

        m_motion.evt_handler(&evt, &orientation, 1);
    }
*/
    #ifdef MOTION_DEBUG
        switch (orientation)
        {
            case ANDROID_ORIENT_PORTRAIT:
                NRF_LOG_DEBUG("Portrait\r\n");
                break;
            case ANDROID_ORIENT_LANDSCAPE:
                NRF_LOG_DEBUG("Landscape\r\n");
                break;
            case ANDROID_ORIENT_REVERSE_PORTRAIT:
                NRF_LOG_DEBUG("Reverse Portrait\r\n");
                break;
            case ANDROID_ORIENT_REVERSE_LANDSCAPE:
                NRF_LOG_DEBUG("Reverse Landscape\r\n");
                break;
            default:
                return;
        }
    #endif
}
开发者ID:I-SYST,项目名称:EHAL,代码行数:31,代码来源:BlueIOMPU9250.cpp

示例9: lis2dh12_read_register

/**
 * Read registers
 *
 * Read one or more registers from the sensor
 *
 * @param[in] address Start address to read from
 * @param[out] p_toRead Pointer to result buffer
 * @param[in] cound Number of bytes to read
 *
 * @return LIS2DH12_RET_OK No Error
 * @return LIS2DH12_RET_NULL Result buffer is NULL Pointer
 * @return LIS2DH12_RET_ERROR Read attempt was not successful
 */
lis2dh12_ret_t lis2dh12_read_register(const uint8_t address, uint8_t* const p_toRead, const size_t count)
{
    NRF_LOG_DEBUG("LIS2DH12 Register read started'\r\n");
    lis2dh12_ret_t err_code = LIS2DH12_RET_OK;
    uint8_t* write_buffer   = calloc(count+1, sizeof(uint8_t));
    //Separate buffer to read data, includes room for response to address byte. 
    //This is pretty ineficient, TODO
    uint8_t* read_buffer    = calloc(count+1, sizeof(uint8_t));

    if (NULL == p_toRead)
    {
        err_code |= LIS2DH12_RET_NULL;
    }
    else
    {
        write_buffer[0] = address | SPI_READ | SPI_ADR_INC;
        err_code |= spi_transfer_lis2dh12(write_buffer, (count + 1U), read_buffer);

        if (SPI_RET_OK == (SPI_Ret)err_code)
        {
            /* Transfer was ok, copy result */
            memcpy(p_toRead, &(read_buffer[1]), count);
        }
    }
    NRF_LOG_DEBUG("LIS2DH12 Register read complete'\r\n");
    free(read_buffer);
    free(write_buffer);
    return err_code;
}
开发者ID:ruuvi,项目名称:ruuvitag_fw,代码行数:42,代码来源:lis2dh12.c

示例10: nrf_esb_event_handler

void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)
{
    switch (p_event->evt_id)
    {
        case NRF_ESB_EVENT_TX_SUCCESS:
            NRF_LOG_DEBUG("TX SUCCESS EVENT\r\n");
            break;
        case NRF_ESB_EVENT_TX_FAILED:
            NRF_LOG_DEBUG("TX FAILED EVENT\r\n");
            (void) nrf_esb_flush_tx();
            (void) nrf_esb_start_tx();
            break;
        case NRF_ESB_EVENT_RX_RECEIVED:
            NRF_LOG_DEBUG("RX RECEIVED EVENT\r\n");
            while (nrf_esb_read_rx_payload(&rx_payload) == NRF_SUCCESS)
            {
                if (rx_payload.length > 0)
                {
                    NRF_LOG_DEBUG("RX RECEIVED PAYLOAD\r\n");
                }
            }
            break;
    }
    NRF_GPIO->OUTCLR = 0xFUL << 12;
    NRF_GPIO->OUTSET = (p_event->tx_attempts & 0x0F) << 12;
}
开发者ID:lyncxy119,项目名称:Sentry,代码行数:26,代码来源:main.c

示例11: tx_buffer_process

/**@brief Function for passing any pending request from the buffer to the stack.
 */
static void tx_buffer_process(void)
{
    if (m_tx_index != m_tx_insert_index)
    {
        uint32_t err_code;

        if (m_tx_buffer[m_tx_index].type == READ_REQ)
        {
            err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle,
                                         m_tx_buffer[m_tx_index].req.read_handle,
                                         0);
        }
        else
        {
            err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle,
                                          &m_tx_buffer[m_tx_index].req.write_req.gattc_params);
        }
        if (err_code == NRF_SUCCESS)
        {
            NRF_LOG_DEBUG("SD Read/Write API returns Success..\r\n");
            m_tx_index++;
            m_tx_index &= TX_BUFFER_MASK;
        }
        else
        {
            NRF_LOG_DEBUG("SD Read/Write API returns error. This message sending will be "
                "attempted again..\r\n");
        }
    }
}
开发者ID:CWBudde,项目名称:Espruino,代码行数:32,代码来源:ble_bas_c.c

示例12: attr_id_parse

/**@brief Function for parsing the id of an iOS attribute.
 *        Used in the @ref parse_get_notif_attrs_response state machine.
 *
 * @details We only request attributes that are registered with @ref ble_ancs_c_attr_add
 *          once they have been reveiced we stop parsing.
 *
 * @param[in] p_ancs     Pointer to an ANCS instance to which the event belongs.
 * @param[in] p_data_src Pointer to data that was received from the Notification Provider.
 * @param[in] index      Pointer to an index that helps us keep track of the current data to be parsed.
 *
 * @return The next parse state.
 */
static ble_ancs_c_parse_state_t attr_id_parse(ble_ancs_c_t  * p_ancs,
                                              const uint8_t * p_data_src,
                                              uint32_t      * index)
{
        p_ancs->evt.attr.attr_id     = p_data_src[(*index)++];

        if (p_ancs->evt.attr.attr_id >= p_ancs->parse_info.nb_of_attr)
        {
            NRF_LOG_DEBUG("Attribute ID Invalid.");
            return DONE;
        }
        p_ancs->evt.attr.p_attr_data = p_ancs->parse_info.p_attr_list[p_ancs->evt.attr.attr_id].p_attr_data;

        if (all_req_attrs_parsed(p_ancs))
        {
            NRF_LOG_DEBUG("All requested attributes received. ");
            return DONE;
        }
        else
        {
            if (attr_is_requested(p_ancs, p_ancs->evt.attr))
            {
                p_ancs->parse_info.expected_number_of_attrs--;
            }
            NRF_LOG_DEBUG("Attribute ID %i ", p_ancs->evt.attr.attr_id);
            return ATTR_LEN1;
        }
}
开发者ID:kiibohd,项目名称:controller,代码行数:40,代码来源:ancs_attr_parser.c

示例13: ble_evt_handler

/**@brief Function for handling BLE events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 * @param[in]   p_context   Unused.
 */
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code = NRF_SUCCESS;
		

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO("Disconnected.");
            // LED indication will be changed when advertising starts.
 

            break;

        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO("Connected.");
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
            err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
            APP_ERROR_CHECK(err_code);

            break;

        case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
        {
            NRF_LOG_DEBUG("PHY update request.");
            ble_gap_phys_t const phys =
            {
                .rx_phys = BLE_GAP_PHY_AUTO,
                .tx_phys = BLE_GAP_PHY_AUTO,
            };
            err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
            APP_ERROR_CHECK(err_code);
        } break;

        case BLE_GATTC_EVT_TIMEOUT:
            // Disconnect on GATT Client timeout event.
            NRF_LOG_DEBUG("GATT Client Timeout.");
            err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gattc_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GATTS_EVT_TIMEOUT:
            // Disconnect on GATT Server timeout event.
            NRF_LOG_DEBUG("GATT Server Timeout.");
            err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gatts_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break;

        default:
            // No implementation needed.
            break;
    }

		
}
开发者ID:NordicSemiconductor,项目名称:nrf5-ble-tutorial-characteristic,代码行数:64,代码来源:main.c

示例14: nrf_dfu_mbr_compare

uint32_t nrf_dfu_mbr_compare(uint32_t * p_ptr1, uint32_t * p_ptr2, uint32_t len)
{
    uint32_t ret_val;
    uint32_t const len_words = len / sizeof(uint32_t);

    sd_mbr_command_t command =
    {
        .command = SD_MBR_COMMAND_COMPARE,
        .params.compare.ptr1 = p_ptr1,
        .params.compare.ptr2 = p_ptr2,
        .params.compare.len = len_words
    };

    ret_val = sd_mbr_command(&command);

    return ret_val;
}


uint32_t nrf_dfu_mbr_vector_table_set(uint32_t address)
{
    uint32_t ret_val;

    NRF_LOG_DEBUG("running vector table set");
    sd_mbr_command_t command =
    {
        .command = SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET,
        .params.base_set.address = address,
    };

    ret_val = sd_mbr_command(&command);
    NRF_LOG_DEBUG("After running vector table set");

    return ret_val;
}


#ifndef SOFTDEVICE_PRESENT
uint32_t nrf_dfu_mbr_irq_forward_address_set(uint32_t address)
{
    uint32_t ret_val;

    NRF_LOG_DEBUG("running irq table set");
    sd_mbr_command_t command =
    {
        .command = SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET,
        .params.irq_forward_address_set.address = address,
    };

    ret_val = sd_mbr_command(&command);
    NRF_LOG_DEBUG("After running irq table set");

    return ret_val;
}
开发者ID:petersonev,项目名称:keyboard,代码行数:54,代码来源:nrf_dfu_mbr.c

示例15: on_disconnect

/**@brief Function for handling the Disconnect event.
 *
 * @param[in] p_si7021  si7021 Service structure.
 * @param[in] p_ble_evt  Event received from the BLE stack.
 */
static void on_disconnect(ble_si7021_t * p_si7021, ble_evt_t * p_ble_evt) {
    UNUSED_PARAMETER(p_ble_evt);
	NRF_LOG_DEBUG("on_disconnect\n\r");
    p_si7021->conn_handle = BLE_CONN_HANDLE_INVALID;
    if (p_si7021->evt_handler != NULL) {
    	ble_si7021_evt_t evt;
        evt.evt_type = BLE_si7021_EVT_DISCONNECTED;
        p_si7021->evt_handler(p_si7021, &evt);
    }
	NRF_LOG_DEBUG("on_disconnect %x\n\r",p_si7021->conn_handle);
}
开发者ID:pcbreflux,项目名称:nordic,代码行数:16,代码来源:ble_si7021.c


注:本文中的NRF_LOG_DEBUG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。