Skip to content

M5Cardputer

Basic library for M5Stack M5Cardputer and M5Cardputer-ADV Board

M5Cardputer is an Arduino library for ESP32-based handheld devices featuring an integrated LCD display, keyboard, speaker, microphone, button, IR transmitter, and SD card slot. It wraps M5Unified and M5GFX to provide a unified, high-level API.

Unofficial documentation. Personally maintained, based on M5Cardputer v1.1.1 and dependency headers. May contain errors or omissions. The M5Stack official repository is the authoritative source.
Repo: https://github.com/cheerland01/M5Cardputer-docs

Supported Boards

Board Keyboard Reader
M5Cardputer GPIO Matrix (IOMatrixKeyboardReader)
M5Cardputer-ADV TCA8418 I2C Controller (TCA8418KeyboardReader)

Installation

PlatformIO

Add to platformio.ini:

lib_deps =
    m5stack/M5Cardputer@^1.1.1

Arduino IDE

  1. Open Library Manager (Ctrl+Shift+I)
  2. Search for M5Cardputer
  3. Click Install

Required dependencies (installed automatically):

Library Version
M5Unified *
M5GFX *
IRremote *

Quick Start

#include "M5Cardputer.h"

void setup() {
    auto cfg = M5.config();
    M5Cardputer.begin(cfg, true);  // true = enable keyboard
}

void loop() {
    M5Cardputer.update();          // Must be called every loop iteration

    if (M5Cardputer.Keyboard.isChange()) {
        if (M5Cardputer.Keyboard.isPressed()) {
            auto& state = M5Cardputer.Keyboard.keysState();

            // Print typed characters
            for (char c : state.word) {
                M5Cardputer.Display.print(c);
            }

            // Handle special keys
            if (state.enter) M5Cardputer.Display.println();
            if (state.del) {
                // Backspace logic
            }
        }
    }
}

API Overview

Class / Subsystem Description
M5_CARDPUTER Main device class β€” display, audio, input, I2C buses, button, power
Configuration M5Unified config_t β€” hardware init, pin assignments
Display (M5GFX) Full-featured graphics: drawing shapes, text, images, QR codes
Sprite (M5Canvas) Off-screen canvas, double-buffered rendering
Speaker Tone generation, WAV playback, volume control
Microphone I2S audio recording with configurable sample rate
Keyboard_Class Keyboard state machine with multi-key & modifier handling, key code constants
KeyboardReader Abstract base + GPIO / I2C implementations
ReplView Terminal-style REPL UI framework with prompt, cursor, and command callbacks
SD Card MicroSD file I/O, WAV storage, logging
Infrared IR NEC transmitter (IRremote library)
External APIs Quick links to WiFi, BLE, MQTT, USB HID, FreeRTOS, OTA, JSON docs

License


This documentation was generated with the assistance of DeepSeek.