Set rotation of TinyScreen?

gnargle

  • Newbie
  • *
    • Posts: 1
    • View Profile
Hi there,

I got my Tinyscreen+ in the post this week, and I'm trying to put together a watchface for a prop. However this is a bit of an unusual face, and ideally the orientation of the screen could do with being portrait, rather than landscape. Is this a possbility within the tinyscreen library? I couldn't see a function that would make it easy (only flipDisplay() which is only for landscape orientation).
This would be very useful functioanlity for me and would relieve a bunch of horrible hacky behaviour I'd have to add in my actual sketch.
Thanks.


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 236
    • View Profile
Hello,

The screen contents can be flipped as you have discovered, but it is difficult to write a portrait mode translation of the screen contents due to the pixel difference in the length and width.

I can recommend looking into the writeRemap() function of the TinyScreen library. We have rewritten this function to work with rotating a different, square screen using the following code:

Code: [Select]
uint8_t _rotateDisplay=1;

void TinyScreen::writeRemap(void){
  uint8_t remap=(1<<5)|(1<<4)|(0<<2)|(1<<1);
  if(_flipDisplay){
    remap^=((1<<4)|(1<<1));
    //Set_Display_Offset(0x00);
  }else{
    //Set_Display_Offset(0x40);
  }
  if(_rotateDisplay)
    remap^=((1<<1)|(1<<0));
  if(_mirrorDisplay)
    remap^=(1<<1);
  if(_bitDepth)
    remap|=(1<<6);
  if(_colorMode)
    remap^=(1<<2);
   
   startCommand();
   TSSPI->transfer(0xA0);//set remap
   TSSPI->transfer(remap);
   endTransfer();
}

This does not work with the TinyScreen as is, but might be a good starting point for altering the writeRemap() function.

I hope that helps!

Thanks,
RĂ©na


 

SMF spam blocked by CleanTalk