Change data from uint8 to float32

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 Hi - I've successfully modified the capsense proximity project to add more data characteristics and changed their names and change the numbers various ways w/ no problem.

   

 

   

Now I'm trying to change the data to float32, and did so also in the BLE GATT server to be float32 for the characteristic - but am getting an incompatible pointer type:

   

void SendData(float32 Ah, float32 V, float32 A, float32 S, float32 D)

   

{

   

CYBLE_GATTS_HANDLE_VALUE_NTF_T notificationHandle; 

   

if(busyStatus == CYBLE_STACK_STATE_FREE)

   

{

   

notificationHandle.attrHandle = CYBLE_EBIKEDATA_AMPHOUR_CHAR_HANDLE;

   

notificationHandle.value.val = &Ah;               <-- incompatible pointer types assigned to uint8 from float32

   

notificationHandle.value.len = NOTIFICATION_DATA_LEN;

   

CyBle_GattsNotification(connectionHandle,&notificationHandle);

   

 

   

#define NOTIFICATION_DATA_LEN          4

   

Looking for how to update different data types, or where the uint8 is baked in, or an example to copy. Thanks!

   

Minimal bundle attached.

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Cast your &Ah to a (void *)(&Ah)

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 Thanks!  That's working - for my first value, getting 0.026Ah correctly ( 64:5D:DC:3C )

   

My voltage and rest  are missing but that's another issue :}

0 Likes
Anonymous
Not applicable

Oh cool - now it's totally working - my last bug was the lines of data coming from the Cycle Analyst are TAB delimited, not space. Now all values show up in CySmart.

0 Likes