• 大小: 1.46MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-09-15
  • 语言: 其他
  • 标签: Nordic  

资源简介

基于Nordic蓝牙芯片的智能手环端源码。功能包含计步、统计心率等。

资源截图

代码片段和文件信息

/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
 *
 * The information contained herein is property of Nordic Semiconductor ASA.
 * Terms and conditions of usage are described in detail in NORDIC
 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
 *
 * Licensees are granted free non-transferable use of the information. NO
 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
 * the file.
 *
 */

#include “app_button.h“
#include 
#include “nordic_common.h“
#include “app_util.h“
#include “app_gpiote.h“
#include “app_timer.h“
#include “app_error.h“


static app_button_cfg_t *             mp_buttons = NULL;           /**< Button configuration. */
static uint8_t                        m_button_count;              /**< Number of configured buttons. */
static uint32_t                       m_active_low_states_mask;    /**< Mask representing buttons which are active low. */
static uint32_t                       m_active_high_states_mask;   /**< Mask representing buttons which are active high. */
static uint32_t                       m_detection_delay;           /**< Delay before a button is reported as pushed. */
static app_button_evt_schedule_func_t m_evt_schedule_func;         /**< Pointer to function for propagating button events to the scheduler. */
static app_gpiote_user_id_t           m_gpiote_user_id;            /**< GPIOTE user id for buttons module. */
static app_timer_id_t                 m_detection_delay_timer_id;  /**< Polling timer id. */


/**@brief Function for executing the application button handler for specified button.
 *
 * @param[in]  p_btn   Button that has been pushed.
 */
static void button_handler_execute(app_button_cfg_t * p_btn)
{
    if (m_evt_schedule_func != NULL)
    {
        uint32_t err_code = m_evt_schedule_func(p_btn->button_handler p_btn->pin_no);
        APP_ERROR_CHECK(err_code);
    }
    else
    {
        p_btn->button_handler(p_btn->pin_no);
    }
}


/**@brief Function for handling the timeout that delays reporting buttons as pushed.
 *
 * @details    The detection_delay_timeout_handler(...) is a call-back issued from the app_timer
 *             module. It is called with the p_context parameter. The p_context parameter is
 *             provided to the app_timer module when a timer is started using the call
 *             @ref app_timer_start. On @ref app_timer_start the p_context will be holding the
 *             currently pressed buttons.
 *
 * @param[in]  p_context   Pointer used for passing information app_start_timer() was called.
 *                         In the app_button module the p_context holds information on pressed
 *                         buttons.
 */
static void detection_delay_timeout_handler(void * p_context)
{
    uint32_t err_code;
    uint32_t event_pins_mask;
    uint32_t current_state_pins;
    uint32_t active_pins         = 0;

    // Get state of pins when timer was started.
    event_pins_mask = (uint32_t)p_context;
    
    // 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-07-29 10:17  wrist-rom-master code\
     目录           0  2014-07-29 10:17  wrist-rom-master code\wrist-rom-master\
     文件         109  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\.gitignore
     文件       11325  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\LICENSE
     目录           0  2014-07-29 10:17  wrist-rom-master code\wrist-rom-master\nrf51822\
     目录           0  2014-07-29 10:17  wrist-rom-master code\wrist-rom-master\nrf51822\Include\
     目录           0  2014-07-29 10:17  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\
     文件        8188  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\app_button.h
     文件        2931  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\app_error.h
     文件        3277  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\app_fifo.h
     文件        7989  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\app_gpiote.h
     文件        6158  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\app_scheduler.h
     文件       15908  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\app_timer.h
     文件       20082  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\app_uart.h
     文件       17069  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\app_util.h
     文件        1366  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\crc16.h
     文件        5008  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\hci_mem_pool.h
     文件         832  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\hci_mem_pool_internal.h
     文件        5993  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\hci_slip.h
     文件        9518  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\app_common\hci_transport.h
     目录           0  2014-07-29 10:17  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\
     文件        5234  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_advdata.h
     文件       16859  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_bondmngr.h
     文件        5730  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_conn_params.h
     文件        2185  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_date_time.h
     文件        2448  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_debug_assert_handler.h
     文件        7053  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_dtm.h
     文件        4175  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_error_log.h
     文件        1595  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_eval_board_pins.h
     文件        7032  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_flash.h
     文件        5668  2014-02-13 08:02  wrist-rom-master code\wrist-rom-master\nrf51822\Include\ble\ble_racp.h
............此处省略300个文件信息

评论

共有 条评论