1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ESP32-C3-WROOM-02+SSD1306でM5Stack-Avatarを表示

Last updated at Posted at 2023-10-28

秋月で売ってるSSD1306はM5 GLASS2で使われているSSD1309と互換性があるらしい

cpp main.cpp
#include <M5UnitGLASS2.h>
#include <M5Unified.h>
#include <Avatar.h>

m5avatar::Avatar avatar;

void setup(){
	auto cfg=M5.config();
	cfg.unit_glass2.pin_sda=9;
	cfg.unit_glass2.pin_scl=8;
    M5.begin(cfg);
	M5.setPrimaryDisplayType({m5::board_t::board_M5UnitGLASS2});

	avatar.setScale(.3);
	avatar.setPosition(-88,-96);
	avatar.init();
}
void loop(){}

setPositionの数値は
(M5Stack-Avaterの表示領域([320,240])-ディスプレイサイズ([128,64]))/2
引数は(top,left)なのでY座標が先
setScaleはキャンバス中心を基点に拡縮するので好みの値でOK

何故かAPP_CPU_NUMが宣言されていないと怒られたのでAvater.cpp先頭に追記
ESP32C3がシングルコアだから?

M5stack-Avatar Avater.cpp
#ifndef APP_CPU_NUM
  #define APP_CPU_NUM 0
#endif

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?