A dedicated writing firmware for the Xteink X4 e-paper device. Pairs with any Bluetooth LE (BLE) keyboard and saves notes to MicroSD.
.bak rotation pattern; a failed or interrupted write never destroys the previous version. Orphaned files from a crash are recovered automatically on next bootNo software required. Works on Windows and Mac in Chrome or Edge.
Install MicroSlate → typeslate.com/tools/microslate
Connect your Xteink X4 via USB and click Install MicroSlate for the standalone firmware, or Install Dual-Boot to get MicroSlate + CrossPoint on the same device. Takes about 2 minutes.
Requires a Windows or Linux x86_64 machine (the ESP-IDF toolchain does not support Mac ARM or Raspberry Pi).
Prerequisites
# Clone the repository
git clone https://github.com/Josh-writes/microslate-firmware
cd xteink-writer-firmware
# Build and upload (adjust port if needed)
pio run --target upload --upload-port /dev/ttyUSB0
The upload port defaults to COM5 in platformio.ini.
All libraries are included in the lib/ directory. The only external dependency fetched automatically by PlatformIO is esp-nimble-cpp (BLE stack).
The device remembers paired keyboards (up to 4) and reconnects automatically on subsequent boots. If multiple keyboards are stored, it cycles through them until one responds.
| Key | Action |
|---|---|
| Up / Down | Navigate |
| Left / Right | Also navigate (convenient in landscape) |
| Enter | Select |
Options: Browse Notes, New Note, Settings, Sync — and CrossPoint if the dual-boot firmware is installed
| Key | Action |
|---|---|
| Up / Down | Navigate list |
| Left / Right | Also navigate (convenient in landscape) |
| Enter | Open note |
| Ctrl+N | Edit title of selected note |
| Ctrl+D | Delete selected note (confirmation required) |
| Esc | Back to main menu |
When delete is pending, the footer shows Delete? Enter:Yes Esc:No. Press Enter to confirm or any other key to cancel.
| Key | Action |
|---|---|
| Arrow keys | Move cursor |
| Home / End | Start / end of line |
| Backspace / Delete | Remove characters |
| Tab | Cycle writing mode (Scroll → Typewriter → Pagination) |
| Ctrl+S | Save manually |
| Ctrl+N | Edit note title |
| Ctrl+Z | Toggle clean mode (hides UI chrome) |
| Ctrl+T | Toggle Typewriter mode |
| Ctrl+P | Toggle Pagination mode |
| Ctrl+Left / Right | Jump pages (Pagination mode only) |
| Esc / Back button | Save and return to file browser |
The current writing mode is shown in the header: [S] Scroll, [T] Typewriter, [P] Pagination.
Auto-save runs silently after 10 seconds of idle or every 2 minutes during continuous typing — Ctrl+S is only needed if you want to save immediately.
Scroll [S] — Standard scrolling editor. Text scrolls as the cursor moves down the page.
Typewriter [T] — Only the current line is shown, centered vertically on a blank screen. When you press Enter, the previous line disappears and a fresh line appears. Text is still saved to the buffer normally. Combine with Clean Mode (Ctrl+Z) for a completely minimal writing experience.
Pagination [P] — Instead of scrolling when text fills the screen, the display flips to a new blank page. The current page is shown in the header (e.g. "Pg 1/3"). Use Ctrl+Left and Ctrl+Right to jump between pages. Eliminates per-line scroll refreshes — only one refresh per page transition.
Accessed via Ctrl+N from the file browser or editor.
| Key | Action |
|---|---|
| Type | Enter title text |
| Backspace | Delete last character |
| Enter | Confirm |
| Esc | Cancel |
Navigate with all four direction buttons (or Up/Down on keyboard). Press Enter (or confirm button) to cycle through a setting's values. On a keyboard, Left/Right also cycle values backward/forward.
| Setting | Values |
|---|---|
| Orientation | Portrait, Landscape CW, Inverted, Landscape CCW |
| Dark Mode | Light / Dark |
| Writing Mode | Normal, Typewriter, Pagination |
| Bluetooth | Opens Bluetooth scan to pair a new keyboard |
| Paired Keyboards | Manage saved keyboards (connect, forget, disconnect) |
All settings persist across reboots.
Shows all keyboards saved on the device (up to 4). The currently active keyboard is labelled active; the last used keyboard when none is connected is labelled last.
| Key | Action |
|---|---|
| Up / Down | Navigate list |
| Enter | Switch to selected keyboard |
| D | Forget selected keyboard (removes pairing) |
| Left | Disconnect selected keyboard (if currently active) |
| Esc | Back to Settings |
To pair a second keyboard, go to Settings → Bluetooth, scan, and connect. Both keyboards will then appear in the Paired Keyboards list. On each boot the device tries the last-used keyboard first, then works through the rest of the list until one connects.
| Key | Action |
|---|---|
| Up / Down | Navigate device list |
| Enter | Connect to selected device (or start scan if list is empty) |
| Right | Re-scan for devices |
| Left | Disconnect current keyboard |
| Esc | Back to Settings |
A scan runs for 5 seconds and then stops. Up to 10 nearby devices are shown with name, address, and signal strength.
Back up all notes from the device to your PC over WiFi. The device and PC must be on the same WiFi network.
pip install requests
Windows — double-click sync\install_sync.bat
macOS / Linux — run in a terminal:
chmod +x sync/install_sync.sh && sync/install_sync.sh
That's it. The script starts immediately and will run silently in the background on every login. When a sync completes, a desktop notification lists the files that were downloaded (Windows balloon, macOS notification, or Linux notify-send). Notes are saved to Documents/MicroSlate Notes/ by default (edit LOCAL_DIR in microslate_sync.py to change).
To stop auto-start later:
sync\uninstall_sync.batsync/uninstall_sync.shIf the sync script isn't running, you can start it manually:
python3 sync/microslate_sync.py
| Key | Action |
|---|---|
| Up / Down | Navigate network list |
| Enter | Select network / confirm |
| Esc | Cancel / back |
Notes are plain .txt files stored in /notes/ on the SD card. Filenames are derived from the note title — spaces become underscores, everything is lowercased, and .txt is appended. For example, a note titled "My Note" becomes my_note.txt.
Files are fully compatible with any text editor on a computer. To add notes manually, drop .txt files into the /notes/ folder on the SD card — the title shown on the device is derived from the filename.
xteink-writer-firmware/
├── src/
│ ├── main.cpp — setup, main loop, shared UI state
│ ├── sd_backup.h — inline SD/JSON helpers for NVS backup and restore
│ ├── ble_keyboard.cpp — BLE scanning, pairing, HID report handling
│ ├── input_handler.cpp — keyboard event queue and UI state dispatch
│ ├── text_editor.cpp — text buffer and cursor management
│ ├── file_manager.cpp — SD card file operations
│ ├── ui_renderer.cpp — screen rendering for all UI modes
│ ├── wifi_sync.cpp — WiFi sync server and state machine
│ └── config.h — enums, buffer sizes, constants
├── sync/
│ ├── microslate_sync.py — PC sync script (Python, cross-platform)
│ ├── install_sync.bat — register auto-start on Windows login
│ ├── uninstall_sync.bat — remove auto-start on Windows
│ ├── install_sync.sh — register auto-start on macOS / Linux
│ └── uninstall_sync.sh — remove auto-start on macOS / Linux
├── lib/ — all hardware/display libraries (bundled)
│ ├── GfxRenderer/
│ ├── EpdFont/
│ ├── EInkDisplay/
│ ├── hal/
│ ├── BatteryMonitor/
│ ├── InputManager/
│ ├── SDCardManager/
│ └── Utf8/
└── platformio.ini
Keyboard not showing in scan
Physical buttons not responding
Display appears frozen
Serial monitor shows nothing on startup
MicroSlate is the hardware companion to TypeSlate — a free, full-screen distraction-free writing app for Windows. Same idea, different form factor: open it, write, close it.
If MicroSlate is useful to you and you'd like to say thanks, you can support the project at ko-fi.com/typeslate.
139 commits
Hacker News (1)
C
98.6%
C++
1.3%
A dedicated writing firmware for the Xteink X4 e-paper device. Pairs with any Bluetooth LE (BLE) keyboard and saves notes to MicroSD.
.bak rotation pattern; a failed or interrupted write never destroys the previous version. Orphaned files from a crash are recovered automatically on next bootNo software required. Works on Windows and Mac in Chrome or Edge.
Install MicroSlate → typeslate.com/tools/microslate
Connect your Xteink X4 via USB and click Install MicroSlate for the standalone firmware, or Install Dual-Boot to get MicroSlate + CrossPoint on the same device. Takes about 2 minutes.
Requires a Windows or Linux x86_64 machine (the ESP-IDF toolchain does not support Mac ARM or Raspberry Pi).
Prerequisites
# Clone the repository
git clone https://github.com/Josh-writes/microslate-firmware
cd xteink-writer-firmware
# Build and upload (adjust port if needed)
pio run --target upload --upload-port /dev/ttyUSB0
The upload port defaults to COM5 in platformio.ini.
All libraries are included in the lib/ directory. The only external dependency fetched automatically by PlatformIO is esp-nimble-cpp (BLE stack).
The device remembers paired keyboards (up to 4) and reconnects automatically on subsequent boots. If multiple keyboards are stored, it cycles through them until one responds.
| Key | Action |
|---|---|
| Up / Down | Navigate |
| Left / Right | Also navigate (convenient in landscape) |
| Enter | Select |
Options: Browse Notes, New Note, Settings, Sync — and CrossPoint if the dual-boot firmware is installed
| Key | Action |
|---|---|
| Up / Down | Navigate list |
| Left / Right | Also navigate (convenient in landscape) |
| Enter | Open note |
| Ctrl+N | Edit title of selected note |
| Ctrl+D | Delete selected note (confirmation required) |
| Esc | Back to main menu |
When delete is pending, the footer shows Delete? Enter:Yes Esc:No. Press Enter to confirm or any other key to cancel.
| Key | Action |
|---|---|
| Arrow keys | Move cursor |
| Home / End | Start / end of line |
| Backspace / Delete | Remove characters |
| Tab | Cycle writing mode (Scroll → Typewriter → Pagination) |
| Ctrl+S | Save manually |
| Ctrl+N | Edit note title |
| Ctrl+Z | Toggle clean mode (hides UI chrome) |
| Ctrl+T | Toggle Typewriter mode |
| Ctrl+P | Toggle Pagination mode |
| Ctrl+Left / Right | Jump pages (Pagination mode only) |
| Esc / Back button | Save and return to file browser |
The current writing mode is shown in the header: [S] Scroll, [T] Typewriter, [P] Pagination.
Auto-save runs silently after 10 seconds of idle or every 2 minutes during continuous typing — Ctrl+S is only needed if you want to save immediately.
Scroll [S] — Standard scrolling editor. Text scrolls as the cursor moves down the page.
Typewriter [T] — Only the current line is shown, centered vertically on a blank screen. When you press Enter, the previous line disappears and a fresh line appears. Text is still saved to the buffer normally. Combine with Clean Mode (Ctrl+Z) for a completely minimal writing experience.
Pagination [P] — Instead of scrolling when text fills the screen, the display flips to a new blank page. The current page is shown in the header (e.g. "Pg 1/3"). Use Ctrl+Left and Ctrl+Right to jump between pages. Eliminates per-line scroll refreshes — only one refresh per page transition.
Accessed via Ctrl+N from the file browser or editor.
| Key | Action |
|---|---|
| Type | Enter title text |
| Backspace | Delete last character |
| Enter | Confirm |
| Esc | Cancel |
Navigate with all four direction buttons (or Up/Down on keyboard). Press Enter (or confirm button) to cycle through a setting's values. On a keyboard, Left/Right also cycle values backward/forward.
| Setting | Values |
|---|---|
| Orientation | Portrait, Landscape CW, Inverted, Landscape CCW |
| Dark Mode | Light / Dark |
| Writing Mode | Normal, Typewriter, Pagination |
| Bluetooth | Opens Bluetooth scan to pair a new keyboard |
| Paired Keyboards | Manage saved keyboards (connect, forget, disconnect) |
All settings persist across reboots.
Shows all keyboards saved on the device (up to 4). The currently active keyboard is labelled active; the last used keyboard when none is connected is labelled last.
| Key | Action |
|---|---|
| Up / Down | Navigate list |
| Enter | Switch to selected keyboard |
| D | Forget selected keyboard (removes pairing) |
| Left | Disconnect selected keyboard (if currently active) |
| Esc | Back to Settings |
To pair a second keyboard, go to Settings → Bluetooth, scan, and connect. Both keyboards will then appear in the Paired Keyboards list. On each boot the device tries the last-used keyboard first, then works through the rest of the list until one connects.
| Key | Action |
|---|---|
| Up / Down | Navigate device list |
| Enter | Connect to selected device (or start scan if list is empty) |
| Right | Re-scan for devices |
| Left | Disconnect current keyboard |
| Esc | Back to Settings |
A scan runs for 5 seconds and then stops. Up to 10 nearby devices are shown with name, address, and signal strength.
Back up all notes from the device to your PC over WiFi. The device and PC must be on the same WiFi network.
pip install requests
Windows — double-click sync\install_sync.bat
macOS / Linux — run in a terminal:
chmod +x sync/install_sync.sh && sync/install_sync.sh
That's it. The script starts immediately and will run silently in the background on every login. When a sync completes, a desktop notification lists the files that were downloaded (Windows balloon, macOS notification, or Linux notify-send). Notes are saved to Documents/MicroSlate Notes/ by default (edit LOCAL_DIR in microslate_sync.py to change).
To stop auto-start later:
sync\uninstall_sync.batsync/uninstall_sync.shIf the sync script isn't running, you can start it manually:
python3 sync/microslate_sync.py
| Key | Action |
|---|---|
| Up / Down | Navigate network list |
| Enter | Select network / confirm |
| Esc | Cancel / back |
Notes are plain .txt files stored in /notes/ on the SD card. Filenames are derived from the note title — spaces become underscores, everything is lowercased, and .txt is appended. For example, a note titled "My Note" becomes my_note.txt.
Files are fully compatible with any text editor on a computer. To add notes manually, drop .txt files into the /notes/ folder on the SD card — the title shown on the device is derived from the filename.
xteink-writer-firmware/
├── src/
│ ├── main.cpp — setup, main loop, shared UI state
│ ├── sd_backup.h — inline SD/JSON helpers for NVS backup and restore
│ ├── ble_keyboard.cpp — BLE scanning, pairing, HID report handling
│ ├── input_handler.cpp — keyboard event queue and UI state dispatch
│ ├── text_editor.cpp — text buffer and cursor management
│ ├── file_manager.cpp — SD card file operations
│ ├── ui_renderer.cpp — screen rendering for all UI modes
│ ├── wifi_sync.cpp — WiFi sync server and state machine
│ └── config.h — enums, buffer sizes, constants
├── sync/
│ ├── microslate_sync.py — PC sync script (Python, cross-platform)
│ ├── install_sync.bat — register auto-start on Windows login
│ ├── uninstall_sync.bat — remove auto-start on Windows
│ ├── install_sync.sh — register auto-start on macOS / Linux
│ └── uninstall_sync.sh — remove auto-start on macOS / Linux
├── lib/ — all hardware/display libraries (bundled)
│ ├── GfxRenderer/
│ ├── EpdFont/
│ ├── EInkDisplay/
│ ├── hal/
│ ├── BatteryMonitor/
│ ├── InputManager/
│ ├── SDCardManager/
│ └── Utf8/
└── platformio.ini
Keyboard not showing in scan
Physical buttons not responding
Display appears frozen
Serial monitor shows nothing on startup
MicroSlate is the hardware companion to TypeSlate — a free, full-screen distraction-free writing app for Windows. Same idea, different form factor: open it, write, close it.
If MicroSlate is useful to you and you'd like to say thanks, you can support the project at ko-fi.com/typeslate.
Hacker News (1)
139 commits
C
98.6%
C++
1.3%