Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
20bc94beed |
10 changed files with 178 additions and 50 deletions
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
|
@ -11,8 +11,7 @@
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"executable": "${workspaceFolder}/build/debug/voc-sensor.elf",
|
"executable": "${workspaceFolder}/build/debug/voc-sensor.elf",
|
||||||
"servertype": "stutil",
|
"servertype": "stutil",
|
||||||
"device": "STM32F103CB",
|
"device": "STM32F103CB"
|
||||||
"runToMain": true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
4
Makefile
4
Makefile
|
@ -16,9 +16,11 @@ src \
|
||||||
|
|
||||||
SOURCES := \
|
SOURCES := \
|
||||||
src/BME68x-Sensor-API/bme68x.c \
|
src/BME68x-Sensor-API/bme68x.c \
|
||||||
src/oled-driver/fonts/mono.cxx \
|
src/oled-driver/fonts/dfi.cxx \
|
||||||
src/oled-driver/src/SSD1305.cxx \
|
src/oled-driver/src/SSD1305.cxx \
|
||||||
src/oled-driver/src/SSD1306.cxx \
|
src/oled-driver/src/SSD1306.cxx \
|
||||||
|
src/oled-driver/src/SSD1675a.cxx \
|
||||||
|
src/oled-driver/src/SSD1680.cxx \
|
||||||
src/oled-driver/src/Image.cxx \
|
src/oled-driver/src/Image.cxx \
|
||||||
src/oled-driver/src/Renderer.cxx \
|
src/oled-driver/src/Renderer.cxx \
|
||||||
src/bmeSPI.cxx \
|
src/bmeSPI.cxx \
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||||
#define configMAX_PRIORITIES ( 56 )
|
#define configMAX_PRIORITIES ( 56 )
|
||||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
||||||
#define configTOTAL_HEAP_SIZE ((size_t)6000)
|
#define configTOTAL_HEAP_SIZE ((size_t)20000)
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
#define configUSE_TRACE_FACILITY 1
|
#define configUSE_TRACE_FACILITY 1
|
||||||
#define configUSE_16_BIT_TICKS 0
|
#define configUSE_16_BIT_TICKS 0
|
||||||
|
|
|
@ -60,6 +60,10 @@ void Error_Handler(void);
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
#define VocSensorCS_Pin GPIO_PIN_0
|
#define VocSensorCS_Pin GPIO_PIN_0
|
||||||
#define VocSensorCS_GPIO_Port GPIOA
|
#define VocSensorCS_GPIO_Port GPIOA
|
||||||
|
#define EINK_BUSY_Pin GPIO_PIN_5
|
||||||
|
#define EINK_BUSY_GPIO_Port GPIOA
|
||||||
|
#define EINK_RS_Pin GPIO_PIN_2
|
||||||
|
#define EINK_RS_GPIO_Port GPIOB
|
||||||
#define DisplayDC_Pin GPIO_PIN_10
|
#define DisplayDC_Pin GPIO_PIN_10
|
||||||
#define DisplayDC_GPIO_Port GPIOB
|
#define DisplayDC_GPIO_Port GPIOB
|
||||||
#define DisplayReset_Pin GPIO_PIN_11
|
#define DisplayReset_Pin GPIO_PIN_11
|
||||||
|
|
|
@ -56,7 +56,7 @@ void MX_GPIO_Init(void)
|
||||||
HAL_GPIO_WritePin(VocSensorCS_GPIO_Port, VocSensorCS_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(VocSensorCS_GPIO_Port, VocSensorCS_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOB, DisplayDC_Pin|DisplayReset_Pin|DisplayCS_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOB, EINK_RS_Pin|DisplayDC_Pin|DisplayReset_Pin|DisplayCS_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pins : PC13 PC14 PC15 PC0
|
/*Configure GPIO pins : PC13 PC14 PC15 PC0
|
||||||
PC1 PC2 PC3 PC4
|
PC1 PC2 PC3 PC4
|
||||||
|
@ -84,29 +84,33 @@ void MX_GPIO_Init(void)
|
||||||
HAL_GPIO_Init(VocSensorCS_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(VocSensorCS_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PA1 PA2 PA3 PA4
|
/*Configure GPIO pins : PA1 PA2 PA3 PA4
|
||||||
PA5 PA6 PA7 PA8
|
PA6 PA7 PA8 PA9
|
||||||
PA9 PA10 PA11 PA12
|
PA10 PA11 PA12 PA15 */
|
||||||
PA15 */
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4
|
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4
|
||||||
|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8
|
|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9
|
||||||
|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12
|
|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_15;
|
||||||
|GPIO_PIN_15;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PB0 PB1 PB2 PB3
|
/*Configure GPIO pin : PtPin */
|
||||||
PB4 PB5 PB6 PB7
|
GPIO_InitStruct.Pin = EINK_BUSY_Pin;
|
||||||
PB8 PB9 */
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
|
HAL_GPIO_Init(EINK_BUSY_GPIO_Port, &GPIO_InitStruct);
|
||||||
|GPIO_PIN_8|GPIO_PIN_9;
|
|
||||||
|
/*Configure GPIO pins : PB0 PB1 PB3 PB4
|
||||||
|
PB5 PB6 PB7 PB8
|
||||||
|
PB9 */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4
|
||||||
|
|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8
|
||||||
|
|GPIO_PIN_9;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PBPin PBPin PBPin */
|
/*Configure GPIO pins : PBPin PBPin PBPin PBPin */
|
||||||
GPIO_InitStruct.Pin = DisplayDC_Pin|DisplayReset_Pin|DisplayCS_Pin;
|
GPIO_InitStruct.Pin = EINK_RS_Pin|DisplayDC_Pin|DisplayReset_Pin|DisplayCS_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
|
|
@ -26,7 +26,7 @@ FREERTOS.IPParameters=Tasks01,configCHECK_FOR_STACK_OVERFLOW,FootprintOK,HEAP_NU
|
||||||
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;sensor,24,512,sensorTask,As external,NULL,Dynamic,NULL,NULL
|
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;sensor,24,512,sensorTask,As external,NULL,Dynamic,NULL,NULL
|
||||||
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=2
|
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=2
|
||||||
FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1
|
FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1
|
||||||
FREERTOS.configTOTAL_HEAP_SIZE=6000
|
FREERTOS.configTOTAL_HEAP_SIZE=20000
|
||||||
FREERTOS.configUSE_MALLOC_FAILED_HOOK=1
|
FREERTOS.configUSE_MALLOC_FAILED_HOOK=1
|
||||||
File.Version=6
|
File.Version=6
|
||||||
GPIO.groupedBy=
|
GPIO.groupedBy=
|
||||||
|
@ -42,17 +42,19 @@ Mcu.IPNb=6
|
||||||
Mcu.Name=STM32L152RCTx
|
Mcu.Name=STM32L152RCTx
|
||||||
Mcu.Package=LQFP64
|
Mcu.Package=LQFP64
|
||||||
Mcu.Pin0=PA0-WKUP1
|
Mcu.Pin0=PA0-WKUP1
|
||||||
Mcu.Pin1=PB10
|
Mcu.Pin1=PA5
|
||||||
Mcu.Pin10=VP_SYS_VS_tim2
|
Mcu.Pin10=PA14
|
||||||
Mcu.Pin2=PB11
|
Mcu.Pin11=VP_FREERTOS_VS_CMSIS_V2
|
||||||
Mcu.Pin3=PB12
|
Mcu.Pin12=VP_SYS_VS_tim2
|
||||||
Mcu.Pin4=PB13
|
Mcu.Pin2=PB2
|
||||||
Mcu.Pin5=PB14
|
Mcu.Pin3=PB10
|
||||||
Mcu.Pin6=PB15
|
Mcu.Pin4=PB11
|
||||||
Mcu.Pin7=PA13
|
Mcu.Pin5=PB12
|
||||||
Mcu.Pin8=PA14
|
Mcu.Pin6=PB13
|
||||||
Mcu.Pin9=VP_FREERTOS_VS_CMSIS_V2
|
Mcu.Pin7=PB14
|
||||||
Mcu.PinsNb=11
|
Mcu.Pin8=PB15
|
||||||
|
Mcu.Pin9=PA13
|
||||||
|
Mcu.PinsNb=13
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32L152RCTx
|
Mcu.UserName=STM32L152RCTx
|
||||||
|
@ -84,6 +86,10 @@ PA13.Mode=Serial_Wire
|
||||||
PA13.Signal=SYS_JTMS-SWDIO
|
PA13.Signal=SYS_JTMS-SWDIO
|
||||||
PA14.Mode=Serial_Wire
|
PA14.Mode=Serial_Wire
|
||||||
PA14.Signal=SYS_JTCK-SWCLK
|
PA14.Signal=SYS_JTCK-SWCLK
|
||||||
|
PA5.GPIOParameters=GPIO_Label
|
||||||
|
PA5.GPIO_Label=EINK_BUSY
|
||||||
|
PA5.Locked=true
|
||||||
|
PA5.Signal=GPIO_Input
|
||||||
PB10.GPIOParameters=GPIO_Label
|
PB10.GPIOParameters=GPIO_Label
|
||||||
PB10.GPIO_Label=DisplayDC
|
PB10.GPIO_Label=DisplayDC
|
||||||
PB10.Signal=GPIO_Output
|
PB10.Signal=GPIO_Output
|
||||||
|
@ -105,6 +111,10 @@ PB15.GPIOParameters=GPIO_Speed
|
||||||
PB15.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM
|
PB15.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM
|
||||||
PB15.Mode=Full_Duplex_Master
|
PB15.Mode=Full_Duplex_Master
|
||||||
PB15.Signal=SPI2_MOSI
|
PB15.Signal=SPI2_MOSI
|
||||||
|
PB2.GPIOParameters=GPIO_Label
|
||||||
|
PB2.GPIO_Label=EINK_RS
|
||||||
|
PB2.Locked=true
|
||||||
|
PB2.Signal=GPIO_Output
|
||||||
PinOutPanel.RotationAngle=0
|
PinOutPanel.RotationAngle=0
|
||||||
ProjectManager.AskForMigrate=true
|
ProjectManager.AskForMigrate=true
|
||||||
ProjectManager.BackupPrevious=false
|
ProjectManager.BackupPrevious=false
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
|
|
||||||
#include "oled-driver/SSDInterface.hpp"
|
#include "oled-driver/SSDInterface.hpp"
|
||||||
|
|
||||||
constexpr size_t OledWidth = 128;
|
|
||||||
constexpr size_t OledPages = 4;
|
|
||||||
|
|
||||||
constexpr auto UsedSpiPeripherie = &hspi2;
|
constexpr auto UsedSpiPeripherie = &hspi2;
|
||||||
|
|
||||||
extern QueueHandle_t spiMutex;
|
extern QueueHandle_t spiMutex;
|
||||||
|
@ -19,12 +16,22 @@ extern void waitForSpiFinished();
|
||||||
class SSDSpiInterface : public SSDInterface
|
class SSDSpiInterface : public SSDInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
void waitUntilIdle() override
|
||||||
|
{
|
||||||
|
while (!readBusyPin())
|
||||||
|
{
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
void writeCommand(uint8_t cmd) override
|
void writeCommand(uint8_t cmd) override
|
||||||
{
|
{
|
||||||
xSemaphoreTake(spiMutex, portMAX_DELAY);
|
xSemaphoreTake(spiMutex, portMAX_DELAY);
|
||||||
|
|
||||||
setCommandPin();
|
setCommandPin();
|
||||||
setChipSelect(true);
|
setChipSelect(true);
|
||||||
|
// vTaskDelay(1);
|
||||||
HAL_SPI_Transmit_DMA(UsedSpiPeripherie, &cmd, 1);
|
HAL_SPI_Transmit_DMA(UsedSpiPeripherie, &cmd, 1);
|
||||||
waitForSpiFinished();
|
waitForSpiFinished();
|
||||||
setChipSelect(false);
|
setChipSelect(false);
|
||||||
|
@ -39,6 +46,7 @@ public:
|
||||||
|
|
||||||
setDataPin();
|
setDataPin();
|
||||||
setChipSelect(true);
|
setChipSelect(true);
|
||||||
|
// vTaskDelay(1);
|
||||||
HAL_SPI_Transmit_DMA(UsedSpiPeripherie, &data, 1);
|
HAL_SPI_Transmit_DMA(UsedSpiPeripherie, &data, 1);
|
||||||
waitForSpiFinished();
|
waitForSpiFinished();
|
||||||
setChipSelect(false);
|
setChipSelect(false);
|
||||||
|
@ -49,8 +57,8 @@ public:
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void writeData(const uint8_t *data, unsigned int length) override
|
void writeData(const uint8_t *data, unsigned int length) override
|
||||||
{
|
{
|
||||||
if (length > OledWidth * OledPages)
|
// if (length > OledWidth * OledPages)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
xSemaphoreTake(spiMutex, portMAX_DELAY);
|
xSemaphoreTake(spiMutex, portMAX_DELAY);
|
||||||
|
|
||||||
|
@ -82,4 +90,10 @@ private:
|
||||||
HAL_GPIO_WritePin(DisplayCS_GPIO_Port, DisplayCS_Pin,
|
HAL_GPIO_WritePin(DisplayCS_GPIO_Port, DisplayCS_Pin,
|
||||||
state ? GPIO_PIN_RESET : GPIO_PIN_SET);
|
state ? GPIO_PIN_RESET : GPIO_PIN_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool readBusyPin()
|
||||||
|
{
|
||||||
|
return HAL_GPIO_ReadPin(EINK_BUSY_GPIO_Port, EINK_BUSY_Pin) == GPIO_PIN_SET;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -259,7 +259,7 @@ void printBmeSensorData()
|
||||||
renderer.drawVerticalLine(OledWidth - MaxTextWidth - 2, 0, OledPages - 1);
|
renderer.drawVerticalLine(OledWidth - MaxTextWidth - 2, 0, OledPages - 1);
|
||||||
|
|
||||||
if (iaqAccuracy == 0)
|
if (iaqAccuracy == 0)
|
||||||
snprintf(buffer, MaximumChars, "IAQ:---\n----ppm\n");
|
snprintf(buffer, MaximumChars, "IAQ:---\n---ppm\n");
|
||||||
else
|
else
|
||||||
snprintf(buffer, MaximumChars, "IAQ:%d\n%dppm\n",
|
snprintf(buffer, MaximumChars, "IAQ:%d\n%dppm\n",
|
||||||
static_cast<int>(iaq), //
|
static_cast<int>(iaq), //
|
||||||
|
@ -320,14 +320,12 @@ void writeStateToEeprom()
|
||||||
extern "C" void sensorTask(void *)
|
extern "C" void sensorTask(void *)
|
||||||
{
|
{
|
||||||
initDisplay();
|
initDisplay();
|
||||||
|
vTaskSuspend(nullptr);
|
||||||
|
|
||||||
bmeSensorInit();
|
bmeSensorInit();
|
||||||
readStateFromEeprom();
|
readStateFromEeprom();
|
||||||
|
|
||||||
constexpr auto TaskDelay = 10;
|
uint16_t counter = 0;
|
||||||
constexpr auto SaveContentDelay = 12 * 60 * 60 * 1000;
|
|
||||||
constexpr auto SaveContentDelayCounts = SaveContentDelay / TaskDelay;
|
|
||||||
|
|
||||||
uint32_t counter = 0;
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -335,13 +333,13 @@ extern "C" void sensorTask(void *)
|
||||||
bsecRun();
|
bsecRun();
|
||||||
printBmeSensorData();
|
printBmeSensorData();
|
||||||
|
|
||||||
if (counter++ >= SaveContentDelayCounts)
|
if (counter++ >= 1000)
|
||||||
{
|
{
|
||||||
counter = 0;
|
counter = 0;
|
||||||
initDisplay();
|
initDisplay();
|
||||||
writeStateToEeprom();
|
writeStateToEeprom();
|
||||||
}
|
}
|
||||||
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(TaskDelay));
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
}
|
}
|
||||||
}
|
}
|
107
src/main.cxx
107
src/main.cxx
|
@ -5,13 +5,19 @@
|
||||||
|
|
||||||
// #include "BSEC/bsec_integration.h"
|
// #include "BSEC/bsec_integration.h"
|
||||||
#include "SSDSpiInterface.hpp"
|
#include "SSDSpiInterface.hpp"
|
||||||
#include "oled-driver/Renderer.hpp"
|
#include "oled-driver/DualRenderer.hpp"
|
||||||
#include "oled-driver/SSD1306.hpp"
|
#include "oled-driver/SSD1306.hpp"
|
||||||
|
#include "oled-driver/fonts/dfi.hpp"
|
||||||
|
|
||||||
|
#include "oled-driver/SSD1680.hpp"
|
||||||
|
|
||||||
// oled display
|
// oled display
|
||||||
SSDSpiInterface ssdSpiInterface;
|
SSDSpiInterface ssdSpiInterface;
|
||||||
|
|
||||||
|
SSD1680 test(ssdSpiInterface);
|
||||||
|
|
||||||
SSD1306 display(ssdSpiInterface);
|
SSD1306 display(ssdSpiInterface);
|
||||||
Renderer renderer(OledWidth, OledPages, display);
|
DualRenderer renderer(296, 152, test);
|
||||||
|
|
||||||
QueueHandle_t spiMutex = xSemaphoreCreateMutex();
|
QueueHandle_t spiMutex = xSemaphoreCreateMutex();
|
||||||
QueueHandle_t spiBinary = xSemaphoreCreateBinary();
|
QueueHandle_t spiBinary = xSemaphoreCreateBinary();
|
||||||
|
@ -20,10 +26,100 @@ QueueHandle_t spiBinary = xSemaphoreCreateBinary();
|
||||||
void initDisplay()
|
void initDisplay()
|
||||||
{
|
{
|
||||||
HAL_GPIO_WritePin(DisplayReset_GPIO_Port, DisplayReset_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(DisplayReset_GPIO_Port, DisplayReset_Pin, GPIO_PIN_RESET);
|
||||||
vTaskDelay(pdMS_TO_TICKS(1));
|
HAL_GPIO_WritePin(EINK_RS_GPIO_Port, EINK_RS_Pin, GPIO_PIN_RESET);
|
||||||
HAL_GPIO_WritePin(DisplayReset_GPIO_Port, DisplayReset_Pin, GPIO_PIN_SET);
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(1));
|
|
||||||
|
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||||||
|
// HAL_GPIO_WritePin(DisplayReset_GPIO_Port, DisplayReset_Pin, GPIO_PIN_SET);
|
||||||
|
HAL_GPIO_WritePin(EINK_RS_GPIO_Port, EINK_RS_Pin, GPIO_PIN_SET);
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||||||
|
|
||||||
|
test.selectLut(SSD1680::LutSelection::Red);
|
||||||
|
test.init();
|
||||||
|
renderer.black.setFont(fontDfi);
|
||||||
|
|
||||||
|
renderer.black.clearAll();
|
||||||
|
renderer.red.clearAll();
|
||||||
|
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
test.selectLut(SSD1680::LutSelection::None);
|
||||||
|
test.init();
|
||||||
|
renderer.dualRender();
|
||||||
|
test.deepSleep(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr auto aL = Renderer::Alignment::Left;
|
||||||
|
constexpr auto aC = Renderer::Alignment::Center;
|
||||||
|
constexpr auto aR = Renderer::Alignment::Right;
|
||||||
|
|
||||||
|
size_t page = 0;
|
||||||
|
size_t maxNumberPixels = 0;
|
||||||
|
size_t result = 0;
|
||||||
|
|
||||||
|
bool scroll = false;
|
||||||
|
|
||||||
|
if (!scroll)
|
||||||
|
{
|
||||||
|
renderer.black.print({0, page}, "9", aL, 2);
|
||||||
|
renderer.black.print({20, page}, "Neustädter See", aL, 2);
|
||||||
|
renderer.black.print({296, page}, "jetzt", aR, 2);
|
||||||
|
page += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderer.black.print({0, page}, "1", aL, 2);
|
||||||
|
renderer.black.print({20, page}, "Sudenburg", aL, 2);
|
||||||
|
renderer.black.print({296, page}, "1min", aR, 2);
|
||||||
|
page += 2;
|
||||||
|
|
||||||
|
renderer.black.print({0, page}, "10", aL, 2);
|
||||||
|
renderer.black.print({20, page}, "Barleber See", aL, 2);
|
||||||
|
renderer.black.print({296, page}, "2min", aR, 2);
|
||||||
|
page += 2;
|
||||||
|
|
||||||
|
renderer.black.print({0, page}, "1", aL, 2);
|
||||||
|
renderer.black.print({20, page}, "Kannenstieg", aL, 2);
|
||||||
|
result = renderer.black.print({296, page}, "5min", aR, 2);
|
||||||
|
maxNumberPixels = std::max(maxNumberPixels, result);
|
||||||
|
page += 2;
|
||||||
|
|
||||||
|
renderer.black.print({0, page}, "9", aL, 2);
|
||||||
|
renderer.black.print({20, page}, "Reform", aL, 2);
|
||||||
|
result = renderer.black.print({296, page}, "55min", aR, 2);
|
||||||
|
maxNumberPixels = std::max(maxNumberPixels, result);
|
||||||
|
page += 2;
|
||||||
|
|
||||||
|
renderer.black.print({0, page}, "10", aL, 2);
|
||||||
|
renderer.black.print({20, page}, "Rothensee", aL, 2);
|
||||||
|
result = renderer.black.print({296, page}, "107min", aR, 2);
|
||||||
|
maxNumberPixels = std::max(maxNumberPixels, result);
|
||||||
|
page += 2;
|
||||||
|
|
||||||
|
renderer.red.print({0, page}, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", aL, 2);
|
||||||
|
|
||||||
|
page = scroll ? 2 : 3;
|
||||||
|
|
||||||
|
const auto PositionX = 296 - maxNumberPixels - 4;
|
||||||
|
result = renderer.black.print({PositionX, page}, ")", aR, 2);
|
||||||
|
auto result2 = renderer.red.print({PositionX - result, page}, "-8", aR, 2);
|
||||||
|
renderer.black.print({PositionX - result - result2, page}, "(", aR, 2);
|
||||||
|
page += 2;
|
||||||
|
|
||||||
|
result = renderer.black.print({PositionX, page}, ")", aR, 2);
|
||||||
|
result2 = renderer.red.print({PositionX - result, page}, "+2", aR, 2);
|
||||||
|
renderer.black.print({PositionX - result - result2, page}, "(", aR, 2);
|
||||||
|
page += 2;
|
||||||
|
|
||||||
|
result = renderer.black.print({PositionX, page}, ")", aR, 2);
|
||||||
|
result2 = renderer.red.print({PositionX - result, page}, "+22", aR, 2);
|
||||||
|
renderer.black.print({PositionX - result - result2, page}, "(", aR, 2);
|
||||||
|
page += 2;
|
||||||
|
|
||||||
|
renderer.dualRender();
|
||||||
|
|
||||||
|
test.deepSleep(1);
|
||||||
|
|
||||||
|
/*
|
||||||
display.setDisplayState(SSD1306::DisplayState::Off);
|
display.setDisplayState(SSD1306::DisplayState::Off);
|
||||||
display.setMultiplexRatio(OledPages * 8 - 1);
|
display.setMultiplexRatio(OledPages * 8 - 1);
|
||||||
display.setComPinConfig(false, false);
|
display.setComPinConfig(false, false);
|
||||||
|
@ -39,6 +135,7 @@ void initDisplay()
|
||||||
display.setColumnAddress(0, OledWidth - 1); // columns from 0 to 127
|
display.setColumnAddress(0, OledWidth - 1); // columns from 0 to 127
|
||||||
|
|
||||||
display.setDisplayState(SSD1306::DisplayState::On);
|
display.setDisplayState(SSD1306::DisplayState::On);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 95f315a0764640e542031c3307565e5b11f902ff
|
Subproject commit 2be16647b4431014c75ae8d0f46dbfb24772d2ad
|
Loading…
Reference in a new issue