|
KW41Z蓝牙部分终于做好,其实也不算得上做好,只不过是用已成的例子进行移植。
蓝牙连接后定时上传
- 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, 下载次数: 3)
手机APP用的是NXP自代的例子
下一代就是自己做APP
|
|