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.
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()
{
}
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.