Skip to content

Instantly share code, notes, and snippets.

@GOB52
GOB52 / main.cpp
Created November 13, 2024 03:52
M5Unit-ENV Unit-CO2/CO2L の AtomS3 example の M5UnitUnified 版
/*
Unit-CO2/CO2L example using M5UnitUnified for M5AtomS3
https://github.com/m5stack/M5Unit-ENV/blob/master/examples/Unit_CO2_M5AtomS3/Unit_CO2_M5AtomS3.ino
Unit-CO2 https://docs.m5stack.com/ja/unit/co2
Unit-CO2L https://docs.m5stack.com/ja/unit/CO2L
*/
#include <M5UnitUnified.h>
#include <M5UnitUnifiedENV.h>
@GOB52
GOB52 / detect_flicked.cpp
Created January 31, 2024 13:55
Detect flicked (right/left) sample by M5Unified (develop)
// return 0:none 1:right flicked 2:left flicked
int foo()
{
if(M5.Touch.getCount())
{
auto dt = M5.Touch.getDetail(0);
if(dt.wasFlicked())
{
int16_t dx = dt.distanceX();
int16_t dy = dt.distanceY();
@GOB52
GOB52 / FlipBookSD_0_1_2.log
Last active July 6, 2023 05:50
Logging of M5Stack_FlipBookSD CoreS3/Core2
e.g)
01:14:36.959 > [ 42557][D][main.cpp:485] loopRender(): 300/ 3145 30.16/29.76 4775/451/22761
currentFrame/totalFrame currentFPS/averageFPS loadCycle/playRawCycle/drawJpgCycle(us)
320x180 8K u8 1ch wav 29.97 FPS
CoreS3
01:14:36.959 > [ 42556][D][main.cpp:476] loopRender(): outIdx:0 jsz:7081 wsz:267/80347
01:14:36.959 > [ 42557][D][main.cpp:485] loopRender(): 300/ 3145 30.16/29.76 4775/451/22761
@GOB52
GOB52 / word_left_shift.py
Last active May 21, 2023 05:55
Word-by-word left shift
import string
import sys
TEXT_BUFFER = 'Once upon a time, a woodcutter and his wife lived in their cottage on the edge of a large and ancient forest. They had two dear little children who met with a most wonderful adventure.'
def wordLeft(pos):
buf = TEXT_BUFFER
i = pos
isPunc = lambda c:c in string.punctuation
@GOB52
GOB52 / Infinite_loop_FPGA.log
Created May 20, 2023 15:14
Infinite loop in Panel_M5HDMI.cpp
00:02:48.894 > [ 468][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
00:02:48.894 > [ 506][I][M5GFX.cpp:507] init_impl(): [M5GFX] [Autodetect] load from NVS : board:3
00:02:48.894 > [ 506][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=21 scl=22 freq=100000
00:02:48.894 > [ 516][I][M5GFX.cpp:800] autodetect(): [M5GFX] [Autodetect] M5StackCore2
00:02:48.894 > [ 638][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=21 scl=22 freq=100000
00:02:48.894 > [ 639][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=21 scl=22 freq=100000
00:02:48.894 > [ 680][I][Panel_M5HDMI.cpp:468] init(): [M5HDMI] i2c port:1 sda:21 scl:22
00:02:48.894 > [ 680][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=21 scl=22 freq=100000
00:02:48.894 > [ 685][I][Panel_M5HDMI.cpp:475] init(): [M5HDMI] Chip ID: 17 02 e2
00:02:48.894 > [ 690][I][Panel_M5HDMI.cpp:481] init(): [M5HDMI] Resetting HDMI transmitter...
@GOB52
GOB52 / main.cpp
Created May 20, 2023 03:44
[M5StackCoreS3] Example of separating the tasks of the camera and the display on the LCD.
/*
Example of separating the tasks of the camera and the display on the LCD.
*/
#include <M5Unified.h>
#include <gob_unifiedButton.hpp>
#include <esp_camera.h>
#include <rom/cache.h> // Cache_WriteBack_Addr
#include <cstring>
@GOB52
GOB52 / intro_vscode.en.md
Created May 19, 2023 07:15
English translation from the Japanese version of M5Unified intro_vscode

How to build project with M5Unified in VSCode.

This section summarizes the steps to build a project with M5Unified in Visual Studio Code (henceforth VSCode) and its extension PlatformIO. Just follow the instructions.

The version at the time of writing this document is as follows.

  • Windows : Windows 11 Home 22H2
  • VSCode : 1.70.2
  • PlatformIO : 3.1.1
  • M5Unified : 0.1.6
@GOB52
GOB52 / M5Unified_HDMI.log
Last active May 15, 2023 09:42
M5Unified + M5ModuleDisplay.h HDMI ログ
// HDMI ケーブル未接続、 DCなしにも関わらず本体液晶にでない時のログ
15:01:41.443 > rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
15:01:41.443 > configsip: 0, SPIWP:0xee
15:01:41.443 > clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
15:01:41.443 > mode:DIO, clock div:1
15:01:41.443 > load:0x3fff0030,len:1344
15:01:41.443 > load:0x40078000,len:13924
15:01:41.443 > ho 0 tail 12 room 4
15:01:41.443 > load:0x40080400,len:3600
@GOB52
GOB52 / BasicHttpsClient.ino
Created January 11, 2023 13:33
BasicHttpsClient.ino の証明書変更して繋いでみた
/**
BasicHTTPSClient.ino
Created on: 14.10.2018
*/
#include <Arduino.h>
#include <WiFi.h>
@GOB52
GOB52 / inherit_LGFX_Sprite2.hpp
Last active January 2, 2023 06:31
LGFX_Sprite 派生クラス間の Bitblt
class Sprite : public ::LGFX_Sprite
{
public:
explicit Sprite(::LovyanGFX* parent) : ::LGFX_Sprite(parent) {}
Sprite() : LGFX_Sprite() {}
/*!
@brief Bit block transfer of color data corresponding to a pixel rectangle from the specified source sprite to the destination sprite.
@param dst Destination sprite.
@param dx X coodrdinate of the left-top corner of destination rectabgle.