示例#1
0
def cmdSetColAddr(colStart, colEnd):
    """ Setup column start and end address for horizontal/vertical mode """
    if (colStart < 0) or (colStart > 127):
        raise ValueError("Column Start only valid from 0 to 127")
    if (colEnd < 0) or (colEnd > 127):
        raise ValueError("Column End only valid from 0 to 127")
    if (colStart > colEnd):
        raise ValueError("Column End must be greater then Column Start")
    sendCmd(0x21, colStart, colEnd)
示例#2
0
def cmdSetPageAddr(pageStart, pageEnd):
    """ Setup page start and end address for horizontal/vertical mode """
    if (pageStart < 0) or (pageStart > 7):
        raise ValueError("Page Start only valid from 0 to 7")
    if (pageEnd < 0) or (pageEnd > 7):
        raise ValueError("Page End only valid from 0 to 7")
    if (pageStart > pageEnd):
        raise ValueError("Page End must be greater then Page Start")
    sendCmd(0x22, pageStart, pageEnd)
示例#3
0
def cmdSetContrast(contrast):
    """ Set display contrast 0-255 """
    if contrast > 255: raise ValueError('Paramteres from 0 to 255 excepted!')
    sendCmd(0x81, contrast)
示例#4
0
def cmdSetMuxRatio(muxRatio):
    """ Set MUX ratio to N+1 MUX, values from 16 to 63 allowed """
    if (muxRatio < 15) or (muxRatio > 63):
        raise ValueError("Mux Ratio from 16 to 63 supported!")
    sendCmd(0xA8, muxRatio)
示例#5
0
def cmdRemapCol(bRemap):
    """ Remap segments to either start from 0 or from 127 """
    if bRemap: sendCmd(0xA1)
    else: sendCmd(0xA0)
示例#6
0
def cmdSetStartRow(startRow):
    """ Set Display RAM start row from 0-63 """
    if (startRow < 0) or (startRow > 63):
        raise ValueError("Start Row from 0 to 63 supported!")
    sendCmd(0x40 | startRow)
示例#7
0
def cmdChargePumpDisable():
    """ Disable charge pump for the display """
    sendCmd(0x8D, 0x10)
示例#8
0
def cmdChargePumpEnable():
    """ Enable charge pump for the display """
    sendCmd(0x8D, 0x14)
示例#9
0
def cmdSetCurPage(page):
    """ Set Page Start Address, Current Line if in Page Mode """
    if (page < 0) or (page > 7):
        raise ValueError("Pages from 0 to 7 supported!")
    sendCmd(0xB0 | page)
示例#10
0
def cmdSetAddrMode(addrMode):
    """ Set display address mode """
    if addrMode == ADDR_MODE_HOR or ADDR_MODE_VER or ADDR_MODE_PAGE:
        sendCmd(0x20, addrMode)
    else:
        raise ValueError("Undefined address mode!")
示例#11
0
def cmdDisplayInverse(bInverse):
    """ Inverse display """
    if bInverse: sendCmd(0xA7)
    else: sendCmd(0xA6)
示例#12
0
def cmdDisplayAllOn(bOn):
    """ Turn all pixels On """
    if bOn: sendCmd(0xA5)
    else: sendCmd(0xA4)
示例#13
0
def cmdDisplayOFF():
    """ Turn display off """
    sendCmd(0xAE)
示例#14
0
def cmdDisplayON():
    """ Turn display on """
    sendCmd(0xAF)
示例#15
0
def cmdRemapRow(bRemap):
    """ Remap COM Output scan direction """
    if bRemap: sendCmd(0xC8)
    else: sendCmd(0xC0)
示例#16
0
def cmdSetRowOffset(offset):
    """ Set vertical shift by COM from 0 to 63 """
    if (offset < 0) or (offset > 63):
        raise ValueError("Offset from 0 to 63 supported!")
    sendCmd(0xD3, offset)
示例#17
0
def cmdSetCurCol(col):
    """ Set Column Start Address, Current column in Page Mode """
    if (col < 0) or (col > 127):
        raise ValueError("Columns from 0 to 127 supported!")
    sendCmd(col & 0x0F)  # lower nibble with cmd 0x00
    sendCmd(((col >> 4) & 0x0F) | 0x10)  # higher nibble with cmd 0x01