Using Manchester Library with unit16_t x2

The Manchester RF library I am using has a data size limit of uint16_t.

I would like to use it to transmit/receive uint32_t.

From my research it seems it is possible to transmit a unit32_t by splitting it and transmitting as 2 x unit16_t. The receiver would then reassemble the 2 transmissions as a uint32_t.

Without me having to spend a month of Sundays researching and trying to figure it out, could someone please help me to do this.

TIA.

Please link the library you are using. And as usual provide any source code that can help understand your problem. Do not forget to use the code tag.

Cheers!

This is the link to the library.
I am using the library's basic Tx/Rx examples and just changed the data size.

The Manchester RF library I am using has a data size limit of uint16_t.

I would like to use it to transmit/receive uint32_t.

As opposed to sending two values (in an array, possibly)?

Without me having to spend a month of Sundays researching and trying to figure it out, could someone please help me to do this.

union
{
    uint16_t a[2];
    uint32_t b;
} stuff;

stuff.b = whatToSend;
someFunctionToSendData(stuff.b, 2);

Something like this maybe

uint32_t bigVariable = 1234567890;
uint32_t result;
uint16_t lowChunk;
uint16_t highChunk;

void setup()
{
  Serial.begin(115200);
  lowChunk = bigVariable & 0xFFFF;  //put the bottom 16 bits of the 32 bit variable into a 16 bit variable
  highChunk = bigVariable >> 16 & 0xFFFF;  //put the top 16 bits into a 16 bit variable
  //at this point transmit the 2 16 bit numbers and receive them into 2 16 bit variables then
  result = (uint32_t) highChunk << 16;  //recreate the top 16 bits of the 32 bit variable
  result = result | lowChunk;  //put in the bottom 16 bits
  Serial.println(result);
}

void loop()
{
}

PaulS:
As opposed to sending two values (in an array, possibly)?

union

{
    uint16_t a[2];
    uint32_t b;
} stuff;

stuff.b = whatToSend;
someFunctionToSendData(stuff.b, 2);

The library does have an "array" data type transmission capability which I did test.
I suppose I could convert my uint32-t to an array and transmit it as such.
It means I will only have one transmission, which is probably less prone to error.
I might try out some code for that and see if it works for numbers of different lengths.

There is a void transmitArray(uint8_t numBytes, uint8_t *data);. That should do the trick. Use a union to map from the data you want and an array of uin8_t.

The interface would have been better with "void*" instead of "uint8_t*" but that is only "syntax".

Cheers!