Skip to content

Hardware Reference

M5Cardputer (Standard) — GPIO Matrix

The keyboard uses a GPIO matrix with 3 output pins (row select) and 7 input pins (column read).

Pin Assignments

Role Pin GPIO
Output (row select bit 0) OUT0 8
Output (row select bit 1) OUT1 9
Output (row select bit 2) OUT2 11
Input (column read bit 0) IN0 13
Input (column read bit 1) IN1 15
Input (column read bit 2) IN2 3
Input (column read bit 3) IN3 4
Input (column read bit 4) IN4 5
Input (column read bit 5) IN5 6
Input (column read bit 6) IN6 7

Input pins use INPUT_PULLUP mode. A key press pulls the corresponding line LOW.

Key Layout (4 rows × 14 columns)

   0   1   2   3   4   5   6   7   8   9  10  11  12  13
0  `   1   2   3   4   5   6   7   8   9   0   -   =  BKSP
1 TAB   q   w   e   r   t   y   u   i   o   p   [   ]   \
2  FN SHIFT a   s   d   f   g   h   j   k   l   ;   ' ENTER
3 CTRL OPT ALT  z   x   c   v   b   n   m   ,   .   / SPACE

Each cell has two values: lowercase (value_first) and shifted/uppercase (value_second). The Point2D_t {x, y} coordinate matches this grid exactly.

X-map Chart

The 7 input bits decode into column indices via X_map_chart:

Input Bit value x_1 (first 4 rows) x_2 (last 4 rows)
bit 0 1 0 1
bit 1 2 2 3
bit 2 4 4 5
bit 3 8 6 7
bit 4 16 8 9
bit 5 32 10 11
bit 6 64 12 13

M5Cardputer-ADV — TCA8418 I2C

The ADV model uses a TCA8418 I2C keypad matrix controller chip.

Item Value
I2C Bus Internal (m5::In_I2C)
I2C Address 0x34
I2C Frequency 400 kHz
Matrix Size 7 rows × 8 columns
Interrupt Pin GPIO 11

Remapping

The TCA8418 raw row/column values are remapped to match the standard M5Cardputer coordinate system:

Column = row_raw * 2 + (col_raw > 3 ? 1 : 0)
Row    = (col_raw + 4) % 4

This ensures the same Point2D_t coordinates and _key_value_map can be shared between both board variants.


Other Hardware

Component Interface Notes
Display SPI 320×240 TFT, accessed via M5Cardputer.Display (M5GFX)
Button A GPIO Physical button, accessed via M5Cardputer.BtnA
Speaker DAC / PWM Tone output via M5Cardputer.Speaker
Microphone ADC Recording via M5Cardputer.Mic
IR Transmitter GPIO NEC format via IRremote library
SD Card SPI File I/O
External I2C Port.A (m5::Ex_I2C) Available for user peripherals
Internal I2C m5::In_I2C On-board TCA8418 (ADV model)