User Tools

Site Tools


module:micropython:esp32displaykey:esp32displaykey

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
module:micropython:esp32displaykey:esp32displaykey [2021/12/25 14:08] – [Haupt-Module: Esp32CheckDisplayKey.py] omdevelopmodule:micropython:esp32displaykey:esp32displaykey [2022/09/13 11:58] (current) – external edit 127.0.0.1
Line 18: Line 18:
   * minimale Zeit zur Erkennung von Tastenwiederholungen: ZeitTIME_KEYREPETITION = 0.5   * minimale Zeit zur Erkennung von Tastenwiederholungen: ZeitTIME_KEYREPETITION = 0.5
   * Eigener Thread mit permanenter Tastatur-Abfrage   * Eigener Thread mit permanenter Tastatur-Abfrage
 +  * Entprellung über TIME_KEYPRESSES
 +  * Tasten-Wiederholung über TIME_KEYREPETITION
   * MainLoop: periodische Abfrage GetKeyCode()   * MainLoop: periodische Abfrage GetKeyCode()
   * Keys beim IT01:   * Keys beim IT01:
Line 42: Line 44:
  
 ===== Version =====  ===== Version ===== 
-{{:module:micropython:Esp32DisplayKey:2112251329_Esp32DisplayKey_01V02.zip | 2112251329_Esp32DisplayKey_01V02.zip}} +{{:module:micropython:Esp32DisplayKey:2112251413_Esp32DisplayKey_01V03.zip | 2112251413_Esp32DisplayKey_01V03.zip}} 
  
 ===== Beschreibung ===== ===== Beschreibung =====
  
 +{{:module:micropython:Esp32DisplayKey:2112251421_Esp32DisplayKey_01V03.png?600|2112251421_Esp32DisplayKey_01V03.png}}
 ==== Ausgabe MicroPython-Terminal: Esp32CheckDisplayKey.py ==== ==== Ausgabe MicroPython-Terminal: Esp32CheckDisplayKey.py ====
   * Ausgabe der KeyCodes (mit Wiederholungen)   * Ausgabe der KeyCodes (mit Wiederholungen)
