mirror of
https://github.com/RoCry/blozi-etag.git
synced 2025-12-06 09:02:49 +08:00
feat: add support for bwr 290
This commit is contained in:
Binary file not shown.
@@ -100,7 +100,7 @@ $(LST_FILE): $(ELF_FILE)
|
||||
$(BIN_FILE): $(ELF_FILE)
|
||||
@echo 'Create Flash image (binary format)'
|
||||
@$(TC32_COMPILER_PATH)tc32-elf-objcopy -v -O binary $(ELF_FILE) $(BIN_FILE)
|
||||
@python3 $(TEL_PATH)/make/tl_firmware_tools.py add_crc $(BIN_FILE)
|
||||
@python $(TEL_PATH)/make/tl_firmware_tools.py add_crc $(BIN_FILE)
|
||||
@echo 'Finished building: $@'
|
||||
@echo ' '
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ RAM my_fifo_t blt_txfifo = {
|
||||
blt_txfifo_b,
|
||||
};
|
||||
|
||||
RAM uint8_t ble_name[] = {11, 0x09, 'E', 'S', 'L', '_', '0', '0', '0', '0', '0', '0'};
|
||||
RAM uint8_t ble_name[] = {11, 0x09, 'S', '2', '4', '_', '0', '0', '0', '0', '0', '0'};
|
||||
|
||||
RAM uint8_t advertising_data[] = {
|
||||
/*Description*/ 16, 0x16, 0x1a, 0x18,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "epd_bwr_213.h"
|
||||
#include "epd_bw_213_ice.h"
|
||||
#include "epd_bwr_154.h"
|
||||
#include "epd_bwr_290.h"
|
||||
#include "drivers.h"
|
||||
#include "stack/ble/ble.h"
|
||||
|
||||
@@ -20,8 +21,8 @@ extern const uint8_t ucMirror[];
|
||||
#include "font16.h"
|
||||
#include "font30.h"
|
||||
|
||||
RAM uint8_t epd_model = 0; // 0 = Undetected, 1 = BW213, 2 = BWR213, 3 = BWR154, 4 = BW213ICE
|
||||
const char *epd_model_string[] = {"NC", "BW213", "BWR213", "BWR154", "213ICE"};
|
||||
RAM uint8_t epd_model = 0; // 0 = Undetected, 1 = BW213, 2 = BWR213, 3 = BWR154, 4 = BW213ICE, 5 BWR290
|
||||
const char *epd_model_string[] = {"NC", "BW213", "BWR213", "BWR154", "213ICE", "BWR290"};
|
||||
RAM uint8_t epd_update_state = 0;
|
||||
|
||||
const char *BLE_conn_string[] = {"", "B"};
|
||||
@@ -55,6 +56,10 @@ _attribute_ram_code_ void EPD_detect_model(void)
|
||||
|
||||
// Here we neeed to detect it
|
||||
if (EPD_BWR_213_detect())
|
||||
{
|
||||
epd_model = 5;
|
||||
}
|
||||
else if (EPD_BWR_213_detect())
|
||||
{
|
||||
epd_model = 2;
|
||||
}
|
||||
@@ -98,7 +103,7 @@ _attribute_ram_code_ uint8_t EPD_read_temp(void)
|
||||
epd_temperature = EPD_BWR_213_read_temp();
|
||||
else if (epd_model == 3)
|
||||
epd_temperature = EPD_BWR_154_read_temp();
|
||||
else if (epd_model == 4)
|
||||
else if (epd_model == 4 || epd_model == 5)
|
||||
epd_temperature = EPD_BW_213_ice_read_temp();
|
||||
|
||||
EPD_POWER_OFF();
|
||||
@@ -131,6 +136,8 @@ _attribute_ram_code_ void EPD_Display(unsigned char *image, int size, uint8_t fu
|
||||
epd_temperature = EPD_BWR_154_Display(image, size, full_or_partial);
|
||||
else if (epd_model == 4)
|
||||
epd_temperature = EPD_BW_213_ice_Display(image, size, full_or_partial);
|
||||
else if (epd_model == 5)
|
||||
epd_temperature = EPD_BWR_290_Display(image, size, full_or_partial);
|
||||
|
||||
epd_temperature_is_read = 1;
|
||||
epd_update_state = 1;
|
||||
@@ -147,7 +154,7 @@ _attribute_ram_code_ void epd_set_sleep(void)
|
||||
EPD_BWR_213_set_sleep();
|
||||
else if (epd_model == 3)
|
||||
EPD_BWR_154_set_sleep();
|
||||
else if (epd_model == 4)
|
||||
else if (epd_model == 4 || epd_model == 5)
|
||||
EPD_BW_213_ice_set_sleep();
|
||||
|
||||
EPD_POWER_OFF();
|
||||
@@ -262,12 +269,17 @@ _attribute_ram_code_ void epd_display(uint32_t time_is, uint16_t battery_mv, int
|
||||
resolution_w = 212;
|
||||
resolution_h = 104;
|
||||
}
|
||||
else if (epd_model == 5)
|
||||
{
|
||||
resolution_w = 250;
|
||||
resolution_h = 128;
|
||||
}
|
||||
|
||||
obdCreateVirtualDisplay(&obd, resolution_w, resolution_h, epd_temp);
|
||||
obdFill(&obd, 0, 0); // fill with white
|
||||
|
||||
char buff[100];
|
||||
sprintf(buff, "ESL_%02X%02X%02X %s", mac_public[2], mac_public[1], mac_public[0], epd_model_string[epd_model]);
|
||||
sprintf(buff, "S24_%02X%02X%02X %s", mac_public[2], mac_public[1], mac_public[0], epd_model_string[epd_model]);
|
||||
obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 1, 17, (char *)buff, 1);
|
||||
sprintf(buff, "%s", BLE_conn_string[ble_get_connected()]);
|
||||
obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 232, 20, (char *)buff, 1);
|
||||
|
||||
267
Firmware/src/epd_bwr_290.c
Normal file
267
Firmware/src/epd_bwr_290.c
Normal file
@@ -0,0 +1,267 @@
|
||||
#include <stdint.h>
|
||||
#include "tl_common.h"
|
||||
#include "main.h"
|
||||
#include "epd.h"
|
||||
#include "epd_spi.h"
|
||||
#include "epd_bwr_290.h"
|
||||
#include "drivers.h"
|
||||
#include "stack/ble/ble.h"
|
||||
|
||||
// SSD1675 mixed with SSD1680 EPD Controller
|
||||
|
||||
#define BWR_290_Len 50
|
||||
uint8_t LUT_bwr_290_part[] = {
|
||||
|
||||
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
BWR_290_Len, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||
0x00, 0x00, 0x00,
|
||||
|
||||
};
|
||||
|
||||
#define EPD_BWR_290_test_pattern 0xA5
|
||||
_attribute_ram_code_ uint8_t EPD_BWR_290_detect(void)
|
||||
{
|
||||
// SW Reset
|
||||
EPD_WriteCmd(0x12);
|
||||
WaitMs(10);
|
||||
|
||||
EPD_WriteCmd(0x32);
|
||||
int i;
|
||||
for (i = 0; i < 153; i++)// This model has a 159 bytes LUT storage so we test for that
|
||||
{
|
||||
EPD_WriteData(EPD_BWR_290_test_pattern);
|
||||
}
|
||||
EPD_WriteCmd(0x33);
|
||||
for (i = 0; i < 153; i++)
|
||||
{
|
||||
if(EPD_SPI_read() != EPD_BWR_290_test_pattern)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
_attribute_ram_code_ uint8_t EPD_BWR_290_read_temp(void)
|
||||
{
|
||||
uint8_t epd_temperature = 0 ;
|
||||
|
||||
// SW Reset
|
||||
EPD_WriteCmd(0x12);
|
||||
|
||||
EPD_CheckStatus_inverted(100);
|
||||
|
||||
// Set Analog Block control
|
||||
EPD_WriteCmd(0x74);
|
||||
EPD_WriteData(0x54);
|
||||
// Set Digital Block control
|
||||
EPD_WriteCmd(0x7E);
|
||||
EPD_WriteData(0x3B);
|
||||
|
||||
// Booster soft start
|
||||
EPD_WriteCmd(0x0C);
|
||||
EPD_WriteData(0x8B);
|
||||
EPD_WriteData(0x9C);
|
||||
EPD_WriteData(0x96);
|
||||
EPD_WriteData(0x0F);
|
||||
|
||||
// Driver output control
|
||||
EPD_WriteCmd(0x01);
|
||||
EPD_WriteData(0x28);
|
||||
EPD_WriteData(0x01);
|
||||
EPD_WriteData(0x01);
|
||||
|
||||
// Data entry mode setting
|
||||
EPD_WriteCmd(0x11);
|
||||
EPD_WriteData(0x01);
|
||||
|
||||
// Set RAM X- Address Start/End
|
||||
EPD_WriteCmd(0x44);
|
||||
EPD_WriteData(0x00);
|
||||
EPD_WriteData(0x0F);
|
||||
|
||||
// Set RAM Y- Address Start/End
|
||||
EPD_WriteCmd(0x45);
|
||||
EPD_WriteData(0x28);
|
||||
EPD_WriteData(0x01);
|
||||
EPD_WriteData(0x2E);
|
||||
EPD_WriteData(0x00);
|
||||
|
||||
// Border waveform control
|
||||
EPD_WriteCmd(0x3C);
|
||||
EPD_WriteData(0x05);
|
||||
|
||||
// Display update control
|
||||
EPD_WriteCmd(0x21);
|
||||
EPD_WriteData(0x00);
|
||||
EPD_WriteData(0x80);
|
||||
|
||||
// Temperature sensor control
|
||||
EPD_WriteCmd(0x18);
|
||||
EPD_WriteData(0x80);
|
||||
|
||||
// Display update control
|
||||
EPD_WriteCmd(0x22);
|
||||
EPD_WriteData(0xB1);
|
||||
|
||||
// Master Activation
|
||||
EPD_WriteCmd(0x20);
|
||||
|
||||
EPD_CheckStatus_inverted(100);
|
||||
|
||||
// Temperature sensor read from register
|
||||
EPD_WriteCmd(0x1B);
|
||||
epd_temperature = EPD_SPI_read();
|
||||
EPD_SPI_read();
|
||||
|
||||
WaitMs(5);
|
||||
|
||||
// deep sleep
|
||||
EPD_WriteCmd(0x10);
|
||||
EPD_WriteData(0x01);
|
||||
|
||||
return epd_temperature;
|
||||
}
|
||||
|
||||
_attribute_ram_code_ uint8_t EPD_BWR_290_Display(unsigned char *image, int size, uint8_t full_or_partial)
|
||||
{
|
||||
uint8_t epd_temperature = 0 ;
|
||||
|
||||
// SW Reset
|
||||
EPD_WriteCmd(0x12);
|
||||
|
||||
EPD_CheckStatus_inverted(100);
|
||||
|
||||
// Set Analog Block control
|
||||
EPD_WriteCmd(0x74);
|
||||
EPD_WriteData(0x54);
|
||||
// Set Digital Block control
|
||||
EPD_WriteCmd(0x7E);
|
||||
EPD_WriteData(0x3B);
|
||||
|
||||
// Booster soft start
|
||||
EPD_WriteCmd(0x0C);
|
||||
EPD_WriteData(0x8B);
|
||||
EPD_WriteData(0x9C);
|
||||
EPD_WriteData(0x96);
|
||||
EPD_WriteData(0x0F);
|
||||
|
||||
// Driver output control
|
||||
EPD_WriteCmd(0x01);
|
||||
EPD_WriteData(0x28);
|
||||
EPD_WriteData(0x01);
|
||||
EPD_WriteData(0x01);
|
||||
|
||||
// Data entry mode setting
|
||||
EPD_WriteCmd(0x11);
|
||||
EPD_WriteData(0x01);
|
||||
|
||||
// Set RAM X- Address Start/End
|
||||
EPD_WriteCmd(0x44);
|
||||
EPD_WriteData(0x00);
|
||||
EPD_WriteData(0x0F);
|
||||
|
||||
// Set RAM Y- Address Start/End
|
||||
EPD_WriteCmd(0x45);
|
||||
EPD_WriteData(0x28);
|
||||
EPD_WriteData(0x01);
|
||||
EPD_WriteData(0x2E);
|
||||
EPD_WriteData(0x00);
|
||||
|
||||
// Border waveform control
|
||||
EPD_WriteCmd(0x3C);
|
||||
EPD_WriteData(0x05);
|
||||
|
||||
// Display update control
|
||||
EPD_WriteCmd(0x21);
|
||||
EPD_WriteData(0x00);
|
||||
EPD_WriteData(0x80);
|
||||
|
||||
// Temperature sensor control
|
||||
EPD_WriteCmd(0x18);
|
||||
EPD_WriteData(0x80);
|
||||
|
||||
// Display update control
|
||||
EPD_WriteCmd(0x22);
|
||||
EPD_WriteData(0xB1);
|
||||
|
||||
// Master Activation
|
||||
EPD_WriteCmd(0x20);
|
||||
|
||||
EPD_CheckStatus_inverted(100);
|
||||
|
||||
// Temperature sensor read from register
|
||||
EPD_WriteCmd(0x1B);
|
||||
epd_temperature = EPD_SPI_read();
|
||||
EPD_SPI_read();
|
||||
|
||||
WaitMs(5);
|
||||
|
||||
// Set RAM X address
|
||||
EPD_WriteCmd(0x4E);
|
||||
EPD_WriteData(0x00);
|
||||
|
||||
// Set RAM Y address
|
||||
EPD_WriteCmd(0x4F);
|
||||
EPD_WriteData(0x28);
|
||||
EPD_WriteData(0x01);
|
||||
|
||||
EPD_LoadImage(image, size, 0x24);
|
||||
|
||||
// Set RAM X address
|
||||
EPD_WriteCmd(0x4E);
|
||||
EPD_WriteData(0x00);
|
||||
|
||||
// Set RAM Y address
|
||||
EPD_WriteCmd(0x4F);
|
||||
EPD_WriteData(0x28);
|
||||
EPD_WriteData(0x01);
|
||||
|
||||
EPD_WriteCmd(0x26);// RED Color TODO make something out of it :)
|
||||
int i;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
EPD_WriteData(0x00);
|
||||
}
|
||||
|
||||
if (!full_or_partial)
|
||||
{
|
||||
EPD_WriteCmd(0x32);
|
||||
for (i = 0; i < sizeof(LUT_bwr_290_part); i++)
|
||||
{
|
||||
EPD_WriteData(LUT_bwr_290_part[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Display update control
|
||||
EPD_WriteCmd(0x22);
|
||||
EPD_WriteData(0xC7);
|
||||
|
||||
// Master Activation
|
||||
EPD_WriteCmd(0x20);
|
||||
|
||||
return epd_temperature;
|
||||
}
|
||||
|
||||
_attribute_ram_code_ void EPD_BWR_290_set_sleep(void)
|
||||
{
|
||||
// deep sleep
|
||||
EPD_WriteCmd(0x10);
|
||||
EPD_WriteData(0x01);
|
||||
|
||||
}
|
||||
6
Firmware/src/epd_bwr_290.h
Normal file
6
Firmware/src/epd_bwr_290.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
uint8_t EPD_BWR_290_detect(void);
|
||||
uint8_t EPD_BWR_290_read_temp(void);
|
||||
uint8_t EPD_BWR_290_Display(unsigned char *image, int size, uint8_t full_or_partial);
|
||||
void EPD_BWR_290_set_sleep(void);
|
||||
@@ -11,6 +11,7 @@ $(OUT_PATH)/time.o \
|
||||
$(OUT_PATH)/epd_spi.o \
|
||||
$(OUT_PATH)/epd.o \
|
||||
$(OUT_PATH)/epd_bw_213.o \
|
||||
$(OUT_PATH)/epd_bwr_290.o \
|
||||
$(OUT_PATH)/epd_bwr_213.o \
|
||||
$(OUT_PATH)/epd_bw_213_ice.o \
|
||||
$(OUT_PATH)/epd_bwr_154.o \
|
||||
|
||||
Reference in New Issue
Block a user