Skip to content

Commit

Permalink
Merge pull request OpenEPaperLink#226 from VstudioLAB/ST‐GM29MT1
Browse files Browse the repository at this point in the history
Adding support to the ST‐GM29MT1 BW (UC8151)
  • Loading branch information
jjwbruijn authored Feb 8, 2024
2 parents b4836e8 + a1eba95 commit edb8740
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 15 deletions.
16 changes: 16 additions & 0 deletions ESP32_AP-Flasher/data/tagtypes/27.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ST‐GM29MT1 2.9\"",
"width": 296,
"height": 128,
"rotatebuffer": 1,
"bpp": 1,
"colors": 2,
"colortable": {
"white": [255, 255, 255],
"black": [0, 0, 0]
},
"shortlut": 0,
"options": ["button", "customlut"],
"contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21 ],
"usetemplate": 1
}
1 change: 1 addition & 0 deletions oepl-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define SOLUM_M2_BWR_42 0x24
#define SOLUM_M2_BW_16 0x25
#define SOLUM_M2_BWR_75 0x26
#define SOLUM_M2_BW_29 0x27



Expand Down
14 changes: 8 additions & 6 deletions zbs243_Tag_FW/userinterface.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


#include "userinterface.h"

#include <stdbool.h>
Expand Down Expand Up @@ -80,16 +79,17 @@ void addOverlay() {
#ifdef ISDEBUGBUILD
#if (SCREEN_WIDTH == 152) || (SCREEN_WIDTH == 176) || (SCREEN_WIDTH == 200)
epdPrintBegin(139, 151, EPD_DIRECTION_Y, EPD_SIZE_SINGLE, EPD_COLOR_RED);
epdpr("DEBUG");
epdPrintEnd();
#elif (SCREEN_WIDTH == 400)
epdPrintBegin(87, 0, EPD_DIRECTION_Y, EPD_SIZE_SINGLE, EPD_COLOR_RED);
epdpr("DEBUG");
epdPrintEnd();
#elif (SCREEN_WIDTH == 128)
epdPrintBegin(87, 0, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_RED);
loadRawBitmap(debugbuild, 100, 2, EPD_COLOR_RED);
#elif (SCREEN_WIDTH == 176)
loadRawBitmap(debugbuild, 144, 2, EPD_COLOR_RED);
// epdPrintBegin(130, 1, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_RED);
#endif
// epdpr("DEBUG");
// epdPrintEnd();
#endif
}

