Mercurial > public > ostc4
changeset 873:e373e90a48db Evo_2_23
merge new screen stuff
author | heinrichsweikamp |
---|---|
date | Wed, 14 Aug 2024 16:44:46 +0200 |
parents | 5e027b0f7475 (current diff) f7318457df4d (diff) |
children | fbb6f8f41e0a |
files | Common/Inc/settings.h Discovery/Inc/ostc_discovery.h Discovery/Inc/ostc_hw1.h Discovery/Inc/text_multilanguage.h Discovery/Src/check_warning.c Discovery/Src/data_central.c Discovery/Src/display.c Discovery/Src/gfx_engine.c Discovery/Src/settings.c Discovery/Src/tComm.c Discovery/Src/text_multilanguage.c RefPrj/Firmware/.cproject |
diffstat | 14 files changed, 788 insertions(+), 326 deletions(-) [+] |
line wrap: on
line diff
--- a/Common/Inc/settings.h Wed Aug 14 14:41:04 2024 +0200 +++ b/Common/Inc/settings.h Wed Aug 14 16:44:46 2024 +0200 @@ -46,6 +46,7 @@ #define NUM_GASES 5 #define NUM_OFFSET_DILUENT 5 #define SPECIAL_GAS_ID 0 +#define NO_GAS_ID 255 #define ERROR_ 0xFF
--- a/Discovery/Inc/ostc.h Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Inc/ostc.h Wed Aug 14 16:44:46 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
--- a/Discovery/Inc/ostc_discovery.h Wed Aug 14 14:41:04 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 <http://www.gnu.org/licenses/>. -////////////////////////////////////////////////////////////////////////////// - -#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
--- a/Discovery/Inc/ostc_hw1.h Wed Aug 14 14:41:04 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 <http://www.gnu.org/licenses/>. -////////////////////////////////////////////////////////////////////////////// - -/* 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
--- a/Discovery/Inc/text_multilanguage.h Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Inc/text_multilanguage.h Wed Aug 14 16:44:46 2024 +0200 @@ -380,7 +380,9 @@ TXT2BYTE_Starting, TXT2BYTE_Finished, - TXT2BYTE_END + TXT2BYTE_Page, + + TXT2BYTE_END, }; #endif /* TEXT_MULTILINGUAGE_H */
--- a/Discovery/Src/data_central.c Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Src/data_central.c Wed Aug 14 16:44:46 2024 +0200 @@ -563,12 +563,19 @@ nitrogen -= helium; - if((lifeData->actualGas.nitrogen_percentage != nitrogen) || (lifeData->actualGas.helium_percentage != helium) || (lifeData->actualGas.AppliedDiveMode != DIVEMODE_OC)) + if ((lifeData->actualGas.nitrogen_percentage != nitrogen) || (lifeData->actualGas.helium_percentage != helium) || lifeData->actualGas.AppliedDiveMode != DIVEMODE_OC) { - stateUsedWrite->events.manualGasSet = 1; - stateUsedWrite->events.info_manualGasSetHe = helium; - stateUsedWrite->events.info_manualGasSetO2 = oxygen; + if (stateUsed->diveSettings.ccrOption) { + stateUsedWrite->events.bailout = 1; + stateUsedWrite->events.info_bailoutHe = helium; + stateUsedWrite->events.info_bailoutO2 = oxygen; + } else { + stateUsedWrite->events.manualGasSet = 1; + stateUsedWrite->events.info_manualGasSetHe = helium; + stateUsedWrite->events.info_manualGasSetO2 = oxygen; + } } + if( lifeData->actualGas.setPoint_cbar != setpoint_cbar) { stateUsedWrite->events.setpointChange = 1;
--- a/Discovery/Src/display.c Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Src/display.c Wed Aug 14 16:44:46 2024 +0200 @@ -3,32 +3,79 @@ #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; + } + else + { // re-reset the screen to be sure the 0x71 command did nothing + 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(25); + + } /* RGB signals should be now for 2 frames or more (datasheet) */ } @@ -47,6 +94,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 +160,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 +182,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 +205,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 +241,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 +259,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 +299,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) { } }
--- a/Discovery/Src/gfx_engine.c Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Src/gfx_engine.c Wed Aug 14 16:44:46 2024 +0200 @@ -185,6 +185,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 --------------------------------------------------------*/ @@ -2151,7 +2154,7 @@ settings.actualFont = (tFont *)settings.font; } else -#ifndef BOOTLOADER_STANDALONE +//#ifndef BOOTLOADER_STANDALONE if((*pText == '\005') && !minimal) { newXdelta = GFX_write_char(hgfx, &settings, 'a', (tFont *)&Awe48); @@ -2164,7 +2167,7 @@ settings.Xdelta = newXdelta; } else -#endif +//#endif if((*pText >= '\020') && (*pText <= '\032') && !minimal) settings.color = *pText - '\020'; else @@ -3386,35 +3389,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_d0 800 +#define ActiveW_d0 480 + +#define Hsync_d0 10 +#define HFP_d0 8 +#define HBP_d0 10 + +#define Vsync_d0 2 +#define VFP_d0 2 +#define VBP_d0 2 + + /* Horizontal synchronization width = Hsync - 1 */ - LtdcHandle.Init.HorizontalSync = 9; + LtdcHandle.Init.HorizontalSync = Hsync_d0 - 1; /* Vertical synchronization height = Vsync - 1 */ - LtdcHandle.Init.VerticalSync = 1; + LtdcHandle.Init.VerticalSync = Vsync_d0 - 1; /* Accumulated horizontal back porch = Hsync + HBP - 1 */ - LtdcHandle.Init.AccumulatedHBP = 19; + LtdcHandle.Init.AccumulatedHBP = Hsync_d0 + HBP_d0 - 1; /* Accumulated vertical back porch = Vsync + VBP - 1 */ - LtdcHandle.Init.AccumulatedVBP = 3; + LtdcHandle.Init.AccumulatedVBP = Vsync_d0 + VBP_d0 - 1; /* Accumulated active width = Hsync + HBP + Active Width - 1 */ - LtdcHandle.Init.AccumulatedActiveW = 499;//500;//499; + LtdcHandle.Init.AccumulatedActiveW = Hsync_d0 + HBP_d0 + ActiveW_d0 - 1; /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */ - LtdcHandle.Init.AccumulatedActiveH = 803; + LtdcHandle.Init.AccumulatedActiveH = Vsync_d0 + VBP_d0 + ActiveH_d0 - 1; /* Total width = Hsync + HBP + Active Width + HFP - 1 */ - LtdcHandle.Init.TotalWidth = 507;//508;//507; + LtdcHandle.Init.TotalWidth = Hsync_d0 + HBP_d0 + ActiveW_d0 + HFP_d0 - 1; /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */ - LtdcHandle.Init.TotalHeigh = 805; + LtdcHandle.Init.TotalHeigh = Vsync_d0 + VBP_d0 + ActiveH_d0 + VFP_d0 - 1; /* Configure R,G,B component values for LCD background color */ LtdcHandle.Init.Backcolor.Red= 0; @@ -3427,7 +3443,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; @@ -3444,7 +3460,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();
--- a/Discovery/Src/settings.c Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Src/settings.c Wed Aug 14 16:44:46 2024 +0200 @@ -62,7 +62,7 @@ { .versionFirst = 1, .versionSecond = 6, - .versionThird = 6, + .versionThird = 7, .versionBeta = 1, /* 4 bytes with trailing 0 */
--- a/Discovery/Src/tComm.c Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Src/tComm.c Wed Aug 14 16:44:46 2024 +0200 @@ -2148,10 +2148,13 @@ } } +#ifdef BOOTLOADER_STANDALONE void tComm_StartBlueModBaseInit() { BmTmpConfig = BM_INIT_TRIGGER_ON; } +#endif + void tComm_StartBlueModConfig() { uint8_t answer = HAL_OK;
--- a/Discovery/Src/tInfoLog.c Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Src/tInfoLog.c Wed Aug 14 16:44:46 2024 +0200 @@ -233,6 +233,8 @@ infolog.line = 0; infolog.modeFlipPages = 1; + tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); + if(!settingsGetPointer()->FlipDisplay) { GFX_SetFrameBottom(pMenuCursorDesignSolo->FBStartAdress, 0, 25, 800, 390); @@ -420,12 +422,11 @@ } GFX_write_string(&FontT48, &INFOLOGwindow, text,1); - if(infolog.linesAvailableForPage > 1) + if(infolog.page == 255) { + tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_ButtonBack,0,0); + } else { tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); - else if(infolog.page == 255) - tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_ButtonBack,0,0); - else - tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,0); + } GFX_SetFrameTop(INFOLOGscreen.FBStartAdress); set_globalState_Log_Page(infolog.page); @@ -443,6 +444,12 @@ infolog.modeFlipPages = 0; + if (infolog.linesAvailableForPage > 1) { + tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_Page, TXT2BYTE_ButtonEnter, TXT2BYTE_ButtonNext); + } else { + tInfo_write_buttonTextline(&INFOLOGscreen, TXT2BYTE_Page, TXT2BYTE_ButtonEnter, 0); + } + if(!settingsGetPointer()->FlipDisplay) { GFX_SetFrameBottom((pMenuCursor->FBStartAdress) + 65*2*(infolog.line - 1), 0, 25, 800, 390);
--- a/Discovery/Src/text_multilanguage.c Wed Aug 14 14:41:04 2024 +0200 +++ b/Discovery/Src/text_multilanguage.c Wed Aug 14 16:44:46 2024 +0200 @@ -1932,6 +1932,12 @@ static uint8_t text_IT_Finished[] = "Finito"; static uint8_t text_ES_Finished[] = "Terminado"; +static uint8_t text_EN_Page[] = "Page"; +static uint8_t text_DE_Page[] = "Blättern"; +static uint8_t text_FR_Page[] = "Défiler"; +static uint8_t text_IT_Page[] = "Scorrere"; +static uint8_t text_ES_Page[] = "Desplazarse"; + /* Lookup Table -------------------------------------------------------------*/ const tText text_array[] = @@ -2226,4 +2232,6 @@ {(uint8_t)TXT2BYTE_Timer, {text_EN_Timer, text_DE_Timer, text_FR_Timer, text_IT_Timer, text_ES_Timer}}, {(uint8_t)TXT2BYTE_Starting, {text_EN_Starting, text_DE_Starting, text_FR_Starting, text_IT_Starting, text_ES_Starting}}, {(uint8_t)TXT2BYTE_Finished, {text_EN_Finished, text_DE_Finished, text_FR_Finished, text_IT_Finished, text_ES_Finished}}, + + {(uint8_t)TXT2BYTE_Page, {text_EN_Page, text_DE_Page, text_FR_Page, text_IT_Page, text_ES_Page}}, };
--- a/RefPrj/FontPack/.cproject Wed Aug 14 14:41:04 2024 +0200 +++ b/RefPrj/FontPack/.cproject Wed Aug 14 16:44:46 2024 +0200 @@ -51,7 +51,7 @@ <option id="gnu.cpp.compiler.option.debugging.level.263533406" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> </tool> <tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.974050716" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"> - <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1276477164" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}\..\ostc4\Common\CPU1-F429.ld" valueType="string"/> + <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1276477164" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}/../../Common/CPU1-F429.ld" valueType="string"/> <option id="gnu.c.link.option.ldflags.1724198262" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="-specs=nosys.specs -specs=nano.specs -specs=rdimon.specs -lc -lrdimon" valueType="string"/> <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.538362104" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> @@ -119,7 +119,7 @@ <option id="gnu.cpp.compiler.option.debugging.level.447927632" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> </tool> <tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1086419053" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"> - <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1362967323" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}\..\ostc4\Common\CPU1-F429.ld" valueType="string"/> + <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1362967323" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}/../../Common/CPU1-F429.ld" valueType="string"/> <option id="gnu.c.link.option.ldflags.948436028" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="" valueType="string"/> <option id="gnu.c.link.option.libs.26271697" name="Libraries (-l)" superClass="gnu.c.link.option.libs" useByScannerDiscovery="false" valueType="libs"> <listOptionValue builtIn="false" value="OSTC4_FontPack"/> @@ -207,7 +207,7 @@ <option id="gnu.cpp.compiler.option.debugging.level.54545315" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> </tool> <tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.186877509" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"> - <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.984692934" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="D:\Projekte\OSTC\workspace\ostc4\Common\CPU1-F429.ld" valueType="string"/> + <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.984692934" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}/../../Common/CPU1-F429.ld" valueType="string"/> <option id="gnu.c.link.option.ldflags.607567160" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="" valueType="string"/> <option defaultValue="true" id="gnu.c.link.option.shared.1993088520" name="Shared (-shared)" superClass="gnu.c.link.option.shared" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.libmath.56830929" name="Use C math library (-lm)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.libmath" useByScannerDiscovery="false" value="false" valueType="boolean"/>
--- a/RefPrj/RTE/.cproject Wed Aug 14 14:41:04 2024 +0200 +++ b/RefPrj/RTE/.cproject Wed Aug 14 16:44:46 2024 +0200 @@ -48,7 +48,7 @@ <option id="gnu.cpp.compiler.option.debugging.level.1059605192" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> </tool> <tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.829628376" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"> - <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1343275553" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}\..\ostc4\Small_CPU\CPU2-RTE.ld" valueType="string"/> + <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1343275553" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}/../ostc4/Small_CPU/CPU2-RTE.ld" valueType="string"/> <option id="gnu.c.link.option.nodeflibs.1383905067" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.c.link.option.nodeflibs" useByScannerDiscovery="false" value="false" valueType="boolean"/> <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.60862160" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> @@ -117,7 +117,7 @@ <option id="gnu.cpp.compiler.option.debugging.level.1980132124" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> </tool> <tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1224776758" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"> - <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.477531566" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}\..\ostc4\Small_CPU\CPU2-RTE.ld" valueType="string"/> + <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.477531566" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}/../../Small_CPU/CPU2-RTE.ld" valueType="string"/> <option id="gnu.c.link.option.nodeflibs.1006660034" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.c.link.option.nodeflibs" useByScannerDiscovery="false" value="false" valueType="boolean"/> <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1337752943" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>