12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #if !defined (POWER_DECODER_H)
- #define POWER_DECODER_H
- #define ANT_POWERONLY 0x10
- #define ANT_WHEELTORQUE 0x11
- #define ANT_CRANKTORQUE 0x12
- #define ANT_CRANKFREQ 0x20
- #define ANT_TEPS 0x13
- #define ANT_CALIBRATION_MESSAGE (0x01)
- #define CALIBRATION_ID_BYTE (1)
- #define ANT_CTF_CALIBRATION_ID (0x10)
- #define ANT_CTF_CAL_TYPE_BYTE (2)
- #define ANT_CTF_CAL_ZERO (0x01)
- #define ANT_CTF_CAL_SLOPE (0x02)
- #define ANT_CTF_CAL_ESN (0x03)
- #define ANT_CTF_CAL_ACK (0xAC)
- #define ANT_CTF_CAL_ZERO_MSB_BYTE (6)
- #define ANT_CTF_CAL_ZERO_LSB_BYTE (7)
- #define MAXIMUM_TIME_GAP (240.0)
- typedef struct _BPSAMPLER_t_
- {
- unsigned char ucPedalBalance;
- unsigned char ucCadence;
- unsigned long ulEventTime;
- unsigned long ulLastRecordTime;
- unsigned short usRecordInterval;
- unsigned short usTimeBase;
- unsigned char ucRecordGapCount;
- unsigned short usTorqueOffset;
- float fPendingRotation;
- float fGapRotation;
- float fAccumRotation;
- double dTotalRotation;
- float fPendingEnergy;
- float fGapEnergy;
- float fAccumEnergy;
- double dTotalEnergy;
- double dLastRecordTime;
- double dLastMessageTime;
- unsigned short usLastAccumPeriod;
- unsigned short usLastAccumTorque;
- unsigned char ucLastEventCount;
- unsigned char ucLastRotationTicks;
- } BPSAMPLER;
- typedef void(*PowerRecordReceiver) (double dLastRecordTime_, double dTotalRotation_, double dTotalEnergy_, float fAverageCadence_, float fAveragePower_);
- void InitPowerDecoder(double dRecordInterval_, double dTimeBase_, double dReSyncInterval_, PowerRecordReceiver powerRecordReceiverPtr_);
- void DecodePowerMessage(double dRxTime_, unsigned char messagePayload_[]);
- void SetPowerMeterType(unsigned char ucPowerMeterType_);
- #endif
|