Waveshare 1.54 inch with nRF52

Updated on 16 December 2021
dev board Adafruit Feather Bluefruit
chip nRF52
chip Waveshare
features e-paper e-ink SPI
e-paper version 1

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Code

Download code waveshare-1in54-e-paper-nrf52.ino
#include <SPI.h>
#include "epd1in54.h"
#include "epdpaint.h"

#define COLORED     0
#define UNCOLORED   1

unsigned char image[1024];
Paint paint(image, 0, 0);
Epd epd;

void setup() {
  Serial.begin(9600);
  if (epd.Init(lut_full_update) != 0) {
      Serial.print("e-Paper init failed");
      return;
  }

  epd.ClearFrameMemory(0xFF);
  epd.DisplayFrame();
  epd.ClearFrameMemory(0xFF);
  epd.DisplayFrame();

  paint.SetRotate(ROTATE_0);
  paint.SetWidth(200);
  paint.SetHeight(24);

  paint.Clear(UNCOLORED);
  paint.DrawStringAt(10, 4, "Hello world!", &Font16, COLORED);
  epd.SetFrameMemory(paint.GetImage(), 0, 10, paint.GetWidth(), paint.GetHeight());

  paint.Clear(UNCOLORED);
  paint.DrawStringAt(10, 4, "e-Paper+nRF52", &Font16, COLORED);
  epd.SetFrameMemory(paint.GetImage(), 0, 30, paint.GetWidth(), paint.GetHeight());

  epd.DisplayFrame();

  delay(2000);
  epd.Sleep();
}

void loop() { }

Makefile

BOARD?=adafruit:nrf52:feather52832
PORT?=/dev/tty.SLAB_USBtoUART

.PHONY: default lint all flash clean

default: all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

all:
	arduino-cli compile --fqbn $(BOARD) ./

flash:
	adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ./.*.hex dfu-package.zip
	adafruit-nrfutil dfu serial --package dfu-package.zip -p $(PORT) -b 115200

clean:
	rm -f .*.elf
	rm -f .*.hex
	rm -f *.zip

Prototype

A photo of the actual setup.

Waveshare 1.54 inch with nRF52 prototype

Schematic

Wire up the hardware accordingly

Waveshare 1.54 inch with nRF52 schematic

Description

The 4 non-SPI pins are defined in epdif.h file:

// Pin definition
#define RST_PIN         2   // A0
#define DC_PIN          3   // A1
#define CS_PIN          4   // A2
#define BUSY_PIN        5   // A3

References

Watch