/* Swaps the bit order from MSB to LSB, since the LCD expects LSB, but the M3 shifts bits out MSB.  */
uint8_t sharpmemSwap(uint8_t data)
/* Swaps the bit order from MSB to LSB, since the LCD expects LSB, but the M3 shifts bits out MSB.  */
uint8_t sharpmemSwap(uint8_t data)
{
  uint8_t out = 0;
  if (data)
  {
    if(data & 0x01) out |= 0x80;
    if(data & 0x02) out |= 0x40;
    if(data & 0x04) out |= 0x20;
    if(data & 0x08) out |= 0x10;
    if(data & 0x10) out |= 0x08;
    if(data & 0x20) out |= 0x04;
    if(data & 0x40) out |= 0x02;
    if(data & 0x80) out |= 0x01;
  }
  return out;
}