# -*- coding: utf-8 -*-
# Copyright (c) 2014-17 Richard Hull and contributors
# See LICENSE.rst for details.


from luma.core.const import common


class ssd1306(common):
    CHARGEPUMP = 0x8D
    COLUMNADDR = 0x21
    COMSCANDEC = 0xC8
    COMSCANINC = 0xC0
    EXTERNALVCC = 0x1
    MEMORYMODE = 0x20
    PAGEADDR = 0x22
    SETCOMPINS = 0xDA
    SETDISPLAYCLOCKDIV = 0xD5
    SETDISPLAYOFFSET = 0xD3
    SETHIGHCOLUMN = 0x10
    SETLOWCOLUMN = 0x00
    SETPRECHARGE = 0xD9
    SETSEGMENTREMAP = 0xA1
    SETSTARTLINE = 0x40
    SETVCOMDETECT = 0xDB
    SWITCHCAPVCC = 0x2


sh1106 = ssd1306


class ssd1331(common):
    ACTIVESCROLLING = 0x2F
    CLOCKDIVIDER = 0xB3
    CONTINUOUSSCROLLINGSETUP = 0x27
    DEACTIVESCROLLING = 0x2E
    DISPLAYONDIM = 0xAC
    LOCKMODE = 0xFD
    MASTERCURRENTCONTROL = 0x87
    NORMALDISPLAY = 0xA4
    PHASE12PERIOD = 0xB1
    POWERSAVEMODE = 0xB0
    SETCOLUMNADDR = 0x15
    SETCONTRASTA = 0x81
    SETCONTRASTB = 0x82
    SETCONTRASTC = 0x83
    SETDISPLAYOFFSET = 0xA2
    SETDISPLAYSTARTLINE = 0xA1
    SETMASTERCONFIGURE = 0xAD
    SETPRECHARGESPEEDA = 0x8A
    SETPRECHARGESPEEDB = 0x8B
    SETPRECHARGESPEEDC = 0x8C
    SETPRECHARGEVOLTAGE = 0xBB
    SETROWADDR = 0x75
    SETVVOLTAGE = 0xBE


class ssd1325(common):
    SETCOLUMNADDR = 0x15
    SETROWADDR = 0x75
    SETCURRENT = 0x84
    SETSTARTLINE = 0xA1
    SETOFFSET = 0xA2
    NORMALDISPLAY = 0xA4
    DISPLAYALLOFF = 0xA6
    MASTERCONFIG = 0xAD
    SETPRECHARGECOMPENABLE = 0xB0
    SETPHASELEN = 0xB1
    SETROWPERIOD = 0xB2
    SETCLOCK = 0xB3
    SETPRECHARGECOMP = 0xB4
    SETGRAYTABLE = 0xB8
    SETPRECHARGEVOLTAGE = 0xBC
    SETVCOMLEVEL = 0xBE
    SETVSL = 0xBF


class ssd1322(common):
    DISPLAYON = 0xAF
    DISPLAYOFF = 0xAE
    SETCONTRAST = 0xC1
