Hi I have a base 10 number for example 3198, and the hex representation is 0x0C7E
How do I convert that number to hex and put that hex value in a byte array in the f
Maybe this will work ?
uint32_t x = 0x0C7E; uint8_t bytes[3]; bytes[0] = (x >> 0) & 0xFF; bytes[1] = (x >> 8) & 0xFF; bytes[2] = (x >> 16) & 0xFF; /* Go back. */ x = (bytes[2] << 16) | (bytes[1] << 8) | (bytes[0] << 0);