Skip to content

Instantly share code, notes, and snippets.

View hollyhockberry's full-sized avatar

hollyhockberry

View GitHub Profile
@hollyhockberry
hollyhockberry / main.cpp
Created September 22, 2021 10:23
M5Paper draw bitmap file
#include <M5EPD.h>
void setup() {
M5.begin();
M5.EPD.SetRotation(90);
M5.EPD.Clear(true);
M5EPD_Canvas canvas(&M5.EPD);
canvas.createCanvas(540, 960);
canvas.drawBmpFile(SD, "/inaba.bmp", 0, 0);
@hollyhockberry
hollyhockberry / main.cpp
Created September 26, 2021 11:02
M5Paper: draw bitmap file with M5GFX
#include <M5EPD.h>
#include <M5GFX.h>
// SDカードに以下のファイルを用意
// /inaba.bmp 540x540 24bit
// /inaba2.bmp 270x270 24bit
void setup() {
M5.begin();
@hollyhockberry
hollyhockberry / main.cpp
Created September 26, 2021 11:33
M5Paper: draw bitmap to fixed size with M5GFX
#include <M5EPD.h>
#include <M5GFX.h>
void setup() {
M5.begin();
M5GFX display;
display.begin();
display.invertDisplay(false);
display.clear(TFT_WHITE);
@hollyhockberry
hollyhockberry / main.cpp
Created September 28, 2021 10:07
M5Paper: Detection of touched points.
#include <M5EPD.h>
void setup() {
M5.begin();
}
void loop() {
if (!M5.TP.avaliable()) {
return;
}
@hollyhockberry
hollyhockberry / main.cpp
Created September 29, 2021 09:35
M5Paper: Judge touch gestures.
#include <M5EPD.h>
int lastFingers;
int eventIndex;
u_long events[4];
void pushTouchEvent(bool down) {
if (!down && (eventIndex <= 0)) {
return;
}
@hollyhockberry
hollyhockberry / main.cpp
Created September 29, 2021 10:05
M5Paper: Show touch position.
#include <M5EPD.h>
void setup() {
M5.begin();
}
void loop() {
if (!M5.TP.avaliable()) {
return;
}
@hollyhockberry
hollyhockberry / main.cpp
Last active October 10, 2021 10:36
M5Core2: LVGL Sample (with LGFX)
#define LGFX_AUTODETECT
#define LGFX_USE_V1
#include <lvgl.h>
#include <M5Core2.h>
#include <LovyanGFX.hpp>
constexpr uint16_t screenWidth = 320;
constexpr uint16_t screenHeight = 240;
lv_disp_draw_buf_t draw_buf;
@hollyhockberry
hollyhockberry / main.cpp
Last active February 23, 2024 00:35
M5Paper: LVGL Sample (with LGFX)
#define LGFX_AUTODETECT
#define LGFX_USE_V1
#include <lvgl.h>
#include <M5EPD.h>
#include <LovyanGFX.hpp>
static const uint16_t screenWidth = 960;
static const uint16_t screenHeight = 540;
lv_disp_draw_buf_t draw_buf;
@hollyhockberry
hollyhockberry / main.cpp
Created October 22, 2021 11:09
M5 Fader unit: Fader in
#include <Arduino.h>
constexpr int pin_fader = 33;
void setup() {
Serial.begin(115200);
::pinMode(pin_fader, INPUT);
}
void loop() {
@hollyhockberry
hollyhockberry / main.cpp
Created October 22, 2021 11:23
M5 Fader unit: LED out 1
#include <Arduino.h>
#include <FastLED.h>
constexpr int pin_fader = 33;
constexpr int pin_led = 32;
constexpr int led_count = 14;
CRGB leds[led_count];
long show = 0;