# HG changeset patch
# User heinrichsweikamp
# Date 1723548294 -7200
# Node ID f7318457df4d5ddf4621c40c89ade4a41cee8ab6
# Parent 3a1c533f3840d109ccac737d2b02fd19cc7f2c67
support for new screen
ToDo: Brightness settings
diff -r 3a1c533f3840 -r f7318457df4d Discovery/Inc/ostc.h
--- a/Discovery/Inc/ostc.h Mon Jul 22 16:40:14 2024 +0200
+++ b/Discovery/Inc/ostc.h Tue Aug 13 13:24:54 2024 +0200
@@ -98,5 +98,6 @@
void MX_TestPin_High(void);
void MX_TestPin_Low(void);
+uint8_t hardwareDisplay; //< either OSTC4 LCD (=0) or new Screen (=1)
#endif // OSTC_H
diff -r 3a1c533f3840 -r f7318457df4d Discovery/Inc/ostc_discovery.h
--- a/Discovery/Inc/ostc_discovery.h Mon Jul 22 16:40:14 2024 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-/// -*- coding: UTF-8 -*-
-///
-/// \file Discovery/Inc/ostc_discovery.h
-/// \brief Hardware specific configuration
-/// \author heinrichs weikamp gmbh
-/// \date 05-Dec-2014
-///
-/// $Id$
-///////////////////////////////////////////////////////////////////////////////
-/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU General Public License as published by
-/// the Free Software Foundation, either version 3 of the License, or
-/// (at your option) any later version.
-///
-/// This program is distributed in the hope that it will be useful,
-/// but WITHOUT ANY WARRANTY; without even the implied warranty of
-/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/// GNU General Public License for more details.
-///
-/// You should have received a copy of the GNU General Public License
-/// along with this program. If not, see .
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef OSTC_DISCOVERY_H
-#define OSTC_DISCOVERY_H
-
-#define DISPLAY_RESETB_PIN GPIO_PIN_6
-#define DISPLAY_RESETB_GPIO_PORT GPIOF
-#define DISPLAY_RESETB_GPIO_ENABLE()__GPIOF_CLK_ENABLE()
-
-#define DISPLAY_CSB_PIN GPIO_PIN_8
-#define DISPLAY_CSB_GPIO_PORT GPIOC
-#define DISPLAY_CSB_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-
-#define VSYNC_IRQ_PIN GPIO_PIN_4
-#define VSYNC_IRQ_GPIO_PORT GPIOD
-#define VSYNC_IRQ_GPIO_ENABLE() __GPIOD_CLK_ENABLE()
-#define VSYNC_IRQ_EXTI_IRQn EXTI4_IRQn
-
-#define BUTTON_ENTER_PIN GPIO_PIN_0
-#define BUTTON_ENTER_GPIO_PORT GPIOA
-#define BUTTON_ENTER_GPIO_ENABLE() __GPIOA_CLK_ENABLE()
-#define BUTTON_ENTER_EXTI_IRQn EXTI0_IRQn
-
-#define BUTTON_DOWN_PIN GPIO_PIN_1
-#define BUTTON_DOWN_GPIO_PORT GPIOA
-#define BUTTON_DOWN_GPIO_ENABLE() __GPIOA_CLK_ENABLE()
-#define BUTTON_DOWN_EXTI_IRQn EXTI1_IRQn
-
-#define BUTTON_NEXT_PIN GPIO_PIN_2
-#define BUTTON_NEXT_GPIO_PORT GPIOA
-#define BUTTON_NEXT_GPIO_ENABLE() __GPIOA_CLK_ENABLE()
-#define BUTTON_NEXT_EXTI_IRQn EXTI2_IRQn
-
-#define BUTTON_BACK_PIN GPIO_PIN_3
-#define BUTTON_BACK_GPIO_PORT GPIOC
-#define BUTTON_BACK_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-#define BUTTON_BACK_EXTI_IRQn EXTI3_IRQn
-
-#define EXTFLASH_CSB_PIN GPIO_PIN_1
-#define EXTFLASH_CSB_GPIO_PORT GPIOC
-#define EXTFLASH_CSB_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-
-#define OSCILLOSCOPE_PIN GPIO_PIN_14
-#define OSCILLOSCOPE_GPIO_PORT GPIOG
-#define OSCILLOSCOPE_GPIO_ENABLE() __GPIOG_CLK_ENABLE()
-
-#define OSCILLOSCOPE2_PIN GPIO_PIN_13
-#define OSCILLOSCOPE2_GPIO_PORT GPIOG
-#define OSCILLOSCOPE2_GPIO_ENABLE() __GPIOG_CLK_ENABLE()
-
-#define USARTx USART1
-#define USARTx_CLK_ENABLE() __USART1_CLK_ENABLE();
-#define USARTx_FORCE_RESET() __USART1_FORCE_RESET()
-#define USARTx_RELEASE_RESET() __USART1_RELEASE_RESET()
-
-#define USARTx_RX_AF GPIO_AF7_USART1
-#define USARTx_RX_PIN GPIO_PIN_10
-#define USARTx_RX_GPIO_PORT GPIOA
-#define USARTx_RX_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
-
-#define USARTx_TX_AF GPIO_AF7_USART1
-#define USARTx_TX_PIN GPIO_PIN_9
-#define USARTx_TX_GPIO_PORT GPIOA
-#define USARTx_TX_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
-#define USARTx_IRQn USART1_IRQn
-#define USARTx_IRQHandler USART1_IRQHandler
-
-#define TIMx TIM3
-#define TIMx_CLK_ENABLE __TIM3_CLK_ENABLE
-#define TIMx_IRQn TIM3_IRQn
-#define TIMx_IRQHandler TIM3_IRQHandler
-
-#define SMALLCPU_CSB_PIN GPIO_PIN_15
-#define SMALLCPU_CSB_GPIO_PORT GPIOA
-#define SMALLCPU_CSB_GPIO_ENABLE() __GPIOA_CLK_ENABLE()
-
-#endif // OSTC_DISCOVERY_H
diff -r 3a1c533f3840 -r f7318457df4d Discovery/Inc/ostc_hw1.h
--- a/Discovery/Inc/ostc_hw1.h Mon Jul 22 16:40:14 2024 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-/// -*- coding: UTF-8 -*-
-///
-/// \file Discovery/Inc/ostc_hw1.h
-/// \brief
-/// \author Heinrichs Weikamp
-/// \date 2018
-///
-/// $Id$
-///////////////////////////////////////////////////////////////////////////////
-/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU General Public License as published by
-/// the Free Software Foundation, either version 3 of the License, or
-/// (at your option) any later version.
-///
-/// This program is distributed in the hope that it will be useful,
-/// but WITHOUT ANY WARRANTY; without even the implied warranty of
-/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/// GNU General Public License for more details.
-///
-/// You should have received a copy of the GNU General Public License
-/// along with this program. If not, see .
-//////////////////////////////////////////////////////////////////////////////
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef OSTC_HW1_H
-#define OSTC_HW1_H
-
-/*
-#define DISPLAY_BACKLIGHT_PIN GPIO_PIN_7
-#define DISPLAY_BACKLIGHT_GPIO_PORT GPIOC
-#define DISPLAY_BACKLIGHT_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-*/
-
-#define DISPLAY_RESETB_PIN GPIO_PIN_13
-#define DISPLAY_RESETB_GPIO_PORT GPIOC
-#define DISPLAY_RESETB_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-
-#define DISPLAY_CSB_PIN GPIO_PIN_8
-#define DISPLAY_CSB_GPIO_PORT GPIOI
-#define DISPLAY_CSB_GPIO_ENABLE() __GPIOI_CLK_ENABLE()
-
-#define VSYNC_IRQ_PIN GPIO_PIN_3
-#define VSYNC_IRQ_GPIO_PORT GPIOE
-#define VSYNC_IRQ_GPIO_ENABLE() __GPIOE_CLK_ENABLE()
-#define VSYNC_IRQ_EXTI_IRQn EXTI3_IRQn
-
-#define BUTTON_ENTER_PIN GPIO_PIN_4
-#define BUTTON_ENTER_GPIO_PORT GPIOH
-#define BUTTON_ENTER_GPIO_ENABLE() __GPIOH_CLK_ENABLE()
-#define BUTTON_ENTER_EXTI_IRQn EXTI4_IRQn
-
-#define BUTTON_DOWN_PIN GPIO_PIN_1
-#define BUTTON_DOWN_GPIO_PORT GPIOA
-#define BUTTON_DOWN_GPIO_ENABLE() __GPIOA_CLK_ENABLE()
-#define BUTTON_DOWN_EXTI_IRQn EXTI1_IRQn
-
-#define BUTTON_NEXT_PIN GPIO_PIN_2
-#define BUTTON_NEXT_GPIO_PORT GPIOA
-#define BUTTON_NEXT_GPIO_ENABLE() __GPIOA_CLK_ENABLE()
-#define BUTTON_NEXT_EXTI_IRQn EXTI2_IRQn
-
-#define BUTTON_BACK_PIN GPIO_PIN_0
-#define BUTTON_BACK_GPIO_PORT GPIOB
-#define BUTTON_BACK_GPIO_ENABLE() __GPIOB_CLK_ENABLE()
-#define BUTTON_BACK_EXTI_IRQn EXTI0_IRQn
-
-#define EXTFLASH_CSB_PIN GPIO_PIN_6
-#define EXTFLASH_CSB_GPIO_PORT GPIOF
-#define EXTFLASH_CSB_GPIO_ENABLE() __GPIOF_CLK_ENABLE()
-
-#define OSCILLOSCOPE_PIN GPIO_PIN_3
-#define OSCILLOSCOPE_GPIO_PORT GPIOA
-#define OSCILLOSCOPE_GPIO_ENABLE() __GPIOA_CLK_ENABLE()
-
-#define OSCILLOSCOPE2_PIN GPIO_PIN_11
-#define OSCILLOSCOPE2_GPIO_PORT GPIOB
-#define OSCILLOSCOPE2_GPIO_ENABLE() __GPIOB_CLK_ENABLE()
-
-#define IR_HUD_ENABLE_PIN GPIO_PIN_7
-#define IR_HUD_ENABLE_GPIO_PORT GPIOD
-#define IR_HUD_ENABLE_GPIO_ENABLE() __GPIOD_CLK_ENABLE()
-
-#define USARTx USART1
-#define USARTx_CLK_ENABLE() __USART1_CLK_ENABLE();
-#define USARTx_FORCE_RESET() __USART1_FORCE_RESET()
-#define USARTx_RELEASE_RESET() __USART1_RELEASE_RESET()
-
-#define USARTx_RX_AF GPIO_AF7_USART1
-#define USARTx_RX_PIN GPIO_PIN_10
-#define USARTx_RX_GPIO_PORT GPIOA
-#define USARTx_RX_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
-
-#define USARTx_TX_AF GPIO_AF7_USART1
-#define USARTx_TX_PIN GPIO_PIN_9
-#define USARTx_TX_GPIO_PORT GPIOA
-#define USARTx_TX_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
-#define USARTx_IRQn USART1_IRQn
-#define USARTx_IRQHandler USART1_IRQHandler
-
-#define USART_PIEZO USART3
-#define USART_PIEZO_TX_AF GPIO_AF7_USART3
-#define USART_PIEZO_TX_PIN GPIO_PIN_10
-#define USART_PIEZO_TX_GPIO_PORT GPIOC
-#define USART_PIEZO_TX_GPIO_CLK_ENABLE() __GPIOC_CLK_ENABLE()
-
-#define USART_PIEZO_RX_AF GPIO_AF7_USART3
-#define USART_PIEZO_RX_PIN GPIO_PIN_11
-#define USART_PIEZO_RX_GPIO_PORT GPIOC
-#define USART_PIEZO_RX_GPIO_CLK_ENABLE() __GPIOC_CLK_ENABLE()
-
-#define USART_IR_HUD USART2
-#define USART_IR_HUD_CLK_ENABLE() __USART2_CLK_ENABLE();
-#define USART_IR_HUD_FORCE_RESET() __USART2_FORCE_RESET()
-#define USART_IR_HUD_RELEASE_RESET() __USART2_RELEASE_RESET()
-#define USART_IR_HUD_TX_AF GPIO_AF7_USART2
-#define USART_IR_HUD_TX_PIN GPIO_PIN_5
-#define USART_IR_HUD_TX_GPIO_PORT GPIOD
-#define USART_IR_HUD_TX_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
-
-#define USART_IR_HUD_RX_AF GPIO_AF7_USART2
-#define USART_IR_HUD_RX_PIN GPIO_PIN_6
-#define USART_IR_HUD_RX_GPIO_PORT GPIOD
-#define USART_IR_HUD_RX_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
-#define USART_IR_HUD_IRQn USART2_IRQn
-#define USART_IR_HUD_IRQHandler USART2_IRQHandler
-
-#define TIMx TIM4
-#define TIMx_CLK_ENABLE __TIM4_CLK_ENABLE
-#define TIMx_IRQn TIM4_IRQn
-#define TIMx_IRQHandler TIM4_IRQHandler
-
-#define TIM_BACKLIGHT TIM3
-#define TIM_BACKLIGHT_CLK_ENABLE __TIM3_CLK_ENABLE
-#define TIM_BACKLIGHT_IRQn TIM3_IRQn
-#define TIM_BACKLIGHT_IRQHandler TIM3_IRQHandler
-#define TIM_BACKLIGHT_CHANNEL TIM_CHANNEL_2
-#define TIM_BACKLIGHT_PIN GPIO_PIN_7
-#define TIM_BACKLIGHT_GPIO_PORT GPIOC
-#define TIM_BACKLIGHT_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-
-#define SMALLCPU_CSB_PIN GPIO_PIN_5
-#define SMALLCPU_CSB_GPIO_PORT GPIOC
-#define SMALLCPU_CSB_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-
-#define SMALLCPU_BOOT0_PIN GPIO_PIN_9
-#define SMALLCPU_BOOT0_GPIO_PORT GPIOC
-#define SMALLCPU_BOOT0_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-
-#define SMALLCPU_NRESET_PIN GPIO_PIN_8
-#define SMALLCPU_NRESET_GPIO_PORT GPIOC
-#define SMALLCPU_NRESET_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
-
-#endif OSTC_HW1_H
diff -r 3a1c533f3840 -r f7318457df4d Discovery/Src/display.c
--- a/Discovery/Src/display.c Mon Jul 22 16:40:14 2024 +0200
+++ b/Discovery/Src/display.c Tue Aug 13 13:24:54 2024 +0200
@@ -3,32 +3,71 @@
#include "ostc.h"
#include "display.h"
-#define ENABLE_EXTENDED_COMMANDS 0xB9
-#define SET_POWER 0xB1
-#define SLEEP_OUT 0x11
-#define DISPLAY_INVERSION_OFF 0x20
-#define MEMORY_ACCESS_ONTROL 0x36
-#define INTERFACE_PIXEL_FORMAT 0x3A
-#define SET_RGB_INTERFACE_RELATED 0xB3
-#define SET_DISPLAY_WAVEFORM 0xB4
-#define SET_PANEL 0xCC
-#define SET_GAMMA_CURVE_RELATED 0xE0
-#define DISPLAY_ON 0x29
-#define DISPLAY_OFF 0x28
-#define SLEEP_IN 0x10
+#define TFT_ENABLE_EXTENDED_COMMANDS 0xB9
+#define TFT_SET_POWER 0xB1
+#define TFT_SLEEP_OUT 0x11
+#define TFT_DISPLAY_INVERSION_OFF 0x20
+#define TFT_MEMORY_ACCESS_ONTROL 0x36
+#define TFT_INTERFACE_PIXEL_FORMAT 0x3A
+#define TFT_SET_RGB_INTERFACE_RELATED 0xB3
+#define TFT_SET_DISPLAY_WAVEFORM 0xB4
+#define TFT_SET_PANEL 0xCC
+#define TFT_SET_GAMMA_CURVE_RELATED 0xE0
+#define TFT_DISPLAY_ON 0x29
+#define TFT_DISPLAY_OFF 0x28
+#define TFT_SLEEP_IN 0x10
+#define OLED_SCTE_SET_31h 0x31 // 0x0008
+#define OLED_WCWE_SET_32h 0x32 // 0x0014
+#define OLED_GATELESS1_30h 0x30 // 0x0002
+#define OLED_GATELESS2_27h 0x27 // 0x0000
+#define OLED_OSCILLATOR 0x11 // 0x00A1
+#define OLED_VBP_SET_12h 0x12 // 0x0008
+#define OLED_VFP_SET_13h 0x13 // 0x0008
+#define OLED_DISPLAY_CON_15h 0x15 // 0x0000
+#define OLED_COLOR_DEPTH_SET_16h 0x16 // 0x0000
+#define OLED_PENTILE_KEY_EFh 0xEF // 0x00D0 or 0x00E8
+#define OLED_PENTILE1_A0h 0xA0 // 0x0063
+#define OLED_PENTILE2_A1h 0xA1 // 0x00C0
+#define OLED_PENTILE3_A2h 0xA2 // 0x0032
+#define OLED_PENTILE4_A3h 0xA3 // 0x0002
+#define OLED_BRIGHTNESS_CTRL_39h 0x39 // 0044h
+// gamma table 0x40 - 0x66
+#define OLED_BOOSTING_FREQ 0x17 // 0x0022
+#define OLED_AMP_SET_18h 0x18 // 0x0033
+#define OLED_GAMMA_AMP_19h 0x19 // 0x0003
+#define OLED_POWER_CONTROL2_1Ah 0x1A // 0x0001
+#define OLED_POWER_CONTROL2_1Bh 0x1B //
+#define OLED_POWER_CONTROL2_1Ch 0x1C //
+#define OLED_INTERNAL_LOGIC_VOLTAGE 0x22 // VCC*0,65 = 3,3V * 0,55 = 0x00A2
+#define OLED_POWER_SET 0x23 // VC1OUT = VCI X 0.98 (default) = 0x00
+#define OLED_POWER_SET2 0x24 // VREG2OUT = 5,4V, VREG1OUT = 4,2V =0x77
+#define OLED_DISPLAY_CONDITION_SET_26h 0x26 // 0x00A0
+#define OLED_STB_BY_OFF 0x1D // 00A0 + 300ms wait
+#define OLED_DDISP_ON 0x14 // 0003
static void Display_Error_Handler(void);
+static void display_power_on__2_of_2__post_RGB_display0(void);
+static void display_power_on__2_of_2__post_RGB_display1(void);
+static uint8_t receive_screen();
void display_power_on__1_of_2__pre_RGB(void)
{
- /* reset system */
+ uint8_t aTxBuffer[3];
+ /* reset system */
HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_SET); // chip select
HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_RESET);
HAL_Delay(10);
HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_SET);
- HAL_Delay(10);
+ HAL_Delay(25);
+ // check for new screen
+ hardwareDisplay=0; // default is old screen
+ aTxBuffer[0] = 0x71; // Read internal register
+ if (receive_screen((uint8_t*)aTxBuffer) == 0x27) // chip Index (=0x27 for new screen)
+ {
+ hardwareDisplay=1;
+ }
/* RGB signals should be now for 2 frames or more (datasheet) */
}
@@ -47,6 +86,24 @@
HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_SET); // chip select
}
+static uint8_t receive_screen(uint8_t *pData)
+{
+ uint8_t byte;
+ HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_RESET); // chip select
+ if(HAL_SPI_Transmit(&hspiDisplay,(uint8_t*)pData, 1, 10000) != HAL_OK)
+ Display_Error_Handler();
+ while (HAL_SPI_GetState(&hspiDisplay) != HAL_SPI_STATE_READY)
+ {
+ }
+ if(HAL_SPI_Receive(&hspiDisplay, &byte, 1, 10000) != HAL_OK)
+ Display_Error_Handler();
+ while (HAL_SPI_GetState(&hspiDisplay) != HAL_SPI_STATE_READY)
+ {
+ }
+ HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_SET); // chip select
+ return byte;
+}
+
static uint16_t convert8to9to8(uint8_t *pInput, uint8_t *pOutput,uint16_t inputlength)
{
@@ -95,6 +152,19 @@
void display_power_on__2_of_2__post_RGB(void)
{
+ if (hardwareDisplay == 1)
+ {
+ display_power_on__2_of_2__post_RGB_display1();
+ }
+ else
+ {
+ display_power_on__2_of_2__post_RGB_display0();
+ }
+}
+
+ void display_power_on__2_of_2__post_RGB_display0(void)
+{
+
uint8_t aTxBuffer[32];
uint8_t bTxBuffer[36];
uint16_t i,length;
@@ -104,14 +174,14 @@
for(i=0;i<36;i++)
bTxBuffer[i] = 0;
- aTxBuffer[0] = ENABLE_EXTENDED_COMMANDS;
+ aTxBuffer[0] = TFT_ENABLE_EXTENDED_COMMANDS;
aTxBuffer[1] = 0xFF;
aTxBuffer[2] = 0x83;
aTxBuffer[3] = 0x63;
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,4);
send((uint8_t*)bTxBuffer, length);
- aTxBuffer[0] = SET_POWER;
+ aTxBuffer[0] = TFT_SET_POWER;
aTxBuffer[1] = 0x81;
aTxBuffer[2] = 0x24;
aTxBuffer[3] = 0x04;
@@ -127,27 +197,27 @@
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,13);
send((uint8_t*)bTxBuffer, length);
- aTxBuffer[0] = SLEEP_OUT;
+ aTxBuffer[0] = TFT_SLEEP_OUT;
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1);
send((uint8_t*)bTxBuffer, length);
HAL_Delay(5+1);
- aTxBuffer[0] = DISPLAY_INVERSION_OFF;
+ aTxBuffer[0] = TFT_DISPLAY_INVERSION_OFF;
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1);
send((uint8_t*)bTxBuffer, length);
- aTxBuffer[0] = MEMORY_ACCESS_ONTROL;
+ aTxBuffer[0] = TFT_MEMORY_ACCESS_ONTROL;
aTxBuffer[1] = 0x00;
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,2);
send((uint8_t*)bTxBuffer, length);
- aTxBuffer[0] = INTERFACE_PIXEL_FORMAT;
+ aTxBuffer[0] = TFT_INTERFACE_PIXEL_FORMAT;
aTxBuffer[1] = 0x70;
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,2);
send((uint8_t*)bTxBuffer, length);
HAL_Delay(120+20);
- aTxBuffer[0] = SET_POWER;
+ aTxBuffer[0] = TFT_SET_POWER;
aTxBuffer[1] = 0x78;
aTxBuffer[2] = 0x24;
aTxBuffer[3] = 0x04,
@@ -163,12 +233,12 @@
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,13);
send((uint8_t*)bTxBuffer, length);
- aTxBuffer[0] = SET_RGB_INTERFACE_RELATED;
+ aTxBuffer[0] = TFT_SET_RGB_INTERFACE_RELATED;
aTxBuffer[1] = 0x01;
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,2);
send((uint8_t*)bTxBuffer, length);
- aTxBuffer[0] = SET_DISPLAY_WAVEFORM;
+ aTxBuffer[0] = TFT_SET_DISPLAY_WAVEFORM;
aTxBuffer[1] = 0x00;
aTxBuffer[2] = 0x08;
aTxBuffer[3] = 0x56;
@@ -181,12 +251,12 @@
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,10);
send((uint8_t*)bTxBuffer, length);
- aTxBuffer[0] = SET_PANEL;
+ aTxBuffer[0] = TFT_SET_PANEL;
aTxBuffer[1] = 0x0B;
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,2);
send((uint8_t*)bTxBuffer, length);
- aTxBuffer[0] = SET_GAMMA_CURVE_RELATED;
+ aTxBuffer[0] = TFT_SET_GAMMA_CURVE_RELATED;
aTxBuffer[1] = 0x01;
aTxBuffer[2] = 0x48;
aTxBuffer[3] = 0x4D;
@@ -221,15 +291,544 @@
send((uint8_t*)bTxBuffer, length);
HAL_Delay(5+1);
- aTxBuffer[0] = DISPLAY_ON;
+ aTxBuffer[0] = TFT_DISPLAY_ON;
length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1);
send((uint8_t*)bTxBuffer, length);
}
+void display_power_on__2_of_2__post_RGB_display1(void)
+{
+ uint8_t aTxBuffer[3];
+
+ aTxBuffer[0] = 0x71; // Read chip Index & revision number
+ aTxBuffer[1] = 0x00; // Dummy write - reads out 0x27
+ aTxBuffer[1] = 0x00; // Dummy write - reads out 0x96
+ send((uint8_t*)aTxBuffer, 3);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_OSCILLATOR;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0xA4;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_SCTE_SET_31h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x08;//8
+ send((uint8_t*)aTxBuffer, 2);
+
+ //debug read
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_SCTE_SET_31h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x73; // Read internal register
+ aTxBuffer[1] = 0x00; // Dummy write - reads out 0x08 (The just-set OLED_SCTE_SET value)
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_WCWE_SET_32h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x14;//14
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_GATELESS1_30h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x02;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_GATELESS2_27h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x01;
+ send((uint8_t*)aTxBuffer, 2);
+
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_VBP_SET_12h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x08;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_VFP_SET_13h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x08;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_DISPLAY_CON_15h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x01; //SS=0
+ //aTxBuffer[1] = 0x11; //SS=1
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_COLOR_DEPTH_SET_16h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_PENTILE_KEY_EFh; // write-only register...
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0xD0;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0xE8;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_PENTILE1_A0h; // write-only register...
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x63;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_PENTILE2_A1h; // write-only register...
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0xC0; // SID1&SID0=00
+// aTxBuffer[1] = 0xC4; // SID1&SID0=01 CC C8 C4 C0
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_PENTILE3_A2h; // write-only register...
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x32;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_PENTILE4_A3h; // write-only register...
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x02;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_BRIGHTNESS_CTRL_39h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x44;//44
+ send((uint8_t*)aTxBuffer, 2);
+
+ // GAMMA L=250
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x40;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x41;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x3F;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x42;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x2A;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x43;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x27;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x44;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x27;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x45;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x1F;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x46;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x44;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x50;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x51;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x52;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x17;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x53;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x24;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x54;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x26;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x55;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x1F;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x56;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x43;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x60;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x61;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x3F;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x62;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x2A;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x63;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x25;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x64;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x24;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x65;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x1B;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x66;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x5C;
+ send((uint8_t*)aTxBuffer, 2);
+
+ /*
+ // GAMMA L=150
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x40;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x41;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x3F;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x42;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x2D;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x43;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x29;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x44;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x28;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x45;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x23;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x46;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x37;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x50;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x51;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x52;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x0B;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x53;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x25;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x54;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x28;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x55;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x22;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x56;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x36;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x60;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x61;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x3F;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x62;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x2B;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x63;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x28;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x64;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x26;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x65;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x1F;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = 0x66;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x4A;
+ send((uint8_t*)aTxBuffer, 2);
+ */
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_BOOSTING_FREQ;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x22;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_AMP_SET_18h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x22;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_GAMMA_AMP_19h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x02;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_POWER_CONTROL2_1Ah;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ /*
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_POWER_CONTROL2_1Bh;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x4B;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_POWER_CONTROL2_1Ch;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x05;
+ send((uint8_t*)aTxBuffer, 2);
+ */
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_INTERNAL_LOGIC_VOLTAGE;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0xA2;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_POWER_SET;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x00;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_POWER_SET2;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x77;
+ send((uint8_t*)aTxBuffer, 2);
+
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_DISPLAY_CONDITION_SET_26h;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0xA0;
+ send((uint8_t*)aTxBuffer, 2);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_STB_BY_OFF;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0xA0;
+ send((uint8_t*)aTxBuffer, 2);
+
+ HAL_Delay(250);
+
+ aTxBuffer[0] = 0x70;
+ aTxBuffer[1] = OLED_DDISP_ON;
+ send((uint8_t*)aTxBuffer, 2);
+ aTxBuffer[0] = 0x72;
+ aTxBuffer[1] = 0x03;
+ send((uint8_t*)aTxBuffer, 2);
+
+}
+
static void Display_Error_Handler(void)
{
- while(1)
+ //while(1)
{
}
}
diff -r 3a1c533f3840 -r f7318457df4d Discovery/Src/gfx_engine.c
--- a/Discovery/Src/gfx_engine.c Mon Jul 22 16:40:14 2024 +0200
+++ b/Discovery/Src/gfx_engine.c Tue Aug 13 13:24:54 2024 +0200
@@ -184,6 +184,9 @@
static uint32_t GFX_doubleBufferOne(void);
static uint32_t GFX_doubleBufferTwo(void);
+static void GFX_LTDC_Init_display0(void);
+static void GFX_LTDC_Init_display1(void);
+
/* Exported functions --------------------------------------------------------*/
@@ -3322,35 +3325,48 @@
void GFX_LTDC_Init(void)
{
- /*
- HSYNC=10 (9+1)
- HBP=10 (19-10+1)
- ActiveW=480 (499-10-10+1)
- HFP=8 (507-480-10-10+1)
-
- VSYNC=2 (1+1)
- VBP=2 (3-2+1)
- ActiveH=800 (803-2-2+1)
- VFP=2 (805-800-2-2+1)
- */
-
- /* Timing configuration */
+ if (hardwareDisplay == 1)
+ {
+ GFX_LTDC_Init_display1();
+ }
+ else
+ {
+ GFX_LTDC_Init_display0();
+ }
+}
+
+void GFX_LTDC_Init_display0(void)
+{
+ /* Timing configuration */
+
+#define ActiveH 800
+#define ActiveW 480
+
+#define Hsync 10
+#define HFP 8
+#define HBP 10
+
+#define Vsync 2
+#define VFP 2
+#define VBP 2
+
+
/* Horizontal synchronization width = Hsync - 1 */
- LtdcHandle.Init.HorizontalSync = 9;
+ LtdcHandle.Init.HorizontalSync = Hsync - 1;
/* Vertical synchronization height = Vsync - 1 */
- LtdcHandle.Init.VerticalSync = 1;
+ LtdcHandle.Init.VerticalSync = Vsync -1;
/* Accumulated horizontal back porch = Hsync + HBP - 1 */
- LtdcHandle.Init.AccumulatedHBP = 19;
+ LtdcHandle.Init.AccumulatedHBP = Hsync + HBP - 1;
/* Accumulated vertical back porch = Vsync + VBP - 1 */
- LtdcHandle.Init.AccumulatedVBP = 3;
+ LtdcHandle.Init.AccumulatedVBP = Vsync + VBP - 1;
/* Accumulated active width = Hsync + HBP + Active Width - 1 */
- LtdcHandle.Init.AccumulatedActiveW = 499;//500;//499;
+ LtdcHandle.Init.AccumulatedActiveW = Hsync + HBP + ActiveW- 1;
/* Accumulated active height = Vsync + VBP + Active Heigh - 1 */
- LtdcHandle.Init.AccumulatedActiveH = 803;
+ LtdcHandle.Init.AccumulatedActiveH = Vsync + VBP + ActiveH - 1;
/* Total width = Hsync + HBP + Active Width + HFP - 1 */
- LtdcHandle.Init.TotalWidth = 507;//508;//507;
+ LtdcHandle.Init.TotalWidth = Hsync + HBP + ActiveW + HFP - 1;
/* Total height = Vsync + VBP + Active Heigh + VFP - 1 */
- LtdcHandle.Init.TotalHeigh = 805;
+ LtdcHandle.Init.TotalHeigh = Vsync + VBP + ActiveH + VFP - 1;
/* Configure R,G,B component values for LCD background color */
LtdcHandle.Init.Backcolor.Red= 0;
@@ -3363,7 +3379,7 @@
/* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */
/* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_8 = 48/4 = 6Mhz */
-/* done in main.c SystemClockConfig
+/* done in base.c SystemClockConfig
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
@@ -3380,7 +3396,74 @@
LtdcHandle.Instance = LTDC;
/* Configure the LTDC */
- if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) // auch init der GPIO Pins
+ if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) // initialize GPIO Pins, too
+ {
+ /* Initialization Error */
+ GFX_Error_Handler();
+ }
+}
+
+
+void GFX_LTDC_Init_display1(void)
+{
+ /* Timing configuration */
+#define ActiveH_d1 800
+#define ActiveW_d1 480
+
+#define Hsync_d1 2
+#define HFP_d1 8
+#define HBP_d1 8
+
+#define Vsync_d1 2
+#define VFP_d1 4 // make sure this value * VSYNC is also set in display.c for OLED_VFP_SET
+#define VBP_d1 4 // make sure this value * VSYNC is also set in display.c for OLED_VBP_SET
+
+ /* Horizontal synchronization width = Hsync - 1 */
+ LtdcHandle.Init.HorizontalSync = Hsync_d1 - 1;
+ /* Vertical synchronization height = Vsync - 1 */
+ LtdcHandle.Init.VerticalSync = Vsync_d1 -1;
+ /* Accumulated horizontal back porch = Hsync + HBP - 1 */
+ LtdcHandle.Init.AccumulatedHBP = Hsync_d1 + HBP_d1 - 1;
+ /* Accumulated vertical back porch = Vsync + VBP - 1 */
+ LtdcHandle.Init.AccumulatedVBP = Vsync_d1 + VBP_d1 - 1;
+ /* Accumulated active width = Hsync + HBP + Active Width - 1 */
+ LtdcHandle.Init.AccumulatedActiveW = Hsync_d1 + HBP_d1 + ActiveW_d1 - 1;
+ /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */
+ LtdcHandle.Init.AccumulatedActiveH = Vsync_d1 + VBP_d1 + ActiveH_d1 - 1;
+ /* Total width = Hsync + HBP + Active Width + HFP - 1 */
+ LtdcHandle.Init.TotalWidth = Hsync_d1 + HBP_d1 + ActiveW_d1 + HFP_d1 - 1;
+ /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */
+ LtdcHandle.Init.TotalHeigh = Vsync_d1 + VBP_d1 + ActiveH_d1 + VFP_d1 - 1;
+
+ /* Configure R,G,B component values for LCD background color */
+ LtdcHandle.Init.Backcolor.Red= 0;
+ LtdcHandle.Init.Backcolor.Blue= 0;
+ LtdcHandle.Init.Backcolor.Green= 0;
+
+ /* LCD clock configuration */
+ /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
+ /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */
+ /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */
+ /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_8 = 48/4 = 6Mhz */
+
+/* done in base.c SystemClockConfig
+
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
+ PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
+ PeriphClkInitStruct.PLLSAI.PLLSAIR = 4;
+ PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_8;
+ HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
+*/
+ /* Polarity */
+ LtdcHandle.Init.HSPolarity = LTDC_HSPOLARITY_AL;
+ LtdcHandle.Init.VSPolarity = LTDC_VSPOLARITY_AL;
+ LtdcHandle.Init.DEPolarity = LTDC_DEPOLARITY_AL;
+ LtdcHandle.Init.PCPolarity = LTDC_PCPOLARITY_IIPC;//LTDC_PCPOLARITY_IPC;
+
+ LtdcHandle.Instance = LTDC;
+
+ /* Configure the LTDC */
+ if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) // initialize GPIO Pins, too
{
/* Initialization Error */
GFX_Error_Handler();