ER-OLEDM032-1 icon indicating copy to clipboard operation
ER-OLEDM032-1 copied to clipboard

Magic offset of X coordinate

Open Amomum opened this issue 5 years ago • 1 comments

Again, not an issue, more of a question.

There is a function:

def set_data_window(self,x,y,width,height):
    
    x = int(x / 4) # Column address is 4-pixel-groups (2 bytes)
              # Pass in x=0,4,8, etc
              
    width = int(width / 4) # With limited to 4-pixel increments
                      # Pass in width=4,8, etc
    
    self.Write_Instruction(0x75)
    self.Write_Data(y)
    self.Write_Data(y+height-1)
    
    self.Write_Instruction(0x15) 
    self.Write_Data(0x1C+x)            <<<<
    self.Write_Data(0x1C+x+width-1)    <<<<

for some unexplained reason there is an additional offset 0x1C that is added to the X coordinates (i.e. column address).

I'm aware that this offset got here from the example code (where it's not explained either); but maybe you know why is it required?

Amomum avatar Feb 03 '20 14:02 Amomum

The only thing I can think of is that the driver will work for up to 480x128 p;ixels. This offset must be how the 256x64 is wired

On Mon, Feb 3, 2020 at 8:02 AM Amomum [email protected] wrote:

Again, not an issue, more of a question.

There is a function:

def set_data_window(self,x,y,width,height):

x = int(x / 4) # Column address is 4-pixel-groups (2 bytes)
          # Pass in x=0,4,8, etc

width = int(width / 4) # With limited to 4-pixel increments
                  # Pass in width=4,8, etc

self.Write_Instruction(0x75)
self.Write_Data(y)
self.Write_Data(y+height-1)

self.Write_Instruction(0x15)
self.Write_Data(0x1C+x)            <<<<
self.Write_Data(0x1C+x+width-1)    <<<<

for some unexplained reason there is an additional offset 0x1C that is added to the X coordinates (i.e. column address).

I'm aware that this offset got here from the example code (where it's not explained either); but maybe you know why is it required?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/topherCantrell/ER-OLEDM032-1/issues/4?email_source=notifications&email_token=ABKK6QIWGH5P2DTPAMM3UDTRBAPZBA5CNFSM4KPFWX6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IKTIC6Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKK6QJ6EZPS34F6C7F2KY3RBAPZBANCNFSM4KPFWX6A .

topherCantrell avatar Feb 05 '20 16:02 topherCantrell