From 7eccaf1051f54a777030df43f413125e5b37e262 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Fri, 2 May 2025 12:26:13 +0300 Subject: [PATCH] Init prototypes --- Inc/DS_ILI3941.h | 25 -------------------- Inc/DS_ILI9341.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ Src/DS_ILI3941.c | 2 -- Src/DS_ILI9341.c | 46 +++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 27 deletions(-) delete mode 100644 Inc/DS_ILI3941.h create mode 100644 Inc/DS_ILI9341.h delete mode 100644 Src/DS_ILI3941.c create mode 100644 Src/DS_ILI9341.c diff --git a/Inc/DS_ILI3941.h b/Inc/DS_ILI3941.h deleted file mode 100644 index d8dd52f..0000000 --- a/Inc/DS_ILI3941.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef DS_ILI3941_H -#define DS_ILI3941_H - -#include - -#ifdef STM32G030xx - #include "stm32g0xx_hal.h" -#endif - -#ifdef STM32F030xx - #include "stm32f0xx_hal.h" -#endif - - - - - - - - - - - - -#endif //DS_ILI3941_H \ No newline at end of file diff --git a/Inc/DS_ILI9341.h b/Inc/DS_ILI9341.h new file mode 100644 index 0000000..9fe1af1 --- /dev/null +++ b/Inc/DS_ILI9341.h @@ -0,0 +1,60 @@ +#ifndef DS_ILI9341_H +#define DS_ILI9341_H + +#include + +#ifdef STM32G030xx + #include "stm32g0xx_hal.h" +#endif + +#ifdef STM32F030xx + #include "stm32f0xx_hal.h" +#endif + +#ifdef STM32F103xB + #include "stm32f1xx_hal.h" +#endif + + +typedef struct DS_ILI9341 +{ + GPIO_TypeDef* Port_CS, *Port_D0, *Port_D1, *Port_D2, *Port_D3, *Port_D4, *Port_D5, *Port_D6, *Port_D7, *Port_RQ, *Port_RS, *Port_RST, *Port_WR; + uint16_t Pin_CS, Pin_D0, Pin_D1, Pin_D2, Pin_D3, Pin_D4, Pin_D5, Pin_D6, Pin_D7, Pin_RQ, Pin_RS, Pin_RST, Pin_WR; + +// SPI_HandleTypeDef* SPI; +// char DisplayData[8]; +// uint8_t Dots; +// uint8_t DecodeMode, Intensivity, ScanLimit; +// bool EnableDecodeMode; +// GPIO_TypeDef* Port_CS; +// uint16_t Pin_CS; +}DS_ILI9341; + + +void DS_ILI9341_Init(DS_ILI9341* Display, + GPIO_TypeDef* Port_CS, uint16_t Pin_CS, + GPIO_TypeDef* Port_D0, uint16_t Pin_D0, + GPIO_TypeDef* Port_D1, uint16_t Pin_D1, + GPIO_TypeDef* Port_D2, uint16_t Pin_D2, + GPIO_TypeDef* Port_D3, uint16_t Pin_D3, + GPIO_TypeDef* Port_D4, uint16_t Pin_D4, + GPIO_TypeDef* Port_D5, uint16_t Pin_D5, + GPIO_TypeDef* Port_D6, uint16_t Pin_D6, + GPIO_TypeDef* Port_D7, uint16_t Pin_D7, + GPIO_TypeDef* Port_RQ, uint16_t Pin_RQ, + GPIO_TypeDef* Port_RS, uint16_t Pin_RS, + GPIO_TypeDef* Port_RST, uint16_t Pin_RST, + GPIO_TypeDef* Port_WR, uint16_t Pin_WR + ); + + + + + + + + + + + +#endif //DS_ILI9341_H \ No newline at end of file diff --git a/Src/DS_ILI3941.c b/Src/DS_ILI3941.c deleted file mode 100644 index 1977915..0000000 --- a/Src/DS_ILI3941.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "../inc/DS_ILI3941.h" - diff --git a/Src/DS_ILI9341.c b/Src/DS_ILI9341.c new file mode 100644 index 0000000..624b08b --- /dev/null +++ b/Src/DS_ILI9341.c @@ -0,0 +1,46 @@ +#include "../inc/DS_ILI9341.h" + + +void DS_ILI9341_Init(DS_ILI9341 *Display, GPIO_TypeDef *Port_CS, uint16_t Pin_CS, GPIO_TypeDef *Port_D0, uint16_t Pin_D0, GPIO_TypeDef *Port_D1, uint16_t Pin_D1, GPIO_TypeDef *Port_D2, uint16_t Pin_D2, GPIO_TypeDef *Port_D3, uint16_t Pin_D3, GPIO_TypeDef *Port_D4, uint16_t Pin_D4, GPIO_TypeDef *Port_D5, uint16_t Pin_D5, GPIO_TypeDef *Port_D6, uint16_t Pin_D6, GPIO_TypeDef *Port_D7, uint16_t Pin_D7, GPIO_TypeDef *Port_RQ, uint16_t Pin_RQ, GPIO_TypeDef *Port_RS, uint16_t Pin_RS, GPIO_TypeDef *Port_RST, uint16_t Pin_RST, GPIO_TypeDef *Port_WR, uint16_t Pin_WR) +{ + HAL_Delay(500); + + Display->Port_CS = Port_CS; + Display->Pin_CS = Pin_CS; + + Display->Port_D0 = Port_D0; + Display->Pin_D0 = Pin_D0; + + Display->Port_D1 = Port_D1; + Display->Pin_D1 = Pin_D1; + + Display->Port_D2 = Port_D2; + Display->Pin_D2 = Pin_D2; + + Display->Port_D3 = Port_D3; + Display->Pin_D3 = Pin_D3; + + Display->Port_D4 = Port_D4; + Display->Pin_D4 = Pin_D4; + + Display->Port_D5 = Port_D5; + Display->Pin_D5 = Pin_D5; + + Display->Port_D6 = Port_D6; + Display->Pin_D6 = Pin_D6; + + Display->Port_D7 = Port_D7; + Display->Pin_D7 = Pin_D7; + + Display->Port_RQ = Port_RQ; + Display->Pin_RQ = Pin_RQ; + + Display->Port_RS = Port_RS; + Display->Pin_RS = Pin_RS; + + Display->Port_RST = Port_RST; + Display->Pin_RST = Pin_RST; + + Display->Port_WR = Port_WR; + Display->Pin_WR = Pin_WR; +} \ No newline at end of file