Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions MemoryLCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#include <iostream>

// Memory LCD pixel dimensions - ALTER ACCORDING TO YOUR PARTICULAR LCD MODEL
#define LCDWIDTH (96)
#define LCDHEIGHT (96)
// remark: (400x270) for sharp lcd 2.7 mono memory LCD (ls027bdh01)
#define LCDWIDTH (400)
#define LCDHEIGHT (240)

// Delay constants for LCD timing // (Datasheet values)
#define PWRUP_DISP_DELAY 40 // (>30us)
Expand Down
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SHARP 2.7" 400x240px memory LCD on Raspberry Pi

This repository was forked from: [MakerDyne/Memory-LCD-for-Raspberry-Pi](https://github.com/MakerDyne/Memory-LCD-for-Raspberry-Pi)

Modified for resolving compiling error from the original version of demo code, aim to validate the application of SHARP 400x270 mono memory LCD running on RaspberryPi, and keep in record for personal refrence.

![entire_running_setup](images/entire_running_setup.jpg)



## Hardware Setup
Raspberry Pi 4

Adafruit SHARP Memory Display Breakout - 2.7" 400x240 Monochrome (LS027B7DH01)

wiring:
refer to [RPi Low-level peripherals](https://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29)
| LCD PIN | Rpi4 GPIO Name | Rpi4 PIN# | changeable? | remark |
|------------|----------------|----------------------|-------------|---|
| 3v3 | Any [3.3v] PIN | 1/21 | | |
| Gnd | Any [GND] PIN | 6/9/14/2025/30/34/39 | | |
| CLK(SCLK) | GPIO11(SCLK) | 23 | | |
| DI(MOSI) | GPIO10(MOSI) | 19 | | |
| CS(SS) | GPIO23 | 16 | | |
| EMD(EXTMD) | | | | no need for Adafruit module |
| DISP | GPIO24 | 18 | ::check:: | no need for Adafruit module |
| EIN(EXTIN) | GPIO25 | 22 | ::check:: | no need for Adafruit module |

![rpi4-pin-img](https://elinux.org/images/thumb/3/30/B_plus_hdr_sm.jpg/300px-B_plus_hdr_sm.jpg)
![rpi4-pin-sch](https://elinux.org/images/thumb/5/5c/Pi-GPIO-header.png/300px-Pi-GPIO-header.png)


## Compile from source code
``


last update: Dec. 9, 2021, KW.
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main() {
for(unsigned int radius = 5; radius < expandingCircleRadius; radius++) {
for(unsigned int y = originY - radius; y <= originY; y++) {
// need to calculate left and right limits of the circle
float theta = acos(float(abs(originY-y))/float(radius));
float theta = acos(float(abs(int(originY-y)))/float(radius));
theta -= 1.5708;
unsigned int xLength = cos(theta)*float(radius);
for(unsigned int x = originX - xLength; x <= originX; x++) {
Expand All @@ -81,7 +81,7 @@ int main() {
for(unsigned int radius = expandingCircleRadius; radius > 2; radius--) {
for(unsigned int y = originY - radius; y <= originY; y++) {
// need to calculate left and right limits of the circle
float theta = acos(float(abs(originY-y))/float(radius));
float theta = acos(float(abs(int(originY-y)))/float(radius));
theta -= 1.5708;
unsigned int xLength = cos(theta)*float(radius);
for(unsigned int x = originX - xLength; x <= originX ; x++) {
Expand Down Expand Up @@ -114,7 +114,7 @@ int main() {
// draw circle about the centre
for(unsigned int y = circleOriginY - circleRadius; y <= circleOriginY; y++) {
// need to calculate left and right limits of the circle
float theta = acos(float(std::abs(circleOriginY-y))/float(circleRadius));
float theta = acos(float(std::abs(int(circleOriginY-y)))/float(circleRadius));
theta -= 1.5708;
unsigned int xLength = cos(theta)*float(circleRadius);
for(unsigned int x = circleOriginX - xLength; x <= circleOriginX; x++) {
Expand Down
Binary file added images/compilingerror.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/entire_running_setup.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.