BLE Heart Rate Service Application Implementations.
Copyright (c) 2021 Microchip Technology Inc. and its subsidiaries.
#include "heart_rate_app.h"
#include "ble_manager.h"
#include "heart_rate.h"
#include <asf.h>
#include "driver/include/m2m_wifi.h"
#include "driver/include/m2m_periph.h"
#include "common/include/nm_common.h"
#include "m2m_ble.h"
#include "at_ble_api.h"
#include "wifi_prov.h"
#include "hr_sensor.h"
Macros | |
#define | APP_BTN_EVENT_BTN1_LONG_PRESS 2 |
#define | APP_BTN_EVENT_BTN1_SHORT_PRESS 1 |
#define | APP_BTN_EVENT_BTN2_LONG_PRESS 8 |
#define | APP_BTN_EVENT_BTN2_SHORT_PRESS 4 |
#define | APP_STATE_COMPLETE 6 |
#define | APP_STATE_IDLE 0 |
#define | APP_STATE_PROVISIONING 2 |
#define | APP_STATE_WAITING_FOR_BUTTON_PRESS 3 |
#define | APP_STATE_WAITING_FOR_PROFILE_SWITCH 5 |
#define | APP_STATE_WAITING_FOR_WIFI_CONNECTION 4 |
#define | APP_STATE_WAITING_FOR_WIFI_DISCONNECTION 1 |
#define | APP_WIFI_PROV_DISPLAY_NAME ("3400 DEMO") |
#define | HEX2ASCII(x) (((x)>=10)? (((x)-10)+'A') : ((x)+'0')) |
#define | STRING_HEADER |
Functions | |
static at_ble_event_parameter_t gu8BleParam | __aligned (4) |
static void | app_ble_heart_rate (void) |
static void | app_button_press_callback (uint8 btn, uint8 press) |
static void | app_main (void) |
static void | app_wifi_handle_event (uint8 u8MsgType, void *pvMsg) |
static void | app_wifi_init (tpfAppWifiCb wifi_cb_func) |
void | ble_heart_rate_init (void) |
static void | ble_heart_rate_process (void) |
void | ble_heart_rate_process_event (at_ble_events_t event, at_ble_event_parameter_t *params) |
static void | configure_console (void) |
int | main (void) |
uint32 | nmi_inet_addr (char *pcIpAddr) |
Variables | |
static volatile uint8 | gu8BtnEvent |
static uint8 | gu8ScanIndex |
static volatile uint8 | gu8WiFiConnectionState = M2M_WIFI_DISCONNECTED |
uint16_t | rr_interval_value = RR_VALUE_MIN |
#define APP_BTN_EVENT_BTN1_LONG_PRESS 2 |
Referenced by app_button_press_callback().
#define APP_BTN_EVENT_BTN1_SHORT_PRESS 1 |
Referenced by app_button_press_callback().
#define APP_BTN_EVENT_BTN2_LONG_PRESS 8 |
Referenced by app_button_press_callback().
#define APP_BTN_EVENT_BTN2_SHORT_PRESS 4 |
Referenced by app_button_press_callback().
#define APP_STATE_COMPLETE 6 |
#define APP_STATE_IDLE 0 |
#define APP_STATE_PROVISIONING 2 |
#define APP_STATE_WAITING_FOR_BUTTON_PRESS 3 |
#define APP_STATE_WAITING_FOR_PROFILE_SWITCH 5 |
#define APP_STATE_WAITING_FOR_WIFI_CONNECTION 4 |
#define APP_STATE_WAITING_FOR_WIFI_DISCONNECTION 1 |
#define APP_WIFI_PROV_DISPLAY_NAME ("3400 DEMO") |
#define HEX2ASCII | ( | x | ) | (((x)>=10)? (((x)-10)+'A') : ((x)+'0')) |
Referenced by app_wifi_init().
#define STRING_HEADER |
Referenced by main().
|
static |
|
static |
References AT_BLE_SUCCESS, ble_heart_rate_init(), ble_heart_rate_process_event(), m2m_ble_event_get(), and m2m_ble_init().
Referenced by app_main().
References APP_BTN_EVENT_BTN1_LONG_PRESS, APP_BTN_EVENT_BTN1_SHORT_PRESS, APP_BTN_EVENT_BTN2_LONG_PRESS, APP_BTN_EVENT_BTN2_SHORT_PRESS, gu8BtnEvent, SW1, and SW2.
Referenced by app_main().
|
static |
References app_ble_heart_rate(), app_button_press_callback(), app_wifi_handle_event(), app_wifi_init(), and nm_bsp_btn_init().
Referenced by main().
|
static |
References ble_prov_scan_result(), gu8ScanIndex, gu8WiFiConnectionState, M2M_ERR, M2M_INFO, M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, m2m_wifi_get_num_ap_found(), M2M_WIFI_REQ_DHCP_CONF, m2m_wifi_req_scan_result(), M2M_WIFI_RESP_CON_STATE_CHANGED, M2M_WIFI_RESP_CURRENT_RSSI, M2M_WIFI_RESP_SCAN_DONE, M2M_WIFI_RESP_SCAN_RESULT, M2M_WIFI_RESP_SET_GAIN_TABLE, NM_BSP_TIME_MSEC, tstrM2MGainTableRsp::s8ErrorCode, tstrM2MIPConfig::u32StaticIP, tstrM2mWifiStateChanged::u8CurrState, and tstrM2mScanDone::u8NumofCh.
Referenced by app_main().
|
static |
References tstrEthInitParam::au8ethRcvBuf, HEX2ASCII, m2m_ble_wifi_init(), M2M_DEVICE_NAME, M2M_ERR, M2M_INFO, M2M_LISTEN_INTERVAL, m2m_memset(), M2M_NO_PS, m2m_periph_pullup_ctrl(), M2M_PERIPH_PULLUP_DIS_HOST_WAKEUP, M2M_PERIPH_PULLUP_DIS_SD_CMD_SPI_SCK, M2M_PERIPH_PULLUP_DIS_SD_DAT0_SPI_TXD, M2M_PS_DEEP_AUTOMATIC, M2M_PS_MANUAL, m2m_strlen(), M2M_SUCCESS, m2m_wifi_get_mac_address(), m2m_wifi_get_otp_mac_address(), m2m_wifi_set_device_name(), m2m_wifi_set_lsn_int(), m2m_wifi_set_mac_address(), m2m_wifi_set_sleep_mode(), MAC_ADDRESS, tstrEthInitParam::pfAppEthCb, tstrWifiInitParam::pfAppWifiCb, tstrWifiInitParam::strEthInitParam, tstrEthInitParam::u16ethRcvBufSize, and tstrM2mLsnInt::u16LsnInt.
Referenced by app_main().
void ble_heart_rate_init | ( | void | ) |
References ble_device_init(), ble_heart_rate_profile_init(), and NULL.
Referenced by app_ble_heart_rate().
|
static |
References activity, ACTIVITY_BRISK_WALKING, ACTIVITY_FAST_RUNNING, ACTIVITY_NORMAL, ACTIVITY_RUNNING, ACTIVITY_WALKING, DBG_LOG, DBG_LOG_CONT, ENERGY_EXPENDED_FIELD_PRESENT, energy_expended_val, energy_inclusion, energy_incrementor, ENERGY_RESET, HEART_RATE_INCREMENT_VALUE, heart_rate_send_notification(), heart_rate_value, HR_CHAR_VALUE_LEN, inc_changer, rr_interval_value, RR_INTERVAL_VALUE_PRESENT, RR_VALUE_MAX, RR_VALUE_MIN, second_counter, and timer_cb_done.
Referenced by ble_heart_rate_process_event().
void ble_heart_rate_process_event | ( | at_ble_events_t | event, |
at_ble_event_parameter_t * | params | ||
) |
References AT_BLE_UNDEFINED_EVENT, ble_event_manager(), and ble_heart_rate_process().
Referenced by app_ble_heart_rate().
|
static |
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, CONSOLE_UART_ID, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
References app_main(), board_init(), configure_console(), F_CPU, nm_bsp_app_init(), nm_bsp_init(), STRING_HEADER, and sysclk_init().
uint32 nmi_inet_addr | ( | char * | pcIpAddr | ) |
Synchronous function which returns a BSD socket compliant Internet Protocol (IPv4) socket address. This IPv4 address in the input string parameter could either be specified as a hostname, or as a numeric string representation like n.n.n.n known as the IPv4 dotted-decimal format (i.e. "192.168.10.1"). This function is used whenever an ip address needs to be set in the proper format (i.e. for the @ref tstrM2MIPConfig structure).
[in] | pcIpAddr | A null terminated string containing the IP address in IPv4 dotted-decimal address. |
|
static |
Referenced by app_button_press_callback().
|
static |
Referenced by app_wifi_handle_event().
|
static |
Referenced by app_wifi_handle_event().
uint16_t rr_interval_value = RR_VALUE_MIN |
to count the rr interval value
Referenced by ble_heart_rate_process().