Monthly Archives: February 2021

PlatformIO CLI

  • Platform
  • Framework
  • Package
  • Board

Packages

  • Toolchain
  • Framework
  • Tool

platformio.ini

lolin32

[env:lolin32]
platform = espressif32
board = lolin32
framework = arduino

uno

[env:uno]
platform = atmelavr
board = uno
framework = arduino

help

> pio -h   
Usage: pio [OPTIONS] COMMAND [ARGS]...

Options:
  --version          Show the version and exit.
  -f, --force        DEPRECATE
  -c, --caller TEXT  Caller ID (service)
  --no-ansi          Do not print ANSI control characters
  -h, --help         Show this message and exit.

Commands:
  access    Manage resource access
  account   Manage PlatformIO account
  boards    Embedded board explorer
  check     Static code analysis
  ci        Continuous integration
  debug     Unified debugger
  device    Device manager & serial/socket monitor
  home      GUI to manage PlatformIO
  lib       Library manager
  org       Manage organizations
  package   Package manager
  platform  Platform manager
  project   Project manager
  remote    Remote development
  run       Run project targets (build, upload, clean, etc.)
  settings  Manage system settings
  system    Miscellaneous system commands
  team      Manage organization teams
  test      Unit testing
  update    Update installed platforms, packages and libraries
  upgrade   Upgrade PlatformIO to the latest version

pio platform – Platform manager

