This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

_ALIGN(4) uint8_t sixteen = 16 appears as 10 in characteristic read value?

I defined an integer value _ALIGN(4) uint8_t sixteen = 16 and assigned sixteen to a FDS record that is later assigned to the p_data of a custom characteristic. However, when I read the characteristic the value shows up as 10. When I try doing _ALIGN(4) uint8_t seventeen = 17 the characteristic value also reads as 11, etc. I tried searching online for whether this is something that C does for alignment in integer data type, but couldn't find any clear results. 

If I want uint8_t sixteen = 16 to appear as 16 in the characteristic read value, how should I do it? I think the integer data structure still needs to be aligned so it can be used for .p_data in FDS record. 

Parents Reply Children
Related