0

I'm creating an application to send data to a bluetooth module.

I'm having a tough time following the provided documentation. Can anyone help me understand how to create the checksum as mentioned (Byte No. 3)

So far, I have been able to make a sum of address 1 & 2 by converting them into integers and adding them up, the rest is beyond me... how do I take a bit-inverse and apply a 7-bit checksum and turn it into a "7-bit data with 0x7F" ??

The module communication document

Mohsin Falak
  • 429
  • 6
  • 22

1 Answers1

1

The 0x7F means 0b01111111 in binary and represents a bit mask. You have to do a bitwise and with your checksum like that

result = checksum & 0x7F

EDIT

As long i understand, it schould be

checksum = ~( byte1 + byte2 )
  • Apologies for a noob question, but how do I get the checksum as mentioned above? a tiny code snipped would be great! – Mohsin Falak Jun 20 '18 at 19:31