> pio platform
Usage: pio platform [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  frameworks  List supported frameworks, SDKs
  install     Install new development platform
  list        List installed development platforms
  search      Search for development platform
  show        Show details about development platform
  uninstall   Uninstall development platform
  update      Update installed development platforms

list – List installed development platforms

> pio platform list

frameworks – List supported frameworks, SDKs

> pio platform frameworks   
arduino ~ Arduino
cmsis ~ CMSIS
esp8266-nonos-sdk ~ ESP8266 Non-OS SDK
esp8266-rtos-sdk ~ ESP8266 RTOS SDK
espidf ~ Espressif IoT Development Framework
freedom-e-sdk ~ Freedom E SDK
freertos ~ FreeRTOS
gd32vf103-sdk ~ GigaDevice GD32V SDK
kendryte-freertos-sdk ~ Kendryte FreeRTOS SDK
kendryte-standalone-sdk ~ Kendryte Standalone SDK
libopencm3 ~ libopencm3
mbed ~ Mbed
nuclei-sdk ~ Nuclei SDK
pulp-os ~ PULP OS
pulp-sdk ~ PULP SDK
pumbaa ~ Pumbaa
shakti-sdk ~ Shakti SDK
simba ~ Simba
siwisdk ~ SIWI GSM Software Development Kit for MT6261 and MT2503 SoC
spl ~ Standard Peripheral Library
stm32cube ~ STM32Cube
wd-riscv-sdk ~ WD-Firmware
wiringpi ~ WiringPi
zephyr ~ Zephyr RTOS

search – Search for development platform

> pio platform search
asrmicro650x ~ ASR Microelectronics ASR650x
aceinna_imu ~ Aceinna IMU
atmelavr ~ Atmel AVR
atmelsam ~ Atmel SAM
atmelmegaavr ~ Atmel megaAVR
chipsalliance ~ CHIPS Alliance
espressif32 ~ Espressif 32
espressif8266 ~ Espressif 8266
freescalekinetis ~ Freescale Kinetis
gd32v ~ GigaDevice GD32V
hwlogic ~ HWLogic
infineonxmc ~ Infineon XMC
intel_arc32 ~ Intel ARC32
intel_mcs51 ~ Intel MCS-51 (8051)
kendryte210 ~ Kendryte K210
lattice_ice40 ~ Lattice iCE40
linux_arm ~ Linux ARM
linux_i686 ~ Linux i686
linux_x86_64 ~ Linux x86_64
lgt8f ~ Logic Green boards
maxim32 ~ Maxim 32
microchippic32 ~ Microchip PIC32
m68k ~ Motorola 68k with up to date toolchain builds
nxplpc ~ NXP LPC
nxpimxrt ~ NXP i.MX RT
native ~ Native
nordicnrf51 ~ Nordic nRF51
nordicnrf52 ~ Nordic nRF52
nuclei ~ Nuclei
openhw ~ OpenHW Group
riscv_gap ~ RISC-V GAP
siwigsm ~ SIWI GSM Platform
ststm32 ~ ST STM32
ststm8 ~ ST STM8
shakti ~ Shakti
sifive ~ SiFive
siliconlabsefm32 ~ Silicon Labs EFM32
swm32 ~ Synwit SWM320
timsp430 ~ TI MSP430
titiva ~ TI TIVA
teensy ~ Teensy
wiznet7500 ~ WIZNet W7500
windows_x86 ~ Windows x86

show – Show details about development platform

> pio platform show espressif32
espressif32 ~ Espressif 32
==========================
Frameworks: arduino, espidf, pumbaa, simba

Packages
--------

Package toolchain-xtensa32
Package toolchain-xtensa32s2
Package toolchain-esp32ulp
Package toolchain-esp32s2ulp
Package framework-arduinoespressif32
Package framework-arduino-mbcwb
Package framework-espidf
Package framework-simba
Package framework-pumbaa
Package tool-esptoolpy
Package tool-mbctool
Package tool-openocd-esp32
Package tool-mkspiffs
Package tool-cmake
Package tool-ninja
Package tool-mconf
Package tool-idf

Boards
------
ID                               MCU      Frequency    Flash    RAM     Name
-------------------------------  -------  -----------  -------  ------  -------------------------------------------
[...]
lolin32                          ESP32    240MHz       4MB      320KB   WEMOS LOLIN32
lolin_d32                        ESP32    240MHz       4MB      320KB   WEMOS LOLIN D32
lolin_d32_pro                    ESP32    240MHz       4MB      320KB   WEMOS LOLIN D32 PRO
[...]

pio platform – Platform Manager


pio init

> pio init

The current working directory C:\Users\andreas\switchdrive\PlatformIO will be used for the project.

The next files/directories have been created in C:\Users\andreas\switchdrive\PlatformIO
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File

Project has been successfully initialized! Useful commands:
`pio run` - process/build project from the current directory
`pio run --target upload` or `pio run -t upload` - upload firmware to a target
`pio run --target clean` - clean project (remove compiled files)
`pio run --help` - additional information

pio run

Docs » PlatformIO Core (CLI) » CLI Guide » pio run

list-targets

> pio run --list-targets
Environment    Group     Name         Title                        Description
-------------  --------  -----------  ---------------------------  -----------------------------------------------------
lolin32        Advanced  compiledb    Compilation Database         Generate compilation database `compile_commands.json`
lolin32        Generic   clean        Clean
lolin32        Platform  buildfs      Build Filesystem Image
lolin32        Platform  erase        Erase Flash
lolin32        Platform  size         Program Size                 Calculate program size
lolin32        Platform  upload       Upload
lolin32        Platform  uploadfs     Upload Filesystem Image
lolin32        Platform  uploadfsota  Upload Filesystem Image OTA

pio run

> pio run
Processing lolin32 (platform: espressif32; board: lolin32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/lolin32.html
PLATFORM: Espressif 32 (3.0.0) > WEMOS LOLIN32
[...]
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 3.10004.210126 (1.0.4)
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 27 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP8266Audio> 1.7
|   |-- <SPI> 1.0
|   |-- <SPIFFS> 1.0
|   |   |-- <FS> 1.0
|   |-- <HTTPClient> 1.2
|   |   |-- <WiFiClientSecure> 1.0
|   |   |   |-- <WiFi> 1.0
|   |-- <WiFiClientSecure> 1.0
|   |   |-- <WiFi> 1.0
|   |-- <FS> 1.0
|   |-- <SD(esp32)> 1.0.5
|   |   |-- <FS> 1.0
|   |   |-- <SPI> 1.0
|-- <FS> 1.0
|-- <SD(esp32)> 1.0.5
|   |-- <FS> 1.0
|   |-- <SPI> 1.0
|-- <WiFi> 1.0
Building in release mode
Retrieving maximum program size .pio\build\lolin32\firmware.elf
Checking size .pio\build\lolin32\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15524 bytes from 327680 bytes)
Flash: [===       ]  27.7% (used 363509 bytes from 1310720 bytes)

pio run (verbose)

> pio run -v
Processing lolin32 (platform: espressif32; board: lolin32; framework: arduino; debug_tool: esp-prog; upload_port: COM3; debug_init_break: tbreak setup)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/lolin32.html
PLATFORM: Espressif 32 (3.0.0) > WEMOS LOLIN32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 3.10004.210126 (1.0.4)
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 27 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP8266Audio> 1.7 (C:\Users\andreas\switchdrive\PlatformIO\SoundTest\lib\ESP8266Audio)
|   |-- <SPI> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|   |-- <SPIFFS> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\SPIFFS)
|   |   |-- <FS> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\FS)
|   |-- <HTTPClient> 1.2 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\HTTPClient)
|   |   |-- <WiFi> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\WiFi)
|   |   |-- <WiFiClientSecure> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\WiFiClientSecure)
|   |   |   |-- <WiFi> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\WiFi)
|   |-- <WiFiClientSecure> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\WiFiClientSecure)
|   |   |-- <WiFi> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\WiFi)
|   |-- <FS> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\FS)
|   |-- <SD(esp32)> 1.0.5 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\SD)
|   |   |-- <FS> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\FS)
|   |   |-- <SPI> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|-- <FS> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\FS)
|-- <SD(esp32)> 1.0.5 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\SD)
|   |-- <FS> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\FS)
|   |-- <SPI> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|-- <WiFi> 1.0 (C:\Users\andreas\.platformio\packages\framework-arduinoespressif32\libraries\WiFi)
Building in release mode
<lambda>(["checkprogsize"], [".pio\build\lolin32\firmware.elf"])
MethodWrapper(["checkprogsize"], [".pio\build\lolin32\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15524 bytes from 327680 bytes)
Flash: [===       ]  27.7% (used 363509 bytes from 1310720 bytes)
.pio\build\lolin32\firmware.elf  :
[...]

pio system

> pio system info
--------------------------  --------------------------------------------------------
PlatformIO Core             5.1.0
Python                      3.7.7-final.0
System Type                 windows_amd64
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp1252
PlatformIO Core Directory   C:\Users\andreas\.platformio
PlatformIO Core Executable  C:\Users\andreas\.platformio\penv\Scripts\platformio.exe
Python Executable           C:\Users\andreas\.platformio\penv\Scripts\python.exe
Global Libraries            0
Development Platforms       2
Tools & Toolchains          23

Library Management

ArduinoJson

Library Storage: C:\Users\andreas\switchdrive\PlatformIO\SoundTest\.pio\libdeps\lolin32

.pio/libdeps/lolin32/ArduinoJson/.piopm:{"type": "library", "name": "ArduinoJson", "version": "6.17.2", "spec": {"owner": "bblanchon", "id": 64, "name": "ArduinoJson", "requirements": null, "url": null}}
.pio/libdeps/lolin32/ArduinoJson/library.json:    "url": "https://github.com/bblanchon/ArduinoJson.git"
.pio/libdeps/lolin32/ArduinoJson/library.properties:repository=https://github.com/bblanchon/ArduinoJson.git
[env:lolin32]
[...]
lib_deps = bblanchon/ArduinoJson@^6.17.2

Dear ImGui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

github.com/ocornut/imgui

Python

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies

github.com/hoffstadt/DearPyGui

WebAssembly (wasm)

github.com/jnmaloney/WebGui
github.com/schteppe/imgui-wasm
Native ImGui in the Browser

Applications

github.com/wolfpld/tracy, Tracy Profiler: C++ frame profiler

Qt Popup/Overlay Window

QApplication::activeModalWidget()
A modal widget is a special top-level widget which is a subclass of QDialog that specifies the modal parameter of the constructor as true. A modal widget must be closed before the user can continue with other parts of the program.

QApplication::activePopupWidget()
A popup widget is a special top-level widget that sets the Qt::WType_Popup widget flag, e.g. the QMenu widget. When the application opens a popup widget, all events are sent to the popup. Normal widgets and modal widgets cannot be accessed before the popup widget is closed.


Questions

Custom popup widget
How would I go about making a overlay widget

Code

void QCompleter::setPopup(QAbstractItemView *popup)
{
    Q_D(QCompleter);
    Q_ASSERT(popup != nullptr);
    if (d->popup) {
        QObject::disconnect(d->popup->selectionModel(), nullptr, this, nullptr);
        QObject::disconnect(d->popup, nullptr, this, nullptr);
    }
    if (d->popup != popup)
        delete d->popup;
    if (popup->model() != d->proxy)
        popup->setModel(d->proxy);
     popup->hide();

    Qt::FocusPolicy origPolicy = Qt::NoFocus;
    if (d->widget)
        origPolicy = d->widget->focusPolicy();

    // Mark the widget window as a popup, so that if the last non-popup window is closed by the
    // user, the application should not be prevented from exiting. It needs to be set explicitly via
    // setWindowFlag(), because passing the flag via setParent(parent, windowFlags) does not call
    // QWidgetPrivate::adjustQuitOnCloseAttribute(), and causes an application not to exit if the
    // popup ends up being the last window.
    popup->setParent(nullptr);
    popup->setWindowFlag(Qt::Popup);
    popup->setFocusPolicy(Qt::NoFocus);
    if (d->widget)
        d->widget->setFocusPolicy(origPolicy);

    popup->setFocusProxy(d->widget);
    popup->installEventFilter(this);
    popup->setItemDelegate(new QCompleterItemDelegate(popup));
#if QT_CONFIG(listview)
    if (QListView *listView = qobject_cast<QListView *>(popup)) {
        listView->setModelColumn(d->column);
    }
#endif

    QObject::connect(popup, SIGNAL(clicked(QModelIndex)),
                     this, SLOT(_q_complete(QModelIndex)));
    QObject::connect(this, SIGNAL(activated(QModelIndex)),
                     popup, SLOT(hide()));

    QObject::connect(popup->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
                     this, SLOT(_q_completionSelected(QItemSelection)));
    d->popup = popup;
}

void QCompleterPrivate::showPopup(const QRect& rect)
{
    const QRect screen = QWidgetPrivate::availableScreenGeometry(widget);
    Qt::LayoutDirection dir = widget->layoutDirection();
    QPoint pos;
    int rh, w;
    int h = (popup->sizeHintForRow(0) * qMin(maxVisibleItems, popup->model()->rowCount()) + 3) + 3;
    QScrollBar *hsb = popup->horizontalScrollBar();
    if (hsb && hsb->isVisible())
        h += popup->horizontalScrollBar()->sizeHint().height();

    if (rect.isValid()) {
        rh = rect.height();
        w = rect.width();
        pos = widget->mapToGlobal(dir == Qt::RightToLeft ? rect.bottomRight() : rect.bottomLeft());
    } else {
        rh = widget->height();
        pos = widget->mapToGlobal(QPoint(0, widget->height() - 2));
        w = widget->width();
    }

    if (w > screen.width())
        w = screen.width();
    if ((pos.x() + w) > (screen.x() + screen.width()))
        pos.setX(screen.x() + screen.width() - w);
    if (pos.x() < screen.x())
        pos.setX(screen.x());

    int top = pos.y() - rh - screen.top() + 2;
    int bottom = screen.bottom() - pos.y();
    h = qMax(h, popup->minimumHeight());
    if (h > bottom) {
        h = qMin(qMax(top, bottom), h);

        if (top > bottom)
            pos.setY(pos.y() - h - rh + 2);
    }

    popup->setGeometry(pos.x(), pos.y(), w, h);

    if (!popup->isVisible())
        popup->show();
}

Transparent/Alpha Background

QDialog with transparent background color
How not to lose the alpha channel


QML

Documentation

Qt 5.15 – Qt Quick Controls – Popup Controls

Questions

Popup item loses opaquness
how to set popup background color to transparent
Change popup background to transparent