feat(fw): Jumper T14 support (#4543)

This commit is contained in:
3djc
2024-01-17 12:03:21 +10:00
committed by GitHub
parent 3235293580
commit 1b7044a134
19 changed files with 274 additions and 23 deletions
+43 -1
View File
@@ -72,7 +72,7 @@ void lcdHardwareInit()
// APB1 clock / 2 = 133nS per clock
LCD_SPI->CR1 = 0; // Clear any mode error
LCD_SPI->CR1 = SPI_CR1_SSM | SPI_CR1_SSI | SPI_CR1_CPOL | SPI_CR1_CPHA;
LCD_SPI->CR1 = SPI_CR1_SSM | SPI_CR1_SSI | SPI_CR1_CPOL | SPI_CR1_CPHA | LCD_SPI_PRESCALER;
LCD_SPI->CR2 = 0;
LCD_SPI->CR1 |= SPI_CR1_MSTR; // Make sure in case SSM/SSI needed to be set first
LCD_SPI->CR1 |= SPI_CR1_SPE;
@@ -116,9 +116,44 @@ void lcdHardwareInit()
NVIC_EnableIRQ(LCD_DMA_Stream_IRQn);
}
#if defined(SSD1309_LCD)
void lcdColumnSet(unsigned char column)
{
lcdWriteCommand(0x10|(column >> 4));
lcdWriteCommand(0x00|(column & 0x0f));
}
void lcdPageSet(unsigned char page)
{
lcdWriteCommand(0xb0 + page);
}
#endif
#if LCD_W == 128
void lcdStart()
{
#if defined(SSD1309_LCD)
lcdWriteCommand(0xD5); // Set Display Clock Divide Ratio / OSC Frequency
lcdWriteCommand(0x80); // Display Clock Divide Ratio / OSC Frequency
lcdWriteCommand(0xA8); // Set Multiplex Ratio
lcdWriteCommand(0x3F); // Multiplex Ratio for 128x64 (LCD_HEIGHT - 1)
lcdWriteCommand(0xD3); // Set Display Offset
lcdWriteCommand(0x00); // Display Offset (0)
lcdWriteCommand(0x40); // Set Display Start Line (0)
lcdWriteCommand(0x8D); // Set Charge Pump
lcdWriteCommand(0x10); // Charge Pump (0x10 External, 0x14 Internal DC/DC)
lcdWriteCommand(0xA1); // Set Segment Re-Map (Reversed)
lcdWriteCommand(0xC8); // Set Com Output Scan Direction (Reversed)
lcdWriteCommand(0xDA); // Set COM Hardware Configuration
lcdWriteCommand(0x12); // COM Hardware Configuration
lcdWriteCommand(0xD9); // Set Pre-Charge Period
lcdWriteCommand(0x4F); // Set Pre-Charge Period (A[7:4]:Phase 2, A[3:0]:Phase 1)
lcdWriteCommand(0xDB); // Set VCOMH Deselect Level
lcdWriteCommand(0x20); // VCOMH Deselect Level (0x00 ~ 0.65 x VCC, 0x10 ~ 0.71 x VCC, 0x20 ~ 0.77 x VCC, 0x30 ~ 0.83 x VCC)
lcdWriteCommand(0xA4); // Disable Entire Display On
lcdWriteCommand(0xA6); // Set Normal Display (not inverted)
lcdWriteCommand(0x2E); // Deactivate scroll
#else
#if defined(LCD_VERTICAL_INVERT)
// T12 and TX12 have the screen inverted.
lcdWriteCommand(0xe2); // (14) Soft reset
@@ -155,6 +190,7 @@ void lcdStart()
#else
lcdSetRefVolt(g_eeGeneral.contrast);
#endif
#endif
}
#else
void lcdStart()
@@ -221,10 +257,15 @@ void lcdRefresh(bool wait)
lcdWriteCommand(LCD_W_OFFSET);
#endif
for (uint8_t y=0; y < 8; y++, p+=LCD_W) {
#if defined(SSD1309_LCD)
lcdPageSet(y);
lcdColumnSet(0);
#else
lcdWriteCommand(0x10); // Column addr 0
lcdWriteCommand(0xB0 | y); // Page addr y
#if !defined(LCD_VERTICAL_INVERT)
lcdWriteCommand(0x04);
#endif
#endif
LCD_NCS_LOW();
@@ -297,6 +338,7 @@ void lcdOff()
void lcdReset()
{
LCD_NCS_HIGH();
LCD_RST_LOW();
#if LCD_W == 128
delay_ms(150);