Line 167: Line 170:
  
  
-==== Main-ProgramEsp32CheckUart.py ====+==== Library-ModuleKeyboard4x4.py ====
 <code python> <code python>
 +#
 +import time
 +from machine import Pin
 +#
 +import Define as DEF
 +import Thread as THR
 +#
 +class CKeyboard4x4():
 +    #-----------------------------------------------------------------
 +    #   Constructor
 +    #-----------------------------------------------------------------
 +    def __init__(self, \
 +                 pinin0, pinin1, pinin2, pinin3, \
 +                 pinout0, pinout1, pinout2, pinout3):
 +        #
 +        self.CountRepeat = 3
 +        self.KeySleep = 0.001
 +        #
 +        self.PinIn = []
 +        self.PinIn.append(Pin(pinin0, mode=Pin.IN, pull=Pin.PULL_DOWN))
 +        self.PinIn.append(Pin(pinin1, mode=Pin.IN, pull=Pin.PULL_DOWN))
 +        self.PinIn.append(Pin(pinin2, mode=Pin.IN, pull=Pin.PULL_DOWN))
 +        self.PinIn.append(Pin(pinin3, mode=Pin.IN, pull=Pin.PULL_DOWN))
 +        #
 +        self.PinOut = []
 +        self.PinOut.append(Pin(pinout0, mode=Pin.OUT, pull=Pin.PULL_DOWN))
 +        self.PinOut.append(Pin(pinout1, mode=Pin.OUT, pull=Pin.PULL_DOWN))
 +        self.PinOut.append(Pin(pinout2, mode=Pin.OUT, pull=Pin.PULL_DOWN))
 +        self.PinOut.append(Pin(pinout3, mode=Pin.OUT, pull=Pin.PULL_DOWN))
 +        #
 +        self.Thread = THR.CThread(self.CBOnStart, self.CBOnBusy, self.CBOnAbort, self.CBOnEnd)
 +        #
 +        self.KeyCodes = []
 +        return
 +    #
 +    #-----------------------------------------------------------------
 +    #   Callback
 +    #-----------------------------------------------------------------
 +    def CBOnStart(self, thread):
 +        return
 +    def CBOnBusy(self, thread):
 +        while (THR.stBusy == self.Thread.State):
 +            KeyCode0 = 0x00
 +            KeyCode1 = 0x00
 +            KeyCode2 = 0x00
 +            KeyCode3 = 0x00
 +            #-----------------------------------------
 +            # Row0
 +            #-----------------------------------------
 +            self.PinOut[0].on()
 +            self.PinOut[1].off()
 +            self.PinOut[2].off()
 +            self.PinOut[3].off()
 +            CS0 = 0
 +            CS1 = 0
 +            CS2 = 0
 +            CS3 = 0
 +            for SI in range(0, self.CountRepeat):
 +                CS0 += self.PinIn[0].value()
 +                CS1 += self.PinIn[1].value()
 +                CS2 += self.PinIn[2].value()
 +                CS3 += self.PinIn[3].value()
 +                time.sleep(self.KeySleep)
 +            if (self.CountRepeat <= CS0):
 +                KeyCode0 = 0x11
 +            if (self.CountRepeat <= CS1):
 +                KeyCode0 = 0x21
 +            if (self.CountRepeat <= CS2):
 +                KeyCode0 = 0x41
 +            if (self.CountRepeat <= CS3):
 +                KeyCode0 = 0x81
 +            #-----------------------------------------
 +            # Row1
 +            #-----------------------------------------
 +            self.PinOut[0].off()
 +            self.PinOut[1].on()
 +            self.PinOut[2].off()
 +            self.PinOut[3].off()
 +            CS0 = 0
 +            CS1 = 0
 +            CS2 = 0
 +            CS3 = 0
 +            for SI in range(0, self.CountRepeat):
 +                CS0 += self.PinIn[0].value()
 +                CS1 += self.PinIn[1].value()
 +                CS2 += self.PinIn[2].value()
 +                CS3 += self.PinIn[3].value()
 +                time.sleep(self.KeySleep)
 +            if (self.CountRepeat <= CS0):
 +                KeyCode1 = 0x12
 +            if (self.CountRepeat <= CS1):
 +                KeyCode1 = 0x22
 +            if (self.CountRepeat <= CS2):
 +                KeyCode1 = 0x42
 +            if (self.CountRepeat <= CS3):
 +                KeyCode1 = 0x82
 +            #-----------------------------------------
 +            # Row2
 +            #-----------------------------------------
 +            self.PinOut[0].off()
 +            self.PinOut[1].off()
 +            self.PinOut[2].on()
 +            self.PinOut[3].off()
 +            CS0 = 0
 +            CS1 = 0
 +            CS2 = 0
 +            CS3 = 0
 +            for SI in range(0, self.CountRepeat):
 +                CS0 += self.PinIn[0].value()
 +                CS1 += self.PinIn[1].value()
 +                CS2 += self.PinIn[2].value()
 +                CS3 += self.PinIn[3].value()
 +                time.sleep(self.KeySleep)
 +            if (self.CountRepeat <= CS0):
 +                KeyCode2 = 0x14
 +            if (self.CountRepeat <= CS1):
 +                KeyCode2 = 0x24
 +            if (self.CountRepeat <= CS2):
 +                KeyCode2 = 0x44
 +            if (self.CountRepeat <= CS3):
 +                KeyCode2 = 0x84
 +            #-----------------------------------------
 +            # Row3
 +            #-----------------------------------------
 +            self.PinOut[0].off()
 +            self.PinOut[1].off()
 +            self.PinOut[2].off()
 +            self.PinOut[3].on()
 +            CS0 = 0
 +            CS1 = 0
 +            CS2 = 0
 +            CS3 = 0
 +            for SI in range(0, self.CountRepeat):
 +                CS0 += self.PinIn[0].value()
 +                CS1 += self.PinIn[1].value()
 +                CS2 += self.PinIn[2].value()
 +                CS3 += self.PinIn[3].value()
 +                time.sleep(self.KeySleep)
 +            if (self.CountRepeat <= CS0):
 +                KeyCode3 = 0x18
 +            if (self.CountRepeat <= CS1):
 +                KeyCode3 = 0x28
 +            if (self.CountRepeat <= CS2):
 +                KeyCode3 = 0x48
 +            if (self.CountRepeat <= CS3):
 +                KeyCode3 = 0x88
 +            #
 +            if (0 < KeyCode0):
 +                self.KeyCodes.append(KeyCode0)
 +            if (0 < KeyCode1):
 +                self.KeyCodes.append(KeyCode1)
 +            if (0 < KeyCode2):
 +                self.KeyCodes.append(KeyCode2)
 +            if (0 < KeyCode3):
 +                self.KeyCodes.append(KeyCode3)
 +            #
 +            while (DEF.SIZE_KEYCODEBUFFER < len(self.KeyCodes)):
 +                self.KeyCodes.pop(0)
 +            #
 +            if (0 < len(self.KeyCodes)):
 +                time.sleep(DEF.TIME_KEYREPETITION)
 +            else:
 +                time.sleep(DEF.TIME_KEYPRESSED)
 +        return
 +    def CBOnAbort(self, thread):
 +        return
 +    def CBOnEnd(self, thread):
 +        return
 +    #-----------------------------------------------------------------
 +    #   Manager
 +    #-----------------------------------------------------------------
 +    def Open(self):
 +        self.Thread.Start()
 +        return 
 +    def Close(self):
 +        self.Thread.Abort()
 +        return 
 +    def GetKeyCode(self):
 +        if (0 < len(self.KeyCodes)):
 +            KC = self.KeyCodes.pop(0)
 +            return KC
 +        return 0
 +#
 +#------------------------------------------------------------------
 +#   Check Library
 +#------------------------------------------------------------------
 +if '__main__' == __name__:
 +    print('*** Check Keyboard4x4: begin')
 +    #
 +    Keyboard = CKeyboard4x4(DEF.PIN_KEYBOARD_IN0, DEF.PIN_KEYBOARD_IN1, 
 +                            DEF.PIN_KEYBOARD_IN2, DEF.PIN_KEYBOARD_IN3, 
 +                            DEF.PIN_KEYBOARD_OUT0, DEF.PIN_KEYBOARD_OUT1, 
 +                            DEF.PIN_KEYBOARD_OUT2, DEF.PIN_KEYBOARD_OUT3)
 +    # Open
 +    Keyboard.Open()
 +    # MainLoop ....
 +    for I in range(0, 10000):
 +        KC = Keyboard.GetKeyCode()
 +        if (0 < KC):
 +            print(KC)
 +        time.sleep(0.001)
 +    # Close
 +    Keyboard.Close()
 +    #
 +    print('*** Check Keyboard4x4: end')
 +    #
 +#
 </code> </code>
  
