Making Heart Rate ADC values being advertised

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
13 posts / 0 new
Last post
herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Making Heart Rate ADC values being advertised

Hi there,

Referring to the previous link (https://support.dialog-semicondiondiondum/forums/post/dialog-smartbond-bl ...) that I've commented. I do not know how to make this thing work. I have already tried this function in custom profile of SDK 5 and I am able to get the adc data from the heart rate module. So now I want to implement this function to the heart rate profile in SDK 3 but it seems that I do not know where to place this function in order to make it working. I have already include the adc header files. (attachment 7). I want the heart rate values to be notified in terms of bpm unit in the profile. Thanks.

Attachment:
设备:
herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
请您看一看

请查看此更新的附件。谢谢

Attachment:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

About which function you are talking about ? i dont see any function name in the attachment that you have uploaded, as i ve mentioned a previous post please have a look at the RW BLE Heart Rate Profile (HRP) Interface specification in order to check the message that you need to exchange with the profile in order to communication with the HRP profile module.

谢谢MT_dialog

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

I have searched the documents RW-BLE-HRP-IS but it looks very surface. It does not show where I need to put my adc coding in order for me to get the data.

UINT8_T Heart_rate,Sample,Sample2;

adc_init(gp_adc_se,0,gp_adc_attn3x);
adc_enable_channel (ADC_CHANNEL_P01);
sample = adc_get_sample();

adc_init (GP_ADC_SE, GP_ADC_SIGN, GP_ADC_ATTN3X);
adc_enable_channel (ADC_CHANNEL_P01);
sample2 = adc_get_sample();

heart_rate =(样本+样品2);
heart_rate = heart_rate/2;

app_heart_rate_set_value(heart_rate)

这是我一直在谈论的ADC函数,我将ADC的输出到App_heart_set_value,它是App_hrps.c中的函数之一。请参阅附件8.谢谢

Attachment:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

该文档介绍了配置文件曝光的消息,以便您使用它,您将从传感器执行测量,这取决于您的应用程序。因此,文档提到了一个名为HRPS_MEAS_SEND_REQ的消息,这是应该调用的,以便将通知发送到中央的另一侧(只要您已启用来自中心侧的通知,通知将到达另一侧)。因此,您可以通过计时器触发该消息,并在服务消息时立即执行ADC测量,从ADC获取值,将邮件中的值打包并将消息发送到配置文件。像你已经完成的东西。如何触发依赖于应用程序上提到的函数的函数,它可以在连接时,或者当中央写入的心率配置文件的指定CCC才能启用通知,可以在gattc_write_cmd_ind_handler中捕获该事件()在hrps_task.c文件中。

谢谢MT_dialog

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi,

Hi,

I have called the function in gattc_write_cmd_ind_handler. But the values are not updating. I need to turn off and on the notifications to get the value. By the way, the values should not be so high because I did not stick the electrodes on my body. Please refer to attachment 9. Thank you very much!

Attachment:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

您必须打开通知,以触发Gattc_Write_cmd_ind_handler()并符合要触发的计时器,只要您在Gattc_Write_cmd_ind_handler()中放置了该函数,而无论哪个特征如何,定时器将被激活。点是在写CCC特性时立即拥有定时器计数,请尝试阅读并理解代码。关于您获得的值,我无法假设为什么它们很高(这是您必须通过调试找到的东西),我建议发送虚拟数据,直到您可以验证是否可以正确发送数据。

谢谢MT_dialog

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

I would like to ask, the app_timer_set is unlike app_easy_timer. Can I able to use app_timer_set to call back function just like app_easy_timer?

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

I have been trying to understand the coding and tried to change the placement of the timer function. I want to have a real time data on my smartphone which means once the notifications is on, the value describes by the the heart rate profile will show real time changes until I turn off the notifications but it seems no matter where I put the timer, the results seems to be no real time data but a non-real time data. The non-real time data refers to the data that is showed in the the heart rate profile when i trigger the notification button. Once trigger, the value shows will not be changing with respect to time.

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

I have solved the looping problem through this topic -https://support.dialog-semiconductor.com/timer-problem-again. Thanks

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

我发现了@ app_hrps.c。这个req-> meas_val.rr_intervals [0]

void app_heart_rate_set_value(uint16_t heart_rate_val)
{
// Allocate the message
struct hrps_meas_send_req * req = KE_MSG_ALLOC(HRPS_MEAS_SEND_REQ, TASK_HRPS, TASK_APP,
hrps_meas_send_req);

//填写参数结构
req->conhdl = app_env.conhdl;
//struct hrs_hr_meas meas_val;
/// Flag
req->meas_val.flags = HRS_FLAG_HR_8BITS_VALUE;
/// rr-interval numbers(max 4)
req->meas_val.nb_rr_interval = 4;
/// rr-intervally
//req->meas_val.rr_intervals[0] = heart_rate_val;
///心率测量值
req->meas_val.heart_rate = heart_rate_val-104;
/// Energy Expended
req-> meas_val.energy_expended = hrs_hr_cntl_point_code;}

对心率值没有影响。无论我更改RR_INTERVALS的值[0],从心率配置文件中出来的值是相同的。这真的没有影响吗?谢谢

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

Can I measured the rr_intervals from the heart rate profile. I just found out my values are in terms of ECG or in another words electrical signal over time. What is generated out from the profile currently does not represent heart rate (bpm) but the values of electrical signal over time. Any idea so I can get heart_rate values? Thanks.

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

谢谢. I have found out. You've already answered this question in this linkhttps://support.dialog-semicondiondiondum/forums/post/dialog-smartbond-bl ....