Sending 16 bits using one notification

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.
cayuc_1568091
Level 2
Level 2
First like received

Hello, 

   

 

   

I am using a custom event handler to send 2 bytes of data. How is this typically done? 

   

 

   

Here are the things I've done: the custom characteristic in the BLE component in the TopDesign file is sent to send a uint16 value and I have a function that sends a uint16 value. I am having trouble assigning the handle (where do I change this to point to a uint16 value?) to the actual data I'm sending. 

0 Likes
1 Solution
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

You just treat the uint16 as an array of two uint8. Best way is to use a pointer to the variable, and cast the type of the pointer.

View solution in original post

0 Likes
2 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

You just treat the uint16 as an array of two uint8. Best way is to use a pointer to the variable, and cast the type of the pointer.

0 Likes

Okay cool. So I have one byte that I send as the first element of the array and then the second byte that I send as the second element of the array? Should I write two functions that send each byte individually? I guess I'm still confused about how specifying a 2-element array of uint8s in the BLE component will match up with the functions that are sending the bytes. 

0 Likes