Remarkable.NET
Show / Hide Table of Contents

Introduction

  • Introduction
    • Prerequisites
    • Organization
    • Input devices
      • Buttons
      • Touchscreen
      • Digitizer
    • Output Devices
      • Display

Prerequisites

To run the samples, ensure that you have .NET Core installed on your reMarkable.

Organization

ReMarkable.NET (rM.NET) is mostly a collection of software drivers for the various hardware installed in the reMarkable.

Instances to each of the drivers can be found in their respective device container classes: InputDevices, which provides access to the buttons, digitizer, and touchscreen, OutputDevices, which contains the display, and PassiveDevices, which provides monitoring-only access to the battery, USB power supply, and memory and performance metrics.

Very little code needs to be written to take advantage of the reMarkable's hardware.

Input devices

The input devices utilize the event pattern to dispatch input events. The drivers read the /dev/input/event* streams and parse them accordingly.

The corresponding device container classes do not explicitly reference specific event* streams for each device, as the event stream may not always correspond to the same device if additional devices are attached, like a USB keyboard. Instead, they parse /proc/bus/input/devices to map unique device names to their event stream.

Buttons

Hardware device name: gpio-keys

Field: InputDevices.PhysicalButtons

Hypothetical example:

// Exit when home button is pressed
InputDevices.PhysicalButtons.Pressed += (sender, button) =>
{
	if (button == PhysicalButton.Home)
		CloseApp();
};

Touchscreen

Hardware device name: cyttsp5_mt

Field: InputDevices.Touchscreen

Hypothetical example:

// Hold "dragging" control
Control control = null;

// Start dragging on press
InputDevices.Touchscreen.Pressed += (sender, finger) =>
{
	control = GetControlAt(finger.DevicePosition);
	control.BeginDrag(finger);
};

// Move control when finger moves
InputDevices.Touchscreen.Moved += (sender, finger) =>
{
	if (control.DraggingFingerId == finger.Id)
		control.Drag(finger.PreviousDevicePosition, finger.DevicePosition);
};

// Redraw, etc. when done dragging
InputDevices.Touchscreen.Released += (sender, finger) =>
{
	control.EndDrag(finger);
};

Digitizer

Hardware device name: Wacom I2C Digitizer

Field: InputDevices.Digitizer

Hypothetical example:

// Use the stylus as a pen
InputDevices.Digitizer.StylusUpdate += (sender, state) =>
{
    DrawLine(state);
};

// Swap to an eraser or other tool when the stylus is flipped (or a tool change is otherwise made)
InputDevices.Digitizer.ToolChanged += (sender, tool) =>
{
    SetStylusTool(tool);
};

Output Devices

Display

Hardware device: /dev/fb0

Field: OutputDevices.Display

Example:

// Create an image
var img = new Image<Rgb24>(300, 300);

// Do some image processing
img.Mutate(ctx => ctx.DrawLines(Color.Black, 3, new PointF(50, 50), new PointF(250, 250)));

// Draw the image to the screen
OutputDevices.Display.Draw(img, img.Bounds(), Point.Empty);