Metadata-Version: 2.4
Name: gerwg
Version: 0.1.1
Summary: Краткое описание пустой библиотеки
Home-page: https://github.com/yourusername/gerwg
Author: Ваше Имя
Author-email: Simakovd207@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-python
Dynamic: summary

I checked the link you shared — it’s the [Elbear Arduino IDE Board Support Package (BSP) project on Gitflic](https://gitflic.ru/project/elron-tech/elbear_arduino_bsp?utm_source=chatgpt.com), which is a *Board Support Package for MIK32 “Амур”-based boards* intended for use in Arduino IDE (not PlatformIO) — specifically supporting boards like ELBEAR ACE-UNO, ELBEAR ACE-NANO, ELSOMIK, and START-MIK32. ([gitflic.ru][1])

This is *not* already a PlatformIO package — it’s written to integrate with Arduino’s Boards Manager via a JSON index in Arduino IDE. ([gitflic.ru][1])

---

## Can You Use This BSP in PlatformIO?

Yes — *but you must manually import/adapt it*, because PlatformIO does not automatically consume Arduino IDE board support packages distributed in this form.

### What This BSP Contains

From the README:

* Arduino core and variant files for MIK32 (Amur CPU)-based boards
* Arduino-style libraries adapted for these MCUs
* Board descriptions and behavior tailored for Arduino IDE
* Instructions and special API behavior for GPIO, ADC, PWM, interrupts, etc. ([gitflic.ru][1])

### How to Import It into PlatformIO

There are two practical ways:

---

### Option A — Create a Custom PlatformIO Platform

This is the cleanest way:

1. Clone the BSP locally from the repository.

2. Create a custom PlatformIO platform folder.

   Example structure inside your project:

   

   myproject/
     platformio.ini
     custom_elbear_bsp/
       platform.json
       boards/
         elbear_ace_uno.json
         start_mik32.json
       framework-arduino-mik32/
         cores/
         variants/
         libraries/
   

   Essentially transplant the Arduino IDE BSP into PlatformIO’s structure.

3. Write `platform.json` to define your platform:

   
   {
     "name": "elbear_mik32",
     "title": "Elbear MIK32 Custom Platform",
     "version": "0.1.0",
     "frameworks": { "arduino": {} },
     "packages": {
       "framework-arduino-mik32": {
         "type": "framework",
         "path": "framework-arduino-mik32"
       }
     }
   }
   

4. Convert each board definition into PlatformIO JSON files in boards/.

   Example minimal:

   
   {
     "build": {
       "core": "mik32",
       "mcu": "mik32",
       "f_cpu": "80000000L",
       "variant": "ace_uno"
     },
     "frameworks": ["arduino"],
     "name": "ELBEAR ACE-UNO",
     "upload": {
       "protocol": "serial",
       "speed": 115200
     }
   }
   

5. Use it in your `platformio.ini`:

   
   [env:elbear_ace_uno]
   platform = ./custom_elbear_bsp
   board = elbear_ace_uno
   framework = arduino
   

6. Make sure to port any Arduino IDE build flags in the BSP’s platform.txt into PlatformIO’s build_flags.

---

### Option B — Extend an Existing Platform

If the architecture of the MIK32 CPU is supported by an existing PlatformIO platform (e.g., if it’s GCC-ARM or another supported toolchain), you *could*:

1. Pick the closest existing PlatformIO platform (for example, ststm32 or atmelavr, but only if binary toolchain is compatible).
2. Add the core/variant files from the BSP manually via:

   * build_flags
   * board_build.core
   * board_build.variant
   * Custom include paths (-I)
3. Create a custom board JSON in $HOME/.platformio/boards/ defining MCU, frequency, etc.

This is usually more fragile and only recommended *if* you know the underlying toolchain works.

---

## Practical Tips

* The BSP does *not* include a PlatformIO platform.json or board JSONs — *you must add those yourself*.
* Arduino IDE boards.txt and platform.txt contain build flags that must be translated to PlatformIO’s format (build_flags, upload.protocol, etc.).
* Upload protocol may need custom scripts if the BSP uses something non-standard.

---

## Summary

* The Elbear BSP you linked is for Arduino IDE and supports specific MIK32 boards. ([gitflic.ru][1])
* PlatformIO will not import it automatically — you must:

  1. Create a custom PlatformIO platform
  2. Or extend an existing platform by manually adding BSP files and board JSONs.

If you want, provide the specific board you’re targeting (e.g., ELBEAR ACE-UNO or START-MIK32) and I can help generate the necessary board JSON and platform.json boilerplate for PlatformIO.

[1]: https://gitflic.ru/project/elron-tech/elbear_arduino_bsp?utm_source=chatgpt.com "elron-tech/elbear_arduino_bsp: Elbear Arduino IDE Board Support Package"


import matplotlib.pyplot as plt
import numpy as np
from matplotlib.animation import FuncAnimation
from collections import deque

# ═══════════════════════════════════════════════════════════════
# 🔧 НАСТРОЙКИ - МЕНЯЙТЕ ЗДЕСЬ
# ═══════════════════════════════════════════════════════════════

# Названия для каждого из 5 графиков
GRAPH_TITLES = [
    'Температура',      # График 1
    'Влажность',         # График 2
    'Освещённость',      # График 3
    'Звук',              # График 4
    'Вибрация'           # График 5
]

# Подписи Y-оси для каждого графика
Y_LABELS = [
    '°C',           # График 1
    '%',            # График 2
    'Lux',          # График 3
    'dB',           # График 4
    'Уровень'       # График 5
]

# Диапазоны значений (min, max) для каждого графика
Y_RANGES = [
    (-10, 50),     # График 1 (температура)
    (0, 100),      # График 2 (влажность)
    (0, 1000),     # График 3 (освещённость)
    (0, 100),      # График 4 (звук)
    (-5, 5)        # График 5 (вибрация)
]

# Общие настройки
max_points = 100           # Количество видимых точек
update_interval = 50       # мс между обновлениями
fig_width = 15             # Ширина окна
fig_height = 8             # Высота окна



# ================= СОЗДАНИЕ ОКНА =================
fig = plt.figure(figsize=(fig_width, fig_height))
axes = []
for i in range(5):
    if i < 3:
        ax = fig.add_subplot(2, 3, i + 1)
    else:
        ax = fig.add_subplot(2, 3, i + 2)
    axes.append(ax)

# ================= ХРАНИЛИЩЕ ДАННЫХ =================
data_buffers = [deque(maxlen=max_points) for _ in range(5)]

# Инициализируем буферы начальными значениями
for i in range(5):
    for _ in range(max_points):
        data_buffers[i].append(0)

lines = []

# ================= НАСТРОЙКА ГРАФИКОВ =================
for i, ax in enumerate(axes):
    # X-ось всегда от 0 до max_points
    x = range(max_points)
    line, = ax.plot(x, list(data_buffers[i]), lw=2, color=f'C{i}')
    lines.append(line)
    
    ax.set_xlim(0, max_points)
    ax.set_ylim(Y_RANGES[i][0], Y_RANGES[i][1])
    ax.set_title(f'{GRAPH_TITLES[i]}', fontsize=12, fontweight='bold')
    ax.grid(True, alpha=0.3, linestyle='--')
    ax.set_xlabel('Время →')
    ax.set_ylabel(f'Значение ({Y_LABELS[i]})')
    
    # Добавляем вертикальную линию для визуального эффекта
    ax.axvline(x=max_points-1, color='red', alpha=0.3, linestyle=':', linewidth=1)

# ================= ОБНОВЛЕНИЕ =================
def update(frame):
    for i in range(5):
        # Добавляем новое случайное значение (автоматически удаляется старое)
        # Для реальных данных с Arduino замените эту строку на чтение из порта
        new_value = np.random.uniform(Y_RANGES[i][0], Y_RANGES[i][1])
        data_buffers[i].append(new_value)
        
        # Обновляем линию
        lines[i].set_ydata(list(data_buffers[i]))
    
    return lines

# ================= ЗАПУСК =================
ani = FuncAnimation(fig, update, interval=update_interval, blit=True)
plt.tight_layout()
plt.show()


import matplotlib.pyplot as plt
import numpy as np
from matplotlib.animation import FuncAnimation
from collections import deque




GRAPH_TITLES = [
    'Температура',      
    'Влажность',         
    'Освещённость',     
    'Звук',              
    'Вибрация'           
]


Y_LABELS = [
    '°C',           
    '%',            
    'Lux',          
    'dB',           
    'Уровень'       
]


Y_RANGES = [
    (-10, 50),     
    (0, 100),      
    (0, 1000),     
    (0, 100),      
    (-5, 5)        
]


max_points = 100          
update_interval = 50      
fig_width = 15            
fig_height = 8            

fig = plt.figure(figsize=(fig_width, fig_height))
axes = []
for i in range(5):
    if i < 3:
        ax = fig.add_subplot(2, 3, i + 1)
    else:
        ax = fig.add_subplot(2, 3, i + 2)
    axes.append(ax)


data_buffers = [deque(maxlen=max_points) for _ in range(5)]


for i in range(5):
    for _ in range(max_points):
        data_buffers[i].append(0)

lines = []


for i, ax in enumerate(axes):
    #
    x = range(max_points)
    line, = ax.plot(x, list(data_buffers[i]), lw=2, color=f'C{i}')
    lines.append(line)
    
    ax.set_xlim(0, max_points)
    ax.set_ylim(Y_RANGES[i][0], Y_RANGES[i][1])
    ax.set_title(f'{GRAPH_TITLES[i]}', fontsize=12, fontweight='bold')
    ax.grid(True, alpha=0.3, linestyle='--')
    ax.set_xlabel('Время →')
    ax.set_ylabel(f'Значение ({Y_LABELS[i]})')
    
   
    ax.axvline(x=max_points-1, color='red', alpha=0.3, linestyle=':', linewidth=1)


def update(frame):
    for i in range(5):
        
        new_value = np.random.uniform(Y_RANGES[i][0], Y_RANGES[i][1])
        data_buffers[i].append(new_value)
        
        
        lines[i].set_ydata(list(data_buffers[i]))
    
    return lines


ani = FuncAnimation(fig, update, interval=update_interval, blit=True)
plt.tight_layout()
plt.show()






## Установка

```bash
pip install gerwg
