Microchip® Advanced Software Framework

hr_sensor.c File Reference

Heart Rate Sensor Profile.

Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.

#include "ble_manager.h"
#include "heart_rate.h"
#include "common/include/nm_common.h"
#include <asf.h>
#include "at_ble_api.h"
#include "hr_sensor.h"

Functions

void ble_heart_rate_handle_disconnect_event (at_ble_handle_t conn_handle)
 
void ble_heart_rate_handle_paired_event (at_ble_handle_t conn_handle)
 
static void ble_heart_rate_handle_timer_event (void)
 
void ble_heart_rate_profile_init (void)
 hr_sensor_init initializes and defines the services of the hr profile More...
 
at_ble_status_t ble_heart_rate_start_advertise (void)
 
static void ble_heart_rate_value_init (void)
 
void heart_rate_send_notification (uint8_t *char_data, uint8_t length)
 

Variables

uint8_t activity = 0
 
uint16_t energy_expended_val = ENERGY_EXP_NORMAL
 
uint8_t energy_inclusion = 0
 
uint16_t energy_incrementor
 
static gatt_service_handler_t heart_rate_serv_handler
 
uint16_t heart_rate_value = HEART_RATE_MIN_NORM
 
uint8_t hr_max_value
 
uint8_t hr_min_value
 
uint8_t inc_changer = HEART_RATE_INCREMENT_VALUE
 
uint8_t notification_flag = 0
 
uint8_t prev_activity = DEFAULT_ACTIVITY
 
static const uint8_t SCAN_RESP_DATA [SCAN_RESP_LEN] = {0x09,0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8}
 Scan response data. More...
 
uint8_t second_counter = 0
 
uint8_t time_operator
 
bool volatile timer_cb_done = false
 

void heart_rate_send_notification ( uint8_t *  char_data,
uint8_t  length 
)

uint8_t activity = 0
uint16_t energy_expended_val = ENERGY_EXP_NORMAL

to count the energy expended

Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_process().

uint8_t energy_inclusion = 0

To check for including the energy in hr measurement

Referenced by ble_heart_rate_handle_disconnect_event(), and ble_heart_rate_process().

uint16_t energy_incrementor

energy incrementor for various heart rate values

Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().

gatt_service_handler_t heart_rate_serv_handler
static
uint16_t heart_rate_value = HEART_RATE_MIN_NORM

to count the heart rate value

Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().

uint8_t hr_max_value

the maximum heart rate value

Referenced by ble_heart_rate_value_init().

uint8_t hr_min_value

the minimum heart rate value

Referenced by ble_heart_rate_value_init().

uint8_t inc_changer = HEART_RATE_INCREMENT_VALUE

increment operator to change heart rate

Referenced by ble_heart_rate_process(), and ble_heart_rate_value_init().

uint8_t notification_flag = 0

flag to show notification

Referenced by ble_heart_rate_handle_timer_event().

uint8_t prev_activity = DEFAULT_ACTIVITY
const uint8_t SCAN_RESP_DATA[SCAN_RESP_LEN] = {0x09,0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8}
static

Scan response data.

Referenced by ble_heart_rate_start_advertise().

uint8_t second_counter = 0
uint8_t time_operator

operator to change the seconds

Referenced by ble_heart_rate_handle_timer_event().