title: Big endian byte array to small endian struct elements in C, arm
body: <p>In my application microcontroller stm32f103 is receiving by USART fixed lenght messages, they contains gps velocity which is big endian data. But elements in structure are small endian. Is there any way without doing it manually to write it in correct way?</p>
  <pre><code>typedef struct {
      uint32_t test1;
      uint16_t test2;
  }Mst;
  
  uint8_t myArray[6] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
  
  void main()
  {
      Mst * myStruct_p = (Mst)myArray;
  }
  </code></pre>
  <p>But after that <code>myStruct_p-&gt;test1</code> equals <code>0x030201</code>, but should be <code>0x010203</code>, and <code>myStruct_p-&gt;test2</code> equals <code>0x0605</code>, but should be <code>0x0506</code>.</p>