В процессе работы
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
"""
|
||||
# Создание сокета mkfifo /tmp/gpio_pipe
|
||||
# Необходим файл с данными, например array.txt. Формат записи данных [0xE0, 0x01, 0x4C, 0x88]
|
||||
# Запуск python3 emulator.py array.txt /tmp/gpio_pipe
|
||||
Эмулятор чтения из файла и отправки в pipe.
|
||||
|
||||
Создание сокета: mkfifo /tmp/gpio_pipe
|
||||
Формат файла: [0xE0, 0x01, 0x4C, 0x88]
|
||||
Запуск: python3 emulator.py array.txt /tmp/gpio_pipe
|
||||
"""
|
||||
|
||||
import sys
|
||||
import time
|
||||
import ast
|
||||
@@ -49,6 +52,7 @@ def status_clear():
|
||||
# ================= DATA =================
|
||||
|
||||
def load_array(path):
|
||||
"""Загружает данные из файла."""
|
||||
while True:
|
||||
try:
|
||||
with open(path, "r") as f:
|
||||
@@ -73,6 +77,7 @@ def load_array(path):
|
||||
# ================= PIPE =================
|
||||
|
||||
def open_pipe(path):
|
||||
"""Открывает pipe для записи."""
|
||||
while not stop_flag:
|
||||
try:
|
||||
fd = os.open(path, os.O_WRONLY | os.O_NONBLOCK)
|
||||
|
||||
Reference in New Issue
Block a user