-==== Library-Module: Uart.py ====+==== Library-Module: LCDisplay.py ====
 <code python> <code python>
 +#
 +import time
 +#
 +class CLCDisplay:
 +    # HD44780 LCD controller command set
 +    LCD_CLR = 0x01              # DB0: clear display
 +    LCD_HOME = 0x02             # DB1: return to home position
 +    #
 +    LCD_ENTRY_MODE = 0x04       # DB2: set entry mode
 +    LCD_ENTRY_INC = 0x02        # --DB1: increment
 +    LCD_ENTRY_SHIFT = 0x01      # --DB0: shift
 +    #
 +    LCD_ON_CTRL = 0x08          # DB3: turn lcd/cursor on
 +    LCD_ON_DISPLAY = 0x04       # --DB2: turn display on
 +    LCD_ON_CURSOR = 0x02        # --DB1: turn cursor on
 +    LCD_ON_BLINK = 0x01         # --DB0: blinking cursor
 +    #
 +    LCD_MOVE = 0x10             # DB4: move cursor/display
 +    LCD_MOVE_DISP = 0x08        # --DB3: move display (0-> move cursor)
 +    LCD_MOVE_RIGHT = 0x04       # --DB2: move right (0-> left)
 +    #
 +    LCD_FUNCTION = 0x20         # DB5: function set
 +    LCD_FUNCTION_8BIT = 0x10    # --DB4: set 8BIT mode (0->4BIT mode)
 +    LCD_FUNCTION_2LINES = 0x08  # --DB3: two lines (0->one line)
 +    LCD_FUNCTION_10DOTS = 0x04  # --DB2: 5x10 font (0->5x7 font)
 +    LCD_FUNCTION_RESET = 0x30   # See "Initializing by Instruction" section
 +    #
 +    LCD_CGRAM = 0x40            # DB6: set CG RAM address
 +    LCD_DDRAM = 0x80            # DB7: set DD RAM address
 +    #
 +    LCD_RS_CMD = 0
 +    LCD_RS_DATA = 1
 +    #
 +    LCD_RW_WRITE = 0
 +    LCD_RW_READ = 1
 +    #
 +    def __init__(self, num_lines, num_columns):
 +        self.num_lines = num_lines
 +        if self.num_lines > 4:
 +            self.num_lines = 4
 +        self.num_columns = num_columns
 +        if self.num_columns > 40:
 +            self.num_columns = 40
 +        self.CursorY = 0
 +        self.CursorX = 0
 +        self.ImpliedNewline = False
 +        self.Backlight = True
 +        self.DisplayOff()
 +        self.BacklightOn()
 +        self.Clear()
 +        self.hal_write_command(self.LCD_ENTRY_MODE | self.LCD_ENTRY_INC)
 +        self.HideCursor()
 +        self.DisplayOn()
 +    #
 +    def Clear(self):
 +        self.hal_write_command(self.LCD_CLR)
 +        self.hal_write_command(self.LCD_HOME)
 +        self.CursorY = 0
 +        self.CursorX = 0
 +    #
 +    def ShowCursor(self):
 +        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY |
 +                               self.LCD_ON_CURSOR)
 +    #
 +    def HideCursor(self):
 +        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY)
 +    #
 +    def BlinkCursorOn(self):
 +        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY |
 +                               self.LCD_ON_CURSOR | self.LCD_ON_BLINK)
 +    #
 +    def BlinkCursorOff(self):
 +        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY |
 +                               self.LCD_ON_CURSOR)
 +    #
 +    def DisplayOn(self):
 +        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY)
 +    #
 +    def DisplayOff(self):
 +        self.hal_write_command(self.LCD_ON_CTRL)
 +    #
 +    def BacklightOn(self):
 +        self.backlight = True
 +        self.hal_backlight_on()
 +    #
 +    def BacklightOff(self):
 +        self.backlight = False
 +        self.hal_backlight_off()
 +    #
 +    def MoveTo(self, cursory, cursorx):
 +        self.CursorY = cursory
 +        self.CursorX = cursorx
 +        Address = cursorx & 0x3f
 +        if cursory & 1:
 +            Address += 0x40    # Lines 1 & 3 add 0x40
 +        if cursory & 2:     # Lines 2 & 3 add number of columns
 +            Address += self.num_columns
 +        self.hal_write_command(self.LCD_DDRAM | Address)
 +    #
 +    def PutCharacter(self, character):
 +        if character == '\n':
 +            if self.implied_newline:
 +                self.implied_newline = False
 +            else:
 +                self.CursorX = self.num_columns
 +        else:
 +            self.hal_write_data(ord(character))
 +            self.CursorX += 1
 +        if self.CursorX >= self.num_columns:
 +            self.CursorX = 0
 +            self.CursorY += 1
 +            self.implied_newline = (character != '\n')
 +        if self.CursorY >= self.num_lines:
 +            self.CursorY = 0
 +        self.MoveTo(self.CursorY, self.CursorX)
 +    #
 +    def PutText(self, text):
 +        for C in text:
 +            self.PutCharacter(C)
 +    #
 +    def custom_char(self, location, charmap):
 +        location &= 0x7
 +        self.hal_write_command(self.LCD_CGRAM | (location << 3))
 +        self.hal_sleep_us(40)
 +        for i in range(8):
 +            self.hal_write_data(charmap[i])
 +            self.hal_sleep_us(40)
 +        self.MoveTo(self.cursor_y, self.cursor_x)
 +    #
 +    def hal_backlight_on(self):
 +        pass
 +    #
 +    def hal_backlight_off(self):
 +        pass
 +    #
 +    def hal_write_command(self, cmd):
 +        raise NotImplementedError
 +    #
 +    def hal_write_data(self, data):
 +        raise NotImplementedError
 +    #
 +    def hal_sleep_us(self, usecs):
 +        time.sleep_us(usecs)  
 +    #
 +#
 </code> </code>
  
