Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Why using FIT_UINT8 type for sizes in Ant SDK C-Code?

RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Hallo all,

I just got the Ant SDK and I woundered why they use FIT_UINT8 for byte sizes in paramters and return values of some functions.

fit_crc.c:
FIT_UINT16 FitCRC_Calc16(const volatile void *dataFIT_UINT8 size)
{
   FIT_UINT16 crc 
0;
   
FIT_BYTE *data_ptr = (FIT_BYTE *)data;
   while (
size)
   
{
      crc 
FitCRC_Get16(crc, *data_ptr);
      
data_ptr++;
      
size--;
   
}
   
return crc;


//The parameter size of FIT_UINT8 allows only *data to be up to 255bytes.


fit.h:
FIT_UINT8 Fit_GetMesgSize(FIT_UINT16 global_mesg_num); 

// Size maybe up to 255 bytes also.

FIT_UINT8 Fit_GetFieldOffset(const FIT_MESG_DEF *mesg_defFIT_UINT8 field_def_num); 

// Return offset...


I hope I get an answer to this question.

-Ivo :blink:      
RankRankRankRank

Total Posts: 116

Joined 2008-11-21

PM

Hello,
FIT data messages are limited to 255 bytes in size (note, we do not have a FIT message that would even be in this range), and the CRC is calculated in 255 byte size blocks - this does not mean that the CRC calculation is limited to a 255 byte file.

FIT fields are also limited to a maximum of 255... resulting in defining these parameters using the FIT_UINT8 (typedef unsigned char)...

I hope I understood your question cerrectly and provided the answer you were looking for.