Expand Down Expand Up @@ -292,8 +292,10 @@ void showSplashScreen() {
spr(buffer + 12, "%02X%02X", mSelfMac[1], mSelfMac[0]);
printBarcode(buffer, 120, 284);
#ifndef LEAN_VERSION
loadRawBitmap(oepli, 0, 12, EPD_COLOR_BLACK);

loadRawBitmap(cloud, 0, 0, EPD_COLOR_RED);
loadRawBitmap(oepli, 0, 12, EPD_COLOR_BLACK);

#endif
#endif

Expand Down
43 changes: 34 additions & 9 deletions zbs243_shared/board/uc8151.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
#define CMD_POWER_ON_MEASURE 0x05
#define CMD_BOOSTER_SOFT_START 0x06
#define CMD_DEEP_SLEEP 0x07
#ifndef BW_SCREEN
#define CMD_DISPLAY_START_TRANSMISSION_DTM1 0x10
#else
#define CMD_DISPLAY_START_TRANSMISSION_DTM1 0x13
#endif
#define CMD_DATA_STOP 0x11
#define CMD_DISPLAY_REFRESH 0x12
#define CMD_DISPLAY_START_TRANSMISSION_DTM2 0x13
Expand Down Expand Up @@ -344,49 +348,70 @@ static void epdDrawDirection(bool direction) {
if (direction == drawDirection) return;

drawDirection = direction;

#ifndef BW_SCREEN
uint8_t psr_setting = RES_128x296 | FORMAT_BWR | BOOSTER_ON | RESET_NONE | LUT_OTP | SHIFT_RIGHT;
if (drawDirection) {
psr_setting |= SCAN_DOWN;
} else {
psr_setting |= SCAN_UP;
}
shortCommand1(CMD_PANEL_SETTING, psr_setting);
#else
uint8_t psr_setting = RES_128x296 | FORMAT_BW | BOOSTER_ON | RESET_NONE | LUT_OTP | SHIFT_RIGHT;
if (drawDirection) {
psr_setting |= SCAN_DOWN;
} else {
psr_setting |= SCAN_UP;
}
shortCommand2(CMD_PANEL_SETTING, psr_setting, 0b00001011);
#endif

}

void epdSetup() {
epdReset();

drawDirection = false;
epdDrawDirection(true);

#ifndef BW_SCREEN
commandBegin(CMD_POWER_SETTING);
epdSend(VDS_INTERNAL | VDG_INTERNAL);
epdSend(VCOM_VD | VGHL_16V);
epdSend(0b101011);
epdSend(0b101011);
epdSend(0b101011);
commandEnd();
#else
commandBegin(CMD_POWER_SETTING);
epdSend(VDS_INTERNAL | VDG_INTERNAL);
epdSend(VCOM_VD | VGHL_15V);
commandEnd();
#endif

shortCommand(CMD_POWER_ON);
epdWaitRdy();

commandBegin(CMD_BOOSTER_SOFT_START);
epdSend(START_10MS | STRENGTH_3 | OFF_6_58US);
epdSend(START_10MS | STRENGTH_3 | OFF_6_58US);
epdSend(START_10MS | STRENGTH_3 | OFF_6_58US);
commandEnd();

shortCommand(CMD_POWER_ON);
epdWaitRdy();


commandBegin(CMD_RESOLUTION_SETING);
epdSend(SCREEN_WIDTH);
epdSend(SCREEN_HEIGHT >> 8);
epdSend(SCREEN_HEIGHT & 0xFF);
commandEnd();

shortCommand1(CMD_POWER_OFF_SEQUENCE, FRAMES_1);
shortCommand1(CMD_TEMPERATURE_SELECT, TEMP_INTERNAL | OFFSET_0);
shortCommand1(CMD_TCON_SETTING, 0x22);
#ifndef BW_SCREEN
shortCommand1(CMD_VCOM_INTERVAL, 0x8d); // 0x87
#else
shortCommand1(CMD_VCOM_INTERVAL, 0x4d); // 0x87
#endif
shortCommand1(CMD_PLL_CONTROL, HZ_200);
epdWaitRdy();
shortCommand(CMD_POWER_ON);
Expand Down Expand Up @@ -493,6 +518,7 @@ void beginFullscreenImage() {
// setPosXY(0, 0);
}
void beginWriteFramebuffer(bool color) {

if (color == EPD_COLOR_RED) {
commandBegin(CMD_DISPLAY_START_TRANSMISSION_DTM2);
} else {
Expand All @@ -505,15 +531,15 @@ void endWriteFramebuffer() {
}

void loadRawBitmap(uint8_t* bmp, uint16_t x, uint16_t y, bool color) __reentrant {
// this function is very badly hurt by the switch to UC8151, taking up LOTS of valuable idata space. Only defining variables
// this function is very badly hurt by the switch to UC8151, taking up LOTS of valuable idata space. Only defining variables
// as static, or the function as reentrant (relegating variables to the stack) seemed to fix the idata issue. Fix me, or put me out of my misery...

uint16_t xsize = bmp[0] / 8;
if (bmp[0] % 8) xsize++;
uint16_t ysize = bmp[1];
uint16_t size = xsize * bmp[1];

// shortCommand1(CMD_DATA_ENTRY_MODE, 3);
//shortCommand1(CMD_DATA_ENTRY_MODE, 3);

bmp += 2;

Expand All @@ -530,7 +556,7 @@ void loadRawBitmap(uint8_t* bmp, uint16_t x, uint16_t y, bool color) __reentrant
curY++;
if (color) {
commandBegin(CMD_DISPLAY_START_TRANSMISSION_DTM2);
} else {
} else {
commandBegin(CMD_DISPLAY_START_TRANSMISSION_DTM1);
}
}
Expand Down Expand Up @@ -726,7 +752,6 @@ void epdPrintBegin(uint16_t x, uint16_t y, bool direction, bool fontsize, bool c
// shortCommand1(CMD_DATA_ENTRY_MODE, 7);
memset(rbuffer, 0, 32);
}

if (color) {
commandBegin(CMD_DISPLAY_START_TRANSMISSION_DTM2);
} else {
Expand Down
1 change: 1 addition & 0 deletions zbs243_shared/board/zbs29_BW_uc/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../boardZBS29common.c"
33 changes: 33 additions & 0 deletions zbs243_shared/board/zbs29_BW_uc/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef _BOARD_H_
#define _BOARD_H_

#include <stdint.h>
#include "spi.h"

#define __packed
#include "../oepl-definitions.h"


#define eepromByte spiByte
#define eepromPrvSelect() do { __asm__("nop\nnop\nnop\n"); P1_1 = 0; __asm__("nop\nnop\nnop\n"); } while(0)
#define eepromPrvDeselect() do { __asm__("nop\nnop\nnop\n"); P1_1 = 1; __asm__("nop\nnop\nnop\n"); } while(0)

//eeprom map
#define EEPROM_SETTINGS_AREA_START (0x00000UL)
#define EEPROM_SETTINGS_AREA_LEN (0x01000UL)
#define EEPROM_IMG_START (0x01000UL)
#define EEPROM_IMG_EACH (0x03000UL)

#define HAS_EEPROM 1
#define HAS_SCREEN 1
#define NFC_TYPE 1
#define AP_EMULATE_TAG 1


//hw types
#define HW_TYPE SOLUM_M2_BW_29

#include "../boardCommon.h"


#endif
7 changes: 7 additions & 0 deletions zbs243_shared/board/zbs29_BW_uc/make.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FLAGS += --code-size 0xfc00

SOC = zbs243

BARCODE = datamatrix

# 0xfc00 and not 0x10000 to leave some space for update header and updater in flash
1 change: 1 addition & 0 deletions zbs243_shared/board/zbs29_BW_uc/screen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../uc8151.c"
26 changes: 26 additions & 0 deletions zbs243_shared/board/zbs29_BW_uc/screen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef _SCREEN_H_
#define _SCREEN_H_

#include <stdbool.h>
#include <stdint.h>
#include "../uc8151.h"

#define BW_SCREEN
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 296

#define SCREEN_NUM_GREYS 1
#define SCREEN_FIRST_GREY_IDX 0
#define SCREEN_EXTRA_COLOR_INDEX -1 //set to negative if nonexistent
#define SCREEN_TX_BPP 4 //in transit

#define SCREEN_WIDTH_MM 29
#define SCREEN_HEIGHT_MM 67

#define SCREEN_BYTE_FILL 0x44 //white

#define SCREEN_TYPE TagScreenEink_BW_1bpp

#define SCREEN_DATA_PASSES 2

#endif

0 comments on commit edb8740

Please sign in to comment.