Line 318: Line 673:
 </code> </code>
  
-==== Library-Module: .py ==== +==== Library-Module: ThreadDisplay.py ====
-<code python> +
-</code> +
- +
-==== Library-Module: .py ==== +
-<code python> +
-</code> +
- +
-==== Library-Module: .py ==== +
-<code python> +
-</code> +
- +
-==== Library-Module: LCDisplay.py ====+
 <code python> <code python>
 # #
 +import machine
 import time import time
 # #
-class CLCDisplay: +import Define as DEF 
-    # HD44780 LCD controller command set +import Thread as THR 
-    LCD_CLR = 0x01              DB0clear display +import LCDisplayI2C as LCD 
-    LCD_HOME 0x02             # DB1: return to home position+# 
 +class CCommandDisplay()
 +    def __init__(self, lcdisplay): 
 +        self.LCDisplay lcdisplay 
 +        return
     #     #
-    LCD_ENTRY_MODE = 0x04       # DB2set entry mode +    def Execute(self)
-    LCD_ENTRY_INC = 0x02        # --DB1: increment +        return
-    LCD_ENTRY_SHIFT = 0x01      # --DB0: shift+
     #     #
-    LCD_ON_CTRL = 0x08          # DB3turn lcd/cursor on +class CClear(CCommandDisplay)
-    LCD_ON_DISPLAY = 0x04       # --DB2turn display on +    def __init__(self, lcdisplay)
-    LCD_ON_CURSOR = 0x02        # --DB1: turn cursor on +        super(CClear, self).__init__(lcdisplay
-    LCD_ON_BLINK = 0x01         # --DB0: blinking cursor +        return 
-    # +    def Execute(self): 
-    LCD_MOVE = 0x10             # DB4: move cursor/display +        self.LCDisplay.Clear() 
-    LCD_MOVE_DISP = 0x08        # --DB3: move display (0-> move cursor) +        return 
-    LCD_MOVE_RIGHT = 0x04       # --DB2: move right (0-> left+
-    # +class CWrite(CCommandDisplay)
-    LCD_FUNCTION = 0x20         # DB5: function set +    def __init__(self, lcdisplayrow, col, text): 
-    LCD_FUNCTION_8BIT = 0x10    # --DB4: set 8BIT mode (0->4BIT mode) +        super(CWrite, self).__init__(lcdisplay) 
-    LCD_FUNCTION_2LINES = 0x08  # --DB3two lines (0->one line) +        self.Row row 
-    LCD_FUNCTION_10DOTS = 0x04  # --DB2: 5x10 font (0->5x7 font+        self.Col col 
-    LCD_FUNCTION_RESET = 0x30   # See "Initializing by Instruction" section +        self.Text text 
-    +        return 
-    LCD_CGRAM = 0x40            # DB6set CG RAM address +    def Execute(self): 
-    LCD_DDRAM = 0x80            # DB7: set DD RAM address +        self.LCDisplay.MoveTo(self.Row, self.Col
-    # +        self.LCDisplay.PutText(self.Text
-    LCD_RS_CMD = 0 +        return 
-    LCD_RS_DATA = 1 +
-    # +class CThreadDisplay(THR.CThread):
-    LCD_RW_WRITE = 0 +
-    LCD_RW_READ = 1 +
-    # +
-    def __init__(self, num_linesnum_columns): +
-        self.num_lines = num_lines +
-        if self.num_lines > 4: +
-            self.num_lines 4 +
-        self.num_columns num_columns +
-        if self.num_columns > 40: +
-            self.num_columns 40 +
-        self.CursorY = 0 +
-        self.CursorX = 0 +
-        self.ImpliedNewline = False +
-        self.Backlight = True +
-        self.DisplayOff(+
-        self.BacklightOn() +
-        self.Clear(+
-        self.hal_write_command(self.LCD_ENTRY_MODE | self.LCD_ENTRY_INC+
-        self.HideCursor(+
-        self.DisplayOn()+
     #     #
 +    def __init__(self, i2cdisplay, lcdisplay):
 +        super(CThreadDisplay, self).__init__(self.OnStart, self.OnBusy, self.OnAbort, self.OnEnd)
 +        self.I2CDisplay = i2cdisplay
 +        self.LCDisplay = lcdisplay
 +        self.CommandList = []
 +        return
 +    #---------------------------------------------
 +    def OnStart(self, thread):
 +        return
 +    def OnBusy(self, thread):
 +        while (THR.stBusy == thread.State):
 +            self.Clear()
 +            Col = 0
 +            while (Col <= 19):
 +                self.Write(0, Col, ' Hello0')
 +                self.Write(1, Col, ' Hello1')
 +                self.Write(2, Col, ' Hello2')
 +                self.Write(3, Col, ' Hello3')
 +                while (0 < len(self.CommandList)):
 +                    Command = self.CommandList.pop(0)
 +                    Command.Execute()
 +                time.sleep(0.5)
 +                Col += 1
 +                if (THR.stBusy != thread.State):
 +                    break
 +        return
 +    def OnAbort(self, thread):
 +        return
 +    def OnEnd(self, thread):
 +        return
 +    #---------------------------------------------
 +    def Open(self):
 +        self.Start()
 +        return
 +    def Close(self):
 +        self.Abort()
 +        return
 +    #---------------------------------------------
     def Clear(self):     def Clear(self):
-        self.hal_write_command(self.LCD_CLR+        self.CommandList.append(CClear(self.LCDisplay)
-        self.hal_write_command(self.LCD_HOME+        return  
-        self.CursorY = 0 +    def Write(self, row, col, text): 
-        self.CursorX = 0+        self.CommandList.append(CWrite(self.LCDisplay, row, col, text)) 
 +        return
     #     #
-    def ShowCursor(self): +
-        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY | +#------------------------------------------------------------------------------------------ 
-                               self.LCD_ON_CURSOR)+if ('__main__' == __name__): 
 +    print('*** CheckEsp32DisplayKey: begin'   
     #     #
-    def HideCursor(self): +    I2CDisplay = machine.SoftI2C(scl=machine.Pin(22), sda=machine.Pin(21), freq=2000000)  
-        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY)+    LCDisplay = LCD.CLCDisplayI2C(I2CDisplay, DEF.I2CADDRESS_LCDISPLAY_T,
 +                                  DEF.LCDISPLAY_COUNT_ROWS, DEF.LCDISPLAY_COUNT_COLUMNS) 
 +    TD = CThreadDisplay(I2CDisplay, LCDisplay) 
 +    TD.Open()
     #     #
-    def BlinkCursorOn(self): +    time.sleep(10.0)
-        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY | +
-                               self.LCD_ON_CURSOR | self.LCD_ON_BLINK)+
     #     #
-    def BlinkCursorOff(self): +    TD.Close()
-        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY | +
-                               self.LCD_ON_CURSOR)+
     #     #
-    def DisplayOn(self): +    print('*** CheckEsp32DisplayKeyend')
-        self.hal_write_command(self.LCD_ON_CTRL | self.LCD_ON_DISPLAY) +
-    # +
-    def DisplayOff(self): +
-        self.hal_write_command(self.LCD_ON_CTRL) +
-    # +
-    def BacklightOn(self): +
-        self.backlight = True +
-        self.hal_backlight_on() +
-    # +
-    def BacklightOff(self): +
-        self.backlight = False +
-        self.hal_backlight_off() +
-    # +
-    def MoveTo(self, cursory, cursorx): +
-        self.CursorY = cursory +
-        self.CursorX = cursorx +
-        Address = cursorx & 0x3f +
-        if cursory & 1: +
-            Address += 0x40    # Lines 1 & 3 add 0x40 +
-        if cursory & 2:     # Lines 2 & 3 add number of columns +
-            Address += self.num_columns +
-        self.hal_write_command(self.LCD_DDRAM | Address) +
-    # +
-    def PutCharacter(self, character): +
-        if character == '\n': +
-            if self.implied_newline: +
-                self.implied_newline = False +
-            else: +
-                self.CursorX = self.num_columns +
-        else: +
-            self.hal_write_data(ord(character)) +
-            self.CursorX += 1 +
-        if self.CursorX >= self.num_columns: +
-            self.CursorX = 0 +
-            self.CursorY += 1 +
-            self.implied_newline = (character != '\n') +
-        if self.CursorY >= self.num_lines: +
-            self.CursorY = 0 +
-        self.MoveTo(self.CursorY, self.CursorX) +
-    # +
-    def PutText(self, text): +
-        for C in text: +
-            self.PutCharacter(C) +
-    # +
-    def custom_char(self, location, charmap): +
-        location &= 0x7 +
-        self.hal_write_command(self.LCD_CGRAM | (location << 3)) +
-        self.hal_sleep_us(40) +
-        for i in range(8): +
-            self.hal_write_data(charmap[i]) +
-            self.hal_sleep_us(40) +
-        self.MoveTo(self.cursor_y, self.cursor_x) +
-    # +
-    def hal_backlight_on(self): +
-        pass +
-    # +
-    def hal_backlight_off(self): +
-        pass +
-    # +
-    def hal_write_command(self, cmd): +
-        raise NotImplementedError +
-    # +
-    def hal_write_data(self, data): +
-        raise NotImplementedError +
-    # +
-    def hal_sleep_us(self, usecs): +
-        time.sleep_us(usecs +
     #     #
 # #
Line 483: Line 782:
  
  
 +
 +==== 211225 : "echte" Parallelisierung ====
 +  * {{:module:micropython:Esp32DisplayKey:2112251329_Esp32DisplayKey_01V02.zip | 2112251329_Esp32DisplayKey_01V02.zip}} 
  
 ==== 211224 : Versuch zur Thread-Entkopplung ==== ==== 211224 : Versuch zur Thread-Entkopplung ====
module/micropython/esp32displaykey/esp32displaykey.1640437717.txt.gz · Last modified: 2021/12/25 15:08 (external edit)