社区导航

 
查看: 146|回复: 0

[经验] 【KW41Z】步行仪2

[复制链接]

162

TA的帖子

10

TA的资源

一粒金砂(中级)

Rank: 2

发表于 2017-7-16 22:26:52 | 显示全部楼层 |阅读模式
KW41Z蓝牙部分终于做好,其实也不算得上做好,只不过是用已成的例子进行移植。
蓝牙连接后定时上传
[C] 纯文本查看 复制代码
extern unsigned long int STEPS;
extern unsigned char TempSteps;		//记步缓存  100HZ 自加1
static void TimerMeasurementCallback(void * pParam)
{
    uint32_t random = 0;
    rscsMeasurement_t measurement;
    
    if ( rscsServiceConfig.calibrationInProgress)
    {
        /* Finish calibration procedure */
        Rscs_FinishSensorCalibration(&rscsServiceConfig, mCalibrationSuccessful);
    }

    RNG_GetRandomNo(&random);
    
    mReportTotalDistanceCounter  = (mReportTotalDistanceCounter + 1) % 3;
        
    //mRscsUserData.totalDistance += random & 0x0F;
    mRscsUserData.totalDistance =STEPS;

    measurement.flags = gRscs_InstantStrideLengthPresent_c;
    
    //if (mRunningStatus)
    if(TempSteps>5)
    {
      measurement.flags |= gRscs_RunningStatus_c;
    }
      
    if (mReportTotalDistanceCounter == 1)  
    {
        measurement.flags |= gRscs_TotalDistancePresent_c;       
    }
    measurement.instantCadence = TempSteps;
    measurement.instantStrideLength = 22;    
    //measurement.instantSpeed = 256 * ( 2 + (random & 0x03 ));
    measurement.instantSpeed = 256 * ( 2 + (TempSteps & 0x03 ));
    measurement.totalDistance = mRscsUserData.totalDistance;
    
    Rscs_RecordMeasurement(service_rsc, &measurement);

}


全整的代码
frdmkw41z_wireless_examples_bluetooth_running_speed_cadence_sensor_freertos.rar (2.39 MB, 下载次数: 0)

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

  • 论坛活动 E手掌握

    扫码关注
    EEWORLD 官方微信

  • EE福利  唾手可得

    扫码关注
    EE福利 唾手可得

小黑屋|手机版|Archiver|电子工程世界 ( 京ICP证 060456

GMT+8, 2017-7-25 02:41 , Processed in 0.197262 second(s), 15 queries , Redis On.

快速回复 返回顶部 返回列表