module:micropython:esp32uart:esp32uart
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| module:micropython:esp32uart:esp32uart [2021/12/19 12:27] – [Quell-Code] omdevelop | module:micropython:esp32uart:esp32uart [2022/09/13 11:58] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| {{https:// | {{https:// | ||
| {{https:// | {{https:// | ||
| - | ==== Beschreibung ==== | + | ===== Version ===== |
| + | {{: | ||
| + | |||
| + | ===== Beschreibung ===== | ||
| + | |||
| + | **Ausgabe MicroPython-Terminal Esp32CheckUart.py** | ||
| + | <code python> | ||
| + | >>> | ||
| + | >>> | ||
| + | CBUartOnTxLine[000 < | ||
| + | CBUartOnRxLine[000 < | ||
| + | CBUartOnTxLine[111 < | ||
| + | CBUartOnTxLine[222 < | ||
| + | CBUartOnRxLine[111 < | ||
| + | CBUartOnTxLine[333 < | ||
| + | CBUartOnRxLine[222 < | ||
| + | CBUartOnTxLine[444 < | ||
| + | CBUartOnRxLine[333 < | ||
| + | CBUartOnTxLine[555 < | ||
| + | CBUartOnRxLine[444 < | ||
| + | CBUartOnTxLine[666 < | ||
| + | CBUartOnRxLine[555 < | ||
| + | CBUartOnTxLine[777 < | ||
| + | CBUartOnRxLine[666 < | ||
| + | CBUartOnTxLine[888 < | ||
| + | CBUartOnRxLine[777 < | ||
| + | CBUartOnTxLine[999 < | ||
| + | CBUartOnRxLine[888 < | ||
| + | CBUartOnRxLine[999 < | ||
| + | *** Esp32CheckUart: | ||
| + | >>> | ||
| + | </ | ||
| - | ==== Quell-Code==== | ||
| **Main-Program: | **Main-Program: | ||
| <code python> | <code python> | ||
| Line 167: | Line 198: | ||
| # | # | ||
| </ | </ | ||
| + | |||
| **Library-Module: | **Library-Module: | ||
| <code python> | <code python> | ||
| + | # | ||
| + | import time | ||
| + | import _thread as THR | ||
| + | # | ||
| + | # States - EStateThread : | ||
| + | stIdle = 0 | ||
| + | stBusy = 1 | ||
| + | stEnd = 2 | ||
| + | # | ||
| + | class CThread(): | ||
| + | # | ||
| + | def __init__(self, | ||
| + | self.State = stIdle | ||
| + | self.Thread = None | ||
| + | self.OnStart = onstart | ||
| + | self.OnBusy = onbusy | ||
| + | self.OnAbort = onabort | ||
| + | self.OnEnd = onend | ||
| + | return | ||
| + | # | ||
| + | def Start(self): | ||
| + | self.State = stBusy | ||
| + | if (None != self.OnStart): | ||
| + | self.OnStart(self) | ||
| + | self.ThreadID = THR.start_new_thread(self.CBOnExecute, | ||
| + | return | ||
| + | # | ||
| + | def Abort(self): | ||
| + | self.State = stEnd | ||
| + | if (None != self.OnAbort): | ||
| + | self.OnAbort(self) | ||
| + | return | ||
| + | # | ||
| + | def CBOnExecute(self, | ||
| + | if (None != self.OnBusy): | ||
| + | self.OnBusy(self) | ||
| + | if (None != self.OnEnd): | ||
| + | self.OnEnd(self) | ||
| + | return | ||
| + | # | ||
| + | # | ||
| + | if (' | ||
| + | print(' | ||
| + | # | ||
| + | # Thread = CThread(CBOnStart, | ||
| + | # Thread.Start() | ||
| + | # time.sleep(5.0) | ||
| + | # Thread.Abort() | ||
| + | # | ||
| + | print(' | ||
| + | # | ||
| </ | </ | ||
| + | |||
| + | **Library-Module: | ||
| + | <code python> | ||
| + | # | ||
| + | # CLines : FirstIn-FirstOut | ||
| + | class CLines(list): | ||
| + | # | ||
| + | def __init__(self): | ||
| + | self = [] | ||
| + | # | ||
| + | def Count(self): | ||
| + | return len(self) | ||
| + | # | ||
| + | def Push(self, line): | ||
| + | self.append(line) | ||
| + | return | ||
| + | # | ||
| + | def Pop(self): | ||
| + | Line = '' | ||
| + | if (0 < self.Count()): | ||
| + | Line = self.pop(0) | ||
| + | return Line | ||
| + | </ | ||
| + | |||
| + | **Library-Module: | ||
| + | <code python> | ||
| + | # | ||
| + | ID_UART0 | ||
| + | PIN_UART0_TX = 1 # USB | ||
| + | PIN_UART0_RX = 3 # USB | ||
| + | # | ||
| + | ID_UART1 | ||
| + | PIN_UART1_RX = 25 # 9 - not usable | ||
| + | PIN_UART1_TX = 26 # 10 - not usable | ||
| + | # | ||
| + | ID_UART2 | ||
| + | PIN_UART2_RX = 16 | ||
| + | PIN_UART2_TX = 17 | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| ===== Entwicklung ===== | ===== Entwicklung ===== | ||
module/micropython/esp32uart/esp32uart.1639913260.txt.gz · Last modified: 2021/12/19 13:27 (external edit)